CMS 3D CMS Logo

SiStripCommissioningSource.cc
Go to the documentation of this file.
34 #include <ctime>
35 #include <iomanip>
36 #include <memory>
37 #include <sstream>
38 
39 #include <sys/types.h>
40 #include <unistd.h>
41 #include <iomanip>
42 
43 #include <arpa/inet.h>
44 #include <cstdio>
45 #include <netdb.h>
46 #include <sys/socket.h>
47 #include <sys/unistd.h>
48 #include <cstdint>
49 
50 using namespace sistrip;
51 
52 // -----------------------------------------------------------------------------
53 //
55  : dqm_(nullptr),
56  fedCabling_(nullptr),
57  fecCabling_(nullptr),
58  inputModuleLabel_(pset.getParameter<std::string>("InputModuleLabel")),
59  inputModuleLabelAlt_(pset.existsAs<std::string>("InputModuleLabelAlt")
60  ? pset.getParameter<std::string>("InputModuleLabelAlt")
61  : ""),
62  inputModuleLabelSummary_(pset.getParameter<std::string>("SummaryInputModuleLabel")),
63  inputClusterLabel_(
64  pset.existsAs<std::string>("InputClusterLabel") ? pset.getParameter<std::string>("InputClusterLabel") : ""),
65  filename_(pset.getUntrackedParameter<std::string>("RootFileName", sistrip::dqmSourceFileName_)),
66  run_(0),
67  partitionName_(pset.existsAs<std::string>("PartitionName") ? pset.getParameter<std::string>("PartitionName")
68  : ""),
69  time_(0),
70  isSpy_(pset.existsAs<bool>("isSpy") ? pset.getParameter<bool>("isSpy") : false),
71  taskConfigurable_(pset.getUntrackedParameter<std::string>("CommissioningTask", "UNDEFINED")),
73  tasks_(),
74  cablingTasks_(),
75  tasksExist_(false),
76  cablingTask_(false),
77  updateFreq_(pset.getUntrackedParameter<int>("HistoUpdateFreq", 1)),
78  base_(""),
79  view_(pset.getUntrackedParameter<std::string>("View", "Default")),
80  parameters_(pset) {
81  inputModuleSummaryToken_ = consumes<SiStripEventSummary>(edm::InputTag(inputModuleLabelSummary_));
82  digiVirginRawToken_ = mayConsume<edm::DetSetVector<SiStripRawDigi> >(edm::InputTag(inputModuleLabel_, "VirginRaw"));
84  mayConsume<edm::DetSetVector<SiStripRawDigi> >(edm::InputTag(inputModuleLabel_, "FineDelaySelection"));
85  digiReorderedToken_ = mayConsume<edm::DetSetVector<SiStripRawDigi> >(edm::InputTag(inputModuleLabel_, "Reordered"));
87  if (not isSpy_)
88  digiScopeModeToken_ = mayConsume<edm::DetSetVector<SiStripRawDigi> >(edm::InputTag(inputModuleLabel_, "ScopeMode"));
89  else {
91  mayConsume<edm::DetSetVector<SiStripRawDigi> >(edm::InputTag(inputModuleLabelAlt_, "ScopeRawDigis"));
92  clustersToken_ = mayConsume<edmNew::DetSetVector<SiStripCluster> >(edm::InputTag(inputClusterLabel_));
93  }
95  LogTrace(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
96  << " Constructing object...";
97  tasks_.clear();
98  tasks_.resize(1024, VecOfTasks(96, static_cast<CommissioningTask*>(nullptr)));
99 }
100 
101 // -----------------------------------------------------------------------------
102 //
104  LogTrace(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
105  << " Destructing object...";
106 }
107 
108 // -----------------------------------------------------------------------------
109 //
111  if (!dqm_) {
112  std::stringstream ss;
113  if (!method.empty()) {
114  ss << "[SiStripCommissioningSource::" << method << "]" << std::endl;
115  } else {
116  ss << "[SiStripCommissioningSource]" << std::endl;
117  }
118  ss << " NULL pointer to DQMStore";
119  edm::LogWarning(mlDqmSource_) << ss.str();
120  return nullptr;
121  } else {
122  return dqm_;
123  }
124 }
125 
126 // -----------------------------------------------------------------------------
127 // Retrieve DQM interface, control cabling and "control view" utility
128 // class, create histogram directory structure and generate "reverse"
129 // control cabling.
131  LogTrace(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
132  << " Configuring..." << std::endl;
133 
134  // ---------- DQM back-end interface ----------
135 
137  edm::LogInfo(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
138  << " DQMStore service: " << dqm_;
139  dqm(__func__);
140 
141  // ---------- Base directory ----------
142 
143  std::stringstream dir("");
144  base_ = dir.str();
145 
146  // ---------- FED and FEC cabling ----------
147 
149  setup.get<SiStripFedCablingRcd>().get(fed_cabling);
150  fedCabling_ = const_cast<SiStripFedCabling*>(fed_cabling.product());
151  LogDebug(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
152  << "Initialized FED cabling. Number of FEDs is " << fedCabling_->fedIds().size();
153  fecCabling_ = new SiStripFecCabling(*fed_cabling);
154  if (fecCabling_->crates().empty()) {
155  std::stringstream ss;
156  ss << "[SiStripCommissioningSource::" << __func__ << "]"
157  << " Empty std::vector returned by FEC cabling object!"
158  << " Check if database connection failed...";
159  edm::LogWarning(mlDqmSource_) << ss.str();
160  }
161 
162  // ---------- Reset ----------
163 
164  tasksExist_ = false;
166  cablingTask_ = false;
167 
168  remove();
169 
171  clearTasks();
172 }
173 
174 // -----------------------------------------------------------------------------
175 //
177  LogTrace(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
178  << " Halting..." << std::endl;
179 
180  // ---------- Update histograms ----------
181  // Cabling task
182  for (TaskMap::iterator itask = cablingTasks_.begin(); itask != cablingTasks_.end(); itask++) {
183  if (itask->second) {
184  itask->second->updateHistograms();
185  }
186  }
187 
188  if (task_ == sistrip::APV_LATENCY) {
189  for (uint16_t partition = 0; partition < 4; ++partition) {
190  tasks_[0][partition]->updateHistograms();
191  }
192  } else if (task_ == sistrip::FINE_DELAY) {
193  tasks_[0][0]->updateHistograms();
194  } else {
195  // All tasks except cabling
196  uint16_t fed_id = 0;
197  uint16_t fed_ch = 0;
198  auto ifed = fedCabling_->fedIds().begin();
199  for (; ifed != fedCabling_->fedIds().end(); ifed++) {
200  auto conns = fedCabling_->fedConnections(*ifed);
201  for (auto iconn = conns.begin(); iconn != conns.end(); iconn++) {
202  if (!iconn->isConnected()) {
203  continue;
204  }
205  fed_id = iconn->fedId();
206  fed_ch = iconn->fedCh();
207  if (tasks_[fed_id][fed_ch]) {
208  tasks_[fed_id][fed_ch]->updateHistograms();
209  delete tasks_[fed_id][fed_ch];
210  }
211  }
212  }
213  }
214  // ---------- Save histos to root file ----------
215 
216  // Strip filename of ".root" extension
218  if (filename_.find(".root", 0) == std::string::npos) {
219  name = filename_;
220  } else {
221  name = filename_.substr(0, filename_.find(".root", 0));
222  }
223 
224  // Retrieve SCRATCH directory
225  std::string scratch = "SCRATCH"; //@@ remove trailing slash!!!
226  std::string dir = "";
227  if (std::getenv(scratch.c_str()) != nullptr) {
228  dir = std::getenv(scratch.c_str());
229  }
230 
231  // Add directory path
232  std::stringstream ss;
233  if (!dir.empty()) {
234  ss << dir << "/";
235  } else {
236  ss << "/tmp/";
237  }
238 
239  // Add filename with run number, host ip, pid and .root extension
240  ss << name << "_";
241  if (task_ == sistrip::DAQ_SCOPE_MODE and not partitionName_.empty()) // only for spy-runs
242  ss << partitionName_ << "_";
243 
244  directory(ss, run_);
245  ss << ".root";
246 
247  // Save file with appropriate filename (if run number is known)
248  if (!filename_.empty()) {
249  if (run_ != 0) {
250  dqm()->save(ss.str());
251  } else {
252  edm::LogWarning(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
253  << " NULL value for RunNumber! No root file saved!";
254  }
255  } else {
256  edm::LogWarning(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
257  << " NULL value for filename! No root file saved!";
258  }
259 
260  LogTrace(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
261  << " Saved all histograms to file \"" << ss.str() << "\"";
262 
263  // ---------- Delete histograms ----------
264  // Remove all MonitorElements in "SiStrip" dir and below
265  // remove();
266 
267  // Delete histogram objects
268  // clearCablingTasks();
269  // clearTasks();
270 
271  // ---------- Delete cabling ----------
272  if (fedCabling_) {
273  fedCabling_ = nullptr;
274  }
275  if (fecCabling_) {
276  delete fecCabling_;
277  fecCabling_ = nullptr;
278  }
279 }
280 
281 // ----------------------------------------------------------------------------
282 //
284  // Retrieve commissioning information from "event summary"
286  // event.getByLabel( inputModuleLabelSummary_, summary );
287  event.getByToken(inputModuleSummaryToken_, summary);
288 
289  // Check if EventSummary has info attached
290  if ((summary->runType() == sistrip::UNDEFINED_RUN_TYPE || summary->runType() == sistrip::UNKNOWN_RUN_TYPE) &&
291  summary->nullParams()) {
292  edm::LogWarning(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
293  << " Unknown/undefined RunType and NULL parameter values!"
294  << " It may be that the 'trigger FED' object was not found!";
295  }
296 
297  // Check if need to rebuild FED/FEC cabling objects for connection run
298  //cablingForConnectionRun( summary->runType() ); //@@ do not use!
299 
300  // Extract run number and forward to client
301  if (event.id().run() != run_) {
302  run_ = event.id().run();
303  createRunNumber();
304  }
305 
306  // Coarse event rate counter
307  if (!(event.id().event() % updateFreq_)) {
308  std::stringstream ss;
309  ss << "[SiStripCommissioningSource::" << __func__ << "]"
310  << " The last " << updateFreq_ << " events were processed at a rate of ";
311  if (time(nullptr) == time_) {
312  ss << ">" << updateFreq_ << " Hz";
313  } else {
314  ss << (updateFreq_ / (time(nullptr) - time_)) << " Hz";
315  }
316  edm::LogVerbatim(mlDqmSource_) << ss.str();
317  time_ = time(nullptr);
318  }
319 
320  // Create commissioning task objects
321  if (!tasksExist_) {
322  createTask(summary.product(), setup);
323  } else {
324  for (auto& v : tasks_) {
325  for (auto& t : v) {
326  t->eventSetup(&setup);
327  }
328  }
329  }
330 
331  // Retrieve raw digis with mode appropriate to task
335 
336  if (task_ == sistrip::DAQ_SCOPE_MODE) { // scop-mode runs
337  if (not isSpy_ and
338  summary->fedReadoutMode() == FED_VIRGIN_RAW) { // if the readout is virgin raw just take the VR digis
339  event.getByToken(digiVirginRawToken_, raw);
340  } else if (not isSpy_ and summary->fedReadoutMode() == FED_SCOPE_MODE) {
341  event.getByToken(digiScopeModeToken_, raw);
342  } else if (isSpy_) { // spy case take both re-ordered and scope mode
343  event.getByToken(digiScopeModeToken_, rawAlt);
344  event.getByToken(digiReorderedToken_, raw);
345  if (not inputClusterLabel_.empty())
346  event.getByToken(clustersToken_, cluster);
347  } else {
348  std::stringstream ss;
349  ss << "[SiStripCommissioningSource::" << __func__ << "]"
350  << " Requested DAQ_SCOPE_MODE but unknown FED"
351  << " readout mode retrieved from SiStripEventSummary: "
353  edm::LogWarning(mlDqmSource_) << ss.str();
354  }
357  event.getByToken(digiScopeModeToken_, raw);
362  event.getByToken(digiVirginRawToken_, raw);
363  } else if (task_ == sistrip::APV_LATENCY || task_ == sistrip::FINE_DELAY) {
364  event.getByToken(digiFineDelaySelectionToken_, raw);
365  } else {
366  std::stringstream ss;
367  ss << "[SiStripCommissioningSource::" << __func__ << "]"
368  << " Unknown CommissioningTask: " << SiStripEnumsAndStrings::runType(task_)
369  << " Unable to establish FED readout mode and retrieve digi container!"
370  << " Check if SiStripEventSummary object is found/present in Event";
371  edm::LogWarning(mlDqmSource_) << ss.str();
372  return;
373  }
374 
375  // Check for NULL pointer to digi container
376  if (not raw.isValid()) {
377  std::stringstream ss;
378  ss << "[SiStripCommissioningSource::" << __func__ << "]" << std::endl
379  << " NULL pointer to DetSetVector!" << std::endl
380  << " Unable to fill histograms!";
381  edm::LogWarning(mlDqmSource_) << ss.str();
382  return;
383  }
384 
385  if (isSpy_ and not inputModuleLabelAlt_.empty() and not rawAlt.isValid()) {
386  std::stringstream ss;
387  ss << "[SiStripCommissioningSource::" << __func__ << "]" << std::endl
388  << " NULL pointer to DetSetVector!" << std::endl
389  << " Unable to fill histograms!";
390  edm::LogWarning(mlDqmSource_) << ss.str();
391  return;
392  }
393 
394  if (isSpy_ and not inputClusterLabel_.empty() and not cluster.isValid()) {
395  std::stringstream ss;
396  ss << "[SiStripCommissioningSource::" << __func__ << "]" << std::endl
397  << " NULL pointer to DetSetVector!" << std::endl
398  << " Unable to fill histograms!";
399  edm::LogWarning(mlDqmSource_) << ss.str();
400  return;
401  }
402 
403  if (!cablingTask_) {
404  fillHistos(summary.product(), *raw, *rawAlt, *cluster);
405  } else {
406  fillCablingHistos(summary.product(), *raw);
407  }
408 }
409 
410 // ----------------------------------------------------------------------------
411 //
414  // Create FEC key using DCU id and LLD channel from SiStripEventSummary
415  const SiStripModule& module = fecCabling_->module(summary->dcuId());
416  uint16_t lld_channel = (summary->deviceId() & 0x3) + 1;
417  SiStripFecKey key_object(module.key().fecCrate(),
418  module.key().fecSlot(),
419  module.key().fecRing(),
420  module.key().ccuAddr(),
421  module.key().ccuChan(),
422  lld_channel);
423  uint32_t fec_key = key_object.key();
424  std::stringstream sss;
425  sss << "[SiStripCommissioningSource::" << __func__ << "]"
426  << " Found DcuId 0x" << std::hex << std::setw(8) << std::setfill('0') << summary->dcuId() << std::dec
427  << " with Crate/FEC/Ring/CCU/Module/LLD: " << module.key().fecCrate() << "/" << module.key().fecSlot() << "/"
428  << module.key().fecRing() << "/" << module.key().ccuAddr() << "/" << module.key().ccuChan() << "/" << lld_channel;
429  edm::LogWarning(mlDqmSource_) << sss.str();
430 
431  //LogTrace(mlTest_) << "TEST : " << key_object;
432 
433  // Check on whether DCU id is found
434  if (key_object.isInvalid(sistrip::CCU_CHAN)) {
435  std::stringstream ss;
436  ss << "[SiStripCommissioningSource::" << __func__ << "]"
437  << " DcuId 0x" << std::hex << std::setw(8) << std::setfill('0') << summary->dcuId() << std::dec
438  << " in 'DAQ register' field not found in cabling map!"
439  << " (NULL values returned for FEC path)";
440  edm::LogWarning(mlDqmSource_) << ss.str();
441  return;
442  }
443 
444  // Iterate through FED ids
445  for (auto ifed = fedCabling_->fedIds().begin(); ifed != fedCabling_->fedIds().end(); ifed++) {
446  // Check if FedId is non-zero
447  if (*ifed == sistrip::invalid_) {
448  continue;
449  }
450 
451  // Container to hold median signal level for FED cabling task
452  std::map<uint16_t, float> medians;
453  medians.clear();
454  std::map<uint16_t, float> medians1;
455  medians1.clear();
456 
457  // Iterate through FED channels
458  for (uint16_t ichan = 0; ichan < 96; ichan++) {
459  // Retrieve digis for given FED key
460  uint32_t fed_key = ((*ifed & sistrip::invalid_) << 16) | (ichan & sistrip::invalid_);
461 
462  std::vector<edm::DetSet<SiStripRawDigi> >::const_iterator digis = raw.find(fed_key);
463  if (digis != raw.end()) {
464  if (digis->data.empty()) {
465  continue;
466  }
467 
468  Averages ave;
469  for (uint16_t idigi = 0; idigi < digis->data.size(); idigi++) {
470  ave.add(static_cast<uint32_t>(digis->data[idigi].adc()));
471  }
473  ave.calc(params);
474  medians[ichan] = params.median_; // Store median signal level
475  medians1[ichan] = digis->data[0].adc();
476  }
477 
478  } // fed channel loop
479 
480  // Calculate mean and spread on all (median) signal levels
481  Averages average;
482  std::map<uint16_t, float>::const_iterator ii = medians.begin();
483  for (; ii != medians.end(); ii++) {
484  average.add(ii->second);
485  }
487  average.calc(tmp);
488 
489  std::stringstream ss;
490  ss << "FED Averages:" << std::endl
491  << " nChans: " << medians.size() << std::endl
492  << " num/mean/median/rms/max/min: " << tmp.num_ << "/" << tmp.mean_ << "/" << tmp.median_ << "/" << tmp.rms_
493  << "/" << tmp.max_ << "/" << tmp.min_ << std::endl;
494  LogTrace(mlDqmSource_) << ss.str();
495 
496  // Calculate mean and spread on "filtered" data
497  Averages truncated;
498  std::map<uint16_t, float>::const_iterator jj = medians.begin();
499  for (; jj != medians.end(); jj++) {
500  if (jj->second < tmp.median_ + tmp.rms_) {
501  truncated.add(jj->second);
502  }
503  }
505  truncated.calc(params);
506 
507  std::stringstream ss1;
508  ss1 << "Truncated Averages:" << std::endl
509  << " nChans: " << medians.size() << std::endl
510  << " num/mean/median/rms/max/min: " << params.num_ << "/" << params.mean_ << "/" << params.median_ << "/"
511  << params.rms_ << "/" << params.max_ << "/" << params.min_ << std::endl;
512  LogTrace(mlDqmSource_) << ss1.str();
513 
514  // Identify channels with signal
515  std::stringstream ss2;
516  std::stringstream ss3;
517  std::map<uint16_t, float> channels;
518  std::map<uint16_t, float>::const_iterator ichan = medians.begin();
519  for (; ichan != medians.end(); ichan++) {
520  if (ichan->second > 200.) {
521  LogTrace(mlTest_) << "TEST FOUND SIGNAL HIGH: " << *ifed << " " << ichan->first << " " << ichan->second;
522  channels[ichan->first] = ichan->second;
523  }
524  ss2 //<< ichan->first << "/"
525  << ichan->second << " ";
526  ss3 //<< ichan->first << "/"
527  << medians1[ichan->first] << " ";
528  }
529 
530  ss2 << std::endl;
531  ss3 << std::endl;
532  LogTrace(mlTest_) << "DUMP for FED " << *ifed << ": " << ss2.str();
533  LogTrace(mlTest_) << "FIRST ADC VAL " << *ifed << ": " << ss3.str();
534 
535  // Fill cabling histograms
536  if (cablingTasks_.find(fec_key) != cablingTasks_.end()) {
537  if (!channels.empty()) {
538  cablingTasks_[fec_key]->fillHistograms(*summary, *ifed, channels);
539  SiStripFecKey path(fec_key);
540  std::stringstream ss;
541  ss << "[SiStripCommissioningSource::" << __func__ << "]"
542  << " Filled histogram for '" << cablingTasks_[fec_key]->myName() << "' object with FecKey: 0x" << std::hex
543  << std::setfill('0') << std::setw(8) << fec_key << std::dec
544  << " and Crate/FEC/ring/CCU/module/LLDchan: " << path.fecCrate() << "/" << path.fecSlot() << "/"
545  << path.fecRing() << "/" << path.ccuAddr() << "/" << path.ccuChan() << "/" << path.channel();
546  LogTrace(mlDqmSource_) << ss.str();
547  }
548  } else {
549  SiStripFecKey path(fec_key);
550  std::stringstream ss;
551  ss << "[SiStripCommissioningSource::" << __func__ << "]"
552  << " Unable to find CommissioningTask object with FecKey: 0x" << std::hex << std::setfill('0') << std::setw(8)
553  << fec_key << std::dec << " and Crate/FEC/ring/CCU/module/LLDchan: " << path.fecCrate() << "/"
554  << path.fecSlot() << "/" << path.fecRing() << "/" << path.ccuAddr() << "/" << path.ccuChan() << "/"
555  << path.channel();
556  edm::LogWarning(mlDqmSource_) << ss.str();
557  }
558 
559  } // fed id loop
560 }
561 
562 // ----------------------------------------------------------------------------
563 //
566  const edm::DetSetVector<SiStripRawDigi>& rawAlt,
568  // Iterate through FED ids and channels
569  std::vector<uint16_t> stripOnClusters;
570  auto ifed = fedCabling_->fedIds().begin();
571  for (; ifed != fedCabling_->fedIds().end(); ifed++) {
572  // Iterate through connected FED channels
573  auto conns = fedCabling_->fedConnections(*ifed);
574  for (auto iconn = conns.begin(); iconn != conns.end(); iconn++) {
575  if (!(iconn->fedId()) || iconn->fedId() > sistrip::valid_) {
576  continue;
577  }
578  if (!iconn->isConnected()) {
579  continue;
580  }
581 
582  // Create FED key and check if non-zero
583  // note: the key is not computed using the same formula as in commissioning histograms.
584  // beware that changes here must match changes in raw2digi and in SiStripFineDelayHit
585  uint32_t fed_key = ((iconn->fedId() & sistrip::invalid_) << 16) | (iconn->fedCh() & sistrip::invalid_);
586  // Retrieve digis for given FED key and check if found
587  std::vector<edm::DetSet<SiStripRawDigi> >::const_iterator digis = raw.find(fed_key);
588 
589  // only for spy data-taking --> tick measurement
590  std::vector<edm::DetSet<SiStripRawDigi> >::const_iterator digisAlt;
591  if (not rawAlt.empty()) {
592  digisAlt = rawAlt.find(fed_key);
593  if (digisAlt == rawAlt.end())
594  continue;
595  }
596 
597  // find the strips belonging to the clusters connected to this APV pair
598  stripOnClusters.clear();
599  if (not clusters.empty()) {
600  for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = clusters.begin(); DSViter != clusters.end();
601  DSViter++) {
602  if (DSViter->id() != iconn->detId())
603  continue; // select clusters on this module
604  for (edmNew::DetSet<SiStripCluster>::const_iterator DSiter = DSViter->begin(); DSiter != DSViter->end();
605  DSiter++) { // loop on the clusters
606  if (DSiter->firstStrip() >= iconn->apvPairNumber() * 256 and
607  DSiter->firstStrip() < (1 + iconn->apvPairNumber()) * 256) { // found the right APV
608  for (size_t istrip = 0; istrip < DSiter->amplitudes().size(); istrip++) {
609  stripOnClusters.push_back(DSiter->firstStrip() + istrip - iconn->apvPairNumber() * 256);
610  }
611  }
612  }
613  }
614  }
615 
616  if (digis != raw.end()) {
617  // tasks involving tracking have partition-level histos, so treat separately
618  if (task_ == sistrip::APV_LATENCY) {
619  if (tasks_[0][iconn->fecCrate() - 1]) {
620  tasks_[0][iconn->fecCrate() - 1]->fillHistograms(*summary, *digis);
621  } else {
622  std::stringstream ss;
623  ss << "[SiStripCommissioningSource::" << __func__ << "]"
624  << " Unable to find CommissioningTask for FEC crate " << iconn->fecCrate()
625  << ". Unable to fill histograms!";
626  edm::LogWarning(mlDqmSource_) << ss.str();
627  }
628  } else if (task_ == sistrip::FINE_DELAY) {
629  if (tasks_[0][0]) {
630  tasks_[0][0]->fillHistograms(*summary, *digis);
631  } else {
632  std::stringstream ss;
633  ss << "[SiStripCommissioningSource::" << __func__ << "]"
634  << " Unable to find global CommissioningTask for FineDelay. Unable to fill histograms!";
635  edm::LogWarning(mlDqmSource_) << ss.str();
636  }
637  } else {
638  if (tasks_[iconn->fedId()][iconn->fedCh()]) {
639  if (not rawAlt.empty() or digisAlt == rawAlt.end())
640  tasks_[iconn->fedId()][iconn->fedCh()]->fillHistograms(*summary, *digis);
641  else { // for spy-data
642  if (stripOnClusters.empty())
643  tasks_[iconn->fedId()][iconn->fedCh()]->fillHistograms(*summary, *digis, *digisAlt);
644  else {
645  tasks_[iconn->fedId()][iconn->fedCh()]->fillHistograms(*summary, *digis, *digisAlt, stripOnClusters);
646  }
647  }
648  } else {
649  std::stringstream ss;
650  ss << "[SiStripCommissioningSource::" << __func__ << "]"
651  << " Unable to find CommissioningTask object with FED key " << std::hex << std::setfill('0')
652  << std::setw(8) << fed_key << std::dec << " and FED id/ch " << iconn->fedId() << "/" << iconn->fedCh()
653  << " Unable to fill histograms!";
654  edm::LogWarning(mlDqmSource_) << ss.str();
655  }
656  }
657  } else {
658  // issue a warning only for standard runs, as latency and fine delay only deliver
659  // pseudo zero-suppressed data
661  std::stringstream ss;
662  ss << "[SiStripCommissioningSource::" << __func__ << "]"
663  << " Unable to find any DetSet containing digis for FED key " << std::hex << std::setfill('0')
664  << std::setw(8) << fed_key << std::dec << " and FED id/ch " << iconn->fedId() << "/" << iconn->fedCh();
665  edm::LogWarning(mlDqmSource_) << ss.str();
666  }
667  }
668  } // fed channel loop
669  } // fed id loop
670 }
671 
672 // -----------------------------------------------------------------------------
673 //
675  // Set commissioning task to default ("undefined") value
676  if (!run_) {
677  edm::LogWarning(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
678  << " NULL run number!";
679  return;
680  }
681 
682  // Create MonitorElement that identifies run number
684  std::stringstream run;
685  run << run_;
686  dqm()->bookString(std::string(sistrip::runNumber_) + sistrip::sep_ + run.str(), run.str());
687 }
688 
689 // -----------------------------------------------------------------------------
690 //
692  // Set commissioning task to default ("undefined") value
694 
695  // Retrieve commissioning task from EventSummary
696  if (summary) {
697  task_ = summary->runType();
698  std::stringstream ss;
699  ss << "[SiStripCommissioningSource::" << __func__ << "]"
700  << " Identified CommissioningTask from EventSummary to be \"" << SiStripEnumsAndStrings::runType(task_) << "\"";
701  LogTrace(mlDqmSource_) << ss.str();
702  } else {
704  std::stringstream ss;
705  ss << "[SiStripCommissioningSource::" << __func__ << "]"
706  << " NULL pointer to SiStripEventSummary!"
707  << " Check SiStripEventSummary is found/present in Event";
708  edm::LogWarning(mlDqmSource_) << ss.str();
709  }
710 
711  // Override task with ParameterSet configurable (if defined)
713  if (configurable != sistrip::UNDEFINED_RUN_TYPE && configurable != sistrip::UNKNOWN_RUN_TYPE) {
714  std::stringstream ss;
715  ss << "[SiStripCommissioningSource::" << __func__ << "]"
716  << " Overriding CommissioningTask from EventSummary (\"" << SiStripEnumsAndStrings::runType(task_)
717  << "\") with value retrieved from .cfg file (\"" << SiStripEnumsAndStrings::runType(configurable) << "\")!";
718  LogTrace(mlDqmSource_) << ss.str();
719  task_ = configurable;
720  }
721 
722  // Create ME (std::string) that identifies commissioning task
725  dqm()->bookString(std::string(sistrip::taskId_) + sistrip::sep_ + task_str, task_str);
726 
727  // Check commissioning task is known / defined
729  std::stringstream ss;
730  ss << "[SiStripCommissioningSource::" << __func__ << "]"
731  << " Unexpected CommissioningTask found (" << static_cast<uint16_t>(task_) << ") \""
733  << " Unexpected value found in SiStripEventSummary and/or cfg file"
734  << " If SiStripEventSummary is not present in Event,"
735  << " check 'CommissioningTask' configurable in cfg file";
736  edm::LogWarning(mlDqmSource_) << ss.str();
737  return;
738  } else {
739  std::stringstream ss;
740  ss << "[SiStripCommissioningSource::" << __func__ << "]"
741  << " Identified CommissioningTask to be \"" << SiStripEnumsAndStrings::runType(task_) << "\"";
742  LogTrace(mlDqmSource_) << ss.str();
743  }
744 
745  // Check if commissioning task is FED cabling
746  if (task_ == sistrip::FED_CABLING) {
747  cablingTask_ = true;
748  } else {
749  cablingTask_ = false;
750  }
751 
752  std::stringstream ss;
753  ss << "[SiStripCommissioningSource::" << __func__ << "]"
754  << " CommissioningTask: " << SiStripEnumsAndStrings::runType(summary->runType());
755  LogTrace(mlDqmSource_) << ss.str();
756 
757  edm::LogVerbatim(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
758  << " Creating CommissioningTask objects and booking histograms...";
759  if (cablingTask_) {
761  } else {
762  createTasks(task_, setup);
763  }
764  edm::LogVerbatim(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
765  << " Finished booking histograms!";
766  tasksExist_ = true;
767 }
768 
769 // -----------------------------------------------------------------------------
770 //
772  // Iterate through FEC cabling and create commissioning task objects
773  uint16_t booked = 0;
774  for (std::vector<SiStripFecCrate>::const_iterator icrate = fecCabling_->crates().begin();
775  icrate != fecCabling_->crates().end();
776  icrate++) {
777  for (std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++) {
778  for (std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end();
779  iring++) {
780  for (std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end();
781  iccu++) {
782  for (std::vector<SiStripModule>::const_iterator imodule = iccu->modules().begin();
783  imodule != iccu->modules().end();
784  imodule++) {
785  // Build FEC key
787  icrate->fecCrate(), ifec->fecSlot(), iring->fecRing(), iccu->ccuAddr(), imodule->ccuChan());
788 
789  // Check if FEC key is invalid
790  if (!path.isValid()) {
791  continue;
792  }
793 
794  // Set working directory prior to booking histograms
795  std::string dir = base_ + path.path();
796  dqm()->setCurrentFolder(dir);
797 
798  // Iterate through all APV pairs for this module
799  for (uint16_t ipair = 0; ipair < imodule->nApvPairs(); ipair++) {
800  // Retrieve active APV devices
801  SiStripModule::PairOfU16 apvs = imodule->activeApvPair(imodule->lldChannel(ipair));
802 
803  // Create connection object to hold all relevant info
804  FedChannelConnection conn(icrate->fecCrate(),
805  ifec->fecSlot(),
806  iring->fecRing(),
807  iccu->ccuAddr(),
808  imodule->ccuChan(),
809  apvs.first,
810  apvs.second,
811  imodule->dcuId(),
812  imodule->detId(),
813  imodule->nApvPairs());
814 
815  // Define key encoding control path
816  uint32_t key = SiStripFecKey(icrate->fecCrate(),
817  ifec->fecSlot(),
818  iring->fecRing(),
819  iccu->ccuAddr(),
820  imodule->ccuChan(),
821  imodule->lldChannel(ipair))
822  .key();
823 
824  // Check key is non zero
825  if (!key) {
826  edm::LogWarning(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
827  << " Unexpected NULL value for FEC key!";
828  continue;
829  }
830 
831  // Create cabling task objects if not already existing
832  if (cablingTasks_.find(key) == cablingTasks_.end()) {
833  if (task_ == sistrip::FED_CABLING) {
835  } else if (task_ == sistrip::UNDEFINED_RUN_TYPE) {
836  edm::LogWarning(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
837  << " Undefined CommissioningTask"
838  << " Unable to create FedCablingTask object!";
839  } else if (task_ == sistrip::UNKNOWN_RUN_TYPE) {
840  edm::LogWarning(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
841  << " Unknown CommissioningTask"
842  << " Unable to create FedCablingTask object!";
843  } else {
845  << "[SiStripCommissioningSource::" << __func__ << "]"
846  << " Unexpected CommissioningTask: " << SiStripEnumsAndStrings::runType(task_)
847  << " Unable to create FedCablingTask object!";
848  }
849 
850  // Check if key is found and, if so, book histos and set update freq
851  if (cablingTasks_.find(key) != cablingTasks_.end()) {
852  if (cablingTasks_[key]) {
853  cablingTasks_[key]->bookHistograms();
854  cablingTasks_[key]->updateFreq(1); //@@ hardwired to update every event!!!
855  booked++;
856  std::stringstream ss;
857  ss << "[SiStripCommissioningSource::" << __func__ << "]"
858  << " Booking histograms for '" << cablingTasks_[key]->myName() << "' object with key 0x"
859  << std::hex << std::setfill('0') << std::setw(8) << key << std::dec << " in directory \"" << dir
860  << "\"";
861  LogTrace(mlDqmSource_) << ss.str();
862  } else {
863  std::stringstream ss;
864  ss << "[SiStripCommissioningSource::" << __func__ << "]"
865  << " NULL pointer to CommissioningTask for key 0x" << std::hex << std::setfill('0')
866  << std::setw(8) << key << std::dec << " in directory " << dir << " Unable to book histograms!";
867  edm::LogWarning(mlDqmSource_) << ss.str();
868  }
869  } else {
870  std::stringstream ss;
871  ss << "[SiStripCommissioningSource::" << __func__ << "]"
872  << " Unable to find CommissioningTask for key 0x" << std::hex << std::setfill('0') << std::setw(8)
873  << key << std::dec << " in directory " << dir << " Unable to book histograms!";
874  edm::LogWarning(mlDqmSource_) << ss.str();
875  }
876 
877  } else {
878  std::stringstream ss;
879  ss << "[SiStripCommissioningSource::" << __func__ << "]"
880  << " CommissioningTask object already exists for key 0x" << std::hex << std::setfill('0')
881  << std::setw(8) << key << std::dec << " in directory " << dir
882  << " Unable to create FedCablingTask object!";
883  edm::LogWarning(mlDqmSource_) << ss.str();
884  }
885 
886  } // loop through apv pairs
887  } // loop through modules
888  } // loop through ccus
889  } // loop through rings
890  } // loop through fecs
891  } // loop through crates
892 
893  edm::LogVerbatim(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
894  << " Created " << booked << " CommissioningTask objects and booked histograms";
895 }
896 
897 // -----------------------------------------------------------------------------
898 //
900  uint16_t booked = 0;
901 
902  // latency has partition-level histos, so treat separately
903  if (task_ == sistrip::APV_LATENCY) {
904  for (uint16_t partition = 0; partition < 4; ++partition) {
905  // make a task for every partition; tracker-wide histo is shared
906  tasks_[0][partition] = new LatencyTask(
907  dqm(),
910  tasks_[0][partition]->eventSetup(&setup);
911  tasks_[0][partition]->bookHistograms();
912  tasks_[0][partition]->updateFreq(updateFreq_);
913  booked++;
914  }
915 
916  // fine-delay has 1 histo for the whole tracker, so treat separately
917  } else if (task_ == sistrip::FINE_DELAY) {
918  tasks_[0][0] = new FineDelayTask(dqm(), FedChannelConnection());
919  tasks_[0][0]->eventSetup(&setup);
920  tasks_[0][0]->bookHistograms();
921  tasks_[0][0]->updateFreq(updateFreq_);
922  booked++;
923 
924  } else { // now do any other task
925 
926  // Iterate through FED ids and channels
927  for (auto ifed = fedCabling_->fedIds().begin(); ifed != fedCabling_->fedIds().end(); ++ifed) {
928  // Iterate through connected FED channels
929  auto conns = fedCabling_->fedConnections(*ifed);
930  for (auto iconn = conns.begin(); iconn != conns.end(); ++iconn) {
931  // Create FEC key
932  SiStripFecKey fec_key(
933  iconn->fecCrate(), iconn->fecSlot(), iconn->fecRing(), iconn->ccuAddr(), iconn->ccuChan());
934  // Create FED key and check if non-zero
935  SiStripFedKey fed_key(
936  iconn->fedId(), SiStripFedKey::feUnit(iconn->fedCh()), SiStripFedKey::feChan(iconn->fedCh()));
937  if (!iconn->isConnected()) {
938  continue;
939  }
940 
941  // define the view in which to work and paths for histograms
942  // currently FecView (control view) and FedView (readout view)
943  // DetView (detector view) implementation has started
944  // Set working directory prior to booking histograms
945  std::stringstream dir;
946  dir << base_;
947  if (view_ == "Default") { // default
948  if (run_type == sistrip::FAST_CABLING) {
949  dir << fed_key.path(); // cabling in fed view
950  } else {
951  dir << fec_key.path(); // all other runs in control view
952  }
953  } else if (view_ == "FecView") {
954  dir << fec_key.path();
955  } else if (view_ == "FedView") {
956  dir << fed_key.path();
957  } else if (view_ == "DetView") {
958  // currently just by detid from the connection, which is empty...
959  dir << sistrip::root_ << sistrip::dir_ << sistrip::detectorView_ << sistrip::dir_ << iconn->detId();
960  } else {
961  edm::LogWarning(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
962  << " Invalid view " << view_ << std::endl
963  << " Histograms will end up all in the top directory.";
964  } // end if view_ == ...
965  dqm()->setCurrentFolder(dir.str());
966 
967  // Create commissioning task objects
968  if (!tasks_[iconn->fedId()][iconn->fedCh()]) {
969  if (task_ == sistrip::FAST_CABLING) {
970  tasks_[iconn->fedId()][iconn->fedCh()] = new FastFedCablingTask(dqm(), *iconn);
971  } else if (task_ == sistrip::APV_TIMING) {
972  tasks_[iconn->fedId()][iconn->fedCh()] = new ApvTimingTask(dqm(), *iconn);
973  } else if (task_ == sistrip::FED_TIMING) {
974  tasks_[iconn->fedId()][iconn->fedCh()] = new FedTimingTask(dqm(), *iconn);
975  } else if (task_ == sistrip::OPTO_SCAN) {
976  tasks_[iconn->fedId()][iconn->fedCh()] = new OptoScanTask(dqm(), *iconn);
977  } else if (task_ == sistrip::VPSP_SCAN) {
978  tasks_[iconn->fedId()][iconn->fedCh()] = new VpspScanTask(dqm(), *iconn);
979  } else if (task_ == sistrip::PEDESTALS) {
980  tasks_[iconn->fedId()][iconn->fedCh()] = new PedestalsTask(dqm(), *iconn);
981  } else if (task_ == sistrip::PEDS_ONLY) {
982  tasks_[iconn->fedId()][iconn->fedCh()] = new PedsOnlyTask(dqm(), *iconn);
983  } else if (task_ == sistrip::NOISE) {
984  tasks_[iconn->fedId()][iconn->fedCh()] = new NoiseTask(dqm(), *iconn);
985  } else if (task_ == sistrip::PEDS_FULL_NOISE) {
986  tasks_[iconn->fedId()][iconn->fedCh()] = new PedsFullNoiseTask(dqm(), *iconn, parameters_);
987  } else if (task_ == sistrip::DAQ_SCOPE_MODE) {
988  tasks_[iconn->fedId()][iconn->fedCh()] = new DaqScopeModeTask(dqm(), *iconn, parameters_);
990  tasks_[iconn->fedId()][iconn->fedCh()] =
991  new CalibrationScanTask(dqm(), *iconn, task_, filename_.c_str(), run_, setup);
993  tasks_[iconn->fedId()][iconn->fedCh()] =
994  new CalibrationTask(dqm(), *iconn, task_, filename_.c_str(), run_, setup);
995  } else if (task_ == sistrip::UNDEFINED_RUN_TYPE) {
996  edm::LogWarning(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
997  << " Undefined CommissioningTask"
998  << " Unable to create CommissioningTask object!";
999  } else {
1000  edm::LogWarning(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
1001  << " Unknown CommissioningTask"
1002  << " Unable to create CommissioningTask object!";
1003  }
1004 
1005  // Check if fed_key is found and, if so, book histos and set update freq
1006  if (tasks_[iconn->fedId()][iconn->fedCh()]) {
1007  tasks_[iconn->fedId()][iconn->fedCh()]->eventSetup(&setup);
1008 
1011  tasks_[iconn->fedId()][iconn->fedCh()]->bookHistograms();
1012  else {
1014  static_cast<CalibrationScanTask*>(tasks_[iconn->fedId()][iconn->fedCh()])->setCurrentFolder(dir.str());
1016  static_cast<CalibrationTask*>(tasks_[iconn->fedId()][iconn->fedCh()])->setCurrentFolder(dir.str());
1017  }
1018  tasks_[iconn->fedId()][iconn->fedCh()]->updateFreq(updateFreq_);
1019  booked++;
1020  } else {
1021  std::stringstream ss;
1022  ss << "[SiStripCommissioningSource::" << __func__ << "]"
1023  << " NULL pointer to CommissioningTask for key 0x" << std::hex << std::setfill('0') << std::setw(8)
1024  << fed_key.key() << std::dec << " in directory " << dir.str() << " Unable to book histograms!";
1025  edm::LogWarning(mlDqmSource_) << ss.str();
1026  }
1027  } else {
1028  std::stringstream ss;
1029  ss << "[SiStripCommissioningSource::" << __func__ << "]"
1030  << " CommissioningTask object already exists for key 0x" << std::hex << std::setfill('0') << std::setw(8)
1031  << fed_key.key() << std::dec << " in directory " << dir.str()
1032  << " Unable to create CommissioningTask object!";
1033  edm::LogWarning(mlDqmSource_) << ss.str();
1034  }
1035  } // loop over fed channels
1036  } // loop over feds
1037  } // end other tasks
1038  edm::LogVerbatim(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]"
1039  << " Created " << booked << " CommissioningTask objects and booked histograms";
1040 }
1041 
1042 // ----------------------------------------------------------------------------
1043 //
1045  if (cablingTasks_.empty()) {
1046  return;
1047  }
1048  for (TaskMap::iterator itask = cablingTasks_.begin(); itask != cablingTasks_.end(); itask++) {
1049  if (itask->second) {
1050  delete itask->second;
1051  }
1052  }
1053  cablingTasks_.clear();
1054 }
1055 
1056 // ----------------------------------------------------------------------------
1057 //
1059  if (tasks_.empty()) {
1060  return;
1061  }
1062  VecOfVecOfTasks::iterator ifed = tasks_.begin();
1063  for (; ifed != tasks_.end(); ifed++) {
1064  VecOfTasks::iterator ichan = ifed->begin();
1065  for (; ichan != ifed->end(); ichan++) {
1066  if (*ichan) {
1067  delete *ichan;
1068  *ichan = 0;
1069  }
1070  }
1071  ifed->resize(96, nullptr);
1072  }
1073  tasks_.resize(1024);
1074 }
1075 
1076 // ----------------------------------------------------------------------------
1077 //
1079  // TODO: remove no longer supported in DQMStore.
1080 }
1081 
1082 // -----------------------------------------------------------------------------
1083 //
1084 void SiStripCommissioningSource::directory(std::stringstream& dir, uint32_t run_number) {
1085  // Get details about host
1086  char hn[256];
1087  gethostname(hn, sizeof(hn));
1088  struct hostent* he;
1089  he = gethostbyname(hn);
1090 
1091  // Extract host name and ip
1092  std::string host_name;
1093  std::string host_ip;
1094  if (he) {
1095  host_name = std::string(he->h_name);
1096  host_ip = std::string(inet_ntoa(*(struct in_addr*)(he->h_addr)));
1097  } else {
1098  host_name = "unknown.cern.ch";
1099  host_ip = "255.255.255.255";
1100  }
1101 
1102  // Reformat IP address
1104  std::stringstream ip;
1105  //for ( uint16_t ii = 0; ii < 4; ++ii ) {
1106  while (pos != std::string::npos) {
1107  std::string::size_type tmp = host_ip.find(".", pos);
1108  if (tmp != std::string::npos) {
1109  ip << std::setw(3) << std::setfill('0') << host_ip.substr(pos, tmp - pos) << ".";
1110  pos = tmp + 1; // skip the delimiter "."
1111  } else {
1112  ip << std::setw(3) << std::setfill('0') << host_ip.substr(pos);
1113  pos = std::string::npos;
1114  }
1115  }
1116 
1117  // Get pid
1118  pid_t pid = getpid();
1119 
1120  // Construct string
1121  if (run_number) {
1122  dir << std::setw(8) << std::setfill('0') << run_number << "_";
1123  }
1124  dir << ip.str() << "_" << std::setw(5) << std::setfill('0') << pid;
1125 }
1126 
1127 // -----------------------------------------------------------------------------
1128 //
1129 // void SiStripCommissioningSource::cablingForConnectionRun( const sistrip::RunType& type ) {
1130 
1131 // if ( type == sistrip::FED_CABLING ||
1132 // type == sistrip::QUITE_FAST_CABLING ||
1133 // type == sistrip::FAST_CABLING ) {
1134 // std::stringstream ss;
1135 // ss << "[SiStripCommissioningSource::" << __func__ << "]"
1136 // << " Run type is " << SiStripEnumsAndStrings::runType( type ) << "!"
1137 // << " Checking if cabling should be rebuilt using FED and device descriptions!...";
1138 // edm::LogVerbatim(mlDqmSource_) << ss.str();
1139 // } else { return; }
1140 
1141 // // Build and retrieve SiStripConfigDb object using service
1142 // SiStripConfigDb* db = edm::Service<SiStripConfigDb>().operator->(); //@@ NOT GUARANTEED TO BE THREAD SAFE!
1143 // LogTrace(mlCabling_)
1144 // << "[SiStripCommissioningSource::" << __func__ << "]"
1145 // << " Nota bene: using the SiStripConfigDb API"
1146 // << " as a \"service\" does not presently guarantee"
1147 // << " thread-safe behaviour!...";
1148 
1149 // if ( !db ) {
1150 // edm::LogError(mlCabling_)
1151 // << "[SiStripCommissioningSource::" << __func__ << "]"
1152 // << " NULL pointer to SiStripConfigDb returned by service!"
1153 // << " Cannot check if cabling needs to be rebuilt!";
1154 // return;
1155 // }
1156 
1157 // if ( db->getFedConnections().empty() ) {
1158 // edm::LogVerbatim(mlCabling_)
1159 // << "[SiStripCommissioningSource::" << __func__ << "]"
1160 // << " Datbase does not contain FED connections!"
1161 // << " Do not need to rebuild cabling object based on FED and device descriptions!";
1162 // return;
1163 // }
1164 
1165 // if ( fecCabling_ ) { delete fecCabling_; fecCabling_ = 0; }
1166 // if ( fedCabling_ ) { delete fedCabling_; fedCabling_ = 0; }
1167 
1168 // // Build FEC cabling
1169 // fecCabling_ = new SiStripFecCabling();
1170 // SiStripConfigDb::DcuDetIdMap mapping;
1171 // SiStripFedCablingBuilderFromDb::buildFecCablingFromDevices( db,
1172 // *fecCabling_,
1173 // mapping );
1174 // // Build FED cabling
1175 // fedCabling_ = new SiStripFedCabling();
1176 // SiStripFedCablingBuilderFromDb::getFedCabling( *fecCabling_,
1177 // *fedCabling_ );
1178 
1179 // edm::LogVerbatim(mlCabling_)
1180 // << "[SiStripCommissioningSource::" << __func__ << "]"
1181 // << " Cabling object rebuilt using on FED and device descriptions!";
1182 
1183 // }
#define LogDebug(id)
MonitorElement * bookString(char_string const &name, char_string const &value)
Book string.
Definition: DQMStore.cc:1100
RunNumber_t run() const
Definition: EventID.h:38
static const char runNumber_[]
Device and connection information at the level of a front-end module.
Definition: SiStripModule.h:24
EventNumber_t event() const
Definition: EventID.h:40
const_iterator end(bool update=false) const
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiReorderedToken_
iterator find(det_id_type id)
Definition: DetSetVector.h:264
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiVirginRawToken_
const uint16_t & fecRing() const
void createTask(const SiStripEventSummary *const, const edm::EventSetup &)
static const char dir_[]
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const SiStripModule & module(const FedChannelConnection &conn) const
const SiStripFecKey & key() const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clustersToken_
void fillHistos(const SiStripEventSummary *const, const edm::DetSetVector< SiStripRawDigi > &, const edm::DetSetVector< SiStripRawDigi > &=edm::DetSetVector< SiStripRawDigi >(), const edmNew::DetSetVector< SiStripCluster > &=edmNew::DetSetVector< SiStripCluster >())
static const char mlDqmSource_[]
#define nullptr
void createTasks(sistrip::RunType, const edm::EventSetup &)
const std::vector< SiStripFecCrate > & crates() const
data_type const * const_iterator
Definition: DetSetNew.h:31
const uint16_t & fecSlot() const
static const uint16_t valid_
Definition: Constants.h:17
static const char detectorView_[]
uint16_t size_type
void analyze(const edm::Event &, const edm::EventSetup &) override
sistrip classes
void directory(std::stringstream &, uint32_t run_number=0)
const uint32_t & key() const
Definition: SiStripKey.h:120
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
void beginRun(edm::Run const &, const edm::EventSetup &) override
static std::string runType(const sistrip::RunType &)
const sistrip::RunType & runType() const
std::vector< CommissioningTask * > VecOfTasks
static const char sep_[]
Class containning control, module, detector and connection information, at the level of a FED channel...
FedsConstIterRange fedIds() const
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
static const char taskId_[]
void fillCablingHistos(const SiStripEventSummary *const, const edm::DetSetVector< SiStripRawDigi > &)
static const char dqmSourceFileName_[]
const uint32_t & dcuId() const
static const char mlTest_[]
bool isValid() const
Definition: HandleBase.h:70
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
#define LogTrace(id)
ii
Definition: cuy.py:590
const uint16_t & fecCrate() const
const uint32_t & deviceId() const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const uint16_t & feUnit() const
T const * product() const
Definition: Handle.h:69
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiFineDelaySelectionToken_
const uint16_t & channel() const
Definition: SiStripKey.h:123
bool empty() const
Return true if we contain no DetSets.
Definition: DetSetVector.h:254
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:16
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:639
const sistrip::FedReadoutMode & fedReadoutMode() const
edm::EDGetTokenT< SiStripEventSummary > inputModuleSummaryToken_
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiScopeModeToken_
edm::EventID id() const
Definition: EventBase.h:59
uint32_t num_
Definition: Averages.h:24
const uint16_t & feChan() const
T get() const
Definition: EventSetup.h:73
static const char root_[]
DQMStore *const dqm(std::string method="") const
const uint16_t & ccuChan() const
tmp
align.sh
Definition: createJobs.py:716
std::pair< uint16_t, uint16_t > PairOfU16
Definition: SiStripModule.h:40
T const * product() const
Definition: ESHandle.h:86
Definition: vlib.h:198
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
Definition: DQMStore.cc:2244
const_iterator begin(bool update=false) const
Definition: event.py:1
Definition: Run.h:45
static std::string fedReadoutMode(const sistrip::FedReadoutMode &)