44 void setDDU(
int qual,
int bx) { theQual[0] = qual; theBX[0] = bx; }
45 void setTM(
int qual,
int bx) { theQual[1] = qual; theBX[1] = bx; }
47 bool hasOne()
const {
return theQual[0]!=-1 || theQual[1]!=-1; };
48 bool hasBoth()
const {
return theQual[0]!=-1 && theQual[1]!=-1; };
49 bool hasSameQual()
const {
return hasBoth() && theQual[0]==theQual[1]; };
50 int deltaBX()
const {
return theBX[0] - theBX[1]; }
51 int qualDDU()
const {
return theQual[0]; }
52 int qualTM()
const {
return theQual[1]; }
66 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
67 <<
"[DTLocalTriggerBaseTask]: Constructor"<<endl;
88 if (processTM)
theTypes.push_back(
"TM");
89 if (processDDU)
theTypes.push_back(
"DDU");
93 topFolder(
"TM") =
"DT/11-LocalTriggerTP-TM/";
94 topFolder(
"DDU") =
"DT/12-LocalTriggerTP-DDU/";
96 topFolder(
"TM") =
"DT/03-LocalTrigger-TM/";
97 topFolder(
"DDU") =
"DT/04-LocalTrigger-DDU/";
107 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
108 <<
"[DTLocalTriggerBaseTask]: analyzed " <<
nEvents <<
" events" << endl;
117 for (
int wh=-2;wh<3;++wh){
119 for (
int sect=1;sect<13;++sect){
134 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
135 <<
"[DTLocalTriggerBaseTask]: Begin of LS transition" << endl;
137 if(
nLumis%resetCycle == 0 ) {
138 map<uint32_t,map<string,MonitorElement*> >::const_iterator chambIt =
chamberHistos.begin();
139 map<uint32_t,map<string,MonitorElement*> >::const_iterator chambEnd =
chamberHistos.end();
140 for(;chambIt!=chambEnd;++chambIt) {
141 map<string,MonitorElement*>::const_iterator histoIt = chambIt->second.begin();
142 map<string,MonitorElement*>::const_iterator histoEnd = chambIt->second.end();
143 for(;histoIt!=histoEnd;++histoIt) {
144 histoIt->second->Reset();
153 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
154 <<
"[DTLocalTriggerBaseTask]: End of LS transition" << endl;
156 map<uint32_t,DTTimeEvolutionHisto* >::const_iterator chambIt =
trendHistos.begin();
157 map<uint32_t,DTTimeEvolutionHisto* >::const_iterator chambEnd =
trendHistos.end();
158 for(;chambIt!=chambEnd;++chambIt) {
167 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
168 <<
"[DTLocalTriggerBaseTask]: BeginRun" << endl;
201 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
202 <<
"[DTLocalTriggerBaseTask]: one or more TM handles for Input Tag " 203 << inputTagTM <<
" not found!" << endl;
215 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
216 <<
"[DTLocalTriggerBaseTask]: one or more DDU handles for Input Tag " 217 << inputTagDDU <<
" not found!" << endl;
230 uint32_t rawId = dtCh.
rawId();
234 stringstream sector; sector << dtCh.
sector();
236 map<string,int>
minBX;
237 map<string,int>
maxBX;
247 string chTag =
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
248 string labelInOut =
"";
250 vector<string>::const_iterator typeIt =
theTypes.begin();
251 vector<string>::const_iterator typeEnd =
theTypes.end();
253 for (; typeIt!=typeEnd; ++typeIt) {
255 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
256 <<
"[DTLocalTriggerBaseTask]: booking histos for " <<
topFolder((*typeIt)) <<
"Wheel" 257 << wheel.str() <<
"/Sector" << sector.str() <<
"/Station"<< station.str() << endl;
259 for (
int InOut=0; InOut<2;InOut++){
264 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhiIn");
268 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhiOut");
269 labelInOut =
"_Out";}
272 string histoTag = (*typeIt) +
"_BXvsQual" + labelInOut;
274 7,-0.5,6.5,(
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
278 histoTag = (*typeIt) +
"_BestQual" + labelInOut;
280 "Trigger quality of best primitives",7,-0.5,6.5);
283 histoTag = (*typeIt) +
"_Flag1stvsQual" + labelInOut;
285 "1st/2nd trig flag vs quality",7,-0.5,6.5,2,-0.5,1.5);
288 histoTag = (*typeIt) +
"_FlagUpDownvsQual" + labelInOut;
290 "Up/Down trig flag vs quality",7,-0.5,6.5,2,-0.5,1.5);
296 float minPh, maxPh;
int nBinsPh;
299 histoTag = (*typeIt) +
"_QualvsPhirad" + labelInOut;
301 "Trigger quality vs local position",nBinsPh,minPh,maxPh,7,-0.5,6.5);
305 histoTag = (*typeIt) +
"_QualvsPhibend" + labelInOut;
307 "Trigger quality vs local direction",200,-40.,40.,7,-0.5,6.5);
315 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerTheta");
317 string histoTag =
"";
318 if((*typeIt)==
"TM" && dtCh.
station()!=4) {
319 histoTag = (*typeIt) +
"_PositionvsBX";
320 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"Theta trigger position vs BX",
321 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5,7,-0.5,6.5);
322 histoTag = (*typeIt) +
"_PositionvsQual";
323 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"Theta trigger position vs quality",
324 2,0.5,2.5,7,-0.5,6.5);
326 histoTag = (*typeIt) +
"_ThetaBXvsQual";
328 2,0.5,2.5,(
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
336 histoTag = (*typeIt) +
"_ThetaBXvsQual";
337 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"BX vs trigger quality",7,-0.5,6.5,
338 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
341 histoTag = (*typeIt) +
"_ThetaBestQual";
343 "Trigger quality of best primitives (theta)",7,-0.5,6.5);
354 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhiIn");
357 string histoTag =
"COM_QualDDUvsQualTM";
359 "DDU quality vs TM quality",8,-1.5,6.5,8,-1.5,6.5);
363 histoTag =
"COM_MatchingTrend";
365 "Fraction of DDU-TM matches w.r.t. proc evts",
366 nTimeBins,nLSTimeBin,
true,0);
373 stringstream
wheel; wheel << wh;
375 string whTag =
"_W" + wheel.str();
377 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
378 <<
"[DTLocalTriggerBaseTask]: booking wheel histos for " 379 <<
topFolder(
"DDU") <<
"Wheel" << wh << endl;
381 string histoTag =
"COM_BXDiff";
383 "DDU-TM BX Difference",12,1,13,4,1,5,0.,20.);
392 std::vector<L1MuDTChambPhDigi>
const* phOutTrigs,
393 std::vector<L1MuDTChambThDigi>
const* thTrigs )
395 vector<L1MuDTChambPhDigi>::const_iterator iph = phInTrigs->begin();
396 vector<L1MuDTChambPhDigi>::const_iterator iphe = phInTrigs->end();
398 for(; iph !=iphe ; ++iph) {
400 int wh = iph->whNum();
401 int sec = iph->scNum() + 1;
402 int st = iph->stNum();
403 int qual = iph->code();
404 int is1st = iph->Ts2Tag() ? 1 : 0;
405 int bx = iph->bxNum() - is1st;
406 int updown = iph->UpDownTag();
408 if (qual <0 || qual>6)
continue;
411 uint32_t rawId = dtChId.
rawId();
420 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
422 innerME[
"TM_BXvsQual_In"]->Fill(qual,bx);
423 innerME[
"TM_QualvsPhirad_In"]->Fill(pos,qual);
425 innerME[
"TM_BXvsQual_In"]->Fill(qual,bx);
426 innerME[
"TM_Flag1stvsQual_In"]->Fill(qual,is1st);
427 innerME[
"TM_FlagUpDownvsQual_In"]->Fill(qual,updown);
428 if (!is1st) innerME[
"TM_QualvsPhirad_In"]->Fill(pos,qual);
430 innerME[
"TM_QualvsPhibend_In"]->Fill(dir,qual);
436 iph = phOutTrigs->begin();
437 iphe = phOutTrigs->end();
439 for(; iph !=iphe ; ++iph) {
441 int wh = iph->whNum();
442 int sec = iph->scNum() + 1;
443 int st = iph->stNum();
444 int qual = iph->code();
445 int is1st = iph->Ts2Tag() ? 1 : 0;
446 int bx = iph->bxNum() - is1st;
447 int updown = iph->UpDownTag();
448 if (qual <0 || qual>6)
continue;
451 uint32_t rawId = dtChId.
rawId();
460 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
462 innerME[
"TM_BXvsQual_Out"]->Fill(qual,bx);
463 innerME[
"TM_QualvsPhirad_Out"]->Fill(pos,qual);
465 innerME[
"TM_BXvsQual_Out"]->Fill(qual,bx);
466 innerME[
"TM_Flag1stvsQual_Out"]->Fill(qual,is1st);
467 innerME[
"TM_FlagUpDownvsQual_Out"]->Fill(qual,updown);
469 if (!is1st) innerME[
"TM_QualvsPhirad_Out"]->Fill(pos,qual);
471 innerME[
"TM_QualvsPhibend_Out"]->Fill(dir,qual);
477 vector<L1MuDTChambThDigi>::const_iterator ith = thTrigs->begin();
478 vector<L1MuDTChambThDigi>::const_iterator ithe = thTrigs->end();
480 for(; ith != ithe; ++ith) {
481 int wh = ith->whNum();
482 int sec = ith->scNum() + 1;
483 int st = ith->stNum();
484 int bx = ith->bxNum();
489 thcode[
pos] = ith->code(
pos);
492 uint32_t rawId = dtChId.
rawId();
494 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
498 innerME[
"TM_PositionvsBX"]->Fill(bx,
pos);
499 innerME[
"TM_PositionvsQual"]->Fill(thcode[
pos],pos);
500 innerME[
"TM_ThetaBXvsQual"]->Fill(thcode[pos],bx);
505 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMapIn.begin();
506 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMapIn.end();
507 for (; compIt!=compEnd; ++compIt) {
508 int bestQual = compIt->second.qualTM();
510 chamberHistos[compIt->first][
"TM_BestQual_In"]->Fill(bestQual);
516 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMapOut.begin();
517 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMapOut.end();
518 for (; compIt!=compEnd; ++compIt) {
519 int bestQual = compIt->second.qualTM();
521 chamberHistos[compIt->first][
"TM_BestQual_Out"]->Fill(bestQual);
533 for (; detUnitIt!=detUnitEnd; ++detUnitIt){
536 uint32_t rawId = chId.
rawId();
540 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
542 int bestQualTheta = -1;
544 for (; trigIt!=range.second; ++trigIt){
546 int qualPhi = trigIt->quality();
547 int qualTheta = trigIt->trTheta();
548 int flag1st = trigIt->secondTrack() ? 1 : 0;
549 int bx = trigIt->bx();
550 int bxPhi = bx - flag1st;
552 if( qualPhi>-1 && qualPhi<7 ) {
557 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
559 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
560 innerME[
"DDU_Flag1stvsQual"]->Fill(qualPhi,flag1st);
564 if( qualTheta>0 && !
tpMode ){
565 if (qualTheta > bestQualTheta){
566 bestQualTheta = qualTheta;
568 innerME[
"DDU_ThetaBXvsQual"]->Fill(qualTheta,bx);
576 innerME[
"DDU_BestQual"]->Fill(bestQualPhi);
577 if(bestQualTheta>0) {
578 innerME[
"DDU_ThetaBestQual"]->Fill(bestQualTheta);
588 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMapIn.begin();
589 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMapIn.end();
591 for (; compIt!=compEnd; ++compIt) {
593 uint32_t rawId = compIt->first;
595 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
599 innerME[
"COM_QualDDUvsQualTM"]->Fill(compUnit.
qualTM(),compUnit.
qualDDU());
619 axis=histo->GetXaxis();
622 axis=histo->GetYaxis();
626 string labels[7] = {
"LI",
"LO",
"HI",
"HO",
"LL",
"HL",
"HH"};
627 int istart = axis->GetXmin()<-1 ? 2 : 1;
628 for (
int i=0;
i<7;
i++) {
629 axis->SetBinLabel(
i+istart,labels[
i].c_str());
641 axis=histo->GetXaxis();
644 axis=histo->GetYaxis();
648 string labels[2] = {
"L",
"H"};
649 int istart = axis->GetXmin()<-1 ? 2 : 1;
650 for (
int i=0;
i<2;
i++) {
651 axis->SetBinLabel(
i+istart,labels[
i].c_str());
The_Container const * getContainer() const
T getUntrackedParameter(std::string const &, T const &) const
void runDDUvsTMAnalysis()
Run analysis on ROS data.
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Beginrun.
void bookHistos(DQMStore::IBooker &, const DTChamberId &chamb)
Book the histograms.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
float trigDir(const L1MuDTChambPhDigi *trig)
Return local direction (trigger RF) for a given trigger primitive.
void setDDU(int qual, int bx)
constexpr uint32_t rawId() const
get the raw id
std::map< int, std::map< std::string, MonitorElement * > > wheelHistos
void setTM(int qual, int bx)
std::vector< std::string > theTypes
LuminosityBlockNumber_t luminosityBlock() const
DTTrigGeomUtils * theTrigGeomUtils
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
Perform trend plot operations.
void setCurrentFolder(std::string const &fullpath)
~DTLocalTriggerBaseTask() override
Destructor.
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
MonitorElement * bookProfile2D(Args &&...args)
edm::EDGetTokenT< L1MuDTChambThContainer > tm_theta_Token_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
std::map< uint32_t, DTTPGCompareUnit > theCompMapOut
edm::EDGetTokenT< DTLocalTriggerCollection > trig_Token_
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.
MonitorElement * nEventMonitor
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
std::map< uint32_t, DTTPGCompareUnit > theCompMapIn
std::string & topFolder(std::string const &type)
Get the Top folder (different between Physics and TP and TM/DDU)
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
void setQLabelsTheta(MonitorElement *me, short int iaxis)
MonitorElement * book2D(Args &&...args)
edm::ParameterSet theParams
std::vector< DigiType >::const_iterator const_iterator
Phi_Container const * getContainer() const
void setQLabels(MonitorElement *me, short int iaxis)
Set Quality labels.
edm::EDGetTokenT< L1MuDTChambPhContainer > tm_phiIn_Token_
std::map< uint32_t, DTTimeEvolutionHisto * > trendHistos
std::pair< const_iterator, const_iterator > Range
MonitorElement * bookFloat(Args &&...args)
void runDDUAnalysis(edm::Handle< DTLocalTriggerCollection > &trigsDDU)
Run analysis on ROS data.
float trigPos(const L1MuDTChambPhDigi *trig)
Return local position (trigger RF) for a given trigger primitive.
int station() const
Return the station number.
edm::EDGetTokenT< L1MuDTChambPhContainer > tm_phiOut_Token_
DTLocalTriggerBaseTask(const edm::ParameterSet &ps)
Constructor.
int wheel() const
Return the wheel number.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)