CMS 3D CMS Logo

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