43 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask]: Constructor" << endl;
101 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"DTDigiTask: analyzed " <<
nevents <<
" events" << endl;
105 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask]: begin run" << endl;
132 for (
int wh = -2; wh <= 2; ++wh) {
137 bookHistos(ibooker, wh,
string(
"Occupancies"),
"OccupancyAllHits");
140 bookHistos(ibooker, wh,
string(
"Occupancies"),
"OccupancyNoise");
142 bookHistos(ibooker, wh,
string(
"Occupancies"),
"OccupancyInTimeHits");
145 bookHistos(ibooker, wh,
string(
"SynchNoise"),
"SyncNoiseEvents");
146 bookHistos(ibooker, wh,
string(
"SynchNoise"),
"SyncNoiseChambs");
149 for (
int st = 1; st <= 4; ++st) {
150 for (
int sect = 1; sect <= 14; ++sect) {
151 if ((sect == 13 || sect == 14) && st != 4)
162 bookHistos(ibooker, dtChId,
string(
"Occupancies"),
"OccupancyAllHits_perCh");
167 bookHistos(ibooker, dtChId,
string(
"Occupancies"),
"OccupancyNoise_perCh");
169 bookHistos(ibooker, dtChId,
string(
"Occupancies"),
"OccupancyInTimeHits_perCh");
171 for (
int sl = 1; sl <= 3; ++sl) {
172 if (st == 4 && sl == 2)
176 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBox");
179 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBoxDTonly");
180 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBoxNoDT");
181 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBoxDTalso");
191 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask]: Begin of LS transition" << endl;
197 <<
"[DTDigiTask]: Reset at the LS transition : " << lumiBlock << endl;
199 map<string, map<uint32_t, MonitorElement*> >::const_iterator histosIt =
digiHistos.begin();
200 map<string, map<uint32_t, MonitorElement*> >::const_iterator histosEnd =
digiHistos.end();
201 for (; histosIt != histosEnd; ++histosIt) {
202 map<uint32_t, MonitorElement*>::const_iterator histoIt = (*histosIt).second.begin();
203 map<uint32_t, MonitorElement*>::const_iterator histoEnd = (*histosIt).second.end();
204 for (; histoIt != histoEnd; ++histoIt) {
205 (*histoIt).second->Reset();
210 for (
int wh = -2; wh <= 2; wh++) {
211 for (
int sect = 1; sect <= 14; sect++) {
212 for (
int st = 1; st <= 4; st++) {
216 if ((sect == 13 || sect == 14) && st != 4) {
226 map<string, map<int, MonitorElement*> >::const_iterator whHistosIt =
wheelHistos.begin();
227 map<string, map<int, MonitorElement*> >::const_iterator whHistosEnd =
wheelHistos.end();
228 for (; whHistosIt != whHistosEnd; ++whHistosIt) {
229 if ((*whHistosIt).first.find(
"Sync") == string::npos) {
230 map<int, MonitorElement*>::const_iterator histoIt = (*whHistosIt).second.begin();
231 map<int, MonitorElement*>::const_iterator histoEnd = (*whHistosIt).second.end();
232 for (; histoIt != histoEnd; ++histoIt) {
233 (*histoIt).second->Reset();
243 wheel << dtSL.
wheel();
248 stringstream superLayer;
254 histoTag +
"_W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
"_SL" + superLayer.str();
256 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
257 <<
"[DTDigiTask]: booking SL histo:" << histoName <<
" (tag: " << histoTag <<
") folder: "
258 <<
topFolder() +
"Wheel" + wheel.str() +
"/Station" + station.str() +
"/Sector" + sector.str() +
"/" + folder
267 if (folder ==
"TimeBoxes") {
268 string histoTitle = histoName +
" (TDC Counts)";
276 stringstream layerHistoName;
277 layerHistoName << histoName <<
"_L" <<
layer;
278 (
digiHistos[histoTag])[layerId.rawId()] = ibooker.
book1D(layerHistoName.str(),
279 layerHistoName.str(),
292 stringstream layerHistoName;
293 layerHistoName << histoName <<
"_L" <<
layer;
301 if (folder ==
"CathodPhotoPeaks") {
303 station.str() +
"/" +
folder);
311 wheel << dtCh.
wheel();
319 string histoName = histoTag +
"_W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str();
321 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
322 <<
"[DTDigiTask]: booking chamber histo:"
323 <<
" (tag: " << histoTag
324 <<
") folder: " <<
topFolder() +
"Wheel" + wheel.str() +
"/Station" + station.str() +
"/Sector" + sector.str()
327 if (folder ==
"Occupancies") {
329 const std::vector<const DTSuperLayer*>& dtSupLylist = dtchamber->
superLayers();
330 std::vector<const DTSuperLayer*>::const_iterator suly = dtSupLylist.begin();
331 std::vector<const DTSuperLayer*>::const_iterator sulyend = dtSupLylist.end();
337 while (suly != sulyend) {
338 const std::vector<const DTLayer*> dtLyList = (*suly)->layers();
339 std::vector<const DTLayer*>::const_iterator ly = dtLyList.begin();
340 std::vector<const DTLayer*>::const_iterator lyend = dtLyList.end();
341 stringstream superLayer;
342 superLayer << (*suly)->id().superlayer();
344 while (ly != lyend) {
345 nWires =
muonGeom->
layer((*ly)->id())->specificTopology().channels();
346 firstWire =
muonGeom->
layer((*ly)->id())->specificTopology().firstChannel();
348 layer << (*ly)->id().layer();
349 string histoName_layer = histoName +
"_SL" + superLayer.str() +
"_L" + layer.str();
350 if (histoTag ==
"OccupancyAllHits_perL" || histoTag ==
"OccupancyNoise_perL" ||
351 histoTag ==
"OccupancyInTimeHits_perL")
353 ibooker.
book1D(histoName_layer, histoName_layer, nWires, firstWire, nWires + firstWire);
355 if ((nWires + firstWire) > nWires_max)
356 nWires_max = (nWires + firstWire);
361 if (histoTag !=
"OccupancyAllHits_perL" && histoTag !=
"OccupancyNoise_perL" &&
362 histoTag !=
"OccupancyInTimeHits_perL") {
364 string histoTitle = histoName;
365 if (!
readTTrigDB && histoTag ==
"OccupancyInTimeHits_perCh") {
369 title <<
"Occ. digis in time [" << inTimeHitsLowerBoundCorr <<
", " << inTimeHitsUpperBoundCorr
371 histoTitle = title.str();
374 ibooker.
book2D(histoName, histoTitle, nWires_max, 1, nWires_max + 1, 12, 0, 12);
376 for (
int i = 1;
i <= 12;
i++) {
382 string label =
"SL1: L" + layer_name;
384 }
else if (i > 4 && i < 9) {
389 string label =
"SL2: L" + layer_name;
391 }
else if (i > 8 && i < 13) {
396 string label =
"SL3: L" + layer_name;
410 string histoName = histoTag +
"_W" + wheel.str();
412 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
413 <<
"[DTDigiTask]: booking wheel histo:" << histoName <<
" (tag: " << histoTag
414 <<
") folder: " <<
topFolder() +
"Wheel" + wheel.str() +
"/" << endl;
416 if (folder ==
"Occupancies") {
418 string histoTitle =
"# of digis per chamber WHEEL: " + wheel.str();
419 (
wheelHistos[histoTag])[wheelId] = ibooker.
book2D(histoName, histoTitle, 12, 1, 13, 4, 1, 5);
420 (
wheelHistos[histoTag])[wheelId]->setBinLabel(1,
"MB1", 2);
421 (
wheelHistos[histoTag])[wheelId]->setBinLabel(2,
"MB2", 2);
422 (
wheelHistos[histoTag])[wheelId]->setBinLabel(3,
"MB3", 2);
423 (
wheelHistos[histoTag])[wheelId]->setBinLabel(4,
"MB4", 2);
424 (
wheelHistos[histoTag])[wheelId]->setAxisTitle(
"sector", 1);
425 }
else if (folder ==
"SynchNoise") {
427 if (histoTag ==
"SyncNoiseEvents") {
428 string histoTitle =
"# of Syncronous-noise events WHEEL: " + wheel.str();
429 (
wheelHistos[histoTag])[wheelId] = ibooker.
book2D(histoName, histoTitle, 12, 1, 13, 4, 1, 5);
430 (
wheelHistos[histoTag])[wheelId]->setBinLabel(1,
"MB1", 2);
431 (
wheelHistos[histoTag])[wheelId]->setBinLabel(2,
"MB2", 2);
432 (
wheelHistos[histoTag])[wheelId]->setBinLabel(3,
"MB3", 2);
433 (
wheelHistos[histoTag])[wheelId]->setBinLabel(4,
"MB4", 2);
434 (
wheelHistos[histoTag])[wheelId]->setAxisTitle(
"sector", 1);
435 }
else if (histoTag ==
"SyncNoiseChambs") {
436 string histoTitle =
"# of Synchornous-noise chamb per evt. WHEEL: " + wheel.str();
437 (
wheelHistos[histoTag])[wheelId] = ibooker.
book1D(histoName, histoTitle, 50, 0.5, 50.5);
438 (
wheelHistos[histoTag])[wheelId]->setAxisTitle(
"# of noisy chambs.", 1);
439 (
wheelHistos[histoTag])[wheelId]->setAxisTitle(
"# of evts.", 2);
448 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
449 <<
"[DTDigiTask] Analyze #Run: " <<
event.id().run() <<
" #Event: " <<
event.id().event() << endl;
471 if (dtdigis->begin() == dtdigis->end()) {
472 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"Event " <<
nevents <<
" empty." << endl;
478 for (dtLayerId_It = dtdigis->begin(); dtLayerId_It != dtdigis->end(); dtLayerId_It++) {
479 DTChamberId chId = ((*dtLayerId_It).first).chamberId();
483 hitMap[chId] += (((*dtLayerId_It).second).
second - ((*dtLayerId_It).second).first);
487 map<DTChamberId, int>::const_iterator hitMapIt =
hitMap.begin();
488 map<DTChamberId, int>::const_iterator hitMapEnd =
hitMap.end();
492 for (; hitMapIt != hitMapEnd; ++hitMapIt) {
495 int wh = chId.
wheel();
497 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
498 <<
"[DTDigiTask] Synch noise in chamber: " << chId <<
" with # digis: " << hitMapIt->second << endl;
500 if (chMap.find(wh) == chMap.end()) {
512 map<int, int>::const_iterator chMapIt = chMap.begin();
513 map<int, int>::const_iterator chMapEnd = chMap.end();
514 for (; chMapIt != chMapEnd; ++chMapIt) {
515 wheelHistos[
"SyncNoiseChambs"][(*chMapIt).first]->Fill((*chMapIt).second);
522 LogVerbatim(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask] Synch Noise in event: " <<
nevents;
525 <<
"\tnoisy time-boxes and occupancy will not be filled!" << endl;
532 time_t eventTime = time_t(event.
time().
value() >> 32);
534 LogVerbatim(
"DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise")
535 <<
"[DTDigiTask] At least 4 Synch Noisy chambers in Run : " <<
event.id().run()
536 <<
" Lumi : " <<
event.id().luminosityBlock() <<
" Event : " <<
event.id().event()
537 <<
" at time : " << ctime(&eventTime) << endl;
542 stringstream synchNoisyCh;
543 for (; chIt != chEnd; ++chIt) {
544 synchNoisyCh <<
" " << (*chIt);
546 LogVerbatim(
"DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise")
547 <<
"[DTDigiTask] Chamber List :" << synchNoisyCh.str() << endl;
553 << (
syncNum * 0.1) <<
"% sync noise events in the last 1000 events " << endl;
558 bool isSyncNoisy =
false;
561 for (dtLayerId_It = dtdigis->begin(); dtLayerId_It != dtdigis->end(); ++dtLayerId_It) {
565 DTChamberId chId = ((*dtLayerId_It).first).chamberId();
572 digiIt != ((*dtLayerId_It).second).
second;
575 bool isNoisy =
false;
576 bool isFEMasked =
false;
577 bool isTDCMasked =
false;
578 bool isTrigMask =
false;
582 const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire());
583 statusMap->
cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
587 const DTSuperLayerId dtSLId = ((*dtLayerId_It).first).superlayerId();
588 uint32_t indexSL = dtSLId.
rawId();
590 uint32_t indexCh = dtChId.
rawId();
591 int layer_number = ((*dtLayerId_It).first).
layer();
606 int tdcTime = (*digiIt).countsTDC();
609 const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire());
612 tdcTime += int(round(t0));
622 if ((!isNoisy) && (!isSyncNoisy)) {
626 (
digiHistos.find(histoTag)->second).
find(indexSL)->second->Fill(tdcTime);
636 histoTag =
"OccupancyAllHits_perCh";
637 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
digiHistos[histoTag].find(indexCh);
646 mappedHisto->second->Fill((*digiIt).wire(), (layer_number + (superlayer_number - 1) * 4) - 1);
649 histoTag =
"OccupancyAllHits";
650 map<int, MonitorElement*>::const_iterator histoPerWheel =
wheelHistos[histoTag].find(dtChId.
wheel());
652 histoPerWheel->second->Fill(dtChId.
sector(), dtChId.
station());
656 if (tdcTime < inTimeHitsLowerBoundCorr) {
661 histoTag =
"OccupancyNoise_perCh";
662 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
digiHistos[histoTag].find(indexCh);
664 mappedHisto->second->Fill((*digiIt).wire(), (layer_number + (superlayer_number - 1) * 4) - 1);
668 histoTag =
"OccupancyNoise";
669 map<int, MonitorElement*>::const_iterator histoPerWheel =
wheelHistos[histoTag].find(dtChId.
wheel());
671 histoPerWheel->second->Fill(dtChId.
sector(), dtChId.
station());
676 if (tdcTime > inTimeHitsLowerBoundCorr && tdcTime < inTimeHitsUpperBoundCorr) {
680 histoTag =
"OccupancyInTimeHits_perCh";
681 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
digiHistos[histoTag].find(indexCh);
683 mappedHisto->second->Fill((*digiIt).wire(), (layer_number + (superlayer_number - 1) * 4) - 1);
686 histoTag =
"OccupancyInTimeHits";
687 map<int, MonitorElement*>::const_iterator histoPerWheel =
wheelHistos[histoTag].find(dtChId.
wheel());
689 histoPerWheel->second->Fill(dtChId.
sector(), dtChId.
station());
704 for (std::vector<LTCDigi>::const_iterator ltc_it =
ltcdigis->begin(); ltc_it !=
ltcdigis->end(); ltc_it++) {
705 size_t otherTriggerSum = 0;
706 for (
size_t i = 1; i < 6; i++)
707 otherTriggerSum +=
size_t((*ltc_it).HasTriggered(i));
709 if ((*ltc_it).HasTriggered(0) && otherTriggerSum == 0)
710 l1ASource =
"DTonly";
711 else if (!(*ltc_it).HasTriggered(0))
713 else if ((*ltc_it).HasTriggered(0) && otherTriggerSum > 0)
714 l1ASource =
"DTalso";
722 return string(
"DT/10-TestPulses/");
724 return string(
"DT/01-SliceTestDigi/");
725 return string(
"DT/01-Digi/");
733 for (
int sl = 1; sl <= 3; sl++) {
734 for (
int ly = 1; ly <= 4; ly++) {
735 for (
int ch = 1; ch <= nWires_max; ch++) {
736 int dduId = -1, rosId = -1, robId = -1, tdcId = -1, channelId = -1;
738 dtCh.
wheel(), dtCh.
station(), dtCh.
sector(), sl, ly, ch, dduId, rosId, robId, tdcId, channelId);
742 int lybin = (4 * sl - 4) + ly;
LuminosityBlockID id() const
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
const edm::EventSetup & c
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void channelsMap(const DTChamberId &dtCh, std::string histoTag)
To map real channels.
const DTReadOutMapping * mapping
virtual void setCurrentFolder(std::string const &fullpath)
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
DTChamberId chamberId() const
Return the corresponding ChamberId.
std::string topFolder() const
constexpr uint32_t rawId() const
get the raw id
edm::ESGetToken< DTStatusFlag, DTStatusFlagRcd > statusMapToken_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit) const
std::map< DTChamberId, int > hitMap
constexpr std::array< uint8_t, layerIndexSize > layer
edm::ESGetToken< DTReadOutMapping, DTReadOutMappingRcd > readOutMapToken_
const DTStatusFlag * statusMap
DTDigiTask(const edm::ParameterSet &ps)
Constructor.
bool getData(T &iHolder) const
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< DTDigiCollection > dtDigiToken_
edm::ESGetToken< DTT0, DTT0Rcd > T0Token_
const std::vector< const DTSuperLayer * > & superLayers() const
Return the superlayers in the chamber.
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
std::map< std::string, std::map< int, MonitorElement * > > wheelHistos
float tTrig
tTrig from the DB
int tMax
no needs to be precise. Value from PSets will always be used
int geometryToReadOut(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, int &dduId, int &rosId, int &robId, int &tdcId, int &channelId) const
int superlayer() const
Return the superlayer number (deprecated method name)
const DTGeometry * muonGeom
bool doAllHitsOccupancies
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
void bookHistos(DQMStore::IBooker &ibooker, const DTSuperLayerId &dtSL, std::string folder, std::string histoTag)
Book the ME.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
LuminosityBlockNumber_t luminosityBlock() const
std::vector< DigiType >::const_iterator const_iterator
int cellStatus(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool &noiseFlag, bool &feMask, bool &tdcMask, bool &trigMask, bool &deadFlag, bool &nohvFlag) const
get content
~DTDigiTask() override
Destructor.
std::set< DTChamberId > syncNoisyChambers
MonitorElement * nEventMonitor
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context) override
To reset the MEs.
edm::ESGetToken< DTTtrig, DTTtrigRcd > TtrigToken_
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int station() const
Return the station number.
std::map< std::string, std::map< uint32_t, MonitorElement * > > digiHistos
int wheel() const
Return the wheel number.
std::string triggerSource()
get the L1A source
edm::Handle< LTCDigiCollection > ltcdigis
TimeValue_t value() const
edm::Timestamp time() const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
edm::EDGetTokenT< LTCDigiCollection > ltcDigiCollectionToken_