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]; }
64 nEvents(0), nLumis(0), theTrigGeomUtils(0) {
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);
290 float minPh, maxPh;
int nBinsPh;
293 histoTag = (*typeIt) +
"_QualvsPhirad" + labelInOut;
295 "Trigger quality vs local position",nBinsPh,minPh,maxPh,7,-0.5,6.5);
299 histoTag = (*typeIt) +
"_QualvsPhibend" + labelInOut;
301 "Trigger quality vs local direction",200,-40.,40.,7,-0.5,6.5);
309 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerTheta");
311 string histoTag =
"";
312 if((*typeIt)==
"TM" && dtCh.
station()!=4) {
313 histoTag = (*typeIt) +
"_PositionvsBX";
314 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"Theta trigger position vs BX",
315 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5,7,-0.5,6.5);
316 histoTag = (*typeIt) +
"_PositionvsQual";
317 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"Theta trigger position vs quality",
318 2,0.5,2.5,7,-0.5,6.5);
320 histoTag = (*typeIt) +
"_ThetaBXvsQual";
322 2,0.5,2.5,(
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
330 histoTag = (*typeIt) +
"_ThetaBXvsQual";
331 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"BX vs trigger quality",7,-0.5,6.5,
332 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
335 histoTag = (*typeIt) +
"_ThetaBestQual";
337 "Trigger quality of best primitives (theta)",7,-0.5,6.5);
348 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhiIn");
351 string histoTag =
"COM_QualDDUvsQualTM";
353 "DDU quality vs TM quality",8,-1.5,6.5,8,-1.5,6.5);
357 histoTag =
"COM_MatchingTrend";
359 "Fraction of DDU-TM matches w.r.t. proc evts",
360 nTimeBins,nLSTimeBin,
true,0);
367 stringstream
wheel; wheel << wh;
369 string whTag =
"_W" + wheel.str();
371 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
372 <<
"[DTLocalTriggerBaseTask]: booking wheel histos for " 373 <<
topFolder(
"DDU") <<
"Wheel" << wh << endl;
375 string histoTag =
"COM_BXDiff";
377 "DDU-TM BX Difference",12,1,13,4,1,5,0.,20.);
386 std::vector<L1MuDTChambPhDigi>
const* phOutTrigs,
387 std::vector<L1MuDTChambThDigi>
const* thTrigs )
389 vector<L1MuDTChambPhDigi>::const_iterator iph = phInTrigs->begin();
390 vector<L1MuDTChambPhDigi>::const_iterator iphe = phInTrigs->end();
392 for(; iph !=iphe ; ++iph) {
394 int wh = iph->whNum();
395 int sec = iph->scNum() + 1;
396 int st = iph->stNum();
397 int qual = iph->code();
398 int is1st = iph->Ts2Tag() ? 1 : 0;
399 int bx = iph->bxNum() - is1st;
400 if (qual <0 || qual>6)
continue;
403 uint32_t rawId = dtChId.
rawId();
412 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
414 innerME[
"TM_BXvsQual_In"]->Fill(qual,bx);
415 innerME[
"TM_QualvsPhirad_In"]->Fill(pos,qual);
417 innerME[
"TM_BXvsQual_In"]->Fill(qual,bx);
418 innerME[
"TM_Flag1stvsQual_In"]->Fill(qual,is1st);
419 if (!is1st) innerME[
"TM_QualvsPhirad_In"]->Fill(pos,qual);
421 innerME[
"TM_QualvsPhibend_In"]->Fill(dir,qual);
427 iph = phOutTrigs->begin();
428 iphe = phOutTrigs->end();
430 for(; iph !=iphe ; ++iph) {
432 int wh = iph->whNum();
433 int sec = iph->scNum() + 1;
434 int st = iph->stNum();
435 int qual = iph->code();
436 int is1st = iph->Ts2Tag() ? 1 : 0;
437 int bx = iph->bxNum() - is1st;
439 if (qual <0 || qual>6)
continue;
442 uint32_t rawId = dtChId.
rawId();
451 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
453 innerME[
"TM_BXvsQual_Out"]->Fill(qual,bx);
454 innerME[
"TM_QualvsPhirad_Out"]->Fill(pos,qual);
456 innerME[
"TM_BXvsQual_Out"]->Fill(qual,bx);
457 innerME[
"TM_Flag1stvsQual_Out"]->Fill(qual,is1st);
458 if (!is1st) innerME[
"TM_QualvsPhirad_Out"]->Fill(pos,qual);
460 innerME[
"TM_QualvsPhibend_Out"]->Fill(dir,qual);
466 vector<L1MuDTChambThDigi>::const_iterator ith = thTrigs->begin();
467 vector<L1MuDTChambThDigi>::const_iterator ithe = thTrigs->end();
469 for(; ith != ithe; ++ith) {
470 int wh = ith->whNum();
471 int sec = ith->scNum() + 1;
472 int st = ith->stNum();
473 int bx = ith->bxNum();
478 thcode[
pos] = ith->code(
pos);
481 uint32_t rawId = dtChId.
rawId();
483 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
487 innerME[
"TM_PositionvsBX"]->Fill(bx,
pos);
488 innerME[
"TM_PositionvsQual"]->Fill(thcode[
pos],pos);
489 innerME[
"TM_ThetaBXvsQual"]->Fill(thcode[pos],bx);
494 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMapIn.begin();
495 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMapIn.end();
496 for (; compIt!=compEnd; ++compIt) {
497 int bestQual = compIt->second.qualTM();
499 chamberHistos[compIt->first][
"TM_BestQual_In"]->Fill(bestQual);
505 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMapOut.begin();
506 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMapOut.end();
507 for (; compIt!=compEnd; ++compIt) {
508 int bestQual = compIt->second.qualTM();
510 chamberHistos[compIt->first][
"TM_BestQual_Out"]->Fill(bestQual);
522 for (; detUnitIt!=detUnitEnd; ++detUnitIt){
525 uint32_t rawId = chId.
rawId();
529 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
531 int bestQualTheta = -1;
533 for (; trigIt!=range.second; ++trigIt){
535 int qualPhi = trigIt->quality();
536 int qualTheta = trigIt->trTheta();
537 int flag1st = trigIt->secondTrack() ? 1 : 0;
538 int bx = trigIt->bx();
539 int bxPhi = bx - flag1st;
541 if( qualPhi>-1 && qualPhi<7 ) {
546 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
548 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
549 innerME[
"DDU_Flag1stvsQual"]->Fill(qualPhi,flag1st);
553 if( qualTheta>0 && !
tpMode ){
554 if (qualTheta > bestQualTheta){
555 bestQualTheta = qualTheta;
557 innerME[
"DDU_ThetaBXvsQual"]->Fill(qualTheta,bx);
565 innerME[
"DDU_BestQual"]->Fill(bestQualPhi);
566 if(bestQualTheta>0) {
567 innerME[
"DDU_ThetaBestQual"]->Fill(bestQualTheta);
577 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMapIn.begin();
578 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMapIn.end();
580 for (; compIt!=compEnd; ++compIt) {
582 uint32_t rawId = compIt->first;
584 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
588 innerME[
"COM_QualDDUvsQualTM"]->Fill(compUnit.
qualTM(),compUnit.
qualDDU());
608 axis=histo->GetXaxis();
611 axis=histo->GetYaxis();
615 string labels[7] = {
"LI",
"LO",
"HI",
"HO",
"LL",
"HL",
"HH"};
616 int istart = axis->GetXmin()<-1 ? 2 : 1;
617 for (
int i=0;
i<7;
i++) {
618 axis->SetBinLabel(
i+istart,labels[
i].c_str());
630 axis=histo->GetXaxis();
633 axis=histo->GetYaxis();
637 string labels[2] = {
"L",
"H"};
638 int istart = axis->GetXmin()<-1 ? 2 : 1;
639 for (
int i=0;
i<2;
i++) {
640 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)
std::map< int, std::map< std::string, MonitorElement * > > wheelHistos
void setTM(int qual, int bx)
virtual ~DTLocalTriggerBaseTask()
Destructor.
std::vector< std::string > theTypes
LuminosityBlockNumber_t luminosityBlock() const
uint32_t rawId() const
get the raw id
DTTrigGeomUtils * theTrigGeomUtils
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
Perform trend plot operations.
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)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
edm::ParameterSet theParams
std::vector< DTLocalTrigger >::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)