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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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::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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 449 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().

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

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

187  {
188 
189  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask]: Begin of LS transition" << endl;
190 
191  // Reset the MonitorElements every n (= ResetCycle) Lumi Blocks
192  int lumiBlock = lumiSeg.id().luminosityBlock();
193  if(lumiBlock % resetCycle == 0) {
194  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask")
195  <<"[DTDigiTask]: Reset at the LS transition : "
196  << lumiBlock << endl;
197  // Loop over all ME
198  map<string,map<uint32_t,MonitorElement*> >::const_iterator histosIt = digiHistos.begin();
199  map<string,map<uint32_t,MonitorElement*> >::const_iterator histosEnd = digiHistos.end();
200  for(;histosIt != histosEnd ; ++histosIt) {
201  map<uint32_t,MonitorElement*>::const_iterator histoIt = (*histosIt).second.begin();
202  map<uint32_t,MonitorElement*>::const_iterator histoEnd = (*histosIt).second.end();
203  for(;histoIt != histoEnd; ++histoIt) { (*histoIt).second->Reset(); }
204  }
205 
206  // re-set mapping for not real channels in the occupancyHits per chamber
207  for(int wh=-2; wh<=2; wh++) {
208  for(int sect=1; sect<=14; sect++) {
209  for(int st=1; st<=4; st++) {
210  if( (sect == 13 || sect == 14) && st != 4 ) {continue;}
211  const DTChamberId dtChId(wh,st,sect);
212  channelsMap(dtChId, "OccupancyAllHits_perCh");
213  }
214  }
215  }
216 
217  // loop over wheel summaries
218  map<string,map<int,MonitorElement*> >::const_iterator whHistosIt = wheelHistos.begin();
219  map<string,map<int,MonitorElement*> >::const_iterator whHistosEnd = wheelHistos.end();
220  for(; whHistosIt != whHistosEnd ; ++whHistosIt) {
221  if ((*whHistosIt).first.find("Sync") == string::npos) { // FIXME skips synch noise plots
222  map<int,MonitorElement*>::const_iterator histoIt = (*whHistosIt).second.begin();
223  map<int,MonitorElement*>::const_iterator histoEnd = (*whHistosIt).second.end();
224  for(;histoIt != histoEnd; ++histoIt) { (*histoIt).second->Reset(); }
225  }
226  }
227  }
228 
229 }
void channelsMap(const DTChamberId &dtCh, std::string histoTag)
To map real channels.
Definition: DTDigiTask.cc:746
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 
143  if(doNoiseOccupancies) bookHistos(ibooker, wh,string("Occupancies"),"OccupancyNoise");
144  if(doInTimeOccupancies) bookHistos(ibooker, wh,string("Occupancies"),"OccupancyInTimeHits");
145 
147  bookHistos(ibooker, wh,string("SynchNoise"),"SyncNoiseEvents");
148  bookHistos(ibooker, wh,string("SynchNoise"),"SyncNoiseChambs");
149  }
150 
151  for(int st = 1; st <= 4; ++st) { // loop over stations
152  for(int sect = 1; sect <= 14; ++sect) { // loop over sectors
153  if((sect == 13 || sect == 14) && st != 4) continue;
154  // Get the chamber ID
155  const DTChamberId dtChId(wh,st,sect);
156 
157  // Occupancies
158  if (doAllHitsOccupancies) {
159  bookHistos(ibooker, dtChId,string("Occupancies"),"OccupancyAllHits_perCh");
160  // set channel mapping
161  channelsMap(dtChId, "OccupancyAllHits_perCh");
162  }
164  bookHistos(ibooker, dtChId,string("Occupancies"),"OccupancyNoise_perCh");
166  bookHistos(ibooker, dtChId,string("Occupancies"),"OccupancyInTimeHits_perCh");
167 
168  for(int sl = 1; sl <= 3; ++sl) { // Loop over SLs
169  if(st == 4 && sl == 2) continue;
170  const DTSuperLayerId dtSLId(wh,st,sect,sl);
171  if(isLocalRun) {
172  bookHistos(ibooker, dtSLId,string("TimeBoxes"),"TimeBox");
173  } else {
174  // TimeBoxes for different triggers
175  bookHistos(ibooker, dtSLId,string("TimeBoxes"),"TimeBoxDTonly");
176  bookHistos(ibooker, dtSLId,string("TimeBoxes"),"TimeBoxNoDT");
177  bookHistos(ibooker, dtSLId,string("TimeBoxes"),"TimeBoxDTalso");
178  }
179  }
180  }
181  }
182  }
183  }
184 }
bool doStaticBooking
Definition: DTDigiTask.h:137
void channelsMap(const DTChamberId &dtCh, std::string histoTag)
To map real channels.
Definition: DTDigiTask.cc:746
bool tpMode
Definition: DTDigiTask.h:155
bool filterSyncNoise
Definition: DTDigiTask.h:157
std::string topFolder() const
Definition: DTDigiTask.cc:732
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 746 of file DTDigiTask.cc.

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

746  {
747 
748  // n max channels
749  int nWires_max = (digiHistos[histoTag])[dtCh.rawId()] -> getNbinsX();
750 
751  // set bin content = -1 for each not real channel. For visualization purposes
752  for(int sl=1; sl<=3; sl++) {
753  for(int ly=1; ly<=4; ly++) {
754  for(int ch=1; ch<=nWires_max; ch++) {
755 
756  int dduId = -1, rosId = -1, robId = -1, tdcId = -1, channelId = -1;
757  int realCh = mapping->geometryToReadOut(dtCh.wheel(),dtCh.station(),dtCh.sector(),sl,ly,ch,dduId,rosId,robId,tdcId,channelId);
758 
759  // realCh = 0 if the channel exists, while realCh = 1 if it does not exist
760  if( realCh ) {
761 
762  int lybin = (4*sl - 4) + ly;
763  (digiHistos[histoTag])[dtCh.rawId()] -> setBinContent(ch,lybin,-1.);
764 
765  }
766 
767  }
768  }
769  }
770 
771 }
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:56
Definition: DTT0Rcd.h:9
void DTDigiTask::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup setup 
)
protectedvirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 742 of file DTDigiTask.cc.

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

Definition at line 732 of file DTDigiTask.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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

get the L1A source

Definition at line 708 of file DTDigiTask.cc.

708  {
709 
710  string l1ASource;
711  if (isLocalRun)
712  return l1ASource;
713 
714  for (std::vector<LTCDigi>::const_iterator ltc_it = ltcdigis->begin(); ltc_it != ltcdigis->end(); ltc_it++){
715  size_t otherTriggerSum=0;
716  for (size_t i = 1; i < 6; i++)
717  otherTriggerSum += size_t((*ltc_it).HasTriggered(i));
718 
719  if ((*ltc_it).HasTriggered(0) && otherTriggerSum == 0)
720  l1ASource = "DTonly";
721  else if (!(*ltc_it).HasTriggered(0))
722  l1ASource = "NoDT";
723  else if ((*ltc_it).HasTriggered(0) && otherTriggerSum > 0)
724  l1ASource = "DTalso";
725  }
726 
727  return l1ASource;
728 
729 }
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.