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 //
32 void SiStripEventSummary::commissioningInfo(const uint32_t* const buffer, const uint32_t& event) {
33  // Set RunType
34  uint16_t run = static_cast<uint16_t>(buffer[10] & 0xFFFF);
36 
37  // Set spill number
38  spillNumber_ = buffer[0];
39 
40  // Set number of DataSenders
41  nDataSenders_ = buffer[20];
42 
43  // Set FED readout mode
44  if (buffer[15] == 0) {
46  } else if (buffer[15] == 1) {
48  } else if (buffer[15] == 2) {
50  } else if (buffer[15] == 3) {
52  } else if (buffer[15] == 4) {
54  } else {
56  }
57 
58  // Set hardware parameters
62  params_[0] = buffer[11]; // latency
63  params_[1] = buffer[12]; // cal_chan
64  params_[2] = buffer[13]; // cal_sel
65  params_[3] = buffer[15]; // isha
66  params_[4] = buffer[16]; // vfs
67 
68  } else if (runType_ == sistrip::OPTO_SCAN) {
69  params_[0] = buffer[11]; // opto gain
70  params_[1] = buffer[12]; // opto bias
71 
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
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  params_[0] = buffer[11]; // bin number
85  params_[1] = buffer[12]; // fec instance
86  params_[2] = buffer[13]; // fec ip
87  params_[3] = buffer[14]; // dcu hard id
88 
91  uint16_t ii = 0;
92  bool found = false;
93  while (!found && ii < 20) {
94  uint32_t dcu = buffer[21 + 3 * ii];
95  uint32_t key = buffer[21 + 3 * ii + 1];
96  uint32_t evt = buffer[21 + 3 * ii + 2];
97  if (evt == event) {
98  params_[0] = key; // device id
99  params_[1] = 0; // process id
100  params_[2] = 0; // process ip
101  params_[3] = dcu; // dcu hard id
102  found = true;
103  }
104  ii++;
105  }
106  if (!found) {
107  if (edm::isDebugEnabled()) {
108  std::stringstream ss;
109  ss << "[SiStripEventSummary::" << __func__ << "]"
110  << " Did not find DeviceId/DCUid for event " << event << "!";
111  edm::LogWarning(mlDigis_) << ss.str();
112  }
113  params_[0] = 0;
114  params_[1] = 0;
115  params_[2] = 0;
116  params_[3] = 0;
117  } else {
118  if (edm::isDebugEnabled()) {
119  std::stringstream ss;
120  ss << "[SiStripEventSummary::" << __func__ << "]"
121  << " Found DeviceId/DCUid for event " << event << ": 0x" << std::hex << std::setw(8) << std::setfill('0')
122  << params_[0] << std::dec << "/0x" << std::hex << std::setw(8) << std::setfill('0') << params_[3]
123  << std::dec;
124  LogTrace(mlDigis_) << ss.str();
125  }
126  }
127 
128  } else {
129  params_[0] = buffer[11]; // device id
130  params_[1] = buffer[12]; // process id
131  params_[2] = buffer[13]; // process ip
132  params_[3] = buffer[14]; // dcu hard id
133  }
134 
135  } else if (runType_ == sistrip::VPSP_SCAN) {
136  params_[0] = buffer[11]; // vpsp value
137  params_[1] = buffer[12]; // ccu channel
138 
139  } else if (runType_ == sistrip::DAQ_SCOPE_MODE) {
140  // nothing interesting!
141 
143  //@@ do anything?...
144 
145  } else {
146  if (edm::isDebugEnabled()) {
147  edm::LogWarning(mlDigis_) << "[SiStripEventSummary::" << __func__ << "]"
148  << " Unexpected commissioning task: " << runType_;
149  }
150  }
151 }
152 
153 // -----------------------------------------------------------------------------
154 //
155 
156 // -----------------------------------------------------------------------------
157 //
158 void SiStripEventSummary::commissioningInfo(const uint32_t& daq1, const uint32_t& daq2) {
159  // Extract if commissioning info are valid or not
160  uint16_t temp = static_cast<uint16_t>((daq1 >> 8) & 0x3);
161  if (temp == uint16_t(1)) {
162  valid_ = true;
163  } else if (temp == uint16_t(2)) {
164  valid_ = false;
165  } else if (temp == uint16_t(3) && daq1 == sistrip::invalid32_) {
166  if (edm::isDebugEnabled()) {
167  edm::LogWarning(mlDigis_) << "[SiStripEventSummary::" << __func__ << "]"
168  << " DAQ register contents set to invalid: 0x" << std::hex << std::setw(8)
169  << std::setfill('0') << daq1 << std::dec;
170  }
171  valid_ = false;
172  } else {
173  if (edm::isDebugEnabled()) {
174  edm::LogWarning(mlDigis_) << "[SiStripEventSummary::" << __func__ << "]"
175  << " Unexpected bit pattern set in DAQ1: 0x" << std::hex << std::setw(8)
176  << std::setfill('0') << daq1 << std::dec;
177  }
178  valid_ = false;
179  }
180 
181  // Set RunType
182  uint16_t run = static_cast<uint16_t>(daq1 & 0xFF);
184 
185  // Set hardware parameters
186  if (runType_ == sistrip::PHYSICS) {
187  } else if (runType_ == sistrip::PHYSICS_ZS) {
188  } else if (runType_ == sistrip::PEDESTALS) {
189  } else if (runType_ == sistrip::DAQ_SCOPE_MODE) {
191  params_[0] = (daq2 >> 8) & 0xFF; // latency
192  params_[1] = (daq2 >> 4) & 0x0F; // cal_chan
193  params_[2] = (daq2 >> 0) & 0x0F; // cal_sel
195  params_[0] = (daq2 >> 8) & 0xFF; // latency
196  params_[1] = (daq2 >> 4) & 0x0F; // cal_chan
197  params_[2] = (daq2 >> 0) & 0x0F; // cal_sel
198  params_[3] = (daq2 >> 16) & 0xFF; // isha
199  params_[4] = (daq2 >> 24); // vfs
200  } else if (runType_ == sistrip::OPTO_SCAN) {
201  params_[0] = (daq2 >> 8) & 0xFF; // opto gain
202  params_[1] = (daq2 >> 0) & 0xFF; // opto bias
203  } else if (runType_ == sistrip::APV_TIMING) {
204  params_[1] = (daq2 >> 0) & 0xFF; // pll fine delay
205  } else if (runType_ == sistrip::APV_LATENCY) {
206  params_[0] = (daq2 >> 0) & 0xFF; // latency
207  } else if (runType_ == sistrip::FINE_DELAY_PLL) {
208  } else if (runType_ == sistrip::FINE_DELAY_TTC) {
209  } else if (runType_ == sistrip::FINE_DELAY) { //@@ layer
210  params_[2] = (daq2 >> 0) & 0xFFFF; // ttcrx delay
211  params_[0] = params_[2] / 25; // pll coarse delay
212  params_[1] = uint32_t((params_[2] % 25) * 24. / 25.); // pll fine delay
213  params_[3] = (daq2 >> 0) & 0xFFFF0000; // layer (private format: DDSSLLLL (det, side, layer)
214  } else if (runType_ == sistrip::FED_TIMING) {
215  params_[1] = (daq2 >> 0) & 0xFF; // pll fine delay
216  } else if (runType_ == sistrip::VPSP_SCAN) {
217  params_[0] = (daq2 >> 8) & 0xFF; // vpsp value
218  params_[1] = (daq2 >> 0) & 0xFF; // ccu channel
219  } else if (runType_ == sistrip::FED_CABLING) {
220  } else if (runType_ == sistrip::QUITE_FAST_CABLING) {
221  } else if (runType_ == sistrip::FAST_CABLING) {
222  params_[0] = (daq2 >> 0) & 0xFF; // key
223  } else {
224  if (edm::isDebugEnabled()) {
225  edm::LogWarning(mlDigis_) << "[SiStripEventSummary::" << __func__ << "]"
226  << " Unexpected commissioning task: " << runType_;
227  }
228  }
229 }
230 
231 // -----------------------------------------------------------------------------
232 //
234  if (mode == 1) {
236  } else if (mode == 2) {
238  } else if (mode == 6) {
240  } else if (mode == 10) {
242  } else if (mode == 12) {
244  } else {
246  }
247 }
248 
249 // -----------------------------------------------------------------------------
250 //
251 std::ostream& operator<<(std::ostream& os, const SiStripEventSummary& input) {
252  return os << "[SiStripEventSummary::" << __func__ << "]" << std::endl
253  << " isSet : " << std::boolalpha << input.isSet() << std::noboolalpha << std::endl
254  << " Trigger FED id : " << input.triggerFed() << std::endl
255  << " isValid : " << std::boolalpha << input.valid() << std::noboolalpha << std::endl
256  << " Run type : " << SiStripEnumsAndStrings::runType(input.runType()) << std::endl
257  << " Event number : " << input.event() << std::endl
258  << " Bunch crossing : " << input.bx() << std::endl
259  << " FED readout mode : " << SiStripEnumsAndStrings::fedReadoutMode(input.fedReadoutMode()) << std::endl
260  << " APV readout mode : " << SiStripEnumsAndStrings::apvReadoutMode(input.apvReadoutMode()) << std::endl
261  << " Commissioning params : " << input.params()[0] << ", " << input.params()[1] << ", " << input.params()[2]
262  << ", " << input.params()[3] << std::endl;
263 }
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
#define LogTrace(id)
static std::string const input
Definition: EdmProvDump.cc:50
static std::string runType(const sistrip::RunType &)
static std::string apvReadoutMode(const sistrip::ApvReadoutMode &)
sistrip::RunType runType_
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
ii
Definition: cuy.py:589
const sistrip::FedReadoutMode & fedReadoutMode() const
Log< level::Warning, false > LogWarning
std::vector< uint32_t > params_
Definition: event.py:1
static std::string fedReadoutMode(const sistrip::FedReadoutMode &)