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");
92 topFolder(
"TM") =
"DT/11-LocalTriggerTP-TM/";
93 topFolder(
"DDU") =
"DT/12-LocalTriggerTP-DDU/";
95 topFolder(
"TM") =
"DT/03-LocalTrigger-TM/";
96 topFolder(
"DDU") =
"DT/04-LocalTrigger-DDU/";
106 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
107 <<
"[DTLocalTriggerBaseTask]: analyzed " <<
nEvents <<
" events" << endl;
116 for (
int wh=-2;wh<3;++wh){
118 for (
int sect=1;sect<13;++sect){
133 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
134 <<
"[DTLocalTriggerBaseTask]: Begin of LS transition" << endl;
136 if(
nLumis%resetCycle == 0 ) {
137 map<uint32_t,map<string,MonitorElement*> >::const_iterator chambIt =
chamberHistos.begin();
138 map<uint32_t,map<string,MonitorElement*> >::const_iterator chambEnd =
chamberHistos.end();
139 for(;chambIt!=chambEnd;++chambIt) {
140 map<string,MonitorElement*>::const_iterator histoIt = chambIt->second.begin();
141 map<string,MonitorElement*>::const_iterator histoEnd = chambIt->second.end();
142 for(;histoIt!=histoEnd;++histoIt) {
143 histoIt->second->Reset();
152 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
153 <<
"[DTLocalTriggerBaseTask]: End of LS transition" << endl;
155 map<uint32_t,DTTimeEvolutionHisto* >::const_iterator chambIt =
trendHistos.begin();
156 map<uint32_t,DTTimeEvolutionHisto* >::const_iterator chambEnd =
trendHistos.end();
157 for(;chambIt!=chambEnd;++chambIt) {
166 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
167 <<
"[DTLocalTriggerBaseTask]: BeginRun" << endl;
200 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
201 <<
"[DTLocalTriggerBaseTask]: one or more TM handles for Input Tag " 202 << inputTagTM <<
" not found!" << endl;
214 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
215 <<
"[DTLocalTriggerBaseTask]: one or more DDU handles for Input Tag " 216 << inputTagDDU <<
" not found!" << endl;
229 uint32_t rawId = dtCh.
rawId();
233 stringstream sector; sector << dtCh.
sector();
235 map<string,int>
minBX;
236 map<string,int>
maxBX;
246 string chTag =
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
247 string labelInOut =
"";
249 vector<string>::const_iterator typeIt =
theTypes.begin();
250 vector<string>::const_iterator typeEnd =
theTypes.end();
252 for (; typeIt!=typeEnd; ++typeIt) {
254 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
255 <<
"[DTLocalTriggerBaseTask]: booking histos for " <<
topFolder((*typeIt)) <<
"Wheel" 256 << wheel.str() <<
"/Sector" << sector.str() <<
"/Station"<< station.str() << endl;
258 for (
int InOut=0; InOut<2;InOut++){
263 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhiIn");
267 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhiOut");
268 labelInOut =
"_Out";}
271 string histoTag = (*typeIt) +
"_BXvsQual" + labelInOut;
273 7,-0.5,6.5,(
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
277 histoTag = (*typeIt) +
"_BestQual" + labelInOut;
279 "Trigger quality of best primitives",7,-0.5,6.5);
282 histoTag = (*typeIt) +
"_Flag1stvsQual" + labelInOut;
284 "1st/2nd trig flag vs quality",7,-0.5,6.5,2,-0.5,1.5);
289 float minPh, maxPh;
int nBinsPh;
292 histoTag = (*typeIt) +
"_QualvsPhirad" + labelInOut;
294 "Trigger quality vs local position",nBinsPh,minPh,maxPh,7,-0.5,6.5);
298 histoTag = (*typeIt) +
"_QualvsPhibend" + labelInOut;
300 "Trigger quality vs local direction",200,-40.,40.,7,-0.5,6.5);
308 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerTheta");
310 string histoTag =
"";
311 if((*typeIt)==
"TM" && dtCh.
station()!=4) {
312 histoTag = (*typeIt) +
"_PositionvsBX";
313 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"Theta trigger position vs BX",
314 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5,7,-0.5,6.5);
315 histoTag = (*typeIt) +
"_PositionvsQual";
316 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"Theta trigger position vs quality",
317 2,0.5,2.5,7,-0.5,6.5);
319 histoTag = (*typeIt) +
"_ThetaBXvsQual";
321 2,0.5,2.5,(
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
329 histoTag = (*typeIt) +
"_ThetaBXvsQual";
330 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"BX vs trigger quality",7,-0.5,6.5,
331 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
334 histoTag = (*typeIt) +
"_ThetaBestQual";
336 "Trigger quality of best primitives (theta)",7,-0.5,6.5);
345 for (
int InOut=0; InOut<2;InOut++){
348 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhiIn");
351 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhiOut");
354 string histoTag =
"COM_QualDDUvsQualTM";
356 "DDU quality vs TM quality",8,-1.5,6.5,8,-1.5,6.5);
360 histoTag =
"COM_MatchingTrend";
362 "Fraction of DDU-TM matches w.r.t. proc evts",
363 nTimeBins,nLSTimeBin,
true,0);
371 stringstream
wheel; wheel << wh;
373 string whTag =
"_W" + wheel.str();
375 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
376 <<
"[DTLocalTriggerBaseTask]: booking wheel histos for " 377 <<
topFolder(
"DDU") <<
"Wheel" << wh << endl;
379 string histoTag =
"COM_BXDiff";
381 "DDU-TM BX Difference",12,1,13,4,1,5,0.,20.);
390 std::vector<L1MuDTChambPhDigi>
const* phOutTrigs,
391 std::vector<L1MuDTChambThDigi>
const* thTrigs )
393 vector<L1MuDTChambPhDigi>::const_iterator iph = phInTrigs->begin();
394 vector<L1MuDTChambPhDigi>::const_iterator iphe = phInTrigs->end();
396 for(; iph !=iphe ; ++iph) {
398 int wh = iph->whNum();
399 int sec = iph->scNum() + 1;
400 int st = iph->stNum();
401 int qual = iph->code();
402 int is1st = iph->Ts2Tag() ? 1 : 0;
403 int bx = iph->bxNum() - is1st;
404 if (qual <0 || qual>6)
continue;
407 uint32_t rawId = dtChId.
rawId();
416 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
418 innerME[
"TM_BXvsQual_In"]->Fill(qual,bx);
419 innerME[
"TM_QualvsPhirad_In"]->Fill(pos,qual);
421 innerME[
"TM_BXvsQual_In"]->Fill(qual,bx);
422 innerME[
"TM_Flag1stvsQual_In"]->Fill(qual,is1st);
423 if (!is1st) innerME[
"TM_QualvsPhirad_In"]->Fill(pos,qual);
425 innerME[
"TM_QualvsPhibend_In"]->Fill(dir,qual);
431 iph = phOutTrigs->begin();
432 iphe = phOutTrigs->end();
434 for(; iph !=iphe ; ++iph) {
436 int wh = iph->whNum();
437 int sec = iph->scNum() + 1;
438 int st = iph->stNum();
439 int qual = iph->code();
440 int is1st = iph->Ts2Tag() ? 1 : 0;
441 int bx = iph->bxNum() - is1st;
443 if (qual <0 || qual>6)
continue;
446 uint32_t rawId = dtChId.
rawId();
455 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
457 innerME[
"TM_BXvsQual_Out"]->Fill(qual,bx);
458 innerME[
"TM_QualvsPhirad_Out"]->Fill(pos,qual);
460 innerME[
"TM_BXvsQual_Out"]->Fill(qual,bx);
461 innerME[
"TM_Flag1stvsQual_Out"]->Fill(qual,is1st);
462 if (!is1st) innerME[
"TM_QualvsPhirad_Out"]->Fill(pos,qual);
464 innerME[
"TM_QualvsPhibend_Out"]->Fill(dir,qual);
470 vector<L1MuDTChambThDigi>::const_iterator ith = thTrigs->begin();
471 vector<L1MuDTChambThDigi>::const_iterator ithe = thTrigs->end();
473 for(; ith != ithe; ++ith) {
474 int wh = ith->whNum();
475 int sec = ith->scNum() + 1;
476 int st = ith->stNum();
477 int bx = ith->bxNum();
482 thcode[
pos] = ith->code(
pos);
485 uint32_t rawId = dtChId.
rawId();
487 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
491 innerME[
"TM_PositionvsBX"]->Fill(bx,
pos);
492 innerME[
"TM_PositionvsQual"]->Fill(thcode[
pos],pos);
493 innerME[
"TM_ThetaBXvsQual"]->Fill(thcode[pos],bx);
498 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMapIn.begin();
499 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMapIn.end();
500 for (; compIt!=compEnd; ++compIt) {
501 int bestQual = compIt->second.qualTM();
503 chamberHistos[compIt->first][
"TM_BestQual_In"]->Fill(bestQual);
509 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMapOut.begin();
510 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMapOut.end();
511 for (; compIt!=compEnd; ++compIt) {
512 int bestQual = compIt->second.qualTM();
514 chamberHistos[compIt->first][
"TM_BestQual_Out"]->Fill(bestQual);
526 for (; detUnitIt!=detUnitEnd; ++detUnitIt){
529 uint32_t rawId = chId.
rawId();
533 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
535 int bestQualTheta = -1;
537 for (; trigIt!=range.second; ++trigIt){
539 int qualPhi = trigIt->quality();
540 int qualTheta = trigIt->trTheta();
541 int flag1st = trigIt->secondTrack() ? 1 : 0;
542 int bx = trigIt->bx();
543 int bxPhi = bx - flag1st;
545 if( qualPhi>-1 && qualPhi<7 ) {
550 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
552 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
553 innerME[
"DDU_Flag1stvsQual"]->Fill(qualPhi,flag1st);
557 if( qualTheta>0 && !
tpMode ){
558 if (qualTheta > bestQualTheta){
559 bestQualTheta = qualTheta;
561 innerME[
"DDU_ThetaBXvsQual"]->Fill(qualTheta,bx);
569 innerME[
"DDU_BestQual"]->Fill(bestQualPhi);
570 if(bestQualTheta>0) {
571 innerME[
"DDU_ThetaBestQual"]->Fill(bestQualTheta);
581 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMapIn.begin();
582 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMapIn.end();
584 for (; compIt!=compEnd; ++compIt) {
586 uint32_t rawId = compIt->first;
588 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
592 innerME[
"COM_QualDDUvsQualTM"]->Fill(compUnit.
qualTM(),compUnit.
qualDDU());
612 axis=histo->GetXaxis();
615 axis=histo->GetYaxis();
619 string labels[7] = {
"LI",
"LO",
"HI",
"HO",
"LL",
"HL",
"HH"};
620 int istart = axis->GetXmin()<-1 ? 2 : 1;
621 for (
int i=0;
i<7;
i++) {
622 axis->SetBinLabel(
i+istart,labels[
i].c_str());
634 axis=histo->GetXaxis();
637 axis=histo->GetYaxis();
641 string labels[2] = {
"L",
"H"};
642 int istart = axis->GetXmin()<-1 ? 2 : 1;
643 for (
int i=0;
i<2;
i++) {
644 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)