22 m_runInEventLoop(ps.getUntrackedParameter<
bool>(
"runInEventLoop",
false)),
23 m_runInEndLumi(ps.getUntrackedParameter<
bool>(
"runInEndLumi",
false)),
24 verbose_(ps.getUntrackedParameter<
bool>(
"verbose",
false)),
41 const int TotalNrBinsLs = 1000;
42 const double totalNrBinsLs = static_cast<double>(TotalNrBinsLs);
46 algo_bits = ibooker.
book1D(
"algo_bits",
"GT algorithm trigger bits", 128, -0.5, 127.5);
50 ibooker.
book2D(
"algo_bits_corr",
"GT algorithm trigger bit correlation", 128, -0.5, 127.5, 128, -0.5, 127.5);
54 tt_bits = ibooker.
book1D(
"tt_bits",
"GT technical trigger bits", 64, -0.5, 63.5);
57 tt_bits_corr = ibooker.
book2D(
"tt_bits_corr",
"GT technical trigger bit correlation", 64, -0.5, 63.5, 64, -0.5, 63.5);
62 "algo_tt_bits_corr",
"GT algorithm - technical trigger bit correlation", 128, -0.5, 127.5, 64, -0.5, 63.5);
67 "algo_bits_lumi",
"GT algorithm trigger bit rate per LS", TotalNrBinsLs, 0., totalNrBinsLs, 128, -0.5, 127.5);
72 "tt_bits_lumi",
"GT technical trigger bit rate per LS", TotalNrBinsLs, 0., totalNrBinsLs, 64, -0.5, 63.5);
85 event_number = ibooker.
book1D(
"event_number",
"GT event number (from last resync)", 100, 0., 50000.);
89 "event_lumi",
"GT event number (from last resync) vs LS", TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e15,
"s");
93 trigger_number = ibooker.
book1D(
"trigger_number",
"GT trigger number (from start run)", 100, 0., 50000.);
97 "GT trigger number (from start run) vs LS",
109 "evnum_trignum_lumi",
"GT event/trigger number ratio vs LS", TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 2.,
"s");
114 "orbit_lumi",
"GT orbit number vs LS", TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e15,
"s");
119 "setupversion_lumi",
"GT setup version vs LS", TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e10,
"i");
123 gtfe_bx = ibooker.
book1D(
"gtfe_bx",
"GTFE Bx number", 3600, 0., 3600.);
127 ibooker.
bookProfile(
"dbx_module",
"delta Bx of GT modules wrt GTFE", 20, 0., 20., 100, -4000., 4000.,
"i");
151 ibooker.
book2D(
"BST_MasterStatus",
"BST master status over LS", TotalNrBinsLs, 0., totalNrBinsLs, 6, -1., 5.);
158 ibooker.
book2D(
"BST_turnCountNumber",
"BST turn count over LS", TotalNrBinsLs, 0., totalNrBinsLs, 250, 0., 4.3e9);
165 BST_beamMode = ibooker.
book2D(
"BST_beamMode",
"BST beam mode over LS", TotalNrBinsLs, 0., totalNrBinsLs, 25, 1., 26.);
191 ibooker.
book2D(
"BST_beamMomentum",
"BST beam momentum", TotalNrBinsLs, 0., totalNrBinsLs, 100, 0., 7200.);
195 gpsfreq = ibooker.
book1D(
"gpsfreq",
"Clock frequency measured by GPS", 1000, 39.95, 40.2);
198 gpsfreqwide = ibooker.
book1D(
"gpsfreqwide",
"Clock frequency measured by GPS", 1000, -2., 200.);
202 "gpsfreqlum",
"Clock frequency measured by GPS", TotalNrBinsLs, 0., totalNrBinsLs, 100, 39.95, 40.2);
207 ibooker.
book2D(
"BST_intensityBeam1",
"Intensity beam 1", TotalNrBinsLs, 0., totalNrBinsLs, 1000, 0., 5000.);
212 ibooker.
book2D(
"BST_intensityBeam2",
"Intensity beam 2", TotalNrBinsLs, 0., totalNrBinsLs, 1000, 0., 5000.);
219 "L1PrescaleFactorSet",
"Index of L1 prescale factor set", TotalNrBinsLs, 0., totalNrBinsLs, 25, 0., 25.);
223 ibooker.
book1D(
"L1PfIndicesPerLs",
"Number of prescale factor indices used per LS", 10, 0., 10.);
233 "Orbit number difference (TCS - EVM_FDL)",
240 "LS number difference (TCS - EVM_FDL)",
249 "Orbit number difference (TCS - EVM_FDL)",
260 "LS number difference (TCS - EVM_FDL)",
283 h_L1AlgoBX1 = ibooker.
book2D(
"h_L1AlgoBX1",
"L1 Algo Trigger BX (algo bit 0 to 31)", 32, -0.5, 31.5, 5, -2.5, 2.5);
284 h_L1AlgoBX2 = ibooker.
book2D(
"h_L1AlgoBX2",
"L1 Algo Trigger BX (algo bit 32 to 63)", 32, 31.5, 63.5, 5, -2.5, 2.5);
285 h_L1AlgoBX3 = ibooker.
book2D(
"h_L1AlgoBX3",
"L1 Algo Trigger BX (algo bit 64 to 95)", 32, 63.5, 95.5, 5, -2.5, 2.5);
286 h_L1AlgoBX4 = ibooker.
book2D(
"h_L1AlgoBX4",
"L1 Algo Trigger BX (algo bit 96 to 127)", 32, 95.5, 127.5, 5, -2.5, 2.5);
287 h_L1TechBX = ibooker.
book2D(
"h_L1TechBX",
"L1 Tech Trigger BX", 64, -0.5, 63.5, 5, -2.5, 2.5);
290 int itrig = (
algo->second).algoBitNumber();
298 }
else if (itrig < 64) {
303 }
else if (itrig < 96) {
308 }
else if (itrig < 128) {
317 for (
CItAlgo techTrig =
menu->gtTechnicalTriggerMap().begin(); techTrig !=
menu->gtTechnicalTriggerMap().end();
319 int itrig = (techTrig->second).algoBitNumber();
335 edm::LogInfo(
"L1TGT") <<
"L1TGT: analyze...." << std::endl;
342 long long int orbitTcs = -1;
343 int orbitEvmFdl = -1;
349 const int lsNumber =
iEvent.luminosityBlock();
355 if (!gtEvmReadoutRecord.
isValid()) {
356 edm::LogInfo(
"L1TGT") <<
"can't find L1GlobalTriggerEvmReadoutRecord";
363 gtfeEvmBx = gtfeEvmWord.
bxNr();
371 tcsBx = tcsWord.
bxNr();
384 static_cast<double>(tcsWord.
eventNr()) / static_cast<double>(tcsWord.
partTrigNr()));
404 edm::LogInfo(
"L1TGT") <<
" check mode = " <<
beam <<
" momentum " << momentum <<
" int2 " << intensity2
409 uint64_t gpshi = (gpsr >> 32) & 0xffffffff;
411 uint64_t gps = gpshi * 1000000 + gpslo;
414 Long64_t delorb = orbitTcs -
preOrb_;
415 Long64_t delgps = gps -
preGps_;
419 freq = ((Double_t)(delorb)) * 3564. / ((Double_t)(delgps));
428 edm::LogInfo(
"L1TGT") <<
" preOrb_ = " <<
preOrb_ <<
" orbitTcs=" << orbitTcs <<
" delorb=" << delorb
430 <<
" delgps=" << delgps <<
" freq=" << freq << std::endl;
443 orbitEvmFdl = fdlWord.
orbitNr();
447 if ((orbitTcs >= 0) && (orbitEvmFdl >= 0)) {
448 int diffOrbit = static_cast<float>(orbitTcs - orbitEvmFdl);
449 edm::LogInfo(
"L1TGT") <<
"\n orbitTcs = " << orbitTcs <<
" orbitEvmFdl = " << orbitEvmFdl
450 <<
" diffOrbit = " << diffOrbit <<
" orbitEvent = " <<
iEvent.orbitNumber() << std::endl;
467 }
else if (orbitEvmFdl >= 0) {
478 if ((lsTcs >= 0) && (lsEvmFdl >= 0)) {
479 int diffLs = static_cast<float>(lsTcs - lsEvmFdl);
480 edm::LogInfo(
"L1TGT") <<
"\n lsTcs = " << lsTcs <<
" lsEvmFdl = " << lsEvmFdl <<
" diffLs = " << diffLs
481 <<
" lsEvent = " << lsNumber << std::endl;
498 }
else if (lsEvmFdl >= 0) {
519 if (!gtReadoutRecord.
isValid()) {
520 edm::LogInfo(
"L1TGT") <<
"can't find L1GlobalTriggerReadoutRecord";
524 if (gtReadoutRecord.
isValid()) {
525 unsigned int NmaxL1AlgoBit = gtReadoutRecord->
decisionWord().size();
531 const std::vector<L1GtFdlWord>& m_gtFdlWord(gtReadoutRecord->
gtFdlVector());
532 int numberBxInEvent = m_gtFdlWord.size();
533 int minBxInEvent = (numberBxInEvent + 1) / 2 - numberBxInEvent;
535 for (
unsigned int iBit = 0; iBit < NmaxL1AlgoBit; ++iBit) {
536 bool accept = dWord[iBit];
547 for (std::vector<L1GtFdlWord>::const_iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
549 bool accept = dWordBX[iBit];
564 for (
unsigned int iBit = 0; iBit < NmaxL1TechBit; ++iBit) {
565 bool accept = technicalTriggerWordBeforeMask[iBit];
575 for (std::vector<L1GtFdlWord>::const_iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
576 const DecisionWord dWordBX = (*itBx).gtTechnicalTriggerWord();
577 bool accept = dWordBX[iBit];
587 int fdlBx[2] = {-1, -1};
588 int psbBx[2][7] = {{-1, -1, -1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1, -1, -1}};
593 gtfeBx = gtfeWord.
bxNr();
603 if (gmtReadoutCollection.
isValid()) {
611 fdlBx[0] = fdlWord.
bxNr();
619 DecisionWord::const_iterator GTdbitItr;
621 for (GTdbitItr = gtDecisionWord.begin(); GTdbitItr != gtDecisionWord.end(); GTdbitItr++) {
626 DecisionWord::const_iterator GTdbitItr1;
627 for (GTdbitItr1 = gtDecisionWord.begin(); GTdbitItr1 != gtDecisionWord.end(); GTdbitItr1++) {
633 TechnicalTriggerWord::const_iterator GTtbitItr1;
634 for (GTtbitItr1 = gtTTWord.begin(); GTtbitItr1 != gtTTWord.end(); GTtbitItr1++) {
644 TechnicalTriggerWord::const_iterator GTtbitItr;
646 for (GTtbitItr = gtTTWord.begin(); GTtbitItr != gtTTWord.end(); GTtbitItr++) {
651 TechnicalTriggerWord::const_iterator GTtbitItr1;
652 for (GTtbitItr1 = gtTTWord.begin(); GTtbitItr1 != gtTTWord.end(); GTtbitItr1++) {
673 std::pair<int, int> pairLsPfi = std::make_pair(lsNumber, pfIndexAlgoTrig);
685 int psbID[7] = {0xbb09, 0xbb0d, 0xbb0e, 0xbb0f, 0xbb13, 0xbb14, 0xbb15};
686 for (
int i = 0;
i < 7;
i++) {
687 if (
isActive(gtfeActiveBoards, ibit)) {
689 psbBx[0][
i] = psbWord.
bxNr();
700 for (
int i = 0;
i < 2;
i++) {
704 for (
int j = 0;
j < 7;
j++) {
705 for (
int i = 0;
i < 2;
i++) {
706 if (psbBx[
i][
j] > -1)
723 if (
word & (1 << bit))
730 edm::LogInfo(
"L1TGT") <<
"\n Prescale factor indices used in a LS " << std::endl;
733 edm::LogVerbatim(
"L1TGT") <<
" lsNumber = " << (*cIt).first <<
" pfIndex = " << (*cIt).second << std::endl;
744 int previousLsNumber = -1;
745 int previousPfsIndex = -1;
751 int pfsIndicesPerLs = 1;
753 if ((*cIt).first == previousLsNumber) {
754 if ((*cIt).second != previousPfsIndex) {
756 previousPfsIndex = (*cIt).second;
761 if (previousLsNumber != -1) {
766 previousLsNumber = (*cIt).first;
767 previousPfsIndex = (*cIt).second;