CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripEventSummary.cc
Go to the documentation of this file.
1 
5 #include <iostream>
6 #include <iomanip>
7 
8 using namespace sistrip;
9 
10 // -----------------------------------------------------------------------------
11 //
13  valid_(true),
14  triggerFed_(0),
15  runType_(sistrip::UNDEFINED_RUN_TYPE),
16  event_(0),
17  bx_(0),
18  spillNumber_(0),
19  nDataSenders_(0),
20  fedReadoutMode_(sistrip::UNDEFINED_FED_READOUT_MODE),
21  apvReadoutMode_(sistrip::UNDEFINED_APV_READOUT_MODE),
22  apveAddress_(0),
23  nApvsInSync_(0),
24  nApvsOutOfSync_(0),
25  nApvsErrors_(0),
26  params_(5,0)
27 {;}
28 
29 // -----------------------------------------------------------------------------
30 //
31 void SiStripEventSummary::commissioningInfo( const uint32_t* const buffer,
32  const uint32_t& event ) {
33 
34  // Set RunType
35  uint16_t run = static_cast<uint16_t>( buffer[10] & 0xFFFF );
37 
38  // Set spill number
39  spillNumber_ = buffer[0];
40 
41  // Set number of DataSenders
42  nDataSenders_ = buffer[20];
43 
44  // Set FED readout mode
45  if ( buffer[15] == 0 ) { fedReadoutMode_ = sistrip::FED_SCOPE_MODE; }
46  else if ( buffer[15] == 1 ) { fedReadoutMode_ = sistrip::FED_VIRGIN_RAW; }
47  else if ( buffer[15] == 2 ) { fedReadoutMode_ = sistrip::FED_PROC_RAW; }
48  else if ( buffer[15] == 3 ) { fedReadoutMode_ = sistrip::FED_ZERO_SUPPR; }
49  else if ( buffer[15] == 4 ) { fedReadoutMode_ = sistrip::FED_ZERO_SUPPR_LITE; }
51 
52  // Set hardware parameters
58 
59  params_[0] = buffer[11]; // latency
60  params_[1] = buffer[12]; // cal_chan
61  params_[2] = buffer[13]; // cal_sel
62  params_[3] = buffer[15]; // isha
63  params_[4] = buffer[16]; // vfs
64 
65  } else if ( runType_ == sistrip::OPTO_SCAN ) {
66 
67  params_[0] = buffer[11]; // opto gain
68  params_[1] = buffer[12]; // opto bias
69 
70  } else if ( runType_ == sistrip::APV_TIMING ||
72  params_[0] = buffer[11]; // pll coarse delay
73  params_[1] = buffer[12]; // pll fine delay
74  params_[2] = buffer[13]; // ttcrx delay
75  } else if ( runType_ == sistrip::FINE_DELAY || //@@ layer
78  params_[0] = buffer[11]; // pll coarse delay
79  params_[1] = buffer[12]; // pll fine delay
80  params_[2] = buffer[13]; // ttcrx delay
81  params_[3] = buffer[14]; // layer (private format: DDSSLLLL, det, side, layer)
82 
83  } else if ( runType_ == sistrip::FAST_CABLING ) {
84 
85  params_[0] = buffer[11]; // bin number
86  params_[1] = buffer[12]; // fec instance
87  params_[2] = buffer[13]; // fec ip
88  params_[3] = buffer[14]; // dcu hard id
89 
90  } else if ( runType_ == sistrip::FED_CABLING ||
92 
94 
95  uint16_t ii = 0;
96  bool found = false;
97  while ( !found && ii < 20 ) {
98  uint32_t dcu = buffer[21+3*ii];
99  uint32_t key = buffer[21+3*ii+1];
100  uint32_t evt = buffer[21+3*ii+2];
101  if ( evt == event ) {
102  params_[0] = key; // device id
103  params_[1] = 0; // process id
104  params_[2] = 0; // process ip
105  params_[3] = dcu; // dcu hard id
106  found = true;
107  }
108  ii++;
109  }
110  if ( !found ) {
111  if ( edm::isDebugEnabled() ) {
112  std::stringstream ss;
113  ss << "[SiStripEventSummary::" << __func__ << "]"
114  << " Did not find DeviceId/DCUid for event "
115  << event << "!";
116  edm::LogWarning(mlDigis_) << ss.str();
117  }
118  params_[0] = 0;
119  params_[1] = 0;
120  params_[2] = 0;
121  params_[3] = 0;
122  } else {
123  if ( edm::isDebugEnabled() ) {
124  std::stringstream ss;
125  ss << "[SiStripEventSummary::" << __func__ << "]"
126  << " Found DeviceId/DCUid for event "
127  << event << ": 0x"
128  << std::hex << std::setw(8) << std::setfill('0') << params_[0] << std::dec
129  << "/0x"
130  << std::hex << std::setw(8) << std::setfill('0') << params_[3] << std::dec;
131  LogTrace(mlDigis_) << ss.str();
132  }
133  }
134 
135  } else {
136 
137  params_[0] = buffer[11]; // device id
138  params_[1] = buffer[12]; // process id
139  params_[2] = buffer[13]; // process ip
140  params_[3] = buffer[14]; // dcu hard id
141 
142  }
143 
144  } else if ( runType_ == sistrip::VPSP_SCAN ) {
145 
146  params_[0] = buffer[11]; // vpsp value
147  params_[1] = buffer[12]; // ccu channel
148 
149  } else if ( runType_ == sistrip::DAQ_SCOPE_MODE ) {
150 
151  // nothing interesting!
152 
153  } else if ( runType_ == sistrip::PHYSICS ||
156 
157  //@@ do anything?...
158 
159  } else {
160 
161  if ( edm::isDebugEnabled() ) {
163  << "[SiStripEventSummary::" << __func__ << "]"
164  << " Unexpected commissioning task: "
165  << runType_;
166  }
167 
168  }
169 
170 }
171 
172 // -----------------------------------------------------------------------------
173 //
174 
175 // -----------------------------------------------------------------------------
176 //
177 void SiStripEventSummary::commissioningInfo( const uint32_t& daq1,
178  const uint32_t& daq2 ) {
179 
180  // Extract if commissioning info are valid or not
181  uint16_t temp = static_cast<uint16_t>( (daq1>>8)&0x3 );
182  if ( temp == uint16_t(1) ) { valid_ = true; }
183  else if ( temp == uint16_t(2) ) { valid_ = false; }
184  else if ( temp == uint16_t(3) &&
185  daq1 == sistrip::invalid32_ ) {
186  if ( edm::isDebugEnabled() ) {
188  << "[SiStripEventSummary::" << __func__ << "]"
189  << " DAQ register contents set to invalid: 0x"
190  << std::hex
191  << std::setw(8) << std::setfill('0') << daq1
192  << std::dec;
193  }
194  valid_ = false;
195  } else {
196  if ( edm::isDebugEnabled() ) {
198  << "[SiStripEventSummary::" << __func__ << "]"
199  << " Unexpected bit pattern set in DAQ1: 0x"
200  << std::hex
201  << std::setw(8) << std::setfill('0') << daq1
202  << std::dec;
203  }
204  valid_ = false;
205  }
206 
207  // Set RunType
208  uint16_t run = static_cast<uint16_t>( daq1&0xFF );
210 
211  // Set hardware parameters
212  if ( runType_ == sistrip::PHYSICS ) {
213  } else if ( runType_ == sistrip::PHYSICS_ZS ) {
214  } else if ( runType_ == sistrip::PEDESTALS ) {
215  } else if ( runType_ == sistrip::DAQ_SCOPE_MODE ) {
216  } else if ( runType_ == sistrip::CALIBRATION ) {
217  } else if ( runType_ == sistrip::CALIBRATION_DECO ) {
218  params_[0] = (daq2>>8)&0xFF; // latency
219  params_[1] = (daq2>>4)&0x0F; // cal_chan
220  params_[2] = (daq2>>0)&0x0F; // cal_sel
221  } else if ( runType_ == sistrip::CALIBRATION_SCAN ) {
222  params_[0] = (daq2>>8)&0xFF; // latency
223  params_[1] = (daq2>>4)&0x0F; // cal_chan
224  params_[2] = (daq2>>0)&0x0F; // cal_sel
225  } else if ( runType_ == sistrip::OPTO_SCAN ) {
226  params_[0] = (daq2>>8)&0xFF; // opto gain
227  params_[1] = (daq2>>0)&0xFF; // opto bias
228  } else if ( runType_ == sistrip::APV_TIMING ) {
229  params_[1] = (daq2>>0)&0xFF; // pll fine delay
230  } else if ( runType_ == sistrip::APV_LATENCY ) {
231  params_[0] = (daq2>>0)&0xFF; // latency
232  } else if ( runType_ == sistrip::FINE_DELAY_PLL ) {
233  } else if ( runType_ == sistrip::FINE_DELAY_TTC ) {
234  } else if ( runType_ == sistrip::FINE_DELAY ) { //@@ layer
235  params_[2] = (daq2>>0 )&0xFFFF; // ttcrx delay
236  params_[0] = params_[2]/25; // pll coarse delay
237  params_[1] = uint32_t((params_[2]%25)*24./25.); // pll fine delay
238  params_[3] = (daq2>>0)&0xFFFF0000; // layer (private format: DDSSLLLL (det, side, layer)
239  } else if ( runType_ == sistrip::FED_TIMING ) {
240  params_[1] = (daq2>>0)&0xFF; // pll fine delay
241  } else if ( runType_ == sistrip::VPSP_SCAN ) {
242  params_[0] = (daq2>>8)&0xFF; // vpsp value
243  params_[1] = (daq2>>0)&0xFF; // ccu channel
244  } else if ( runType_ == sistrip::FED_CABLING ) {
245  } else if ( runType_ == sistrip::QUITE_FAST_CABLING ) {
246  } else if ( runType_ == sistrip::FAST_CABLING ) {
247  params_[0] = (daq2>>0)&0xFF; // key
248  } else {
249  if ( edm::isDebugEnabled() ) {
251  << "[SiStripEventSummary::" << __func__ << "]"
252  << " Unexpected commissioning task: "
253  << runType_;
254  }
255  }
256 
257 }
258 
259 // -----------------------------------------------------------------------------
260 //
261 void SiStripEventSummary::fedReadoutMode( const uint16_t& mode ) {
262  if ( mode == 1 ) { fedReadoutMode_ = sistrip::FED_SCOPE_MODE; }
263  else if ( mode == 2 ) { fedReadoutMode_ = sistrip::FED_VIRGIN_RAW; }
264  else if ( mode == 6 ) { fedReadoutMode_ = sistrip::FED_PROC_RAW; }
265  else if ( mode == 10 ) { fedReadoutMode_ = sistrip::FED_ZERO_SUPPR; }
266  else if ( mode == 12 ) { fedReadoutMode_ = sistrip::FED_ZERO_SUPPR_LITE; }
268 }
269 
270 // -----------------------------------------------------------------------------
271 //
272 std::ostream& operator<< ( std::ostream& os, const SiStripEventSummary& input ) {
273  return os << "[SiStripEventSummary::" << __func__ << "]" << std::endl
274  << " isSet : " << std::boolalpha << input.isSet() << std::noboolalpha << std::endl
275  << " Trigger FED id : " << input.triggerFed() << std::endl
276  << " isValid : " << std::boolalpha << input.valid() << std::noboolalpha << std::endl
277  << " Run type : " << SiStripEnumsAndStrings::runType( input.runType() ) << std::endl
278  << " Event number : " << input.event() << std::endl
279  << " Bunch crossing : " << input.bx() << std::endl
280  << " FED readout mode : " << SiStripEnumsAndStrings::fedReadoutMode( input.fedReadoutMode() ) << std::endl
281  << " APV readout mode : " << SiStripEnumsAndStrings::apvReadoutMode( input.apvReadoutMode() ) << std::endl
282  << " Commissioning params : "
283  << input.params()[0] << ", "
284  << input.params()[1] << ", "
285  << input.params()[2] << ", "
286  << input.params()[3]
287  << std::endl;
288 }
sistrip::FedReadoutMode fedReadoutMode_
bool isDebugEnabled()
static const uint32_t invalid32_
Definition: Constants.h:15
static const char mlDigis_[]
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
static const uint16_t valid_
Definition: Constants.h:17
int ii
Definition: cuy.py:588
static std::string const input
Definition: EdmProvDump.cc:44
const std::vector< uint32_t > & params() const
static std::string runType(const sistrip::RunType &)
const sistrip::RunType & runType() const
static std::string apvReadoutMode(const sistrip::ApvReadoutMode &)
const uint32_t & bx() const
sistrip::RunType runType_
const uint32_t & event() const
void commissioningInfo(const uint32_t *const buffer, const uint32_t &event)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
#define LogTrace(id)
uint16_t triggerFed() const
const sistrip::FedReadoutMode & fedReadoutMode() const
void event_()
const sistrip::ApvReadoutMode & apvReadoutMode() const
std::vector< uint32_t > params_
static std::string fedReadoutMode(const sistrip::FedReadoutMode &)