40 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask]: Constructor" << endl;
98 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"DTDigiTask: analyzed " <<
nevents <<
" events" << endl;
102 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask]: begin run" << endl;
129 for (
int wh = -2; wh <= 2; ++wh) {
134 bookHistos(ibooker, wh,
string(
"Occupancies"),
"OccupancyAllHits");
137 bookHistos(ibooker, wh,
string(
"Occupancies"),
"OccupancyNoise");
139 bookHistos(ibooker, wh,
string(
"Occupancies"),
"OccupancyInTimeHits");
142 bookHistos(ibooker, wh,
string(
"SynchNoise"),
"SyncNoiseEvents");
143 bookHistos(ibooker, wh,
string(
"SynchNoise"),
"SyncNoiseChambs");
146 for (
int st = 1; st <= 4; ++st) {
147 for (
int sect = 1; sect <= 14; ++sect) {
148 if ((sect == 13 || sect == 14) && st != 4)
159 bookHistos(ibooker, dtChId,
string(
"Occupancies"),
"OccupancyAllHits_perCh");
164 bookHistos(ibooker, dtChId,
string(
"Occupancies"),
"OccupancyNoise_perCh");
166 bookHistos(ibooker, dtChId,
string(
"Occupancies"),
"OccupancyInTimeHits_perCh");
168 for (
int sl = 1; sl <= 3; ++sl) {
169 if (st == 4 && sl == 2)
173 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBox");
176 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBoxDTonly");
177 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBoxNoDT");
178 bookHistos(ibooker, dtSLId,
string(
"TimeBoxes"),
"TimeBoxDTalso");
188 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask]: Begin of LS transition" << endl;
194 <<
"[DTDigiTask]: Reset at the LS transition : " << lumiBlock << endl;
196 map<string, map<uint32_t, MonitorElement*> >::const_iterator histosIt =
digiHistos.begin();
197 map<string, map<uint32_t, MonitorElement*> >::const_iterator histosEnd =
digiHistos.end();
198 for (; histosIt != histosEnd; ++histosIt) {
199 map<uint32_t, MonitorElement*>::const_iterator histoIt = (*histosIt).second.begin();
200 map<uint32_t, MonitorElement*>::const_iterator histoEnd = (*histosIt).second.end();
201 for (; histoIt != histoEnd; ++histoIt) {
202 (*histoIt).second->Reset();
207 for (
int wh = -2; wh <= 2; wh++) {
208 for (
int sect = 1; sect <= 14; sect++) {
209 for (
int st = 1; st <= 4; st++) {
213 if ((sect == 13 || sect == 14) && st != 4) {
223 map<string, map<int, MonitorElement*> >::const_iterator whHistosIt =
wheelHistos.begin();
224 map<string, map<int, MonitorElement*> >::const_iterator whHistosEnd =
wheelHistos.end();
225 for (; whHistosIt != whHistosEnd; ++whHistosIt) {
226 if ((*whHistosIt).first.find(
"Sync") == string::npos) {
227 map<int, MonitorElement*>::const_iterator histoIt = (*whHistosIt).second.begin();
228 map<int, MonitorElement*>::const_iterator histoEnd = (*whHistosIt).second.end();
229 for (; histoIt != histoEnd; ++histoIt) {
230 (*histoIt).second->Reset();
245 stringstream superLayer;
251 histoTag +
"_W" +
wheel.str() +
"_St" +
station.str() +
"_Sec" + sector.str() +
"_SL" + superLayer.str();
253 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
254 <<
"[DTDigiTask]: booking SL histo:" <<
histoName <<
" (tag: " <<
histoTag <<
") folder: " 264 if (
folder ==
"TimeBoxes") {
265 string histoTitle =
histoName +
" (TDC Counts)";
273 stringstream layerHistoName;
276 layerHistoName.str(),
289 stringstream layerHistoName;
298 if (
folder ==
"CathodPhotoPeaks") {
318 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
319 <<
"[DTDigiTask]: booking chamber histo:" 321 <<
") folder: " <<
topFolder() +
"Wheel" +
wheel.str() +
"/Station" +
station.str() +
"/Sector" + sector.str()
324 if (
folder ==
"Occupancies") {
326 const std::vector<const DTSuperLayer*>& dtSupLylist = dtchamber->
superLayers();
327 std::vector<const DTSuperLayer*>::const_iterator suly = dtSupLylist.begin();
328 std::vector<const DTSuperLayer*>::const_iterator sulyend = dtSupLylist.end();
334 while (suly != sulyend) {
335 const std::vector<const DTLayer*> dtLyList = (*suly)->layers();
336 std::vector<const DTLayer*>::const_iterator ly = dtLyList.begin();
337 std::vector<const DTLayer*>::const_iterator lyend = dtLyList.end();
338 stringstream superLayer;
339 superLayer << (*suly)->id().superlayer();
341 while (ly != lyend) {
342 nWires =
muonGeom->
layer((*ly)->id())->specificTopology().channels();
343 firstWire =
muonGeom->
layer((*ly)->id())->specificTopology().firstChannel();
345 layer << (*ly)->id().layer();
346 string histoName_layer =
histoName +
"_SL" + superLayer.str() +
"_L" +
layer.str();
347 if (
histoTag ==
"OccupancyAllHits_perL" ||
histoTag ==
"OccupancyNoise_perL" ||
348 histoTag ==
"OccupancyInTimeHits_perL")
350 ibooker.
book1D(histoName_layer, histoName_layer, nWires, firstWire, nWires + firstWire);
352 if ((nWires + firstWire) > nWires_max)
353 nWires_max = (nWires + firstWire);
358 if (
histoTag !=
"OccupancyAllHits_perL" &&
histoTag !=
"OccupancyNoise_perL" &&
359 histoTag !=
"OccupancyInTimeHits_perL") {
366 title <<
"Occ. digis in time [" << inTimeHitsLowerBoundCorr <<
", " << inTimeHitsUpperBoundCorr
368 histoTitle =
title.str();
371 ibooker.
book2D(
histoName, histoTitle, nWires_max, 1, nWires_max + 1, 12, 0, 12);
373 for (
int i = 1;
i <= 12;
i++) {
379 string label =
"SL1: L" + layer_name;
381 }
else if (
i > 4 &&
i < 9) {
386 string label =
"SL2: L" + layer_name;
388 }
else if (
i > 8 &&
i < 13) {
393 string label =
"SL3: L" + layer_name;
409 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
411 <<
") folder: " <<
topFolder() +
"Wheel" +
wheel.str() +
"/" << endl;
413 if (
folder ==
"Occupancies") {
415 string histoTitle =
"# of digis per chamber WHEEL: " +
wheel.str();
422 }
else if (
folder ==
"SynchNoise") {
424 if (
histoTag ==
"SyncNoiseEvents") {
425 string histoTitle =
"# of Syncronous-noise events WHEEL: " +
wheel.str();
432 }
else if (
histoTag ==
"SyncNoiseChambs") {
433 string histoTitle =
"# of Synchornous-noise chamb per evt. WHEEL: " +
wheel.str();
445 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
446 <<
"[DTDigiTask] Analyze #Run: " <<
event.id().run() <<
" #Event: " <<
event.id().event() << endl;
468 if (dtdigis->begin() == dtdigis->end()) {
469 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"Event " <<
nevents <<
" empty." << endl;
475 for (dtLayerId_It = dtdigis->begin(); dtLayerId_It != dtdigis->end(); dtLayerId_It++) {
476 DTChamberId chId = ((*dtLayerId_It).first).chamberId();
480 hitMap[chId] += (((*dtLayerId_It).second).
second - ((*dtLayerId_It).second).first);
484 map<DTChamberId, int>::const_iterator hitMapIt =
hitMap.begin();
485 map<DTChamberId, int>::const_iterator hitMapEnd =
hitMap.end();
489 for (; hitMapIt != hitMapEnd; ++hitMapIt) {
492 int wh = chId.
wheel();
494 LogTrace(
"DTDQM|DTMonitorModule|DTDigiTask")
495 <<
"[DTDigiTask] Synch noise in chamber: " << chId <<
" with # digis: " << hitMapIt->second << endl;
497 if (chMap.find(wh) == chMap.end()) {
509 map<int, int>::const_iterator chMapIt = chMap.begin();
510 map<int, int>::const_iterator chMapEnd = chMap.end();
511 for (; chMapIt != chMapEnd; ++chMapIt) {
512 wheelHistos[
"SyncNoiseChambs"][(*chMapIt).first]->Fill((*chMapIt).second);
519 LogVerbatim(
"DTDQM|DTMonitorModule|DTDigiTask") <<
"[DTDigiTask] Synch Noise in event: " <<
nevents;
522 <<
"\tnoisy time-boxes and occupancy will not be filled!" << endl;
529 time_t eventTime = time_t(
event.time().value() >> 32);
531 LogVerbatim(
"DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise")
532 <<
"[DTDigiTask] At least 4 Synch Noisy chambers in Run : " <<
event.id().run()
533 <<
" Lumi : " <<
event.id().luminosityBlock() <<
" Event : " <<
event.id().event()
534 <<
" at time : " << ctime(&eventTime) << endl;
539 stringstream synchNoisyCh;
540 for (; chIt != chEnd; ++chIt) {
541 synchNoisyCh <<
" " << (*chIt);
543 LogVerbatim(
"DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise")
544 <<
"[DTDigiTask] Chamber List :" << synchNoisyCh.str() << endl;
550 << (
syncNum * 0.1) <<
"% sync noise events in the last 1000 events " << endl;
555 bool isSyncNoisy =
false;
558 for (dtLayerId_It = dtdigis->begin(); dtLayerId_It != dtdigis->end(); ++dtLayerId_It) {
562 DTChamberId chId = ((*dtLayerId_It).first).chamberId();
569 digiIt != ((*dtLayerId_It).second).
second;
572 bool isNoisy =
false;
573 bool isFEMasked =
false;
574 bool isTDCMasked =
false;
575 bool isTrigMask =
false;
579 const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire());
580 statusMap->
cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
584 const DTSuperLayerId dtSLId = ((*dtLayerId_It).first).superlayerId();
585 uint32_t indexSL = dtSLId.
rawId();
587 uint32_t indexCh = dtChId.
rawId();
588 int layer_number = ((*dtLayerId_It).first).
layer();
603 int tdcTime = (*digiIt).countsTDC();
606 const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire());
609 tdcTime +=
int(round(
t0));
619 if ((!isNoisy) && (!isSyncNoisy)) {
633 histoTag =
"OccupancyAllHits_perCh";
634 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
digiHistos[
histoTag].find(indexCh);
643 mappedHisto->second->Fill((*digiIt).wire(), (layer_number + (superlayer_number - 1) * 4) - 1);
649 histoPerWheel->second->Fill(dtChId.
sector(), dtChId.
station());
653 if (tdcTime < inTimeHitsLowerBoundCorr) {
659 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
digiHistos[
histoTag].find(indexCh);
661 mappedHisto->second->Fill((*digiIt).wire(), (layer_number + (superlayer_number - 1) * 4) - 1);
668 histoPerWheel->second->Fill(dtChId.
sector(), dtChId.
station());
673 if (tdcTime > inTimeHitsLowerBoundCorr && tdcTime < inTimeHitsUpperBoundCorr) {
677 histoTag =
"OccupancyInTimeHits_perCh";
678 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
digiHistos[
histoTag].find(indexCh);
680 mappedHisto->second->Fill((*digiIt).wire(), (layer_number + (superlayer_number - 1) * 4) - 1);
686 histoPerWheel->second->Fill(dtChId.
sector(), dtChId.
station());
701 for (std::vector<LTCDigi>::const_iterator ltc_it =
ltcdigis->begin(); ltc_it !=
ltcdigis->end(); ltc_it++) {
702 size_t otherTriggerSum = 0;
703 for (
size_t i = 1;
i < 6;
i++)
704 otherTriggerSum +=
size_t((*ltc_it).HasTriggered(
i));
706 if ((*ltc_it).HasTriggered(0) && otherTriggerSum == 0)
707 l1ASource =
"DTonly";
708 else if (!(*ltc_it).HasTriggered(0))
710 else if ((*ltc_it).HasTriggered(0) && otherTriggerSum > 0)
711 l1ASource =
"DTalso";
719 return string(
"DT/10-TestPulses/");
721 return string(
"DT/01-SliceTestDigi/");
722 return string(
"DT/01-Digi/");
730 for (
int sl = 1; sl <= 3; sl++) {
731 for (
int ly = 1; ly <= 4; ly++) {
732 for (
int ch = 1; ch <= nWires_max; ch++) {
733 int dduId = -1, rosId = -1, robId = -1, tdcId = -1, channelId = -1;
735 dtCh.
wheel(), dtCh.
station(), dtCh.
sector(), sl, ly, ch, dduId, rosId, robId, tdcId, channelId);
739 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
constexpr std::array< uint8_t, layerIndexSize > layer
edm::ESGetToken< DTReadOutMapping, DTReadOutMappingRcd > readOutMapToken_
const DTStatusFlag * statusMap
T getUntrackedParameter(std::string const &, T const &) const
DTDigiTask(const edm::ParameterSet &ps)
Constructor.
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
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.