40 dataTrackProducer = consumes<L1CSCTrackCollection>(pset.
getParameter<
InputTag>(
"dataTrackProducer"));
41 emulTrackProducer = consumes<L1CSCTrackCollection>(pset.
getParameter<
InputTag>(
"emulTrackProducer"));
42 dataStubProducer = consumes<CSCTriggerContainer<csctf::TrackStub> >(pset.
getParameter<
InputTag>(
"dataStubProducer"));
43 emulStubProducer = consumes<L1MuDTChambPhContainer>(pset.
getParameter<
InputTag>(
"emulStubProducer"));
50 if( outFile.size() != 0 )
53 <<
"L1T Monitoring histograms will be saved to " 58 bool disable = pset. getUntrackedParameter<bool>(
"disableROOToutput",
false);
89 my_dtrc =std::make_unique<CSCTFDTReceiver>();
111 pt1Comp = ibooker.
book2D(
"pt1Comp",
"Hardware Vs. Emulator #Delta #phi_{12}",256,0,256,256,0,256);
113 pt1Comp->setAxisTitle(
"Emulator #Delta #phi_{12}",2);
114 pt2Comp = ibooker.
book2D(
"pt2Comp",
"Hardware Vs. Emulator #Delta #phi_{23}",16,0,16,16,0,16);
116 pt2Comp->setAxisTitle(
"Emulator #Delta #phi_{23}",2);
117 pt3Comp = ibooker.
book2D(
"pt3Comp",
"Hardware Vs. Emulator #eta",16,0,16,16,0,16);
119 pt3Comp->setAxisTitle(
"Emulator #eta",2);
120 pt4Comp = ibooker.
book2D(
"pt4Comp",
"Hardware Vs. Emulator Mode",19,0,19,19,0,19);
122 pt4Comp->setAxisTitle(
"Emulator Mode",2);
124 pt4Comp->setBinLabel(1,
"No Track",1);
125 pt4Comp->setBinLabel(2,
"Bad Phi/Single",1);
126 pt4Comp->setBinLabel(3,
"ME1-2-3",1);
127 pt4Comp->setBinLabel(4,
"ME1-2-4",1);
128 pt4Comp->setBinLabel(5,
"ME1-3-4",1);
129 pt4Comp->setBinLabel(6,
"ME2-3-4",1);
130 pt4Comp->setBinLabel(7,
"ME1-2",1);
131 pt4Comp->setBinLabel(8,
"ME1-3",1);
132 pt4Comp->setBinLabel(9,
"ME2-3",1);
133 pt4Comp->setBinLabel(10,
"ME2-4",1);
134 pt4Comp->setBinLabel(11,
"ME3-4",1);
135 pt4Comp->setBinLabel(12,
"MB1-ME3",1);
136 pt4Comp->setBinLabel(13,
"MB1-ME2",1);
137 pt4Comp->setBinLabel(14,
"ME1-4",1);
138 pt4Comp->setBinLabel(15,
"MB1-ME1",1);
139 pt4Comp->setBinLabel(16,
"Halo Trigger",1);
140 pt4Comp->setBinLabel(17,
"MB1-ME1-2",1);
141 pt4Comp->setBinLabel(18,
"MB1-ME1-3",1);
142 pt4Comp->setBinLabel(19,
"MB1-ME2-3",1);
144 pt4Comp->setBinLabel(1,
"No Track",2);
145 pt4Comp->setBinLabel(2,
"Bad Phi/Single",2);
146 pt4Comp->setBinLabel(3,
"ME1-2-3",2);
147 pt4Comp->setBinLabel(4,
"ME1-2-4",2);
148 pt4Comp->setBinLabel(5,
"ME1-3-4",2);
149 pt4Comp->setBinLabel(6,
"ME2-3-4",2);
150 pt4Comp->setBinLabel(7,
"ME1-2",2);
151 pt4Comp->setBinLabel(8,
"ME1-3",2);
152 pt4Comp->setBinLabel(9,
"ME2-3",2);
153 pt4Comp->setBinLabel(10,
"ME2-4",2);
154 pt4Comp->setBinLabel(11,
"ME3-4",2);
155 pt4Comp->setBinLabel(12,
"MB1-ME3",2);
156 pt4Comp->setBinLabel(13,
"MB1-ME2",2);
157 pt4Comp->setBinLabel(14,
"ME1-4",2);
158 pt4Comp->setBinLabel(15,
"MB1-ME1",2);
159 pt4Comp->setBinLabel(16,
"Halo Trigger",2);
160 pt4Comp->setBinLabel(17,
"MB1-ME1-2",2);
161 pt4Comp->setBinLabel(18,
"MB1-ME1-3",2);
162 pt4Comp->setBinLabel(19,
"MB1-ME2-3",2);
164 pt5Comp = ibooker.
book2D(
"pt5Comp",
"Hardware Vs. Emulator Sign, FR",4,0,4,4,0,4);
166 pt5Comp->setAxisTitle(
"Emulator Sign<<1|FR",2);
169 phiComp = ibooker.
book2D(
"phiComp",
"Hardware Vs. Emulator Track #phi",32,0,32,32,0,32);
171 phiComp->setAxisTitle(
"Emulator #phi",2);
172 etaComp = ibooker.
book2D(
"etaComp",
"Hardware Vs. Emulator Track #eta",32,0,32,32,0,32);
174 etaComp->setAxisTitle(
"Emulator #eta",2);
175 occComp = ibooker.
book2D(
"occComp",
"Hardware Vs. Emulator Track Occupancy",5,0,5,5,0,5);
177 occComp->setAxisTitle(
"Emulator Occupancy",2);
178 ptComp = ibooker.
book2D(
"ptComp",
"Hardware Vs. Emulator Pt",32,0,32,32,0,32);
180 ptComp->setAxisTitle(
"Emulator P_{t}",2);
181 qualComp= ibooker.
book2D(
"qualComp",
"Hardware Vs. Emulator Quality",4,0,4,4,0,4);
183 qualComp->setAxisTitle(
"Emulator Quality",2);
187 dtStubPhi = ibooker.
book2D(
"dtStubPhi",
"Hardware Vs. Emulator DT Stub #phi",200,400,2400,200,400,2400);
189 dtStubPhi->setAxisTitle(
"Emulator Stub #phi",2);
190 badDtStubSector = ibooker.
book2D(
"badDtStubSector",
"Dt Sector for bad Dt stub #phi",6,1,7,2,1,3);
191 badDtStubSector->
setAxisTitle(
"Dt stub sector, subsector",1);
192 badDtStubSector->setAxisTitle(
"Dt Stub Endcap",2);
199 pt1Comp_1d = ibooker.
book1D(
"pt1Comp_1d",
"Hardware Vs. Emulator #Delta #phi_{12}",2,0,2);
201 pt1Comp_1d->setBinLabel(1,
"Agree", 1);
202 pt1Comp_1d->setBinLabel(2,
"Disagree", 1);
204 pt2Comp_1d = ibooker.
book1D(
"pt2Comp_1d",
"Hardware Vs. Emulator #Delta #phi_{23}",2,0,2);
206 pt2Comp_1d->setBinLabel(1,
"Agree", 1);
207 pt2Comp_1d->setBinLabel(2,
"Disagree", 1);
209 pt3Comp_1d = ibooker.
book1D(
"pt3Comp_1d",
"Hardware Vs. Emulator #eta",2,0,2);
211 pt3Comp_1d->setBinLabel(1,
"Agree", 1);
212 pt3Comp_1d->setBinLabel(2,
"Disagree", 1);
214 pt4Comp_1d = ibooker.
book1D(
"pt4Comp_1d",
"Hardware Vs. Emulator Mode",2,0,2);
216 pt4Comp_1d->setBinLabel(1,
"Agree", 1);
217 pt4Comp_1d->setBinLabel(2,
"Disagree", 1);
219 pt5Comp_1d = ibooker.
book1D(
"pt5Comp_1d",
"Hardware Vs. Emulator Sign, FR",2,0,2);
221 pt5Comp_1d->setBinLabel(1,
"Agree", 1);
222 pt5Comp_1d->setBinLabel(2,
"Disagree", 1);
226 phiComp_1d = ibooker.
book1D(
"phiComp_1d",
"Hardware Vs. Emulator Track #phi",2,0,2);
228 phiComp_1d->setBinLabel(1,
"Agree", 1);
229 phiComp_1d->setBinLabel(2,
"Disagree", 1);
231 etaComp_1d = ibooker.
book1D(
"etaComp_1d",
"Hardware Vs. Emulator Track #eta",2,0,2);
233 etaComp_1d->setBinLabel(1,
"Agree", 1);
234 etaComp_1d->setBinLabel(2,
"Disagree", 1);
236 occComp_1d = ibooker.
book1D(
"occComp_1d",
"Hardware Vs. Emulator Track Occupancy",2,0,2);
238 occComp_1d->setBinLabel(1,
"Agree", 1);
239 occComp_1d->setBinLabel(2,
"Disagree", 1);
241 ptComp_1d = ibooker.
book1D(
"ptComp_1d",
"Hardware Vs. Emulator Pt",2,0,2);
243 ptComp_1d->setBinLabel(1,
"Agree", 1);
244 ptComp_1d->setBinLabel(2,
"Disagree", 1);
246 qualComp_1d= ibooker.
book1D(
"qualComp_1d",
"Hardware Vs. Emulator Quality",2,0,2);
248 qualComp_1d->setBinLabel(1,
"Agree", 1);
249 qualComp_1d->setBinLabel(2,
"Disagree", 1);
252 dtStubPhi_1d = ibooker.
book1D(
"dtStubPhi_1d",
"Hardware Vs. Emulator DT Stub #phi",2,0,2);
254 dtStubPhi_1d->setBinLabel(1,
"Agree", 1);
255 dtStubPhi_1d->setBinLabel(2,
"Disagree", 1);
261 unsigned int nDataMuons = 0;
262 unsigned int nEmulMuons = 0;
263 int dataMuonArray[8][10], emuMuonArray[8][10];
266 for(
int par=0; par<3; par++)
268 dataMuonArray[
muon][par]=0;
269 emuMuonArray[
muon][par] =0;
271 emuMuonArray[
muon][3] =-1;
272 dataMuonArray[
muon][3]=-1;
274 emuMuonArray[
muon][4]=7;
275 dataMuonArray[
muon][4]=7;
277 for(
int par2=5; par2<10; par2++)
279 emuMuonArray[
muon][par2]= -1;
280 dataMuonArray[
muon][par2]= -1;
285 if( !dataTrackProducer.isUninitialized())
293 <<
"\n No valid [data tracks] product found: " 294 <<
" L1CSCTrackCollection" 300 for(L1CSCTrackCollection::const_iterator trk=tracks.
product()->begin(); trk!=tracks.
product()->end(); trk++)
304 if ( (trk->first.BX() <2) && (trk->first.BX() > -1) )
308 dataMuonArray[nDataMuons][0] = trk->first.ptLUTAddress();
309 dataMuonArray[nDataMuons][1] = trk->first.sector();
310 dataMuonArray[nDataMuons][2] = trk->first.endcap();
311 dataMuonArray[nDataMuons][8] = trk->first.outputLink();
312 dataMuonArray[nDataMuons][4] = trk->first.BX();
313 dataMuonArray[nDataMuons][5] = trk->first.rank();
314 dataMuonArray[nDataMuons][6] = trk->first.localPhi();
315 dataMuonArray[nDataMuons][7] = trk->first.eta_packed();
316 dataMuonArray[nDataMuons][9] = trk->first.modeExtended();
323 if( !emulTrackProducer.isUninitialized() )
331 <<
"\n No valid [emulator tracks] product found: " 332 <<
" L1CSCTrackCollection" 337 for(L1CSCTrackCollection::const_iterator trk=tracks.
product()->begin(); trk!=tracks.
product()->end(); trk++)
341 if((trk->first.BX() <2) && (trk->first.BX() >-1))
345 emuMuonArray[nEmulMuons][0] = trk->first.ptLUTAddress();
346 emuMuonArray[nEmulMuons][1] = trk->first.sector();
347 emuMuonArray[nEmulMuons][2] = trk->first.endcap();
348 emuMuonArray[nEmulMuons][4] = trk->first.BX();
349 emuMuonArray[nEmulMuons][5] = trk->first.rank();
350 emuMuonArray[nEmulMuons][6] = trk->first.localPhi();
351 emuMuonArray[nEmulMuons][7] = trk->first.eta_packed();
352 emuMuonArray[nEmulMuons][9] = trk->first.modeExtended();
358 if( (nDataMuons!=0)||(nEmulMuons!=0) ) {
359 occComp->Fill(nDataMuons,nEmulMuons);
360 (nDataMuons==nEmulMuons) ? occComp_1d->Fill(0) : occComp_1d->Fill(1);
364 if(nDataMuons==nEmulMuons)
367 for(
unsigned int mu1=0; mu1<nDataMuons; mu1++)
369 for(
unsigned int mu2=0; mu2<nEmulMuons; mu2++)
370 if((emuMuonArray[mu2][1]==dataMuonArray[mu1][1])&&(emuMuonArray[mu2][2]==dataMuonArray[mu1][2]))
372 if(emuMuonArray[mu2][0]==dataMuonArray[mu1][0])
374 emuMuonArray[mu2][3]=mu1;
375 dataMuonArray[mu1][3]=1;
380 for(
unsigned int c2a=0; c2a<nEmulMuons; c2a++)
382 if(emuMuonArray[c2a][3]==-1)
384 for(
unsigned int cor_a=0; cor_a<nDataMuons; cor_a++)
386 if( (dataMuonArray[cor_a][1]==emuMuonArray[c2a][1]) && (dataMuonArray[cor_a][2]==emuMuonArray[c2a][2]))
388 emuMuonArray[c2a][3]=cor_a;
389 dataMuonArray[cor_a][3]=1;
395 bool multiMap =
false;
398 for(
unsigned int c1a=0; c1a<(nEmulMuons-1); c1a++)
400 for(
unsigned int c1b=(c1a+1); c1b<nEmulMuons; c1b++)
402 if(emuMuonArray[c1a][3]==emuMuonArray[c1b][3])
414 for(
unsigned int mu3=0; mu3<nEmulMuons; mu3++)
416 int mapping = emuMuonArray[mu3][3];
417 if((mapping!=-1)&&(multiMap==
false))
420 int emuPhi12 = (0x0000ff & emuMuonArray[mu3][0]);
421 int datPhi12 = (0x0000ff & dataMuonArray[
mapping][0]);
422 int emuPhi23 = (0x000f00 & emuMuonArray[mu3][0])>>8;
423 int datPhi23 = (0x000f00 & dataMuonArray[
mapping][0])>>8;
424 int emuEta = (0x00f000 & emuMuonArray[mu3][0])>>12;
425 int datEta = (0x00f000 & dataMuonArray[
mapping][0])>>12;
428 int emuFrSin = (0xf00000 & emuMuonArray[mu3][0])>>20;
429 int datFrSin = (0xf00000 & dataMuonArray[
mapping][0])>>20;
431 int emuQual = emuMuonArray[mu3][5]>>5;
432 int datQual = dataMuonArray[
mapping][5]>>5;
433 int emuPt = 0x1f & emuMuonArray[mu3][5];
434 int datPt = 0x1f & dataMuonArray[
mapping][5];
435 int emuModeExtended = emuMuonArray[mu3][9];
436 int datModeExtended = dataMuonArray[
mapping][9];
439 pt4Comp->Fill(datModeExtended,emuModeExtended);
440 (datModeExtended==emuModeExtended) ? pt4Comp_1d->Fill(0) : pt4Comp_1d->Fill(1);
442 if(emuModeExtended==datModeExtended)
445 pt1Comp->Fill(datPhi12,emuPhi12); (datPhi12==emuPhi12) ? pt1Comp_1d->Fill(0) : pt1Comp_1d->Fill(1);
446 pt2Comp->Fill(datPhi23,emuPhi23); (datPhi23==emuPhi23) ? pt2Comp_1d->Fill(0) : pt2Comp_1d->Fill(1);
447 pt3Comp->Fill(datEta,emuEta); (datEta==emuEta) ? pt3Comp_1d->Fill(0) : pt3Comp_1d->Fill(1);
448 pt5Comp->Fill(datFrSin,emuFrSin); (datFrSin==emuFrSin) ? pt5Comp_1d->Fill(0) : pt5Comp_1d->Fill(1);
450 if(dataMuonArray[mapping][8]==1)
452 ptComp->Fill(datPt,emuPt); (datPt==emuPt) ? ptComp_1d->Fill(0) : ptComp_1d->Fill(1);
453 qualComp->Fill(datQual,emuQual);(datQual==emuQual) ? qualComp_1d->Fill(0) : qualComp_1d->Fill(1);
455 phiComp->Fill(dataMuonArray[mapping][6],emuMuonArray[mu3][6]);
456 etaComp->Fill(dataMuonArray[mapping][7],emuMuonArray[mu3][7]);
458 (dataMuonArray[
mapping][6]==emuMuonArray[mu3][6]) ? phiComp_1d->Fill(0) : phiComp_1d->Fill(1);
459 (dataMuonArray[
mapping][7]==emuMuonArray[mu3][7]) ? etaComp_1d->Fill(0) : etaComp_1d->Fill(1);
472 for(
int dJ=0; dJ<7; dJ++)
474 for(
int dK=0; dK<15; dK++)
476 eDtStub[dJ][dK] = -55;
477 dDtStub[dJ][dK] = -55;
478 dDtStub[7][dK] = -55;
483 if( !dataStubProducer.isUninitialized() )
490 <<
"\n No valid [Data Stubs] product found: " 491 <<
" L1CSCTrackCollection" 498 vector<csctf::TrackStub> stuList = stub_list.
get();
499 vector<csctf::TrackStub>::const_iterator stu= stuList.begin();
500 for(; stu!=stuList.end(); stu++)
504 if((stu->BX()>4) && (stu->BX()<9))
506 dDtStub[0][dDtCounter] = stu->phiPacked();
507 dDtStub[1][dDtCounter] = stu->getQuality();
508 dDtStub[2][dDtCounter] = stu->endcap();
509 dDtStub[3][dDtCounter] = stu->sector();
510 dDtStub[4][dDtCounter] = stu->subsector();
517 if( !emulStubProducer.isUninitialized() )
525 <<
"\n No valid [Data Stubs] product found: " 526 <<
" L1CSCTrackCollection" 531 vector<csctf::TrackStub> emuList = emulStub.
get();
532 vector<csctf::TrackStub>::const_iterator eStu=emuList.begin();
533 for(; eStu!=emuList.end(); eStu++)
537 if((eStu->BX()>4) && (eStu->BX()<9) )
539 eDtStub[0][eDtCounter] = eStu->phiPacked();
540 eDtStub[1][eDtCounter] = eStu->getQuality();
541 eDtStub[2][eDtCounter] = eStu->endcap();
542 eDtStub[3][eDtCounter] = eStu->sector();
543 eDtStub[4][eDtCounter] = eStu->subsector();
551 for(
int eS=0; eS<eDtCounter; eS++)
554 for(
int dS=0; dS<dDtCounter; dS++)
557 if(eDtStub[2][eS]==dDtStub[2][dS])
560 if(eDtStub[3][eS]==dDtStub[3][dS])
563 if(eDtStub[4][eS]==dDtStub[4][dS])
566 if( (eDtStub[0][eS]==dDtStub[0][dS]) && (eDtStub[1][eS]==dDtStub[1][dS]) && (eDtStub[6][eS]!=1) && (dDtStub[6][dS]!=1) )
581 for(
int eS2=0; eS2<eDtCounter; eS2++)
583 for(
int dS2=0; dS2<dDtCounter; dS2++)
586 if( (eDtStub[2][eS2]==dDtStub[2][dS2]) && (eDtStub[3][eS2]==dDtStub[3][dS2]) && (eDtStub[4][eS2]==dDtStub[4][dS2]) )
589 if( ((dDtStub[7][eS2]==-55) || (dDtStub[7][dS2]>(
abs(eDtStub[0][eS2]-dDtStub[0][dS2]))) ) && (eDtStub[6][eS2]!=1) && (dDtStub[6][dS2]!=1) )
592 dDtStub[5][dS2] = eS2;
594 eDtStub[5][eS2] = dS2;
596 dDtStub[7][dS2] =
abs(eDtStub[0][eS2]-dDtStub[0][dS2]);
603 bool dtSMulti =
false;
606 for(
int eS3a=0; eS3a<eDtCounter-1; eS3a++)
607 for(
int eS3b=eS3a+1; eS3b<eDtCounter; eS3b++)
609 if( eDtStub[5][eS3a]==eDtStub[5][eS3b] ) dtSMulti=
true;
610 if( eDtStub[5][eS3a]==-55 || eDtStub[5][eS3b]==-55 ) dtUnmap++;
614 for(
int dS3a=0; dS3a<dDtCounter-1; dS3a++)
615 for(
int dS3b=dS3a+1; dS3b<dDtCounter; dS3b++)
617 if( dDtStub[5][dS3a]==dDtStub[5][dS3b] ) dtSMulti=
true;
618 if( dDtStub[5][dS3a]==-55||dDtStub[5][dS3b]==-55 ) dtUnmap++;
625 if(dtSMulti==
false && dtUnmap==0)
627 for(
int phil=0; phil<eDtCounter; phil++)
629 if(eDtStub[6][phil]==1 || eDtStub[6][phil]==2)
631 int indexFil = eDtStub[3][phil]*2+eDtStub[4][phil]-1;
632 dtStubPhi->Fill(eDtStub[0][phil], dDtStub[0][ eDtStub[5][phil] ]);
633 (eDtStub[0][phil] == dDtStub[0][ eDtStub[5][phil] ]) ? dtStubPhi_1d->Fill(0) : dtStubPhi_1d->Fill(1);
634 if( eDtStub[0][phil] != dDtStub[0][ eDtStub[5][phil] ])
635 badDtStubSector->Fill(indexFil,eDtStub[2][phil]);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< T > get() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
void analyze(edm::Event const &e, edm::EventSetup const &iSetup) override
L1TdeCSCTF(edm::ParameterSet const &pset)
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
void push_many(const std::vector< T > &data)
virtual void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)