CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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")),
70  task_(sistrip::UNDEFINED_RUN_TYPE),
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 
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_;
691  dqm()->bookString(std::string(sistrip::runNumber_) + sistrip::sep_ + run.str(), run.str());
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 {
767  createTasks(task_, setup);
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();
801  dqm()->setCurrentFolder(dir);
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...
964  dir << sistrip::root_ << sistrip::dir_ << sistrip::detectorView_ << sistrip::dir_ << iconn->detId();
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
1108  std::string::size_type pos = 0;
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 // }
RunNumber_t run() const
Definition: EventID.h:38
static const char runNumber_[]
Log< level::Info, true > LogVerbatim
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 &)
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::ESGetToken< SiStripPedestals, SiStripPedestalsRcd > pedestalToken_
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:539
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 >())
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
static const char mlDqmSource_[]
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
int ii
Definition: cuy.py:589
static const char detectorView_[]
uint16_t size_type
void analyze(const edm::Event &, const edm::EventSetup &) override
#define LogTrace(id)
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
Definition: DQMStore.h:87
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
bool getData(T &iHolder) const
Definition: EventSetup.h:128
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
static const char taskId_[]
void fillCablingHistos(const SiStripEventSummary *const, const edm::DetSetVector< SiStripRawDigi > &)
static const char dqmSourceFileName_[]
tuple key
prepare the HTCondor submission files and eventually submit them
const uint32_t & dcuId() const
static const char mlTest_[]
Transition
Definition: Transition.h:12
bool isValid() const
Definition: HandleBase.h:70
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
const uint16_t & fecCrate() const
Log< level::Info, false > LogInfo
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:70
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...
int average
Definition: PDRates.py:138
edm::EDGetTokenT< SiStripEventSummary > inputModuleSummaryToken_
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiScopeModeToken_
edm::EventID id() const
Definition: EventBase.h:59
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:784
uint32_t num_
Definition: Averages.h:24
const uint16_t & feChan() const
tuple conn
Definition: getInfo.py:9
static const char root_[]
DQMStore *const dqm(std::string method="") const
const uint16_t & ccuChan() const
Log< level::Warning, false > LogWarning
tmp
align.sh
Definition: createJobs.py:716
std::pair< uint16_t, uint16_t > PairOfU16
Definition: SiStripModule.h:40
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const_iterator begin(bool update=false) const
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
Definition: Run.h:45
tuple module
Definition: callgraph.py:69
#define LogDebug(id)
static std::string fedReadoutMode(const sistrip::FedReadoutMode &)