40 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask]: Constructor" << endl;
99 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"DTDigiTask: analyzed " <<
nevents <<
" events" << endl;
103 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask]: begin run" << endl;
130 for (
int wh = -2; wh <= 2; ++wh) {
135 bookHistos(ibooker, wh,
string(
"Occupancies"),
"OccupancyAllHits");
138 bookHistos(ibooker, wh,
string(
"Occupancies"),
"OccupancyNoise");
140 bookHistos(ibooker, wh,
string(
"Occupancies"),
"OccupancyInTimeHits");
143 bookHistos(ibooker, wh,
string(
"SynchNoise"),
"SyncNoiseEvents");
144 bookHistos(ibooker, wh,
string(
"SynchNoise"),
"SyncNoiseChambs");
147 for (
int st = 1; st <= 4; ++st) {
148 for (
int sect = 1; sect <= 14; ++sect) {
149 if ((sect == 13 || sect == 14) && st != 4)
160 bookHistos(ibooker, dtChId,
string(
"Occupancies"),
"OccupancyAllHits_perCh");
165 bookHistos(ibooker, dtChId,
string(
"Occupancies"),
"OccupancyNoise_perCh");
167 bookHistos(ibooker, dtChId,
string(
"Occupancies"),
"OccupancyInTimeHits_perCh");
169 for (
int sl = 1; sl <= 3; ++sl) {
170 if (st == 4 && sl == 2)
174 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBox");
177 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBoxDTonly");
178 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBoxNoDT");
179 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBoxDTalso");
189 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask]: Begin of LS transition" << endl;
195 <<
"[DTDigiTask]: Reset at the LS transition : " << lumiBlock << endl;
197 map<string, map<uint32_t, MonitorElement*> >::const_iterator histosIt =
digiHistos.begin();
198 map<string, map<uint32_t, MonitorElement*> >::const_iterator histosEnd =
digiHistos.end();
199 for (; histosIt != histosEnd; ++histosIt) {
200 map<uint32_t, MonitorElement*>::const_iterator histoIt = (*histosIt).second.begin();
201 map<uint32_t, MonitorElement*>::const_iterator histoEnd = (*histosIt).second.end();
202 for (; histoIt != histoEnd; ++histoIt) {
203 (*histoIt).second->Reset();
208 for (
int wh = -2; wh <= 2; wh++) {
209 for (
int sect = 1; sect <= 14; sect++) {
210 for (
int st = 1; st <= 4; st++) {
214 if ((sect == 13 || sect == 14) && st != 4) {
224 map<string, map<int, MonitorElement*> >::const_iterator whHistosIt =
wheelHistos.begin();
225 map<string, map<int, MonitorElement*> >::const_iterator whHistosEnd =
wheelHistos.end();
226 for (; whHistosIt != whHistosEnd; ++whHistosIt) {
227 if ((*whHistosIt).first.find(
"Sync") == string::npos) {
228 map<int, MonitorElement*>::const_iterator histoIt = (*whHistosIt).second.begin();
229 map<int, MonitorElement*>::const_iterator histoEnd = (*whHistosIt).second.end();
230 for (; histoIt != histoEnd; ++histoIt) {
231 (*histoIt).second->Reset();
246 stringstream superLayer;
254 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
255 <<
"[DTDigiTask]: booking SL histo:" <<
histoName <<
" (tag: " <<
histoTag <<
") folder: " 265 if (
folder ==
"TimeBoxes") {
266 string histoTitle =
histoName +
" (TDC Counts)";
274 stringstream layerHistoName;
277 layerHistoName.str(),
290 stringstream layerHistoName;
299 if (
folder ==
"CathodPhotoPeaks") {
319 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
320 <<
"[DTDigiTask]: booking chamber histo:" 325 if (
folder ==
"Occupancies") {
327 const std::vector<const DTSuperLayer*>& dtSupLylist = dtchamber->
superLayers();
328 std::vector<const DTSuperLayer*>::const_iterator suly = dtSupLylist.begin();
329 std::vector<const DTSuperLayer*>::const_iterator sulyend = dtSupLylist.end();
335 while (suly != sulyend) {
336 const std::vector<const DTLayer*> dtLyList = (*suly)->layers();
337 std::vector<const DTLayer*>::const_iterator ly = dtLyList.begin();
338 std::vector<const DTLayer*>::const_iterator lyend = dtLyList.end();
339 stringstream superLayer;
340 superLayer << (*suly)->id().superlayer();
342 while (ly != lyend) {
343 nWires =
muonGeom->
layer((*ly)->id())->specificTopology().channels();
344 firstWire =
muonGeom->
layer((*ly)->id())->specificTopology().firstChannel();
346 layer << (*ly)->id().layer();
347 string histoName_layer =
histoName +
"_SL" + superLayer.str() +
"_L" +
layer.str();
348 if (
histoTag ==
"OccupancyAllHits_perL" ||
histoTag ==
"OccupancyNoise_perL" ||
349 histoTag ==
"OccupancyInTimeHits_perL")
351 ibooker.
book1D(histoName_layer, histoName_layer, nWires, firstWire, nWires + firstWire);
353 if ((nWires + firstWire) > nWires_max)
354 nWires_max = (nWires + firstWire);
359 if (
histoTag !=
"OccupancyAllHits_perL" &&
histoTag !=
"OccupancyNoise_perL" &&
360 histoTag !=
"OccupancyInTimeHits_perL") {
367 title <<
"Occ. digis in time [" << inTimeHitsLowerBoundCorr <<
", " << inTimeHitsUpperBoundCorr
369 histoTitle =
title.str();
372 ibooker.
book2D(
histoName, histoTitle, nWires_max, 1, nWires_max + 1, 12, 0, 12);
374 for (
int i = 1;
i <= 12;
i++) {
380 string label =
"SL1: L" + layer_name;
382 }
else if (
i > 4 &&
i < 9) {
387 string label =
"SL2: L" + layer_name;
389 }
else if (
i > 8 &&
i < 13) {
394 string label =
"SL3: L" + layer_name;
410 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
412 <<
") folder: " <<
topFolder() +
"Wheel" +
wheel.str() +
"/" << endl;
414 if (
folder ==
"Occupancies") {
416 string histoTitle =
"# of digis per chamber WHEEL: " +
wheel.str();
423 }
else if (
folder ==
"SynchNoise") {
425 if (
histoTag ==
"SyncNoiseEvents") {
426 string histoTitle =
"# of Syncronous-noise events WHEEL: " +
wheel.str();
433 }
else if (
histoTag ==
"SyncNoiseChambs") {
434 string histoTitle =
"# of Synchornous-noise chamb per evt. WHEEL: " +
wheel.str();
446 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
447 <<
"[DTDigiTask] Analyze #Run: " <<
event.id().run() <<
" #Event: " <<
event.id().event() << endl;
469 if (dtdigis->begin() == dtdigis->end()) {
470 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"Event " <<
nevents <<
" empty." << endl;
476 for (dtLayerId_It = dtdigis->begin(); dtLayerId_It != dtdigis->end(); dtLayerId_It++) {
477 DTChamberId chId = ((*dtLayerId_It).first).chamberId();
481 hitMap[chId] += (((*dtLayerId_It).second).
second - ((*dtLayerId_It).second).first);
485 map<DTChamberId, int>::const_iterator hitMapIt =
hitMap.begin();
486 map<DTChamberId, int>::const_iterator hitMapEnd =
hitMap.end();
490 for (; hitMapIt != hitMapEnd; ++hitMapIt) {
493 int wh = chId.
wheel();
495 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
496 <<
"[DTDigiTask] Synch noise in chamber: " << chId <<
" with # digis: " << hitMapIt->second << endl;
498 if (chMap.find(wh) == chMap.end()) {
510 map<int, int>::const_iterator chMapIt = chMap.begin();
511 map<int, int>::const_iterator chMapEnd = chMap.end();
512 for (; chMapIt != chMapEnd; ++chMapIt) {
513 wheelHistos[
"SyncNoiseChambs"][(*chMapIt).first]->Fill((*chMapIt).second);
520 LogVerbatim(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask] Synch Noise in event: " <<
nevents;
523 <<
"\tnoisy time-boxes and occupancy will not be filled!" << endl;
530 time_t eventTime = time_t(
event.time().value() >> 32);
532 LogVerbatim(
"DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise")
533 <<
"[DTDigiTask] At least 4 Synch Noisy chambers in Run : " <<
event.id().run()
534 <<
" Lumi : " <<
event.id().luminosityBlock() <<
" Event : " <<
event.id().event()
535 <<
" at time : " << ctime(&eventTime) << endl;
540 stringstream synchNoisyCh;
541 for (; chIt != chEnd; ++chIt) {
542 synchNoisyCh <<
" " << (*chIt);
544 LogVerbatim(
"DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise")
545 <<
"[DTDigiTask] Chamber List :" << synchNoisyCh.str() << endl;
551 << (
syncNum * 0.1) <<
"% sync noise events in the last 1000 events " << endl;
556 bool isSyncNoisy =
false;
559 for (dtLayerId_It = dtdigis->begin(); dtLayerId_It != dtdigis->end(); ++dtLayerId_It) {
563 DTChamberId chId = ((*dtLayerId_It).first).chamberId();
570 digiIt != ((*dtLayerId_It).second).
second;
573 bool isNoisy =
false;
574 bool isFEMasked =
false;
575 bool isTDCMasked =
false;
576 bool isTrigMask =
false;
580 const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire());
581 statusMap->
cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
585 const DTSuperLayerId dtSLId = ((*dtLayerId_It).first).superlayerId();
586 uint32_t indexSL = dtSLId.
rawId();
588 uint32_t indexCh = dtChId.
rawId();
589 int layer_number = ((*dtLayerId_It).first).
layer();
604 int tdcTime = (*digiIt).countsTDC();
607 const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire());
610 tdcTime +=
int(round(
t0));
620 if ((!isNoisy) && (!isSyncNoisy)) {
634 histoTag =
"OccupancyAllHits_perCh";
635 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
digiHistos[
histoTag].find(indexCh);
644 mappedHisto->second->Fill((*digiIt).wire(), (layer_number + (superlayer_number - 1) * 4) - 1);
650 histoPerWheel->second->Fill(dtChId.
sector(), dtChId.
station());
654 if (tdcTime < inTimeHitsLowerBoundCorr) {
660 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
digiHistos[
histoTag].find(indexCh);
662 mappedHisto->second->Fill((*digiIt).wire(), (layer_number + (superlayer_number - 1) * 4) - 1);
669 histoPerWheel->second->Fill(dtChId.
sector(), dtChId.
station());
674 if (tdcTime > inTimeHitsLowerBoundCorr && tdcTime < inTimeHitsUpperBoundCorr) {
678 histoTag =
"OccupancyInTimeHits_perCh";
679 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
digiHistos[
histoTag].find(indexCh);
681 mappedHisto->second->Fill((*digiIt).wire(), (layer_number + (superlayer_number - 1) * 4) - 1);
687 histoPerWheel->second->Fill(dtChId.
sector(), dtChId.
station());
702 for (std::vector<LTCDigi>::const_iterator ltc_it =
ltcdigis->begin(); ltc_it !=
ltcdigis->end(); ltc_it++) {
703 size_t otherTriggerSum = 0;
704 for (
size_t i = 1;
i < 6;
i++)
705 otherTriggerSum +=
size_t((*ltc_it).HasTriggered(
i));
707 if ((*ltc_it).HasTriggered(0) && otherTriggerSum == 0)
708 l1ASource =
"DTonly";
709 else if (!(*ltc_it).HasTriggered(0))
711 else if ((*ltc_it).HasTriggered(0) && otherTriggerSum > 0)
712 l1ASource =
"DTalso";
720 return string(
"DT/10-TestPulses/");
722 return string(
"DT/01-SliceTestDigi/");
723 return string(
"DT/01-Digi/");
731 for (
int sl = 1; sl <= 3; sl++) {
732 for (
int ly = 1; ly <= 4; ly++) {
733 for (
int ch = 1; ch <= nWires_max; ch++) {
734 int dduId = -1, rosId = -1, robId = -1, tdcId = -1,
channelId = -1;
736 dtCh.
wheel(), dtCh.
station(), dtCh.
sector(), sl, ly, ch, dduId, rosId, robId, tdcId,
channelId);
740 int lybin = (4 * sl - 4) + ly;
Log< level::Info, true > LogVerbatim
int station() const
Return the station number.
LuminosityBlockNumber_t luminosityBlock() const
T getParameter(std::string const &) const
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
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)
edm::ESGetToken< DTStatusFlag, DTStatusFlagRcd > statusMapToken_
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
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::map< DTChamberId, int > hitMap
edm::ESGetToken< DTReadOutMapping, DTReadOutMappingRcd > readOutMapToken_
const DTStatusFlag * statusMap
T getUntrackedParameter(std::string const &, T const &) const
DTDigiTask(const edm::ParameterSet &ps)
Constructor.
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< DTDigiCollection > dtDigiToken_
DTChamberId chamberId() const
Return the corresponding ChamberId.
edm::ESGetToken< DTT0, DTT0Rcd > T0Token_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
std::map< std::string, std::map< int, MonitorElement * > > wheelHistos
const std::vector< const DTSuperLayer * > & superLayers() const
Return the superlayers in the chamber.
float tTrig
tTrig from the DB
int tMax
no needs to be precise. Value from PSets will always be used
const DTGeometry * muonGeom
bool doAllHitsOccupancies
int superlayer() const
Return the superlayer number (deprecated method name)
LuminosityBlockID id() const
constexpr uint32_t rawId() const
get the raw id
uint8_t channelId(const VFATFrame &frame)
retrieve this channel identifier
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())
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit) const
std::vector< DigiType >::const_iterator const_iterator
std::string topFolder() const
~DTDigiTask() override
Destructor.
std::set< DTChamberId > syncNoisyChambers
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
MonitorElement * nEventMonitor
int wheel() const
Return the wheel number.
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context) override
To reset the MEs.
edm::ESGetToken< DTTtrig, DTTtrigRcd > TtrigToken_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::map< std::string, std::map< uint32_t, MonitorElement * > > digiHistos
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
std::string triggerSource()
get the L1A source
edm::Handle< LTCDigiCollection > ltcdigis
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
edm::EDGetTokenT< LTCDigiCollection > ltcDigiCollectionToken_
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.