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:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DTDigiTask (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTDigiTask ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 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
 
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 beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 To reset the MEs. More...
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 
void bookHistos (const DTSuperLayerId &dtSL, std::string folder, std::string histoTag)
 Book the ME. More...
 
void bookHistos (const DTChamberId &dtCh, std::string folder, std::string histoTag)
 
void bookHistos (const int wheelId, std::string folder, std::string histoTag)
 
void channelsMap (const DTChamberId &dtCh, std::string histoTag)
 To map real channels. More...
 
void endJob ()
 Endjob. More...
 
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
 
DQMStoredbe
 
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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 46 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, cppFunctionSkipper::operator, 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 
97 
98  syncNumTot = 0;
99  syncNum = 0;
100 
101 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int defaultTmax
Definition: DTDigiTask.h:132
bool doStaticBooking
Definition: DTDigiTask.h:135
bool tpMode
Definition: DTDigiTask.h:153
bool doLayerTimeBoxes
Definition: DTDigiTask.h:157
bool filterSyncNoise
Definition: DTDigiTask.h:155
bool readTTrigDB
Definition: DTDigiTask.h:128
bool lookForSyncNoise
Definition: DTDigiTask.h:154
int maxTDCCounts
Definition: DTDigiTask.h:148
edm::EDGetTokenT< DTDigiCollection > dtDigiToken_
Definition: DTDigiTask.h:123
bool checkNoisyChannels
Definition: DTDigiTask.h:141
bool isLocalRun
Definition: DTDigiTask.h:137
bool doInTimeOccupancies
Definition: DTDigiTask.h:151
bool doNoiseOccupancies
Definition: DTDigiTask.h:150
int resetCycle
Definition: DTDigiTask.h:139
int inTimeHitsUpperBound
Definition: DTDigiTask.h:146
DQMStore * dbe
Definition: DTDigiTask.h:109
#define LogTrace(id)
int defaultTTrig
Definition: DTDigiTask.h:143
bool doAllHitsOccupancies
Definition: DTDigiTask.h:149
int maxTDCHits
Definition: DTDigiTask.h:92
bool subtractT0
Definition: DTDigiTask.h:130
int timeBoxGranularity
Definition: DTDigiTask.h:147
int syncNumTot
Definition: DTDigiTask.h:104
int inTimeHitsLowerBound
Definition: DTDigiTask.h:145
edm::EDGetTokenT< LTCDigiCollection > ltcDigiCollectionToken_
Definition: DTDigiTask.h:125
DTDigiTask::~DTDigiTask ( )
virtual

Destructor.

Definition at line 106 of file DTDigiTask.cc.

References LogTrace, and nevents.

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

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 475 of file DTDigiTask.cc.

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

475  {
476  nevents++;
478  if (nevents%1000 == 0) {
479  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask] Analyze #Run: " << event.id().run()
480  << " #Event: " << event.id().event() << endl;
481  }
482 
483  // Get the ingredients from the event
484 
485  // Digi collection
487  event.getByToken(dtDigiToken_, dtdigis);
488 
489  // LTC digis
490  if (!isLocalRun) event.getByToken(ltcDigiCollectionToken_, ltcdigis);
491 
492  // Status map (for noisy channels)
494  if(checkNoisyChannels) {
495  // Get the map of noisy channels
496  c.get<DTStatusFlagRcd>().get(statusMap);
497  }
498 
499  string histoTag;
500 
501 
502  // Check if the digi container is empty
503  if(dtdigis->begin() == dtdigis->end()) {
504  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "Event " << nevents << " empty." << endl;
505  }
506 
507  if (lookForSyncNoise || filterSyncNoise) { // dosync
508  // Count the # of digis per chamber
510  for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); dtLayerId_It++) {
511  DTChamberId chId = ((*dtLayerId_It).first).chamberId();
512  if(hitMap.find(chId) == hitMap.end()) {// new chamber
513  hitMap[chId] = 0;
514  }
515  hitMap[chId] += (((*dtLayerId_It).second).second - ((*dtLayerId_It).second).first);
516  }
517 
518 
519 
520  // check chamber with # of digis above threshold and flag them as noisy
521  map<DTChamberId,int>::const_iterator hitMapIt = hitMap.begin();
522  map<DTChamberId,int>::const_iterator hitMapEnd = hitMap.end();
523 
524  map<int,int> chMap;
525 
526  for (; hitMapIt != hitMapEnd; ++hitMapIt) {
527  if((hitMapIt->second) > maxTDCHits) {
528 
529  DTChamberId chId = hitMapIt->first;
530  int wh = chId.wheel();
531 
532  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask] Synch noise in chamber: " << chId
533  << " with # digis: " << hitMapIt->second << endl;
534 
535  if(chMap.find(wh) == chMap.end()) { chMap[wh] = 0; }
536  chMap[wh]++ ;
537 
538  syncNoisyChambers.insert(chId);
539 
540  wheelHistos["SyncNoiseEvents"][wh]->Fill(chId.sector(),chId.station());
541 
542  // Only needed in case of ratio map not used right now
543  // FIXME check and optimize
544  // nSynchNoiseEvents[iter->first]++;
545  // FIXME: should update all chambers each event
546  // wheelHistos["SyncNoiseEvents"][(*iter).first.wheel()]->setBinContent((*iter).first.sector(),(*iter).first.station(),
547  // (double)nSynchNoiseEvents[iter->first]/(double)nevents);
548 
549  }
550  }
551 
552  // fill # of noisy ch per wheel plot
553  map<int,int>::const_iterator chMapIt = chMap.begin();
554  map<int,int>::const_iterator chMapEnd = chMap.end();
555  for (; chMapIt != chMapEnd; ++chMapIt) {
556  wheelHistos["SyncNoiseChambs"][(*chMapIt).first]->Fill((*chMapIt).second);
557  }
558 
559  // clear the map of # of digis per chamber: not needed anymore
560  hitMap.clear();
561 
562  if (syncNoisyChambers.size() != 0) {
563  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask] Synch Noise in event: " << nevents;
564  if(filterSyncNoise) LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask") << "\tnoisy time-boxes and occupancy will not be filled!" << endl;
565  syncNumTot++;
566  syncNum++;
567  }
568 
569  // Logging of "large" synch Noisy events in private DQM
570  if (syncNoisyChambers.size() > 3) {
571  time_t eventTime = time_t(event.time().value()>>32);
572 
573  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise")
574  << "[DTDigiTask] At least 4 Synch Noisy chambers in Run : " << event.id().run()
575  << " Lumi : " << event.id().luminosityBlock()
576  << " Event : " << event.id().event()
577  << " at time : " << ctime(&eventTime) << endl;
578 
579  set<DTChamberId>::const_iterator chIt = syncNoisyChambers.begin();
580  set<DTChamberId>::const_iterator chEnd = syncNoisyChambers.end();
581 
582  stringstream synchNoisyCh;
583  for (;chIt!=chEnd;++chIt) { synchNoisyCh << " " << (*chIt); }
584  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise") <<
585  "[DTDigiTask] Chamber List :" << synchNoisyCh.str() << endl;
586 
587  }
588 
589 
590  if (nevents%1000 == 0) {
591  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask") << (syncNumTot*100./nevents) << "% sync noise events since the beginning \n"
592  << (syncNum*0.1) << "% sync noise events in the last 1000 events " << endl;
593  syncNum = 0;
594  }
595  }
596 
597  bool isSyncNoisy = false;
598 
600  for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It) { // Loop over layers
601  isSyncNoisy = false;
602  // check if chamber labeled as synch noisy
603  if (filterSyncNoise) {
604  DTChamberId chId = ((*dtLayerId_It).first).chamberId();
605  if(syncNoisyChambers.find(chId) != syncNoisyChambers.end()) {
606  isSyncNoisy = true;
607  }
608  }
609 
610  for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
611  digiIt!=((*dtLayerId_It).second).second; ++digiIt) { // Loop over all digis
612 
613  bool isNoisy = false;
614  bool isFEMasked = false;
615  bool isTDCMasked = false;
616  bool isTrigMask = false;
617  bool isDead = false;
618  bool isNohv = false;
619  if(checkNoisyChannels) {
620  const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire());
621  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
622  }
623 
624 
625 
626  // Get the useful IDs
627  const DTSuperLayerId dtSLId = ((*dtLayerId_It).first).superlayerId();
628  uint32_t indexSL = dtSLId.rawId();
629  const DTChamberId dtChId = dtSLId.chamberId();
630  uint32_t indexCh = dtChId.rawId();
631  int layer_number=((*dtLayerId_It).first).layer();
632  int superlayer_number=dtSLId.superlayer();
633 
634  // Read the ttrig DB or set a rough value from config
635  // ttrig and rms are TDC counts
636  if (readTTrigDB)
637  tTrigMap->get( ((*dtLayerId_It).first).superlayerId(),
639  else tTrig = defaultTTrig;
640 
641  int inTimeHitsLowerBoundCorr = int(round(tTrig)) - inTimeHitsLowerBound;
642  int inTimeHitsUpperBoundCorr = int(round(tTrig)) + tMax + inTimeHitsUpperBound;
643 
644  float t0; float t0RMS;
645  int tdcTime = (*digiIt).countsTDC();
646 
647  if (subtractT0) {
648  const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire());
649  // t0s and rms are TDC counts
650  t0Map->get(dtWireId, t0, t0RMS, DTTimeUnits::counts) ;
651  tdcTime += int(round(t0));
652  }
653 
654 
655 
656  // Fill Time-Boxes
657  // NOTE: avoid to fill TB and PhotoPeak with noise. Occupancy are filled anyway
658  if (( !isNoisy ) && (!isSyncNoisy)) { // Discard noisy channels
659  // TimeBoxes per SL
660  histoTag = "TimeBox" + triggerSource();
661  if (digiHistos[histoTag].find(indexSL) == digiHistos[histoTag].end())
662  bookHistos( dtSLId, string("TimeBoxes"), histoTag );
663  (digiHistos.find(histoTag)->second).find(indexSL)->second->Fill(tdcTime);
664  if(doLayerTimeBoxes)
665  (digiHistos.find(histoTag)->second).find((*dtLayerId_It).first.rawId())->second->Fill(tdcTime);
666  // FIXME: remove the time distribution for the after-pulses
667  // 2nd - 1st (CathodPhotoPeak) per SL
668  // if ( (*digiIt).number() == 1 ) {
669 
670  // DTDigiCollection::const_iterator firstDigiIt = digiIt;
671  // firstDigiIt--;
672 
673  // histoTag = "CathodPhotoPeak";
674  // if (digiHistos[histoTag].find(indexSL) == digiHistos[histoTag].end())
675  // bookHistos( dtSLId, string("CathodPhotoPeaks"), histoTag );
676  // (digiHistos.find(histoTag)->second).find(indexSL)->second->Fill((*digiIt).countsTDC()-
677  // (*firstDigiIt).countsTDC());
678  // }
679  }
680 
681  // Fill Occupancies
682  if (!isSyncNoisy) { // Discard synch noisy channels
683 
684  if (doAllHitsOccupancies) { // fill occupancies for all hits
685  //Occupancies per chamber & layer
686  histoTag = "OccupancyAllHits_perCh";
687  map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
688  digiHistos[histoTag].find(indexCh);
689  if (mappedHisto == digiHistos[histoTag].end()) { // dynamic booking
690  bookHistos(dtChId, string("Occupancies"), histoTag);
691  mappedHisto = digiHistos[histoTag].find(indexCh);
692  }
693  mappedHisto->second->Fill((*digiIt).wire(),(layer_number+(superlayer_number-1)*4)-1);
694 
695 
696  // Fill the chamber occupancy
697  histoTag = "OccupancyAllHits";
698  map<int, MonitorElement*>::const_iterator histoPerWheel =
699  wheelHistos[histoTag].find(dtChId.wheel());
700  if(histoPerWheel == wheelHistos[histoTag].end()) { // dynamic booking
701  bookHistos(dtChId.wheel(), string("Occupancies"), histoTag);
702  histoPerWheel = wheelHistos[histoTag].find(dtChId.wheel());
703  }
704  histoPerWheel->second->Fill(dtChId.sector(),dtChId.station()); // FIXME: normalize to # of layers
705 
706 
707  }
708 
709  if(doNoiseOccupancies) { // fill occupancies for hits before the ttrig
710  if (tdcTime < inTimeHitsLowerBoundCorr ) {
711  // FIXME: what about tdcTime > inTimeHitsUpperBoundCorr ???
712 
713  // Noise: Before tTrig
714  //Occupancies Noise per chamber & layer
715  histoTag = "OccupancyNoise_perCh";
716  map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
717  digiHistos[histoTag].find(indexCh);
718  if(mappedHisto == digiHistos[histoTag].end()) {
719  bookHistos(dtChId, string("Occupancies"), histoTag);
720  mappedHisto = digiHistos[histoTag].find(indexCh);
721  }
722  mappedHisto->second->Fill((*digiIt).wire(),
723  (layer_number+(superlayer_number-1)*4)-1);
724 
725  // Fill the chamber occupancy
726  histoTag = "OccupancyNoise";
727  map<int, MonitorElement*>::const_iterator histoPerWheel =
728  wheelHistos[histoTag].find(dtChId.wheel());
729  if(histoPerWheel == wheelHistos[histoTag].end()) { // dynamic booking
730  bookHistos(dtChId.wheel(), string("Occupancies"), histoTag);
731  histoPerWheel = wheelHistos[histoTag].find(dtChId.wheel());
732  }
733  histoPerWheel->second->Fill(dtChId.sector(),dtChId.station()); // FIXME: normalize to # of layers
734 
735  }
736  }
737 
738  if(doInTimeOccupancies) { // fill occpunacies for in-time hits only
739  if (tdcTime > inTimeHitsLowerBoundCorr && tdcTime < inTimeHitsUpperBoundCorr) {
740  // Physical hits: within the time window
741 
742  //Occupancies Signal per chamber & layer
743  histoTag = "OccupancyInTimeHits_perCh";
744  map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
745  digiHistos[histoTag].find(indexCh);
746  if(mappedHisto == digiHistos[histoTag].end()) {
747  bookHistos(dtChId, string("Occupancies"), histoTag);
748  mappedHisto = digiHistos[histoTag].find(indexCh);
749  }
750  mappedHisto->second->Fill((*digiIt).wire(),
751  (layer_number+(superlayer_number-1)*4)-1);
752 
753  // Fill the chamber occupancy
754  histoTag = "OccupancyInTimeHits";
755  map<int, MonitorElement*>::const_iterator histoPerWheel =
756  wheelHistos[histoTag].find(dtChId.wheel());
757  if(histoPerWheel == wheelHistos[histoTag].end()) { // dynamic booking
758  bookHistos(dtChId.wheel(), string("Occupancies"), histoTag);
759  histoPerWheel = wheelHistos[histoTag].find(dtChId.wheel());
760  }
761  histoPerWheel->second->Fill(dtChId.sector(),dtChId.station()); // FIXME: normalize to # of layers
762 
763  }
764  }
765  }
766  }
767  }
768 
769  syncNoisyChambers.clear();
770 }
bool doLayerTimeBoxes
Definition: DTDigiTask.h:157
bool filterSyncNoise
Definition: DTDigiTask.h:155
DTChamberId chamberId() const
Return the corresponding ChamberId.
bool readTTrigDB
Definition: DTDigiTask.h:128
bool lookForSyncNoise
Definition: DTDigiTask.h:154
float kFactor
Definition: DTDigiTask.h:97
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:114
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:123
void bookHistos(const DTSuperLayerId &dtSL, std::string folder, std::string histoTag)
Book the ME.
bool checkNoisyChannels
Definition: DTDigiTask.h:141
bool isLocalRun
Definition: DTDigiTask.h:137
edm::ESHandle< DTT0 > t0Map
Definition: DTDigiTask.h:115
bool doInTimeOccupancies
Definition: DTDigiTask.h:151
bool doNoiseOccupancies
Definition: DTDigiTask.h:150
std::map< std::string, std::map< int, MonitorElement * > > wheelHistos
Definition: DTDigiTask.h:118
int nevents
Definition: DTDigiTask.h:88
#define end
Definition: vmac.h:37
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:146
#define LogTrace(id)
int defaultTTrig
Definition: DTDigiTask.h:143
float tTrig
tTrig from the DB
Definition: DTDigiTask.h:95
int tMax
no needs to be precise. Value from PSets will always be used
Definition: DTDigiTask.h:91
int superlayer() const
Return the superlayer number (deprecated method name)
bool doAllHitsOccupancies
Definition: DTDigiTask.h:149
int maxTDCHits
Definition: DTDigiTask.h:92
bool subtractT0
Definition: DTDigiTask.h:130
const T & get() const
Definition: EventSetup.h:55
std::vector< DTDigi >::const_iterator const_iterator
std::set< DTChamberId > syncNoisyChambers
Definition: DTDigiTask.h:103
int syncNumTot
Definition: DTDigiTask.h:104
MonitorElement * nEventMonitor
Definition: DTDigiTask.h:160
int inTimeHitsLowerBound
Definition: DTDigiTask.h:145
float tTrigRMS
Definition: DTDigiTask.h:96
int sector() const
Definition: DTChamberId.h:61
std::map< DTChamberId, int > hitMap
Definition: DTDigiTask.h:102
int station() const
Return the station number.
Definition: DTChamberId.h:51
std::map< std::string, std::map< uint32_t, MonitorElement * > > digiHistos
Definition: DTDigiTask.h:117
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
std::string triggerSource()
get the L1A source
Definition: DTDigiTask.cc:773
edm::Handle< LTCDigiCollection > ltcdigis
Definition: DTDigiTask.h:107
edm::EDGetTokenT< LTCDigiCollection > ltcDigiCollectionToken_
Definition: DTDigiTask.h:125
void DTDigiTask::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file DTDigiTask.cc.

References LogTrace, and nevents.

122  {
123  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") <<"[DTDigiTask]: BeginJob"<<endl;
124 
125  nevents = 0;
126 }
int nevents
Definition: DTDigiTask.h:88
#define LogTrace(id)
void DTDigiTask::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

To reset the MEs.

Reimplemented from edm::EDAnalyzer.

Definition at line 204 of file DTDigiTask.cc.

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

204  {
205 
206  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask]: Begin of LS transition" << endl;
207 
208  // Reset the MonitorElements every n (= ResetCycle) Lumi Blocks
209  int lumiBlock = lumiSeg.id().luminosityBlock();
210  if(lumiBlock % resetCycle == 0) {
211  LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask")
212  <<"[DTDigiTask]: Reset at the LS transition : "
213  << lumiBlock << endl;
214  // Loop over all ME
215  map<string,map<uint32_t,MonitorElement*> >::const_iterator histosIt = digiHistos.begin();
216  map<string,map<uint32_t,MonitorElement*> >::const_iterator histosEnd = digiHistos.end();
217  for(;histosIt != histosEnd ; ++histosIt) {
218  map<uint32_t,MonitorElement*>::const_iterator histoIt = (*histosIt).second.begin();
219  map<uint32_t,MonitorElement*>::const_iterator histoEnd = (*histosIt).second.end();
220  for(;histoIt != histoEnd; ++histoIt) { (*histoIt).second->Reset(); }
221  }
222 
223  // re-set mapping for not real channels in the occupancyHits per chamber
224  for(int wh=-2; wh<=2; wh++) {
225  for(int sect=1; sect<=14; sect++) {
226  for(int st=1; st<=4; st++) {
227  if( (sect == 13 || sect == 14) && st != 4 ) {continue;}
228  const DTChamberId dtChId(wh,st,sect);
229  channelsMap(dtChId, "OccupancyAllHits_perCh");
230  }
231  }
232  }
233 
234  // loop over wheel summaries
235  map<string,map<int,MonitorElement*> >::const_iterator whHistosIt = wheelHistos.begin();
236  map<string,map<int,MonitorElement*> >::const_iterator whHistosEnd = wheelHistos.end();
237  for(; whHistosIt != whHistosEnd ; ++whHistosIt) {
238  if ((*whHistosIt).first.find("Sync") == string::npos) { // FIXME skips synch noise plots
239  map<int,MonitorElement*>::const_iterator histoIt = (*whHistosIt).second.begin();
240  map<int,MonitorElement*>::const_iterator histoEnd = (*whHistosIt).second.end();
241  for(;histoIt != histoEnd; ++histoIt) { (*histoIt).second->Reset(); }
242  }
243  }
244  }
245 
246 }
void channelsMap(const DTChamberId &dtCh, std::string histoTag)
To map real channels.
Definition: DTDigiTask.cc:823
std::map< std::string, std::map< int, MonitorElement * > > wheelHistos
Definition: DTDigiTask.h:118
int resetCycle
Definition: DTDigiTask.h:139
#define LogTrace(id)
std::map< std::string, std::map< uint32_t, MonitorElement * > > digiHistos
Definition: DTDigiTask.h:117
void DTDigiTask::beginRun ( const edm::Run run,
const edm::EventSetup context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 129 of file DTDigiTask.cc.

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

129  {
130  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask]: begin run" << endl;
131 
132  // Get the geometry
133  context.get<MuonGeometryRecord>().get(muonGeom);
134 
135  // map of the channels
136  context.get<DTReadOutMappingRcd>().get(mapping);
137 
138  // tTrig
139  if (readTTrigDB)
140  context.get<DTTtrigRcd>().get(tTrigMap);
141  // t0s
142  if (subtractT0)
143  context.get<DTT0Rcd>().get(t0Map);
144  // FIXME: tMax (not yet from the DB)
145  tMax = defaultTmax;
146 
147  // ----------------------------------------------------------------------
148  if(doStaticBooking) { // Static histo booking
149  // book the event counter
150  dbe->setCurrentFolder("DT/EventInfo/Counters");
151  nEventMonitor = dbe->bookFloat(tpMode ? "nProcessedEventsDigiTP" : "nProcessedEventsDigi" );
153  for(int wh = -2; wh <= 2; ++wh) { // loop over wheels
154  if(doAllHitsOccupancies) bookHistos(wh,string("Occupancies"),"OccupancyAllHits");
155  if(doNoiseOccupancies) bookHistos(wh,string("Occupancies"),"OccupancyNoiseHits");
156  if(doInTimeOccupancies) bookHistos(wh,string("Occupancies"),"OccupancyInTimeHits");
157 
159  bookHistos(wh,string("SynchNoise"),"SyncNoiseEvents");
160  bookHistos(wh,string("SynchNoise"),"SyncNoiseChambs");
161  }
162 
163  for(int st = 1; st <= 4; ++st) { // loop over stations
164  for(int sect = 1; sect <= 14; ++sect) { // loop over sectors
165  if((sect == 13 || sect == 14) && st != 4) continue;
166  // Get the chamber ID
167  const DTChamberId dtChId(wh,st,sect);
168 
169  // Occupancies
170  if (doAllHitsOccupancies) {
171  bookHistos(dtChId,string("Occupancies"),"OccupancyAllHits_perCh");
172  // set channel mapping
173  channelsMap(dtChId, "OccupancyAllHits_perCh");
174  }
176  bookHistos(dtChId,string("Occupancies"),"OccupancyNoise_perCh");
178  bookHistos(dtChId,string("Occupancies"),"OccupancyInTimeHits_perCh");
179 
180 
181 
182 
183  for(int sl = 1; sl <= 3; ++sl) { // Loop over SLs
184  if(st == 4 && sl == 2) continue;
185  const DTSuperLayerId dtSLId(wh,st,sect,sl);
186  if(isLocalRun) {
187  bookHistos(dtSLId,string("TimeBoxes"),"TimeBox");
188  } else {
189  // TimeBoxes for different triggers
190  bookHistos(dtSLId,string("TimeBoxes"),"TimeBoxDTonly");
191  bookHistos(dtSLId,string("TimeBoxes"),"TimeBoxNoDT");
192  bookHistos(dtSLId,string("TimeBoxes"),"TimeBoxDTalso");
193  }
194  }
195  }
196  }
197  }
198  }
199 }
int defaultTmax
Definition: DTDigiTask.h:132
bool doStaticBooking
Definition: DTDigiTask.h:135
void channelsMap(const DTChamberId &dtCh, std::string histoTag)
To map real channels.
Definition: DTDigiTask.cc:823
bool tpMode
Definition: DTDigiTask.h:153
bool filterSyncNoise
Definition: DTDigiTask.h:155
std::string topFolder() const
Definition: DTDigiTask.cc:797
bool readTTrigDB
Definition: DTDigiTask.h:128
edm::ESHandle< DTReadOutMapping > mapping
Definition: DTDigiTask.h:112
bool lookForSyncNoise
Definition: DTDigiTask.h:154
edm::ESHandle< DTTtrig > tTrigMap
Definition: DTDigiTask.h:114
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:891
void bookHistos(const DTSuperLayerId &dtSL, std::string folder, std::string histoTag)
Book the ME.
bool isLocalRun
Definition: DTDigiTask.h:137
edm::ESHandle< DTT0 > t0Map
Definition: DTDigiTask.h:115
bool doInTimeOccupancies
Definition: DTDigiTask.h:151
bool doNoiseOccupancies
Definition: DTDigiTask.h:150
edm::ESHandle< DTGeometry > muonGeom
Definition: DTDigiTask.h:111
DQMStore * dbe
Definition: DTDigiTask.h:109
#define LogTrace(id)
int tMax
no needs to be precise. Value from PSets will always be used
Definition: DTDigiTask.h:91
bool doAllHitsOccupancies
Definition: DTDigiTask.h:149
bool subtractT0
Definition: DTDigiTask.h:130
const T & get() const
Definition: EventSetup.h:55
Definition: DTT0Rcd.h:9
MonitorElement * nEventMonitor
Definition: DTDigiTask.h:160
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void DTDigiTask::bookHistos ( const DTSuperLayerId dtSL,
std::string  folder,
std::string  histoTag 
)
protected

Book the ME.

void DTDigiTask::bookHistos ( const DTChamberId dtCh,
std::string  folder,
std::string  histoTag 
)
protected
void DTDigiTask::bookHistos ( 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 823 of file DTDigiTask.cc.

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

823  {
824 
825  // n max channels
826  int nWires_max = (digiHistos[histoTag])[dtCh.rawId()] -> getNbinsX();
827 
828  // set bin content = -1 for each not real channel. For visualization purposes
829  for(int sl=1; sl<=3; sl++) {
830  for(int ly=1; ly<=4; ly++) {
831  for(int ch=1; ch<=nWires_max; ch++) {
832 
833  int dduId = -1, rosId = -1, robId = -1, tdcId = -1, channelId = -1;
834  int realCh = mapping->geometryToReadOut(dtCh.wheel(),dtCh.station(),dtCh.sector(),sl,ly,ch,dduId,rosId,robId,tdcId,channelId);
835 
836  // realCh = 0 if the channel exists, while realCh = 1 if it does not exist
837  if( realCh ) {
838 
839  int lybin = (4*sl - 4) + ly;
840  (digiHistos[histoTag])[dtCh.rawId()] -> setBinContent(ch,lybin,-1.);
841 
842  }
843 
844  }
845  }
846  }
847 
848 }
edm::ESHandle< DTReadOutMapping > mapping
Definition: DTDigiTask.h:112
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:117
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
void DTDigiTask::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 114 of file DTDigiTask.cc.

References LogTrace.

114  {
115  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") <<"[DTDigiTask] endjob called!"<<endl;
116 
117 }
#define LogTrace(id)
void DTDigiTask::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup setup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 807 of file DTDigiTask.cc.

807  {
808 
809  // To be used for ratio plots not used right now
810  // Update all histos for SynchNoise if needed
811  // if(lookForSyncNoise || filterSyncNoise) {
812  // //loop over chambers with synch noise events and update their entries in the histos
813  // for(map<DTChamberId, int>::const_iterator nEvPerch = nSynchNoiseEvents.begin();
814  // nEvPerch != nSynchNoiseEvents.end(); ++nEvPerch) {
815  // DTChamberId chId = (*nEvPerch).first;
816  // wheelHistos["SyncNoiseEvents"][chId.wheel()]->setBinContent(chId.sector(),chId.station(),
817  // (double)nSynchNoiseEvents[chId]/(double)nevents);
818  // }
819  // }
820 
821 }
string DTDigiTask::topFolder ( ) const
private

Definition at line 797 of file DTDigiTask.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

797  {
798 
799  if(tpMode) return string("DT/10-TestPulses/");
800  return string("DT/01-Digi/");
801 
802 }
bool tpMode
Definition: DTDigiTask.h:153
string DTDigiTask::triggerSource ( )
protected

get the L1A source

Definition at line 773 of file DTDigiTask.cc.

773  {
774 
775  string l1ASource;
776  if (isLocalRun)
777  return l1ASource;
778 
779  for (std::vector<LTCDigi>::const_iterator ltc_it = ltcdigis->begin(); ltc_it != ltcdigis->end(); ltc_it++){
780  size_t otherTriggerSum=0;
781  for (size_t i = 1; i < 6; i++)
782  otherTriggerSum += size_t((*ltc_it).HasTriggered(i));
783 
784  if ((*ltc_it).HasTriggered(0) && otherTriggerSum == 0)
785  l1ASource = "DTonly";
786  else if (!(*ltc_it).HasTriggered(0))
787  l1ASource = "NoDT";
788  else if ((*ltc_it).HasTriggered(0) && otherTriggerSum > 0)
789  l1ASource = "DTalso";
790  }
791 
792  return l1ASource;
793 
794 }
int i
Definition: DBlmapReader.cc:9
bool isLocalRun
Definition: DTDigiTask.h:137
edm::Handle< LTCDigiCollection > ltcdigis
Definition: DTDigiTask.h:107

Member Data Documentation

bool DTDigiTask::checkNoisyChannels
private

Definition at line 141 of file DTDigiTask.h.

DQMStore* DTDigiTask::dbe
private

Definition at line 109 of file DTDigiTask.h.

int DTDigiTask::defaultTmax
private

Definition at line 132 of file DTDigiTask.h.

int DTDigiTask::defaultTTrig
private

Definition at line 143 of file DTDigiTask.h.

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

Definition at line 117 of file DTDigiTask.h.

bool DTDigiTask::doAllHitsOccupancies
private

Definition at line 149 of file DTDigiTask.h.

bool DTDigiTask::doInTimeOccupancies
private

Definition at line 151 of file DTDigiTask.h.

bool DTDigiTask::doLayerTimeBoxes
private

Definition at line 157 of file DTDigiTask.h.

bool DTDigiTask::doNoiseOccupancies
private

Definition at line 150 of file DTDigiTask.h.

bool DTDigiTask::doStaticBooking
private

Definition at line 135 of file DTDigiTask.h.

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

Definition at line 123 of file DTDigiTask.h.

bool DTDigiTask::filterSyncNoise
private

Definition at line 155 of file DTDigiTask.h.

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

Definition at line 102 of file DTDigiTask.h.

int DTDigiTask::inTimeHitsLowerBound
private

Definition at line 145 of file DTDigiTask.h.

int DTDigiTask::inTimeHitsUpperBound
private

Definition at line 146 of file DTDigiTask.h.

bool DTDigiTask::isLocalRun
private

Definition at line 137 of file DTDigiTask.h.

float DTDigiTask::kFactor
private

Definition at line 97 of file DTDigiTask.h.

bool DTDigiTask::lookForSyncNoise
private

Definition at line 154 of file DTDigiTask.h.

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

Definition at line 125 of file DTDigiTask.h.

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

Definition at line 107 of file DTDigiTask.h.

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

Definition at line 112 of file DTDigiTask.h.

int DTDigiTask::maxTDCCounts
private

Definition at line 148 of file DTDigiTask.h.

int DTDigiTask::maxTDCHits
private

Definition at line 92 of file DTDigiTask.h.

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

Definition at line 111 of file DTDigiTask.h.

MonitorElement* DTDigiTask::nEventMonitor
private

Definition at line 160 of file DTDigiTask.h.

int DTDigiTask::nevents
private

Definition at line 88 of file DTDigiTask.h.

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

Definition at line 159 of file DTDigiTask.h.

bool DTDigiTask::readTTrigDB
private

Definition at line 128 of file DTDigiTask.h.

int DTDigiTask::resetCycle
private

Definition at line 139 of file DTDigiTask.h.

bool DTDigiTask::subtractT0
private

Definition at line 130 of file DTDigiTask.h.

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

Definition at line 103 of file DTDigiTask.h.

int DTDigiTask::syncNum
private

Definition at line 105 of file DTDigiTask.h.

int DTDigiTask::syncNumTot
private

Definition at line 104 of file DTDigiTask.h.

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

Definition at line 115 of file DTDigiTask.h.

int DTDigiTask::timeBoxGranularity
private

Definition at line 147 of file DTDigiTask.h.

int DTDigiTask::tMax
private

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

Definition at line 91 of file DTDigiTask.h.

bool DTDigiTask::tpMode
private

Definition at line 153 of file DTDigiTask.h.

float DTDigiTask::tTrig
private

tTrig from the DB

Definition at line 95 of file DTDigiTask.h.

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

Definition at line 114 of file DTDigiTask.h.

float DTDigiTask::tTrigRMS
private

Definition at line 96 of file DTDigiTask.h.

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

Definition at line 118 of file DTDigiTask.h.