CMS 3D CMS Logo

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