CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DTDigiTask Class Reference

#include <DTDigiTask.h>

Inheritance diagram for DTDigiTask:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DTDigiTask (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTDigiTask ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 To reset the MEs. More...
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void bookHistos (DQMStore::IBooker &ibooker, const DTSuperLayerId &dtSL, std::string folder, std::string histoTag)
 Book the ME. More...
 
void bookHistos (DQMStore::IBooker &ibooker, const DTChamberId &dtCh, std::string folder, std::string histoTag)
 
void bookHistos (DQMStore::IBooker &ibooker, const int wheelId, std::string folder, std::string histoTag)
 
void channelsMap (const DTChamberId &dtCh, std::string histoTag)
 To map real channels. More...
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &)
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &setup)
 
std::string triggerSource ()
 get the L1A source More...
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

std::string topFolder () const
 

Private Attributes

bool checkNoisyChannels
 
int defaultTmax
 
int defaultTTrig
 
std::map< std::string,
std::map< uint32_t,
MonitorElement * > > 
digiHistos
 
bool doAllHitsOccupancies
 
bool doInTimeOccupancies
 
bool doLayerTimeBoxes
 
bool doNoiseOccupancies
 
bool doStaticBooking
 
edm::EDGetTokenT
< DTDigiCollection
dtDigiToken_
 
bool filterSyncNoise
 
std::map< DTChamberId, int > hitMap
 
int inTimeHitsLowerBound
 
int inTimeHitsUpperBound
 
bool isLocalRun
 
float kFactor
 
bool lookForSyncNoise
 
edm::EDGetTokenT
< LTCDigiCollection
ltcDigiCollectionToken_
 
edm::Handle< LTCDigiCollectionltcdigis
 
edm::ESHandle< DTReadOutMappingmapping
 
int maxTDCCounts
 
int maxTDCHits
 
edm::ESHandle< DTGeometrymuonGeom
 
MonitorElementnEventMonitor
 
int nevents
 
std::map< DTChamberId, int > nSynchNoiseEvents
 
bool readTTrigDB
 
int resetCycle
 
bool subtractT0
 
std::set< DTChamberIdsyncNoisyChambers
 
int syncNum
 
int syncNumTot
 
edm::ESHandle< DTT0t0Map
 
int timeBoxGranularity
 
int tMax
 no needs to be precise. Value from PSets will always be used More...
 
bool tpMode
 
float tTrig
 tTrig from the DB More...
 
edm::ESHandle< DTTtrigtTrigMap
 
float tTrigRMS
 
std::map< std::string,
std::map< int, MonitorElement * > > 
wheelHistos
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 52 of file DTDigiTask.h.

Constructor & Destructor Documentation

DTDigiTask::DTDigiTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 46 of file DTDigiTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogTrace, and dtTPAnalyzer_cfg::subtractT0.

46  {
47  // switch for the verbosity
48  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask]: Constructor" << endl;
49 
50  // The label to retrieve the digis
51  dtDigiToken_ = consumes<DTDigiCollection>(
52  ps.getParameter<InputTag>("dtDigiLabel"));
53  // Read the configuration parameters
54  maxTDCHits = ps.getUntrackedParameter<int>("maxTDCHitsPerChamber",30000);
55  // Set to true to read the ttrig from DB (useful to determine in-time and out-of-time hits)
56  readTTrigDB = ps.getUntrackedParameter<bool>("readDB", false);
57  // Set to true to subtract t0 from test pulses
58  subtractT0 = ps.getParameter<bool>("performPerWireT0Calibration");
59  // Tmax value (TDC counts)
60  defaultTmax = ps.getParameter<int>("defaultTmax");
61  // Switch from static to dinamic histo booking
62  doStaticBooking = ps.getUntrackedParameter<bool>("staticBooking", true);
63 
64  // Switch for local/global runs
65  isLocalRun = ps.getUntrackedParameter<bool>("localrun", true);
66  if (!isLocalRun) {
67  ltcDigiCollectionToken_ = consumes<LTCDigiCollection>(
68  ps.getParameter<edm::InputTag>("ltcDigiCollectionTag"));
69  }
70 
71  // Setting for the reset of the ME after n (= ResetCycle) luminosity sections
72  resetCycle = ps.getUntrackedParameter<int>("ResetCycle", 3);
73  // Check the DB of noisy channels
74  checkNoisyChannels = ps.getUntrackedParameter<bool>("checkNoisyChannels",false);
75  // Default TTrig to be used when not reading the TTrig DB
76  defaultTTrig = ps.getParameter<int>("defaultTtrig");
77  inTimeHitsLowerBound = ps.getParameter<int>("inTimeHitsLowerBound");
78  inTimeHitsUpperBound = ps.getParameter<int>("inTimeHitsUpperBound");
79  timeBoxGranularity = ps.getUntrackedParameter<int>("timeBoxGranularity",4);
80  maxTDCCounts = ps.getUntrackedParameter<int>("maxTDCCounts", 6400);
81 
82  doAllHitsOccupancies = ps.getUntrackedParameter<bool>("doAllHitsOccupancies", true);
83  doNoiseOccupancies = ps.getUntrackedParameter<bool>("doNoiseOccupancies", false);
84  doInTimeOccupancies = ps.getUntrackedParameter<bool>("doInTimeOccupancies", false);
85 
86  // switch on the mode for running on test pulses (different top folder)
87  tpMode = ps.getUntrackedParameter<bool>("testPulseMode", false);
88  // switch on/off the filtering of synchronous noise events (cutting on the # of digis)
89  // time-boxes and occupancy plots are not filled and summary plots are created to report the problem
90  filterSyncNoise = ps.getUntrackedParameter<bool>("filterSyncNoise", false);
91  // look for synch noisy events, produce histograms but do not filter them
92  lookForSyncNoise = ps.getUntrackedParameter<bool>("lookForSyncNoise", false);
93  // switch on production of time-boxes with layer granularity
94  doLayerTimeBoxes = ps.getUntrackedParameter<bool>("doLayerTimeBoxes", false);
95 
96  syncNumTot = 0;
97  syncNum = 0;
98 
99 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int defaultTmax
Definition: DTDigiTask.h:134
bool doStaticBooking
Definition: DTDigiTask.h:137
bool tpMode
Definition: DTDigiTask.h:155
bool doLayerTimeBoxes
Definition: DTDigiTask.h:159
bool filterSyncNoise
Definition: DTDigiTask.h:157
bool readTTrigDB
Definition: DTDigiTask.h:130
bool lookForSyncNoise
Definition: DTDigiTask.h:156
int maxTDCCounts
Definition: DTDigiTask.h:150
edm::EDGetTokenT< DTDigiCollection > dtDigiToken_
Definition: DTDigiTask.h:125
bool checkNoisyChannels
Definition: DTDigiTask.h:143
bool isLocalRun
Definition: DTDigiTask.h:139
bool doInTimeOccupancies
Definition: DTDigiTask.h:153
bool doNoiseOccupancies
Definition: DTDigiTask.h:152
int resetCycle
Definition: DTDigiTask.h:141
int inTimeHitsUpperBound
Definition: DTDigiTask.h:148
#define LogTrace(id)
int defaultTTrig
Definition: DTDigiTask.h:145
bool doAllHitsOccupancies
Definition: DTDigiTask.h:151
int maxTDCHits
Definition: DTDigiTask.h:97
bool subtractT0
Definition: DTDigiTask.h:132
int timeBoxGranularity
Definition: DTDigiTask.h:149
int syncNumTot
Definition: DTDigiTask.h:108
int inTimeHitsLowerBound
Definition: DTDigiTask.h:147
edm::EDGetTokenT< LTCDigiCollection > ltcDigiCollectionToken_
Definition: DTDigiTask.h:127
DTDigiTask::~DTDigiTask ( )
virtual

Destructor.

Definition at line 104 of file DTDigiTask.cc.

References LogTrace, and cmsHarvester::nevents.

104  {
105  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "DTDigiTask: analyzed " << nevents << " events" << endl;
106 
107 }
int nevents
Definition: DTDigiTask.h:93
#define LogTrace(id)

Member Function Documentation

void DTDigiTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::stream::EDAnalyzerBase.

Definition at line 448 of file DTDigiTask.cc.

References DTSuperLayerId::chamberId(), DTTimeUnits::counts, spr::find(), edm::EventSetup::get(), LogTrace, cmsHarvester::nevents, DetId::rawId(), edm::second(), DTChamberId::sector(), DTChamberId::station(), crabStatusFromReport::statusMap, dtTPAnalyzer_cfg::subtractT0, DTSuperLayerId::superlayer(), edm::EventBase::time(), edm::Timestamp::value(), and DTChamberId::wheel().

448  {
449  nevents++;
451  if (nevents%1000 == 0) {
452  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask] Analyze #Run: " << event.id().run()
453  << " #Event: " << event.id().event() << endl;
454  }
455 
456  // Get the ingredients from the event
457 
458  // Digi collection
460  event.getByToken(dtDigiToken_, dtdigis);
461 
462  // LTC digis
463  if (!isLocalRun) event.getByToken(ltcDigiCollectionToken_, ltcdigis);
464 
465  // Status map (for noisy channels)
467  if(checkNoisyChannels) {
468  // Get the map of noisy channels
469  c.get<DTStatusFlagRcd>().get(statusMap);
470  }
471 
472  string histoTag;
473 
474  // Check if the digi container is empty
475  if(dtdigis->begin() == dtdigis->end()) {
476  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "Event " << nevents << " empty." << endl;
477  }
478 
479  if (lookForSyncNoise || filterSyncNoise) { // dosync
480  // Count the # of digis per chamber
482  for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); dtLayerId_It++) {
483  DTChamberId chId = ((*dtLayerId_It).first).chamberId();
484  if(hitMap.find(chId) == hitMap.end()) {// new chamber
485  hitMap[chId] = 0;
486  }
487  hitMap[chId] += (((*dtLayerId_It).second).second - ((*dtLayerId_It).second).first);
488  }
489 
490 
491 
492  // check chamber with # of digis above threshold and flag them as noisy
493  map<DTChamberId,int>::const_iterator hitMapIt = hitMap.begin();
494  map<DTChamberId,int>::const_iterator hitMapEnd = hitMap.end();
495 
496  map<int,int> chMap;
497 
498  for (; hitMapIt != hitMapEnd; ++hitMapIt) {
499  if((hitMapIt->second) > maxTDCHits) {
500 
501  DTChamberId chId = hitMapIt->first;
502  int wh = chId.wheel();
503 
504  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask] Synch noise in chamber: " << chId
505  << " with # digis: " << hitMapIt->second << endl;
506 
507  if(chMap.find(wh) == chMap.end()) { chMap[wh] = 0; }
508  chMap[wh]++ ;
509 
510  syncNoisyChambers.insert(chId);
511 
512  wheelHistos["SyncNoiseEvents"][wh]->Fill(chId.sector(),chId.station());
513 
514  }
515  }
516 
517  // fill # of noisy ch per wheel plot
518  map<int,int>::const_iterator chMapIt = chMap.begin();
519  map<int,int>::const_iterator chMapEnd = chMap.end();
520  for (; chMapIt != chMapEnd; ++chMapIt) {
521  wheelHistos["SyncNoiseChambs"][(*chMapIt).first]->Fill((*chMapIt).second);
522  }
523 
524  // clear the map of # of digis per chamber: not needed anymore
525  hitMap.clear();
526 
527  if (syncNoisyChambers.size() != 0) {
528  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask] Synch Noise in event: " << nevents;
529  if(filterSyncNoise) LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask") << "\tnoisy time-boxes and occupancy will not be filled!" << endl;
530  syncNumTot++;
531  syncNum++;
532  }
533 
534  // Logging of "large" synch Noisy events in private DQM
535  if (syncNoisyChambers.size() > 3) {
536  time_t eventTime = time_t(event.time().value()>>32);
537 
538  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise")
539  << "[DTDigiTask] At least 4 Synch Noisy chambers in Run : " << event.id().run()
540  << " Lumi : " << event.id().luminosityBlock()
541  << " Event : " << event.id().event()
542  << " at time : " << ctime(&eventTime) << endl;
543 
544  set<DTChamberId>::const_iterator chIt = syncNoisyChambers.begin();
545  set<DTChamberId>::const_iterator chEnd = syncNoisyChambers.end();
546 
547  stringstream synchNoisyCh;
548  for (;chIt!=chEnd;++chIt) { synchNoisyCh << " " << (*chIt); }
549  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise") <<
550  "[DTDigiTask] Chamber List :" << synchNoisyCh.str() << endl;
551  }
552 
553  if (nevents%1000 == 0) {
554  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask") << (syncNumTot*100./nevents) << "% sync noise events since the beginning \n"
555  << (syncNum*0.1) << "% sync noise events in the last 1000 events " << endl;
556  syncNum = 0;
557  }
558  }
559 
560  bool isSyncNoisy = false;
561 
563  for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It) { // Loop over layers
564  isSyncNoisy = false;
565  // check if chamber labeled as synch noisy
566  if (filterSyncNoise) {
567  DTChamberId chId = ((*dtLayerId_It).first).chamberId();
568  if(syncNoisyChambers.find(chId) != syncNoisyChambers.end()) {
569  isSyncNoisy = true;
570  }
571  }
572 
573  for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
574  digiIt!=((*dtLayerId_It).second).second; ++digiIt) { // Loop over all digis
575 
576  bool isNoisy = false;
577  bool isFEMasked = false;
578  bool isTDCMasked = false;
579  bool isTrigMask = false;
580  bool isDead = false;
581  bool isNohv = false;
582  if(checkNoisyChannels) {
583  const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire());
584  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
585  }
586 
587  // Get the useful IDs
588  const DTSuperLayerId dtSLId = ((*dtLayerId_It).first).superlayerId();
589  uint32_t indexSL = dtSLId.rawId();
590  const DTChamberId dtChId = dtSLId.chamberId();
591  uint32_t indexCh = dtChId.rawId();
592  int layer_number=((*dtLayerId_It).first).layer();
593  int superlayer_number=dtSLId.superlayer();
594 
595  // Read the ttrig DB or set a rough value from config
596  // ttrig and rms are TDC counts
597  if (readTTrigDB)
598  tTrigMap->get( ((*dtLayerId_It).first).superlayerId(),
600  else tTrig = defaultTTrig;
601 
602  int inTimeHitsLowerBoundCorr = int(round(tTrig)) - inTimeHitsLowerBound;
603  int inTimeHitsUpperBoundCorr = int(round(tTrig)) + tMax + inTimeHitsUpperBound;
604 
605  float t0; float t0RMS;
606  int tdcTime = (*digiIt).countsTDC();
607 
608  if (subtractT0) {
609  const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire());
610  // t0s and rms are TDC counts
611  t0Map->get(dtWireId, t0, t0RMS, DTTimeUnits::counts) ;
612  tdcTime += int(round(t0));
613  }
614 
615 
616 
617  // Fill Time-Boxes
618  // NOTE: avoid to fill TB and PhotoPeak with noise. Occupancy are filled anyway
619  if (( !isNoisy ) && (!isSyncNoisy)) { // Discard noisy channels
620  // TimeBoxes per SL
621  histoTag = "TimeBox" + triggerSource();
622 
623  (digiHistos.find(histoTag)->second).find(indexSL)->second->Fill(tdcTime);
624  if(doLayerTimeBoxes)
625  (digiHistos.find(histoTag)->second).find((*dtLayerId_It).first.rawId())->second->Fill(tdcTime);
626  }
627 
628  // Fill Occupancies
629  if (!isSyncNoisy) { // Discard synch noisy channels
630 
631  if (doAllHitsOccupancies) { // fill occupancies for all hits
632  //Occupancies per chamber & layer
633  histoTag = "OccupancyAllHits_perCh";
634  map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
635  digiHistos[histoTag].find(indexCh);
636 
637  //FR comment the following cannot pass ibooker to analyze method!
638  /*
639  if (mappedHisto == digiHistos[histoTag].end()) { // dynamic booking
640  bookHistos(ibooker, dtChId, string("Occupancies"), histoTag);
641  mappedHisto = digiHistos[histoTag].find(indexCh);
642  }
643  */
644  mappedHisto->second->Fill((*digiIt).wire(),(layer_number+(superlayer_number-1)*4)-1);
645 
646 
647  // Fill the chamber occupancy
648  histoTag = "OccupancyAllHits";
649  map<int, MonitorElement*>::const_iterator histoPerWheel =
650  wheelHistos[histoTag].find(dtChId.wheel());
651 
652  histoPerWheel->second->Fill(dtChId.sector(),dtChId.station()); // FIXME: normalize to # of layers
653  }
654 
655  if(doNoiseOccupancies) { // fill occupancies for hits before the ttrig
656  if (tdcTime < inTimeHitsLowerBoundCorr ) {
657  // FIXME: what about tdcTime > inTimeHitsUpperBoundCorr ???
658 
659  // Noise: Before tTrig
660  //Occupancies Noise per chamber & layer
661  histoTag = "OccupancyNoise_perCh";
662  map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
663  digiHistos[histoTag].find(indexCh);
664 
665  mappedHisto->second->Fill((*digiIt).wire(),
666  (layer_number+(superlayer_number-1)*4)-1);
667 
668  // Fill the chamber occupancy
669  histoTag = "OccupancyNoise";
670  map<int, MonitorElement*>::const_iterator histoPerWheel =
671  wheelHistos[histoTag].find(dtChId.wheel());
672 
673  histoPerWheel->second->Fill(dtChId.sector(),dtChId.station()); // FIXME: normalize to # of layers
674 
675  }
676  }
677 
678  if(doInTimeOccupancies) { // fill occpunacies for in-time hits only
679  if (tdcTime > inTimeHitsLowerBoundCorr && tdcTime < inTimeHitsUpperBoundCorr) {
680  // Physical hits: within the time window
681 
682  //Occupancies Signal per chamber & layer
683  histoTag = "OccupancyInTimeHits_perCh";
684  map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
685  digiHistos[histoTag].find(indexCh);
686 
687  mappedHisto->second->Fill((*digiIt).wire(),
688  (layer_number+(superlayer_number-1)*4)-1);
689 
690  // Fill the chamber occupancy
691  histoTag = "OccupancyInTimeHits";
692  map<int, MonitorElement*>::const_iterator histoPerWheel =
693  wheelHistos[histoTag].find(dtChId.wheel());
694 
695  histoPerWheel->second->Fill(dtChId.sector(),dtChId.station()); // FIXME: normalize to # of layers
696 
697  }
698  }
699  }
700  }
701  }
702 
703  syncNoisyChambers.clear();
704 }
bool doLayerTimeBoxes
Definition: DTDigiTask.h:159
bool filterSyncNoise
Definition: DTDigiTask.h:157
DTChamberId chamberId() const
Return the corresponding ChamberId.
bool readTTrigDB
Definition: DTDigiTask.h:130
bool lookForSyncNoise
Definition: DTDigiTask.h:156
float kFactor
Definition: DTDigiTask.h:102
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
edm::ESHandle< DTTtrig > tTrigMap
Definition: DTDigiTask.h:116
void Fill(long long x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< DTDigiCollection > dtDigiToken_
Definition: DTDigiTask.h:125
bool checkNoisyChannels
Definition: DTDigiTask.h:143
bool isLocalRun
Definition: DTDigiTask.h:139
edm::ESHandle< DTT0 > t0Map
Definition: DTDigiTask.h:117
bool doInTimeOccupancies
Definition: DTDigiTask.h:153
bool doNoiseOccupancies
Definition: DTDigiTask.h:152
std::map< std::string, std::map< int, MonitorElement * > > wheelHistos
Definition: DTDigiTask.h:120
int nevents
Definition: DTDigiTask.h:93
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
int inTimeHitsUpperBound
Definition: DTDigiTask.h:148
#define LogTrace(id)
int defaultTTrig
Definition: DTDigiTask.h:145
float tTrig
tTrig from the DB
Definition: DTDigiTask.h:100
int tMax
no needs to be precise. Value from PSets will always be used
Definition: DTDigiTask.h:96
int superlayer() const
Return the superlayer number (deprecated method name)
bool doAllHitsOccupancies
Definition: DTDigiTask.h:151
int maxTDCHits
Definition: DTDigiTask.h:97
bool subtractT0
Definition: DTDigiTask.h:132
const T & get() const
Definition: EventSetup.h:55
std::vector< DTDigi >::const_iterator const_iterator
std::set< DTChamberId > syncNoisyChambers
Definition: DTDigiTask.h:107
int syncNumTot
Definition: DTDigiTask.h:108
MonitorElement * nEventMonitor
Definition: DTDigiTask.h:162
int inTimeHitsLowerBound
Definition: DTDigiTask.h:147
float tTrigRMS
Definition: DTDigiTask.h:101
int sector() const
Definition: DTChamberId.h:61
std::map< DTChamberId, int > hitMap
Definition: DTDigiTask.h:106
int station() const
Return the station number.
Definition: DTChamberId.h:51
std::map< std::string, std::map< uint32_t, MonitorElement * > > digiHistos
Definition: DTDigiTask.h:119
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
std::string triggerSource()
get the L1A source
Definition: DTDigiTask.cc:707
edm::Handle< LTCDigiCollection > ltcdigis
Definition: DTDigiTask.h:111
edm::EDGetTokenT< LTCDigiCollection > ltcDigiCollectionToken_
Definition: DTDigiTask.h:127
void DTDigiTask::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

To reset the MEs.

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 186 of file DTDigiTask.cc.

References edm::LuminosityBlockBase::id(), LogTrace, and edm::LuminosityBlockID::luminosityBlock().

186  {
187 
188  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask]: Begin of LS transition" << endl;
189 
190  // Reset the MonitorElements every n (= ResetCycle) Lumi Blocks
191  int lumiBlock = lumiSeg.id().luminosityBlock();
192  if(lumiBlock % resetCycle == 0) {
193  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask")
194  <<"[DTDigiTask]: Reset at the LS transition : "
195  << lumiBlock << endl;
196  // Loop over all ME
197  map<string,map<uint32_t,MonitorElement*> >::const_iterator histosIt = digiHistos.begin();
198  map<string,map<uint32_t,MonitorElement*> >::const_iterator histosEnd = digiHistos.end();
199  for(;histosIt != histosEnd ; ++histosIt) {
200  map<uint32_t,MonitorElement*>::const_iterator histoIt = (*histosIt).second.begin();
201  map<uint32_t,MonitorElement*>::const_iterator histoEnd = (*histosIt).second.end();
202  for(;histoIt != histoEnd; ++histoIt) { (*histoIt).second->Reset(); }
203  }
204 
205  // re-set mapping for not real channels in the occupancyHits per chamber
206  for(int wh=-2; wh<=2; wh++) {
207  for(int sect=1; sect<=14; sect++) {
208  for(int st=1; st<=4; st++) {
209  if( (sect == 13 || sect == 14) && st != 4 ) {continue;}
210  const DTChamberId dtChId(wh,st,sect);
211  channelsMap(dtChId, "OccupancyAllHits_perCh");
212  }
213  }
214  }
215 
216  // loop over wheel summaries
217  map<string,map<int,MonitorElement*> >::const_iterator whHistosIt = wheelHistos.begin();
218  map<string,map<int,MonitorElement*> >::const_iterator whHistosEnd = wheelHistos.end();
219  for(; whHistosIt != whHistosEnd ; ++whHistosIt) {
220  if ((*whHistosIt).first.find("Sync") == string::npos) { // FIXME skips synch noise plots
221  map<int,MonitorElement*>::const_iterator histoIt = (*whHistosIt).second.begin();
222  map<int,MonitorElement*>::const_iterator histoEnd = (*whHistosIt).second.end();
223  for(;histoIt != histoEnd; ++histoIt) { (*histoIt).second->Reset(); }
224  }
225  }
226  }
227 
228 }
void channelsMap(const DTChamberId &dtCh, std::string histoTag)
To map real channels.
Definition: DTDigiTask.cc:745
std::map< std::string, std::map< int, MonitorElement * > > wheelHistos
Definition: DTDigiTask.h:120
int resetCycle
Definition: DTDigiTask.h:141
#define LogTrace(id)
std::map< std::string, std::map< uint32_t, MonitorElement * > > digiHistos
Definition: DTDigiTask.h:119
void DTDigiTask::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &  context 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 133 of file DTDigiTask.cc.

References DQMStore::IBooker::bookFloat(), bookHistos(), and DQMStore::IBooker::setCurrentFolder().

133  {
134 
135  if(doStaticBooking) { // Static histo booking
136  // book the event counter
137  ibooker.setCurrentFolder("DT/EventInfo/Counters");
138  nEventMonitor = ibooker.bookFloat(tpMode ? "nProcessedEventsDigiTP" : "nProcessedEventsDigi" );
139  ibooker.setCurrentFolder(topFolder());
140  for(int wh = -2; wh <= 2; ++wh) { // loop over wheels
141  if(doAllHitsOccupancies) bookHistos(ibooker, wh,string("Occupancies"),"OccupancyAllHits");
142  if(doNoiseOccupancies) bookHistos(ibooker, wh,string("Occupancies"),"OccupancyNoiseHits");
143  if(doInTimeOccupancies) bookHistos(ibooker, wh,string("Occupancies"),"OccupancyInTimeHits");
144 
146  bookHistos(ibooker, wh,string("SynchNoise"),"SyncNoiseEvents");
147  bookHistos(ibooker, wh,string("SynchNoise"),"SyncNoiseChambs");
148  }
149 
150  for(int st = 1; st <= 4; ++st) { // loop over stations
151  for(int sect = 1; sect <= 14; ++sect) { // loop over sectors
152  if((sect == 13 || sect == 14) && st != 4) continue;
153  // Get the chamber ID
154  const DTChamberId dtChId(wh,st,sect);
155 
156  // Occupancies
157  if (doAllHitsOccupancies) {
158  bookHistos(ibooker, dtChId,string("Occupancies"),"OccupancyAllHits_perCh");
159  // set channel mapping
160  channelsMap(dtChId, "OccupancyAllHits_perCh");
161  }
163  bookHistos(ibooker, dtChId,string("Occupancies"),"OccupancyNoise_perCh");
165  bookHistos(ibooker, dtChId,string("Occupancies"),"OccupancyInTimeHits_perCh");
166 
167  for(int sl = 1; sl <= 3; ++sl) { // Loop over SLs
168  if(st == 4 && sl == 2) continue;
169  const DTSuperLayerId dtSLId(wh,st,sect,sl);
170  if(isLocalRun) {
171  bookHistos(ibooker, dtSLId,string("TimeBoxes"),"TimeBox");
172  } else {
173  // TimeBoxes for different triggers
174  bookHistos(ibooker, dtSLId,string("TimeBoxes"),"TimeBoxDTonly");
175  bookHistos(ibooker, dtSLId,string("TimeBoxes"),"TimeBoxNoDT");
176  bookHistos(ibooker, dtSLId,string("TimeBoxes"),"TimeBoxDTalso");
177  }
178  }
179  }
180  }
181  }
182  }
183 }
bool doStaticBooking
Definition: DTDigiTask.h:137
void channelsMap(const DTChamberId &dtCh, std::string histoTag)
To map real channels.
Definition: DTDigiTask.cc:745
bool tpMode
Definition: DTDigiTask.h:155
bool filterSyncNoise
Definition: DTDigiTask.h:157
std::string topFolder() const
Definition: DTDigiTask.cc:731
bool lookForSyncNoise
Definition: DTDigiTask.h:156
bool isLocalRun
Definition: DTDigiTask.h:139
bool doInTimeOccupancies
Definition: DTDigiTask.h:153
bool doNoiseOccupancies
Definition: DTDigiTask.h:152
bool doAllHitsOccupancies
Definition: DTDigiTask.h:151
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
void bookHistos(DQMStore::IBooker &ibooker, const DTSuperLayerId &dtSL, std::string folder, std::string histoTag)
Book the ME.
MonitorElement * nEventMonitor
Definition: DTDigiTask.h:162
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:109
void DTDigiTask::bookHistos ( DQMStore::IBooker ibooker,
const DTSuperLayerId dtSL,
std::string  folder,
std::string  histoTag 
)
protected

Book the ME.

void DTDigiTask::bookHistos ( DQMStore::IBooker ibooker,
const DTChamberId dtCh,
std::string  folder,
std::string  histoTag 
)
protected
void DTDigiTask::bookHistos ( DQMStore::IBooker ibooker,
const int  wheelId,
std::string  folder,
std::string  histoTag 
)
protected
void DTDigiTask::channelsMap ( const DTChamberId dtCh,
std::string  histoTag 
)
protected

To map real channels.

Definition at line 745 of file DTDigiTask.cc.

References DetId::rawId(), DTChamberId::sector(), DTChamberId::station(), and DTChamberId::wheel().

745  {
746 
747  // n max channels
748  int nWires_max = (digiHistos[histoTag])[dtCh.rawId()] -> getNbinsX();
749 
750  // set bin content = -1 for each not real channel. For visualization purposes
751  for(int sl=1; sl<=3; sl++) {
752  for(int ly=1; ly<=4; ly++) {
753  for(int ch=1; ch<=nWires_max; ch++) {
754 
755  int dduId = -1, rosId = -1, robId = -1, tdcId = -1, channelId = -1;
756  int realCh = mapping->geometryToReadOut(dtCh.wheel(),dtCh.station(),dtCh.sector(),sl,ly,ch,dduId,rosId,robId,tdcId,channelId);
757 
758  // realCh = 0 if the channel exists, while realCh = 1 if it does not exist
759  if( realCh ) {
760 
761  int lybin = (4*sl - 4) + ly;
762  (digiHistos[histoTag])[dtCh.rawId()] -> setBinContent(ch,lybin,-1.);
763 
764  }
765 
766  }
767  }
768  }
769 
770 }
edm::ESHandle< DTReadOutMapping > mapping
Definition: DTDigiTask.h:114
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
std::map< std::string, std::map< uint32_t, MonitorElement * > > digiHistos
Definition: DTDigiTask.h:119
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
void DTDigiTask::dqmBeginRun ( const edm::Run run,
const edm::EventSetup context 
)
protectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 110 of file DTDigiTask.cc.

References edm::EventSetup::get(), LogTrace, cmsHarvester::nevents, and dtTPAnalyzer_cfg::subtractT0.

110  {
111 
112  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask]: begin run" << endl;
113  nevents = 0;
114 
115  // Get the geometry
116  context.get<MuonGeometryRecord>().get(muonGeom);
117 
118  // map of the channels
119  context.get<DTReadOutMappingRcd>().get(mapping);
120 
121  // tTrig
122  if (readTTrigDB)
123  context.get<DTTtrigRcd>().get(tTrigMap);
124  // t0s
125  if (subtractT0)
126  context.get<DTT0Rcd>().get(t0Map);
127  // FIXME: tMax (not yet from the DB)
128  tMax = defaultTmax;
129 
130  // ----------------------------------------------------------------------
131 }
int defaultTmax
Definition: DTDigiTask.h:134
bool readTTrigDB
Definition: DTDigiTask.h:130
edm::ESHandle< DTReadOutMapping > mapping
Definition: DTDigiTask.h:114
edm::ESHandle< DTTtrig > tTrigMap
Definition: DTDigiTask.h:116
edm::ESHandle< DTT0 > t0Map
Definition: DTDigiTask.h:117
int nevents
Definition: DTDigiTask.h:93
edm::ESHandle< DTGeometry > muonGeom
Definition: DTDigiTask.h:113
#define LogTrace(id)
int tMax
no needs to be precise. Value from PSets will always be used
Definition: DTDigiTask.h:96
bool subtractT0
Definition: DTDigiTask.h:132
const T & get() const
Definition: EventSetup.h:55
Definition: DTT0Rcd.h:9
void DTDigiTask::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup setup 
)
protectedvirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 741 of file DTDigiTask.cc.

741  {
742 
743 }
string DTDigiTask::topFolder ( ) const
private

Definition at line 731 of file DTDigiTask.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

731  {
732 
733  if(tpMode) return string("DT/10-TestPulses/");
734  return string("DT/01-Digi/");
735 
736 }
bool tpMode
Definition: DTDigiTask.h:155
string DTDigiTask::triggerSource ( )
protected

get the L1A source

Definition at line 707 of file DTDigiTask.cc.

707  {
708 
709  string l1ASource;
710  if (isLocalRun)
711  return l1ASource;
712 
713  for (std::vector<LTCDigi>::const_iterator ltc_it = ltcdigis->begin(); ltc_it != ltcdigis->end(); ltc_it++){
714  size_t otherTriggerSum=0;
715  for (size_t i = 1; i < 6; i++)
716  otherTriggerSum += size_t((*ltc_it).HasTriggered(i));
717 
718  if ((*ltc_it).HasTriggered(0) && otherTriggerSum == 0)
719  l1ASource = "DTonly";
720  else if (!(*ltc_it).HasTriggered(0))
721  l1ASource = "NoDT";
722  else if ((*ltc_it).HasTriggered(0) && otherTriggerSum > 0)
723  l1ASource = "DTalso";
724  }
725 
726  return l1ASource;
727 
728 }
int i
Definition: DBlmapReader.cc:9
bool isLocalRun
Definition: DTDigiTask.h:139
edm::Handle< LTCDigiCollection > ltcdigis
Definition: DTDigiTask.h:111

Member Data Documentation

bool DTDigiTask::checkNoisyChannels
private

Definition at line 143 of file DTDigiTask.h.

int DTDigiTask::defaultTmax
private

Definition at line 134 of file DTDigiTask.h.

int DTDigiTask::defaultTTrig
private

Definition at line 145 of file DTDigiTask.h.

std::map<std::string, std::map<uint32_t, MonitorElement*> > DTDigiTask::digiHistos
private

Definition at line 119 of file DTDigiTask.h.

bool DTDigiTask::doAllHitsOccupancies
private

Definition at line 151 of file DTDigiTask.h.

bool DTDigiTask::doInTimeOccupancies
private

Definition at line 153 of file DTDigiTask.h.

bool DTDigiTask::doLayerTimeBoxes
private

Definition at line 159 of file DTDigiTask.h.

bool DTDigiTask::doNoiseOccupancies
private

Definition at line 152 of file DTDigiTask.h.

bool DTDigiTask::doStaticBooking
private

Definition at line 137 of file DTDigiTask.h.

edm::EDGetTokenT<DTDigiCollection> DTDigiTask::dtDigiToken_
private

Definition at line 125 of file DTDigiTask.h.

bool DTDigiTask::filterSyncNoise
private

Definition at line 157 of file DTDigiTask.h.

std::map<DTChamberId,int> DTDigiTask::hitMap
private

Definition at line 106 of file DTDigiTask.h.

int DTDigiTask::inTimeHitsLowerBound
private

Definition at line 147 of file DTDigiTask.h.

int DTDigiTask::inTimeHitsUpperBound
private

Definition at line 148 of file DTDigiTask.h.

bool DTDigiTask::isLocalRun
private

Definition at line 139 of file DTDigiTask.h.

float DTDigiTask::kFactor
private

Definition at line 102 of file DTDigiTask.h.

bool DTDigiTask::lookForSyncNoise
private

Definition at line 156 of file DTDigiTask.h.

edm::EDGetTokenT<LTCDigiCollection> DTDigiTask::ltcDigiCollectionToken_
private

Definition at line 127 of file DTDigiTask.h.

edm::Handle<LTCDigiCollection> DTDigiTask::ltcdigis
private

Definition at line 111 of file DTDigiTask.h.

edm::ESHandle<DTReadOutMapping> DTDigiTask::mapping
private

Definition at line 114 of file DTDigiTask.h.

int DTDigiTask::maxTDCCounts
private

Definition at line 150 of file DTDigiTask.h.

int DTDigiTask::maxTDCHits
private

Definition at line 97 of file DTDigiTask.h.

edm::ESHandle<DTGeometry> DTDigiTask::muonGeom
private

Definition at line 113 of file DTDigiTask.h.

MonitorElement* DTDigiTask::nEventMonitor
private

Definition at line 162 of file DTDigiTask.h.

int DTDigiTask::nevents
private

Definition at line 93 of file DTDigiTask.h.

std::map<DTChamberId, int> DTDigiTask::nSynchNoiseEvents
private

Definition at line 161 of file DTDigiTask.h.

bool DTDigiTask::readTTrigDB
private

Definition at line 130 of file DTDigiTask.h.

int DTDigiTask::resetCycle
private

Definition at line 141 of file DTDigiTask.h.

bool DTDigiTask::subtractT0
private

Definition at line 132 of file DTDigiTask.h.

std::set<DTChamberId> DTDigiTask::syncNoisyChambers
private

Definition at line 107 of file DTDigiTask.h.

int DTDigiTask::syncNum
private

Definition at line 109 of file DTDigiTask.h.

int DTDigiTask::syncNumTot
private

Definition at line 108 of file DTDigiTask.h.

edm::ESHandle<DTT0> DTDigiTask::t0Map
private

Definition at line 117 of file DTDigiTask.h.

int DTDigiTask::timeBoxGranularity
private

Definition at line 149 of file DTDigiTask.h.

int DTDigiTask::tMax
private

no needs to be precise. Value from PSets will always be used

Definition at line 96 of file DTDigiTask.h.

bool DTDigiTask::tpMode
private

Definition at line 155 of file DTDigiTask.h.

float DTDigiTask::tTrig
private

tTrig from the DB

Definition at line 100 of file DTDigiTask.h.

edm::ESHandle<DTTtrig> DTDigiTask::tTrigMap
private

Definition at line 116 of file DTDigiTask.h.

float DTDigiTask::tTrigRMS
private

Definition at line 101 of file DTDigiTask.h.

std::map<std::string, std::map<int, MonitorElement*> > DTDigiTask::wheelHistos
private

Definition at line 120 of file DTDigiTask.h.