CMS 3D CMS Logo

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 ) {
217  params_[0] = (daq2>>8)&0xFF; // latency
218  params_[1] = (daq2>>4)&0x0F; // cal_chan
219  params_[2] = (daq2>>0)&0x0F; // cal_sel
221  params_[0] = (daq2>>8)&0xFF; // latency
222  params_[1] = (daq2>>4)&0x0F; // cal_chan
223  params_[2] = (daq2>>0)&0x0F; // cal_sel
224  params_[3] = (daq2>>16)&0xFF; // isha
225  params_[4] = (daq2>>24); // vfs
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()
std::ostream & operator<<(std::ostream &os, const SiStripEventSummary &input)
static const uint32_t invalid32_
Definition: Constants.h:15
static const char mlDigis_[]
static const uint16_t valid_
Definition: Constants.h:17
sistrip classes
static std::string const input
Definition: EdmProvDump.cc:48
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)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
#define LogTrace(id)
ii
Definition: cuy.py:590
uint16_t triggerFed() const
const sistrip::FedReadoutMode & fedReadoutMode() const
void event_()
const sistrip::ApvReadoutMode & apvReadoutMode() const
std::vector< uint32_t > params_
Definition: event.py:1
static std::string fedReadoutMode(const sistrip::FedReadoutMode &)