43 m_dirName =
pset.getUntrackedParameter(
"DQMFolder",
string(
"L1TEMU/CSCTFexpert"));
47 outFile =
pset.getUntrackedParameter<
string>(
"outFile",
"");
49 LogWarning(
"L1TdeCSCTF") <<
"L1T Monitoring histograms will be saved to " <<
outFile.c_str() << endl;
52 bool disable =
pset.getUntrackedParameter<
bool>(
"disableROOToutput",
false);
83 my_dtrc = std::make_unique<CSCTFDTReceiver>();
98 pt1Comp = ibooker.
book2D(
"pt1Comp",
"Hardware Vs. Emulator #Delta #phi_{12}", 256, 0, 256, 256, 0, 256);
100 pt1Comp->setAxisTitle(
"Emulator #Delta #phi_{12}", 2);
101 pt2Comp = ibooker.
book2D(
"pt2Comp",
"Hardware Vs. Emulator #Delta #phi_{23}", 16, 0, 16, 16, 0, 16);
103 pt2Comp->setAxisTitle(
"Emulator #Delta #phi_{23}", 2);
104 pt3Comp = ibooker.
book2D(
"pt3Comp",
"Hardware Vs. Emulator #eta", 16, 0, 16, 16, 0, 16);
106 pt3Comp->setAxisTitle(
"Emulator #eta", 2);
107 pt4Comp = ibooker.
book2D(
"pt4Comp",
"Hardware Vs. Emulator Mode", 19, 0, 19, 19, 0, 19);
109 pt4Comp->setAxisTitle(
"Emulator Mode", 2);
111 pt4Comp->setBinLabel(1,
"No Track", 1);
112 pt4Comp->setBinLabel(2,
"Bad Phi/Single", 1);
113 pt4Comp->setBinLabel(3,
"ME1-2-3", 1);
114 pt4Comp->setBinLabel(4,
"ME1-2-4", 1);
115 pt4Comp->setBinLabel(5,
"ME1-3-4", 1);
116 pt4Comp->setBinLabel(6,
"ME2-3-4", 1);
117 pt4Comp->setBinLabel(7,
"ME1-2", 1);
118 pt4Comp->setBinLabel(8,
"ME1-3", 1);
119 pt4Comp->setBinLabel(9,
"ME2-3", 1);
120 pt4Comp->setBinLabel(10,
"ME2-4", 1);
121 pt4Comp->setBinLabel(11,
"ME3-4", 1);
122 pt4Comp->setBinLabel(12,
"MB1-ME3", 1);
123 pt4Comp->setBinLabel(13,
"MB1-ME2", 1);
124 pt4Comp->setBinLabel(14,
"ME1-4", 1);
125 pt4Comp->setBinLabel(15,
"MB1-ME1", 1);
126 pt4Comp->setBinLabel(16,
"Halo Trigger", 1);
127 pt4Comp->setBinLabel(17,
"MB1-ME1-2", 1);
128 pt4Comp->setBinLabel(18,
"MB1-ME1-3", 1);
129 pt4Comp->setBinLabel(19,
"MB1-ME2-3", 1);
131 pt4Comp->setBinLabel(1,
"No Track", 2);
132 pt4Comp->setBinLabel(2,
"Bad Phi/Single", 2);
133 pt4Comp->setBinLabel(3,
"ME1-2-3", 2);
134 pt4Comp->setBinLabel(4,
"ME1-2-4", 2);
135 pt4Comp->setBinLabel(5,
"ME1-3-4", 2);
136 pt4Comp->setBinLabel(6,
"ME2-3-4", 2);
137 pt4Comp->setBinLabel(7,
"ME1-2", 2);
138 pt4Comp->setBinLabel(8,
"ME1-3", 2);
139 pt4Comp->setBinLabel(9,
"ME2-3", 2);
140 pt4Comp->setBinLabel(10,
"ME2-4", 2);
141 pt4Comp->setBinLabel(11,
"ME3-4", 2);
142 pt4Comp->setBinLabel(12,
"MB1-ME3", 2);
143 pt4Comp->setBinLabel(13,
"MB1-ME2", 2);
144 pt4Comp->setBinLabel(14,
"ME1-4", 2);
145 pt4Comp->setBinLabel(15,
"MB1-ME1", 2);
146 pt4Comp->setBinLabel(16,
"Halo Trigger", 2);
147 pt4Comp->setBinLabel(17,
"MB1-ME1-2", 2);
148 pt4Comp->setBinLabel(18,
"MB1-ME1-3", 2);
149 pt4Comp->setBinLabel(19,
"MB1-ME2-3", 2);
151 pt5Comp = ibooker.
book2D(
"pt5Comp",
"Hardware Vs. Emulator Sign, FR", 4, 0, 4, 4, 0, 4);
153 pt5Comp->setAxisTitle(
"Emulator Sign<<1|FR", 2);
156 phiComp = ibooker.
book2D(
"phiComp",
"Hardware Vs. Emulator Track #phi", 32, 0, 32, 32, 0, 32);
158 phiComp->setAxisTitle(
"Emulator #phi", 2);
159 etaComp = ibooker.
book2D(
"etaComp",
"Hardware Vs. Emulator Track #eta", 32, 0, 32, 32, 0, 32);
161 etaComp->setAxisTitle(
"Emulator #eta", 2);
162 occComp = ibooker.
book2D(
"occComp",
"Hardware Vs. Emulator Track Occupancy", 5, 0, 5, 5, 0, 5);
164 occComp->setAxisTitle(
"Emulator Occupancy", 2);
165 ptComp = ibooker.
book2D(
"ptComp",
"Hardware Vs. Emulator Pt", 32, 0, 32, 32, 0, 32);
167 ptComp->setAxisTitle(
"Emulator P_{t}", 2);
168 qualComp = ibooker.
book2D(
"qualComp",
"Hardware Vs. Emulator Quality", 4, 0, 4, 4, 0, 4);
170 qualComp->setAxisTitle(
"Emulator Quality", 2);
173 dtStubPhi = ibooker.
book2D(
"dtStubPhi",
"Hardware Vs. Emulator DT Stub #phi", 200, 400, 2400, 200, 400, 2400);
175 dtStubPhi->setAxisTitle(
"Emulator Stub #phi", 2);
176 badDtStubSector = ibooker.
book2D(
"badDtStubSector",
"Dt Sector for bad Dt stub #phi", 6, 1, 7, 2, 1, 3);
177 badDtStubSector->
setAxisTitle(
"Dt stub sector, subsector", 1);
178 badDtStubSector->setAxisTitle(
"Dt Stub Endcap", 2);
185 pt1Comp_1d = ibooker.
book1D(
"pt1Comp_1d",
"Hardware Vs. Emulator #Delta #phi_{12}", 2, 0, 2);
187 pt1Comp_1d->setBinLabel(1,
"Agree", 1);
188 pt1Comp_1d->setBinLabel(2,
"Disagree", 1);
190 pt2Comp_1d = ibooker.
book1D(
"pt2Comp_1d",
"Hardware Vs. Emulator #Delta #phi_{23}", 2, 0, 2);
192 pt2Comp_1d->setBinLabel(1,
"Agree", 1);
193 pt2Comp_1d->setBinLabel(2,
"Disagree", 1);
195 pt3Comp_1d = ibooker.
book1D(
"pt3Comp_1d",
"Hardware Vs. Emulator #eta", 2, 0, 2);
197 pt3Comp_1d->setBinLabel(1,
"Agree", 1);
198 pt3Comp_1d->setBinLabel(2,
"Disagree", 1);
200 pt4Comp_1d = ibooker.
book1D(
"pt4Comp_1d",
"Hardware Vs. Emulator Mode", 2, 0, 2);
202 pt4Comp_1d->setBinLabel(1,
"Agree", 1);
203 pt4Comp_1d->setBinLabel(2,
"Disagree", 1);
205 pt5Comp_1d = ibooker.
book1D(
"pt5Comp_1d",
"Hardware Vs. Emulator Sign, FR", 2, 0, 2);
207 pt5Comp_1d->setBinLabel(1,
"Agree", 1);
208 pt5Comp_1d->setBinLabel(2,
"Disagree", 1);
211 phiComp_1d = ibooker.
book1D(
"phiComp_1d",
"Hardware Vs. Emulator Track #phi", 2, 0, 2);
213 phiComp_1d->setBinLabel(1,
"Agree", 1);
214 phiComp_1d->setBinLabel(2,
"Disagree", 1);
216 etaComp_1d = ibooker.
book1D(
"etaComp_1d",
"Hardware Vs. Emulator Track #eta", 2, 0, 2);
218 etaComp_1d->setBinLabel(1,
"Agree", 1);
219 etaComp_1d->setBinLabel(2,
"Disagree", 1);
221 occComp_1d = ibooker.
book1D(
"occComp_1d",
"Hardware Vs. Emulator Track Occupancy", 2, 0, 2);
223 occComp_1d->setBinLabel(1,
"Agree", 1);
224 occComp_1d->setBinLabel(2,
"Disagree", 1);
226 ptComp_1d = ibooker.
book1D(
"ptComp_1d",
"Hardware Vs. Emulator Pt", 2, 0, 2);
228 ptComp_1d->setBinLabel(1,
"Agree", 1);
229 ptComp_1d->setBinLabel(2,
"Disagree", 1);
231 qualComp_1d = ibooker.
book1D(
"qualComp_1d",
"Hardware Vs. Emulator Quality", 2, 0, 2);
233 qualComp_1d->setBinLabel(1,
"Agree", 1);
234 qualComp_1d->setBinLabel(2,
"Disagree", 1);
237 dtStubPhi_1d = ibooker.
book1D(
"dtStubPhi_1d",
"Hardware Vs. Emulator DT Stub #phi", 2, 0, 2);
239 dtStubPhi_1d->setBinLabel(1,
"Agree", 1);
240 dtStubPhi_1d->setBinLabel(2,
"Disagree", 1);
246 unsigned int nDataMuons = 0;
247 unsigned int nEmulMuons = 0;
248 int dataMuonArray[8][10], emuMuonArray[8][10];
250 for (
int par = 0; par < 3; par++) {
251 dataMuonArray[
muon][par] = 0;
252 emuMuonArray[
muon][par] = 0;
254 emuMuonArray[
muon][3] = -1;
255 dataMuonArray[
muon][3] = -1;
257 emuMuonArray[
muon][4] = 7;
258 dataMuonArray[
muon][4] = 7;
273 LogWarning(
"L1TdeCSCTF") <<
"\n No valid [data tracks] product found: " 274 <<
" L1CSCTrackCollection" << endl;
278 for (L1CSCTrackCollection::const_iterator trk =
tracks.product()->begin(); trk !=
tracks.product()->end(); trk++) {
281 if ((trk->first.BX() < 2) && (trk->first.BX() > -1)) {
284 dataMuonArray[nDataMuons][0] = trk->first.ptLUTAddress();
285 dataMuonArray[nDataMuons][1] = trk->first.sector();
286 dataMuonArray[nDataMuons][2] = trk->first.endcap();
287 dataMuonArray[nDataMuons][8] = trk->first.outputLink();
288 dataMuonArray[nDataMuons][4] = trk->first.BX();
289 dataMuonArray[nDataMuons][5] = trk->first.rank();
290 dataMuonArray[nDataMuons][6] = trk->first.localPhi();
291 dataMuonArray[nDataMuons][7] = trk->first.eta_packed();
292 dataMuonArray[nDataMuons][9] = trk->first.modeExtended();
305 LogWarning(
"L1TdeCSCTF") <<
"\n No valid [emulator tracks] product found: " 306 <<
" L1CSCTrackCollection" << endl;
310 for (L1CSCTrackCollection::const_iterator trk =
tracks.product()->begin(); trk !=
tracks.product()->end(); trk++) {
313 if ((trk->first.BX() < 2) && (trk->first.BX() > -1)) {
316 emuMuonArray[nEmulMuons][0] = trk->first.ptLUTAddress();
317 emuMuonArray[nEmulMuons][1] = trk->first.sector();
318 emuMuonArray[nEmulMuons][2] = trk->first.endcap();
319 emuMuonArray[nEmulMuons][4] = trk->first.BX();
320 emuMuonArray[nEmulMuons][5] = trk->first.rank();
321 emuMuonArray[nEmulMuons][6] = trk->first.localPhi();
322 emuMuonArray[nEmulMuons][7] = trk->first.eta_packed();
323 emuMuonArray[nEmulMuons][9] = trk->first.modeExtended();
329 if ((nDataMuons != 0) || (nEmulMuons != 0)) {
330 occComp->Fill(nDataMuons, nEmulMuons);
331 (nDataMuons == nEmulMuons) ? occComp_1d->Fill(0) : occComp_1d->Fill(1);
335 if (nDataMuons == nEmulMuons) {
337 for (
unsigned int mu1 = 0; mu1 < nDataMuons; mu1++) {
338 for (
unsigned int mu2 = 0; mu2 < nEmulMuons; mu2++)
339 if ((emuMuonArray[mu2][1] == dataMuonArray[mu1][1]) && (emuMuonArray[mu2][2] == dataMuonArray[mu1][2])) {
340 if (emuMuonArray[mu2][0] == dataMuonArray[mu1][0]) {
341 emuMuonArray[mu2][3] = mu1;
342 dataMuonArray[mu1][3] = 1;
347 for (
unsigned int c2a = 0; c2a < nEmulMuons; c2a++) {
348 if (emuMuonArray[c2a][3] == -1) {
349 for (
unsigned int cor_a = 0; cor_a < nDataMuons; cor_a++) {
350 if ((dataMuonArray[cor_a][1] == emuMuonArray[c2a][1]) &&
351 (dataMuonArray[cor_a][2] == emuMuonArray[c2a][2]))
353 emuMuonArray[c2a][3] = cor_a;
354 dataMuonArray[cor_a][3] = 1;
360 bool multiMap =
false;
361 if (nEmulMuons > 1) {
362 for (
unsigned int c1a = 0; c1a < (nEmulMuons - 1); c1a++) {
363 for (
unsigned int c1b = (c1a + 1); c1b < nEmulMuons; c1b++) {
364 if (emuMuonArray[c1a][3] == emuMuonArray[c1b][3]) {
375 for (
unsigned int mu3 = 0; mu3 < nEmulMuons; mu3++) {
376 int mapping = emuMuonArray[mu3][3];
377 if ((
mapping != -1) && (multiMap ==
false)) {
379 int emuPhi12 = (0x0000ff & emuMuonArray[mu3][0]);
380 int datPhi12 = (0x0000ff & dataMuonArray[
mapping][0]);
381 int emuPhi23 = (0x000f00 & emuMuonArray[mu3][0]) >> 8;
382 int datPhi23 = (0x000f00 & dataMuonArray[
mapping][0]) >> 8;
383 int emuEta = (0x00f000 & emuMuonArray[mu3][0]) >> 12;
384 int datEta = (0x00f000 & dataMuonArray[
mapping][0]) >> 12;
387 int emuFrSin = (0xf00000 & emuMuonArray[mu3][0]) >> 20;
388 int datFrSin = (0xf00000 & dataMuonArray[
mapping][0]) >> 20;
390 int emuQual = emuMuonArray[mu3][5] >> 5;
391 int datQual = dataMuonArray[
mapping][5] >> 5;
392 int emuPt = 0x1f & emuMuonArray[mu3][5];
393 int datPt = 0x1f & dataMuonArray[
mapping][5];
394 int emuModeExtended = emuMuonArray[mu3][9];
395 int datModeExtended = dataMuonArray[
mapping][9];
398 pt4Comp->Fill(datModeExtended, emuModeExtended);
399 (datModeExtended == emuModeExtended) ? pt4Comp_1d->Fill(0) : pt4Comp_1d->Fill(1);
401 if (emuModeExtended == datModeExtended) {
403 pt1Comp->Fill(datPhi12, emuPhi12);
404 (datPhi12 == emuPhi12) ? pt1Comp_1d->Fill(0) : pt1Comp_1d->Fill(1);
405 pt2Comp->Fill(datPhi23, emuPhi23);
406 (datPhi23 == emuPhi23) ? pt2Comp_1d->Fill(0) : pt2Comp_1d->Fill(1);
407 pt3Comp->Fill(datEta, emuEta);
408 (datEta == emuEta) ? pt3Comp_1d->Fill(0) : pt3Comp_1d->Fill(1);
409 pt5Comp->Fill(datFrSin, emuFrSin);
410 (datFrSin == emuFrSin) ? pt5Comp_1d->Fill(0) : pt5Comp_1d->Fill(1);
412 if (dataMuonArray[
mapping][8] == 1)
414 ptComp->Fill(datPt, emuPt);
415 (datPt == emuPt) ? ptComp_1d->Fill(0) : ptComp_1d->Fill(1);
416 qualComp->Fill(datQual, emuQual);
417 (datQual == emuQual) ? qualComp_1d->Fill(0) : qualComp_1d->Fill(1);
419 phiComp->Fill(dataMuonArray[
mapping][6], emuMuonArray[mu3][6]);
420 etaComp->Fill(dataMuonArray[
mapping][7], emuMuonArray[mu3][7]);
422 (dataMuonArray[
mapping][6] == emuMuonArray[mu3][6]) ? phiComp_1d->Fill(0) : phiComp_1d->Fill(1);
423 (dataMuonArray[
mapping][7] == emuMuonArray[mu3][7]) ? etaComp_1d->Fill(0) : etaComp_1d->Fill(1);
436 for (
int dJ = 0; dJ < 7; dJ++) {
437 for (
int dK = 0; dK < 15; dK++) {
438 eDtStub[dJ][dK] = -55;
439 dDtStub[dJ][dK] = -55;
440 dDtStub[7][dK] = -55;
450 LogWarning(
"L1TdeCSCTF") <<
"\n No valid [Data Stubs] product found: " 451 <<
" L1CSCTrackCollection" << endl;
457 vector<csctf::TrackStub> stuList = stub_list.
get();
458 vector<csctf::TrackStub>::const_iterator stu = stuList.begin();
459 for (; stu != stuList.end(); stu++) {
460 if (dDtCounter >= 15)
462 if ((stu->BX() > 4) && (stu->BX() < 9)) {
463 dDtStub[0][dDtCounter] = stu->phiPacked();
464 dDtStub[1][dDtCounter] = stu->getQuality();
465 dDtStub[2][dDtCounter] = stu->endcap();
466 dDtStub[3][dDtCounter] = stu->sector();
467 dDtStub[4][dDtCounter] = stu->subsector();
480 LogWarning(
"L1TdeCSCTF") <<
"\n No valid [Data Stubs] product found: " 481 <<
" L1CSCTrackCollection" << endl;
485 vector<csctf::TrackStub> emuList = emulStub.
get();
486 vector<csctf::TrackStub>::const_iterator eStu = emuList.begin();
487 for (; eStu != emuList.end(); eStu++) {
488 if (eDtCounter >= 15)
490 if ((eStu->BX() > 4) && (eStu->BX() < 9)) {
491 eDtStub[0][eDtCounter] = eStu->phiPacked();
492 eDtStub[1][eDtCounter] = eStu->getQuality();
493 eDtStub[2][eDtCounter] = eStu->endcap();
494 eDtStub[3][eDtCounter] = eStu->sector();
495 eDtStub[4][eDtCounter] = eStu->subsector();
503 for (
int eS = 0; eS < eDtCounter; eS++) {
505 for (
int dS = 0; dS < dDtCounter; dS++) {
507 if (eDtStub[2][eS] == dDtStub[2][dS]) {
509 if (eDtStub[3][eS] == dDtStub[3][dS]) {
511 if (eDtStub[4][eS] == dDtStub[4][dS]) {
513 if ((eDtStub[0][eS] == dDtStub[0][dS]) && (eDtStub[1][eS] == dDtStub[1][dS]) && (eDtStub[6][eS] != 1) &&
514 (dDtStub[6][dS] != 1)) {
528 for (
int eS2 = 0; eS2 < eDtCounter; eS2++) {
529 for (
int dS2 = 0; dS2 < dDtCounter; dS2++) {
531 if ((eDtStub[2][eS2] == dDtStub[2][dS2]) && (eDtStub[3][eS2] == dDtStub[3][dS2]) &&
532 (eDtStub[4][eS2] == dDtStub[4][dS2])) {
534 if (((dDtStub[7][eS2] == -55) || (dDtStub[7][dS2] > (
abs(eDtStub[0][eS2] - dDtStub[0][dS2])))) &&
535 (eDtStub[6][eS2] != 1) && (dDtStub[6][dS2] != 1)) {
537 dDtStub[5][dS2] = eS2;
539 eDtStub[5][eS2] = dS2;
541 dDtStub[7][dS2] =
abs(eDtStub[0][eS2] - dDtStub[0][dS2]);
548 bool dtSMulti =
false;
551 for (
int eS3a = 0; eS3a < eDtCounter - 1; eS3a++)
552 for (
int eS3b = eS3a + 1; eS3b < eDtCounter; eS3b++) {
553 if (eDtStub[5][eS3a] == eDtStub[5][eS3b])
555 if (eDtStub[5][eS3a] == -55 || eDtStub[5][eS3b] == -55)
560 for (
int dS3a = 0; dS3a < dDtCounter - 1; dS3a++)
561 for (
int dS3b = dS3a + 1; dS3b < dDtCounter; dS3b++) {
562 if (dDtStub[5][dS3a] == dDtStub[5][dS3b])
564 if (dDtStub[5][dS3a] == -55 || dDtStub[5][dS3b] == -55)
572 if (dtSMulti ==
false && dtUnmap == 0) {
573 for (
int phil = 0; phil < eDtCounter; phil++) {
574 if (eDtStub[6][phil] == 1 || eDtStub[6][phil] == 2) {
575 int indexFil = eDtStub[3][phil] * 2 + eDtStub[4][phil] - 1;
576 dtStubPhi->Fill(eDtStub[0][phil], dDtStub[0][eDtStub[5][phil]]);
577 (eDtStub[0][phil] == dDtStub[0][eDtStub[5][phil]]) ? dtStubPhi_1d->Fill(0) : dtStubPhi_1d->Fill(1);
578 if (eDtStub[0][phil] != dDtStub[0][eDtStub[5][phil]])
579 badDtStubSector->Fill(indexFil, eDtStub[2][phil]);
virtual void setCurrentFolder(std::string const &fullpath)
T const * product() const
std::vector< T > get() const
void analyze(edm::Event const &e, edm::EventSetup const &iSetup) override
L1TdeCSCTF(edm::ParameterSet const &pset)
Abs< T >::type abs(const T &t)
void push_many(const std::vector< T > &data)
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override
auto const & tracks
cannot be loose
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)