46 int qualTM()
const {
return m_qual; }
55 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") <<
"[DTLocalTriggerBaseTask]: Constructor" << endl;
78 topFolder(
"TM") =
"DT/11-LocalTriggerTP-TM/";
79 topFolder(
"AB7") =
"DT/12-LocalTriggerTP-SliceTest/";
81 topFolder(
"TM") =
"DT/03-LocalTrigger-TM/";
82 topFolder(
"AB7") =
"DT/04-LocalTrigger-SliceTest/";
89 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
90 <<
"[DTLocalTriggerBaseTask]: analyzed " <<
m_nEvents <<
" events" << endl;
100 for (
int wh = -2; wh < 3; ++wh) {
102 for (
int sect = 1; sect < 13; ++sect) {
114 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
115 <<
"[DTLocalTriggerBaseTask]: Begin of LS transition" << endl;
119 for (
auto&
histo : histosInChamb.second)
120 histo.second->Reset();
124 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") <<
"[DTLocalTriggerBaseTask]: End of LS transition" << endl;
131 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") <<
"[DTLocalTriggerBaseTask]: BeginRun" << endl;
158 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
159 <<
"[DTLocalTriggerBaseTask]: one or more TM tokens not valid!" << endl;
170 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
171 <<
"[DTLocalTriggerBaseTask]: AB7 token not valid!" << endl;
177 uint32_t rawId = dtCh.
rawId();
186 map<string, int>
minBX;
187 map<string, int>
maxBX;
194 string chTag =
"_W" +
wheel.str() +
"_Sec" + sector.str() +
"_St" +
station.str();
195 string labelInOut =
"";
198 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
199 <<
"[DTLocalTriggerBaseTask]: booking histos for " <<
topFolder(
type) <<
"Wheel" <<
wheel.str() <<
"/Sector" 200 << sector.str() <<
"/Station" <<
station.str() << endl;
206 vector<string> folderLabels;
211 folderLabels.push_back(
"/LocalTriggerPhiIn");
212 folderLabels.push_back(
"/LocalTriggerPhiOut");
216 folderLabels.push_back(
"/LocalTriggerPhi");
219 for (
size_t iLabel = 0; iLabel <
plotLabels.size(); ++iLabel) {
224 station.str() + folderLabels.at(iLabel));
226 int nQualities =
type ==
"AB7" ? 11 : 7;
230 "BX vs trigger quality",
245 ibooker.
book1D(
histoTag + chTag,
"Trigger quality of best primitives", 7, -0.5, 6.5);
250 ibooker.
book2D(
histoTag + chTag,
"1st/2nd trig flag vs quality", 7, -0.5, 6.5, 2, -0.5, 1.5);
255 ibooker.
book2D(
histoTag + chTag,
"Up/Down trig flag vs quality", 7, -0.5, 6.5, 2, -0.5, 1.5);
266 ibooker.
book2D(
histoTag + chTag,
"Trigger quality vs local position", nBinsPh, minPh, maxPh, 7, -0.5, 6.5);
272 ibooker.
book2D(
histoTag + chTag,
"RPC bit vs DT trigger quality", 9, -1.5, 7.5, 3, -0.5, 2.5);
279 ibooker.
book2D(
histoTag + chTag,
"Trigger quality vs local direction", 200, -40., 40., 7, -0.5, 6.5);
287 station.str() +
"/LocalTriggerTheta");
293 "Theta trigger position vs BX",
302 ibooker.
book2D(
histoTag + chTag,
"Theta trigger position vs quality", 3, 0.5, 3.5, 7, -0.5, 6.5);
306 "BX vs trigger quality",
319 std::vector<L1MuDTChambPhDigi>
const* phOutTrigs,
320 std::vector<L1MuDTChambThDigi>
const* thTrigs) {
321 vector<L1MuDTChambPhDigi>::const_iterator iph = phInTrigs->begin();
322 vector<L1MuDTChambPhDigi>::const_iterator iphe = phInTrigs->end();
324 for (; iph != iphe; ++iph) {
325 int wh = iph->whNum();
326 int sec = iph->scNum() + 1;
327 int st = iph->stNum();
328 int qual = iph->code();
329 int is1st = iph->Ts2Tag() ? 1 : 0;
330 int bx = iph->bxNum() - is1st;
331 int updown = iph->UpDownTag();
333 if (qual < 0 || qual > 6)
337 uint32_t rawId = dtChId.
rawId();
347 innerME[
"TM_BXvsQual_In"]->Fill(qual,
bx);
348 innerME[
"TM_QualvsPhirad_In"]->Fill(
pos, qual);
350 innerME[
"TM_BXvsQual_In"]->Fill(qual,
bx);
351 innerME[
"TM_Flag1stvsQual_In"]->Fill(qual, is1st);
352 innerME[
"TM_FlagUpDownvsQual_In"]->Fill(qual, updown);
354 innerME[
"TM_QualvsPhirad_In"]->Fill(
pos, qual);
356 innerME[
"TM_QualvsPhibend_In"]->Fill(
dir, qual);
361 iph = phOutTrigs->begin();
362 iphe = phOutTrigs->end();
364 for (; iph != iphe; ++iph) {
365 int wh = iph->whNum();
366 int sec = iph->scNum() + 1;
367 int st = iph->stNum();
368 int qual = iph->code();
369 int is1st = iph->Ts2Tag() ? 1 : 0;
370 int rpcBit = iph->RpcBit();
371 int bx = iph->bxNum() - is1st;
372 int updown = iph->UpDownTag();
373 if (qual < 0 || qual > 6)
377 uint32_t rawId = dtChId.
rawId();
387 innerME[
"TM_BXvsQual_Out"]->Fill(qual,
bx);
388 innerME[
"TM_QualvsPhirad_Out"]->Fill(
pos, qual);
390 innerME[
"TM_BXvsQual_Out"]->Fill(qual,
bx);
391 innerME[
"TM_RPCBitvsQual_Out"]->Fill(qual, rpcBit);
392 innerME[
"TM_Flag1stvsQual_Out"]->Fill(qual, is1st);
393 innerME[
"TM_FlagUpDownvsQual_Out"]->Fill(qual, updown);
396 innerME[
"TM_QualvsPhirad_Out"]->Fill(
pos, qual);
398 innerME[
"TM_QualvsPhibend_Out"]->Fill(
dir, qual);
403 vector<L1MuDTChambThDigi>::const_iterator ith = thTrigs->begin();
404 vector<L1MuDTChambThDigi>::const_iterator ithe = thTrigs->end();
406 for (; ith != ithe; ++ith) {
407 int wh = ith->whNum();
408 int sec = ith->scNum() + 1;
409 int st = ith->stNum();
410 int bx = ith->bxNum();
415 thcode[
pos] = ith->code(
pos);
416 if (ith->position(
pos) == 0 && ith->quality(
pos) == 1)
421 uint32_t rawId = dtChId.
rawId();
426 if (thcode[
pos] > 0) {
427 innerME[
"TM_PositionvsBX"]->Fill(
bx,
pos);
428 innerME[
"TM_PositionvsQual"]->Fill(thcode[
pos],
pos);
429 innerME[
"TM_ThetaBXvsQual"]->Fill(thcode[
pos],
bx);
435 int bestQual =
comp.second.qualTM();
444 int bestQual =
comp.second.qualTM();
452 vector<L1Phase2MuDTPhDigi>::const_iterator iph = phTrigs->begin();
453 vector<L1Phase2MuDTPhDigi>::const_iterator iphe = phTrigs->end();
454 for (; iph != iphe; ++iph) {
455 int wh = iph->whNum();
456 int sec = iph->scNum() + 1;
457 int st = iph->stNum();
458 int qual = iph->quality();
459 int bx = iph->bxNum();
462 uint32_t rawId = dtChId.
rawId();
465 innerME[
"AB7_BXvsQual"]->Fill(qual,
bx);
474 TAxis* axis =
nullptr;
476 axis =
histo->GetXaxis();
477 }
else if (iaxis == 2) {
478 axis =
histo->GetYaxis();
483 string labels[7] = {
"LI",
"LO",
"HI",
"HO",
"LL",
"HL",
"HH"};
484 int istart = axis->GetXmin() < -1 ? 2 : 1;
485 for (
int i = 0;
i < 7;
i++) {
486 axis->SetBinLabel(
i + istart,
labels[
i].c_str());
495 TAxis* axis =
nullptr;
497 axis =
histo->GetXaxis();
498 }
else if (iaxis == 2) {
499 axis =
histo->GetYaxis();
504 string labels[3] = {
"L",
"H",
"err"};
505 int istart = axis->GetXmin() < -1 ? 2 : 1;
506 for (
int i = 0;
i < 3;
i++) {
507 axis->SetBinLabel(
i + istart,
labels[
i].c_str());
516 TAxis* axis =
nullptr;
518 axis =
histo->GetXaxis();
519 }
else if (iaxis == 2) {
520 axis =
histo->GetYaxis();
525 string labels[11] = {
"",
"L only",
"L multiple",
"H only",
"H multiple",
"3+2",
"LL",
"4+2",
"HL",
"HH",
""};
526 int istart = axis->GetXmin() < -1 ? 2 : 1;
527 for (
int i = 0;
i < 11;
i++) {
528 axis->SetBinLabel(
i + istart,
labels[
i].c_str());
Log< level::Info, true > LogVerbatim
int station() const
Return the station number.
edm::EDGetTokenT< L1MuDTChambPhContainer > m_tm_phiOut_Token
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
void runAB7Analysis(std::vector< L1Phase2MuDTPhDigi > const *phTrigs)
Run analysis on Phase2 readout for SliceTest.
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Beginrun.
void bookHistos(DQMStore::IBooker &, const DTChamberId &chamb)
Book the histograms.
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * m_nEventMonitor
float trigDir(const L1MuDTChambPhDigi *trig)
Return local direction (trigger RF) for a given trigger primitive.
DTTrigGeomUtils * m_trigGeomUtils
void setTM(int qual, int bx)
The_Container const * getContainer() const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > m_types
std::map< uint32_t, DTTPGCompareUnit > m_compMapIn
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
Perform trend plot operations.
~DTLocalTriggerBaseTask() override
Destructor.
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Abs< T >::type abs(const T &t)
std::map< uint32_t, std::map< std::string, MonitorElement * > > m_chamberHistos
void runTMAnalysis(std::vector< L1MuDTChambPhDigi > const *phInTrigs, std::vector< L1MuDTChambPhDigi > const *phOutTrigs, std::vector< L1MuDTChambThDigi > const *thTrigs)
Run analysis on TM data.
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
To reset the MEs.
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
std::string & topFolder(std::string const &type)
Get the Top folder (different between Physics and TP and TM)
void setQLabelsTheta(MonitorElement *me, short int iaxis)
Phi_Container const * getContainer() const
edm::EDGetTokenT< L1MuDTChambThContainer > m_tm_theta_Token
constexpr uint32_t rawId() const
get the raw id
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Segment_Container const * getContainer() const
edm::EDGetTokenT< L1Phase2MuDTPhContainer > m_ab7_phi_Token
std::map< uint32_t, DTTimeEvolutionHisto * > m_trendHistos
int wheel() const
Return the wheel number.
edm::EDGetTokenT< L1MuDTChambPhContainer > m_tm_phiIn_Token
void setQLabelsPh2(MonitorElement *me, short int iaxis)
void setQLabels(MonitorElement *me, short int iaxis)
Set Quality labels.
std::map< uint32_t, DTTPGCompareUnit > m_compMapOut
std::tuple< std::string, std::string, std::string > plotLabels
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
edm::ParameterSet m_params
float trigPos(const L1MuDTChambPhDigi *trig)
Return local position (trigger RF) for a given trigger primitive.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
DTLocalTriggerBaseTask(const edm::ParameterSet &ps)
Constructor.
LuminosityBlockNumber_t luminosityBlock() const