CMS 3D CMS Logo

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