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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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::InputTag dtDigiLabel
 
bool filterSyncNoise
 
std::map< DTChamberId, int > hitMap
 
int inTimeHitsLowerBound
 
int inTimeHitsUpperBound
 
bool isLocalRun
 
float kFactor
 
bool lookForSyncNoise
 
edm::InputTag ltcDigiCollectionTag
 
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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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 45 of file DTDigiTask.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 50 of file DTDigiTask.cc.

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

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

Destructor.

Definition at line 108 of file DTDigiTask.cc.

References LogTrace, and nevents.

108  {
109  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "DTDigiTask: analyzed " << nevents << " events" << endl;
110 
111 }
int nevents
Definition: DTDigiTask.h:87
#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 477 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().

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file DTDigiTask.cc.

References LogTrace, and nevents.

124  {
125  LogTrace("DTDQM|DTMonitorModule|DTDigiTask") <<"[DTDigiTask]: BeginJob"<<endl;
126 
127  nevents = 0;
128 }
int nevents
Definition: DTDigiTask.h:87
#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 206 of file DTDigiTask.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 131 of file DTDigiTask.cc.

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

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

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

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

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 116 of file DTDigiTask.cc.

References LogTrace.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 809 of file DTDigiTask.cc.

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

Definition at line 799 of file DTDigiTask.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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

get the L1A source

Definition at line 775 of file DTDigiTask.cc.

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

Member Data Documentation

bool DTDigiTask::checkNoisyChannels
private

Definition at line 140 of file DTDigiTask.h.

DQMStore* DTDigiTask::dbe
private

Definition at line 108 of file DTDigiTask.h.

int DTDigiTask::defaultTmax
private

Definition at line 131 of file DTDigiTask.h.

int DTDigiTask::defaultTTrig
private

Definition at line 142 of file DTDigiTask.h.

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

Definition at line 116 of file DTDigiTask.h.

bool DTDigiTask::doAllHitsOccupancies
private

Definition at line 148 of file DTDigiTask.h.

bool DTDigiTask::doInTimeOccupancies
private

Definition at line 150 of file DTDigiTask.h.

bool DTDigiTask::doLayerTimeBoxes
private

Definition at line 156 of file DTDigiTask.h.

bool DTDigiTask::doNoiseOccupancies
private

Definition at line 149 of file DTDigiTask.h.

bool DTDigiTask::doStaticBooking
private

Definition at line 134 of file DTDigiTask.h.

edm::InputTag DTDigiTask::dtDigiLabel
private

Definition at line 122 of file DTDigiTask.h.

bool DTDigiTask::filterSyncNoise
private

Definition at line 154 of file DTDigiTask.h.

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

Definition at line 101 of file DTDigiTask.h.

int DTDigiTask::inTimeHitsLowerBound
private

Definition at line 144 of file DTDigiTask.h.

int DTDigiTask::inTimeHitsUpperBound
private

Definition at line 145 of file DTDigiTask.h.

bool DTDigiTask::isLocalRun
private

Definition at line 136 of file DTDigiTask.h.

float DTDigiTask::kFactor
private

Definition at line 96 of file DTDigiTask.h.

bool DTDigiTask::lookForSyncNoise
private

Definition at line 153 of file DTDigiTask.h.

edm::InputTag DTDigiTask::ltcDigiCollectionTag
private

Definition at line 124 of file DTDigiTask.h.

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

Definition at line 106 of file DTDigiTask.h.

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

Definition at line 111 of file DTDigiTask.h.

int DTDigiTask::maxTDCCounts
private

Definition at line 147 of file DTDigiTask.h.

int DTDigiTask::maxTDCHits
private

Definition at line 91 of file DTDigiTask.h.

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

Definition at line 110 of file DTDigiTask.h.

MonitorElement* DTDigiTask::nEventMonitor
private

Definition at line 159 of file DTDigiTask.h.

int DTDigiTask::nevents
private

Definition at line 87 of file DTDigiTask.h.

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

Definition at line 158 of file DTDigiTask.h.

bool DTDigiTask::readTTrigDB
private

Definition at line 127 of file DTDigiTask.h.

int DTDigiTask::resetCycle
private

Definition at line 138 of file DTDigiTask.h.

bool DTDigiTask::subtractT0
private

Definition at line 129 of file DTDigiTask.h.

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

Definition at line 102 of file DTDigiTask.h.

int DTDigiTask::syncNum
private

Definition at line 104 of file DTDigiTask.h.

int DTDigiTask::syncNumTot
private

Definition at line 103 of file DTDigiTask.h.

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

Definition at line 114 of file DTDigiTask.h.

int DTDigiTask::timeBoxGranularity
private

Definition at line 146 of file DTDigiTask.h.

int DTDigiTask::tMax
private

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

Definition at line 90 of file DTDigiTask.h.

bool DTDigiTask::tpMode
private

Definition at line 152 of file DTDigiTask.h.

float DTDigiTask::tTrig
private

tTrig from the DB

Definition at line 94 of file DTDigiTask.h.

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

Definition at line 113 of file DTDigiTask.h.

float DTDigiTask::tTrigRMS
private

Definition at line 95 of file DTDigiTask.h.

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

Definition at line 117 of file DTDigiTask.h.