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 // Last commit: $Id: SiStripEventSummary.cc,v 1.11 2008/11/26 16:47:10 bainbrid Exp $
2 
6 #include <iostream>
7 #include <iomanip>
8 
9 using namespace sistrip;
10 
11 // -----------------------------------------------------------------------------
12 //
14  valid_(true),
15  triggerFed_(0),
16  runType_(sistrip::UNDEFINED_RUN_TYPE),
17  event_(0),
18  bx_(0),
19  spillNumber_(0),
20  nDataSenders_(0),
21  fedReadoutMode_(sistrip::UNDEFINED_FED_READOUT_MODE),
22  apvReadoutMode_(sistrip::UNDEFINED_APV_READOUT_MODE),
23  apveAddress_(0),
24  nApvsInSync_(0),
25  nApvsOutOfSync_(0),
26  nApvsErrors_(0),
27  params_(5,0)
28 {;}
29 
30 // -----------------------------------------------------------------------------
31 //
32 void SiStripEventSummary::commissioningInfo( const uint32_t* const buffer,
33  const uint32_t& event ) {
34 
35  // Set RunType
36  uint16_t run = static_cast<uint16_t>( buffer[10] & 0xFFFF );
38 
39  // Set spill number
40  spillNumber_ = buffer[0];
41 
42  // Set number of DataSenders
43  nDataSenders_ = buffer[20];
44 
45  // Set FED readout mode
46  if ( buffer[15] == 0 ) { fedReadoutMode_ = sistrip::FED_SCOPE_MODE; }
47  else if ( buffer[15] == 1 ) { fedReadoutMode_ = sistrip::FED_VIRGIN_RAW; }
48  else if ( buffer[15] == 2 ) { fedReadoutMode_ = sistrip::FED_PROC_RAW; }
49  else if ( buffer[15] == 3 ) { fedReadoutMode_ = sistrip::FED_ZERO_SUPPR; }
50  else if ( buffer[15] == 4 ) { fedReadoutMode_ = sistrip::FED_ZERO_SUPPR_LITE; }
52 
53  // Set hardware parameters
59 
60  params_[0] = buffer[11]; // latency
61  params_[1] = buffer[12]; // cal_chan
62  params_[2] = buffer[13]; // cal_sel
63  params_[3] = buffer[15]; // isha
64  params_[4] = buffer[16]; // vfs
65 
66  } else if ( runType_ == sistrip::OPTO_SCAN ) {
67 
68  params_[0] = buffer[11]; // opto gain
69  params_[1] = buffer[12]; // opto bias
70 
71  } else if ( runType_ == sistrip::APV_TIMING ||
73  params_[0] = buffer[11]; // pll coarse delay
74  params_[1] = buffer[12]; // pll fine delay
75  params_[2] = buffer[13]; // ttcrx delay
76  } else if ( runType_ == sistrip::FINE_DELAY || //@@ layer
79  params_[0] = buffer[11]; // pll coarse delay
80  params_[1] = buffer[12]; // pll fine delay
81  params_[2] = buffer[13]; // ttcrx delay
82  params_[3] = buffer[14]; // layer (private format: DDSSLLLL, det, side, layer)
83 
84  } else if ( runType_ == sistrip::FAST_CABLING ) {
85 
86  params_[0] = buffer[11]; // bin number
87  params_[1] = buffer[12]; // fec instance
88  params_[2] = buffer[13]; // fec ip
89  params_[3] = buffer[14]; // dcu hard id
90 
91  } else if ( runType_ == sistrip::FED_CABLING ||
93 
95 
96  uint16_t ii = 0;
97  bool found = false;
98  while ( !found && ii < 20 ) {
99  uint32_t dcu = buffer[21+3*ii];
100  uint32_t key = buffer[21+3*ii+1];
101  uint32_t evt = buffer[21+3*ii+2];
102  if ( evt == event ) {
103  params_[0] = key; // device id
104  params_[1] = 0; // process id
105  params_[2] = 0; // process ip
106  params_[3] = dcu; // dcu hard id
107  found = true;
108  }
109  ii++;
110  }
111  if ( !found ) {
112  if ( edm::isDebugEnabled() ) {
113  std::stringstream ss;
114  ss << "[SiStripEventSummary::" << __func__ << "]"
115  << " Did not find DeviceId/DCUid for event "
116  << event << "!";
117  edm::LogWarning(mlDigis_) << ss.str();
118  }
119  params_[0] = 0;
120  params_[1] = 0;
121  params_[2] = 0;
122  params_[3] = 0;
123  } else {
124  if ( edm::isDebugEnabled() ) {
125  std::stringstream ss;
126  ss << "[SiStripEventSummary::" << __func__ << "]"
127  << " Found DeviceId/DCUid for event "
128  << event << ": 0x"
129  << std::hex << std::setw(8) << std::setfill('0') << params_[0] << std::dec
130  << "/0x"
131  << std::hex << std::setw(8) << std::setfill('0') << params_[3] << std::dec;
132  LogTrace(mlDigis_) << ss.str();
133  }
134  }
135 
136  } else {
137 
138  params_[0] = buffer[11]; // device id
139  params_[1] = buffer[12]; // process id
140  params_[2] = buffer[13]; // process ip
141  params_[3] = buffer[14]; // dcu hard id
142 
143  }
144 
145  } else if ( runType_ == sistrip::VPSP_SCAN ) {
146 
147  params_[0] = buffer[11]; // vpsp value
148  params_[1] = buffer[12]; // ccu channel
149 
150  } else if ( runType_ == sistrip::DAQ_SCOPE_MODE ) {
151 
152  // nothing interesting!
153 
154  } else if ( runType_ == sistrip::PHYSICS ||
157 
158  //@@ do anything?...
159 
160  } else {
161 
162  if ( edm::isDebugEnabled() ) {
164  << "[SiStripEventSummary::" << __func__ << "]"
165  << " Unexpected commissioning task: "
166  << runType_;
167  }
168 
169  }
170 
171 }
172 
173 // -----------------------------------------------------------------------------
174 //
175 
176 // -----------------------------------------------------------------------------
177 //
178 void SiStripEventSummary::commissioningInfo( const uint32_t& daq1,
179  const uint32_t& daq2 ) {
180 
181  // Extract if commissioning info are valid or not
182  uint16_t temp = static_cast<uint16_t>( (daq1>>8)&0x3 );
183  if ( temp == uint16_t(1) ) { valid_ = true; }
184  else if ( temp == uint16_t(2) ) { valid_ = false; }
185  else if ( temp == uint16_t(3) &&
186  daq1 == sistrip::invalid32_ ) {
187  if ( edm::isDebugEnabled() ) {
189  << "[SiStripEventSummary::" << __func__ << "]"
190  << " DAQ register contents set to invalid: 0x"
191  << std::hex
192  << std::setw(8) << std::setfill('0') << daq1
193  << std::dec;
194  }
195  valid_ = false;
196  } else {
197  if ( edm::isDebugEnabled() ) {
199  << "[SiStripEventSummary::" << __func__ << "]"
200  << " Unexpected bit pattern set in DAQ1: 0x"
201  << std::hex
202  << std::setw(8) << std::setfill('0') << daq1
203  << std::dec;
204  }
205  valid_ = false;
206  }
207 
208  // Set RunType
209  uint16_t run = static_cast<uint16_t>( daq1&0xFF );
211 
212  // Set hardware parameters
213  if ( runType_ == sistrip::PHYSICS ) {
214  } else if ( runType_ == sistrip::PHYSICS_ZS ) {
215  } else if ( runType_ == sistrip::PEDESTALS ) {
216  } else if ( runType_ == sistrip::DAQ_SCOPE_MODE ) {
217  } else if ( runType_ == sistrip::CALIBRATION ) {
218  } else if ( runType_ == sistrip::CALIBRATION_DECO ) {
219  params_[0] = (daq2>>8)&0xFF; // latency
220  params_[1] = (daq2>>4)&0x0F; // cal_chan
221  params_[2] = (daq2>>0)&0x0F; // cal_sel
222  } else if ( runType_ == sistrip::CALIBRATION_SCAN ) {
223  params_[0] = (daq2>>8)&0xFF; // latency
224  params_[1] = (daq2>>4)&0x0F; // cal_chan
225  params_[2] = (daq2>>0)&0x0F; // cal_sel
226  } else if ( runType_ == sistrip::OPTO_SCAN ) {
227  params_[0] = (daq2>>8)&0xFF; // opto gain
228  params_[1] = (daq2>>0)&0xFF; // opto bias
229  } else if ( runType_ == sistrip::APV_TIMING ) {
230  params_[1] = (daq2>>0)&0xFF; // pll fine delay
231  } else if ( runType_ == sistrip::APV_LATENCY ) {
232  params_[0] = (daq2>>0)&0xFF; // latency
233  } else if ( runType_ == sistrip::FINE_DELAY_PLL ) {
234  } else if ( runType_ == sistrip::FINE_DELAY_TTC ) {
235  } else if ( runType_ == sistrip::FINE_DELAY ) { //@@ layer
236  params_[2] = (daq2>>0 )&0xFFFF; // ttcrx delay
237  params_[0] = params_[2]/25; // pll coarse delay
238  params_[1] = uint32_t((params_[2]%25)*24./25.); // pll fine delay
239  params_[3] = (daq2>>0)&0xFFFF0000; // layer (private format: DDSSLLLL (det, side, layer)
240  } else if ( runType_ == sistrip::FED_TIMING ) {
241  params_[1] = (daq2>>0)&0xFF; // pll fine delay
242  } else if ( runType_ == sistrip::VPSP_SCAN ) {
243  params_[0] = (daq2>>8)&0xFF; // vpsp value
244  params_[1] = (daq2>>0)&0xFF; // ccu channel
245  } else if ( runType_ == sistrip::FED_CABLING ) {
246  } else if ( runType_ == sistrip::QUITE_FAST_CABLING ) {
247  } else if ( runType_ == sistrip::FAST_CABLING ) {
248  params_[0] = (daq2>>0)&0xFF; // key
249  } else {
250  if ( edm::isDebugEnabled() ) {
252  << "[SiStripEventSummary::" << __func__ << "]"
253  << " Unexpected commissioning task: "
254  << runType_;
255  }
256  }
257 
258 }
259 
260 // -----------------------------------------------------------------------------
261 //
262 void SiStripEventSummary::fedReadoutMode( const uint16_t& mode ) {
263  if ( mode == 1 ) { fedReadoutMode_ = sistrip::FED_SCOPE_MODE; }
264  else if ( mode == 2 ) { fedReadoutMode_ = sistrip::FED_VIRGIN_RAW; }
265  else if ( mode == 6 ) { fedReadoutMode_ = sistrip::FED_PROC_RAW; }
266  else if ( mode == 10 ) { fedReadoutMode_ = sistrip::FED_ZERO_SUPPR; }
267  else if ( mode == 12 ) { fedReadoutMode_ = sistrip::FED_ZERO_SUPPR_LITE; }
269 }
270 
271 // -----------------------------------------------------------------------------
272 //
273 std::ostream& operator<< ( std::ostream& os, const SiStripEventSummary& input ) {
274  return os << "[SiStripEventSummary::" << __func__ << "]" << std::endl
275  << " isSet : " << std::boolalpha << input.isSet() << std::noboolalpha << std::endl
276  << " Trigger FED id : " << input.triggerFed() << std::endl
277  << " isValid : " << std::boolalpha << input.valid() << std::noboolalpha << std::endl
278  << " Run type : " << SiStripEnumsAndStrings::runType( input.runType() ) << std::endl
279  << " Event number : " << input.event() << std::endl
280  << " Bunch crossing : " << input.bx() << std::endl
281  << " FED readout mode : " << SiStripEnumsAndStrings::fedReadoutMode( input.fedReadoutMode() ) << std::endl
282  << " APV readout mode : " << SiStripEnumsAndStrings::apvReadoutMode( input.apvReadoutMode() ) << std::endl
283  << " Commissioning params : "
284  << input.params()[0] << ", "
285  << input.params()[1] << ", "
286  << input.params()[2] << ", "
287  << input.params()[3]
288  << std::endl;
289 }
sistrip::FedReadoutMode fedReadoutMode_
bool isDebugEnabled()
static const uint32_t invalid32_
Definition: Constants.h:16
static const char mlDigis_[]
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static const uint16_t valid_
Definition: Constants.h:18
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
#define LogTrace(id)
uint16_t triggerFed() const
const sistrip::FedReadoutMode & fedReadoutMode() const
list key
Definition: combine.py:13
void event_()
const sistrip::ApvReadoutMode & apvReadoutMode() const
std::vector< uint32_t > params_
static std::string fedReadoutMode(const sistrip::FedReadoutMode &)