22 m_runInEventLoop(ps.getUntrackedParameter<
bool>(
"runInEventLoop",
false)),
23 m_runInEndLumi(ps.getUntrackedParameter<
bool>(
"runInEndLumi",
false)),
24 verbose_(ps.getUntrackedParameter<
bool>(
"verbose",
false)),
40 const int TotalNrBinsLs = 1000;
41 const double totalNrBinsLs = static_cast<double>(TotalNrBinsLs);
45 algo_bits = ibooker.
book1D(
"algo_bits",
"GT algorithm trigger bits", 128, -0.5, 127.5);
49 ibooker.
book2D(
"algo_bits_corr",
"GT algorithm trigger bit correlation", 128, -0.5, 127.5, 128, -0.5, 127.5);
53 tt_bits = ibooker.
book1D(
"tt_bits",
"GT technical trigger bits", 64, -0.5, 63.5);
56 tt_bits_corr = ibooker.
book2D(
"tt_bits_corr",
"GT technical trigger bit correlation", 64, -0.5, 63.5, 64, -0.5, 63.5);
61 "algo_tt_bits_corr",
"GT algorithm - technical trigger bit correlation", 128, -0.5, 127.5, 64, -0.5, 63.5);
66 "algo_bits_lumi",
"GT algorithm trigger bit rate per LS", TotalNrBinsLs, 0., totalNrBinsLs, 128, -0.5, 127.5);
71 "tt_bits_lumi",
"GT technical trigger bit rate per LS", TotalNrBinsLs, 0., totalNrBinsLs, 64, -0.5, 63.5);
84 event_number = ibooker.
book1D(
"event_number",
"GT event number (from last resync)", 100, 0., 50000.);
88 "event_lumi",
"GT event number (from last resync) vs LS", TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e15,
"s");
92 trigger_number = ibooker.
book1D(
"trigger_number",
"GT trigger number (from start run)", 100, 0., 50000.);
96 "GT trigger number (from start run) vs LS",
108 "evnum_trignum_lumi",
"GT event/trigger number ratio vs LS", TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 2.,
"s");
113 "orbit_lumi",
"GT orbit number vs LS", TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e15,
"s");
118 "setupversion_lumi",
"GT setup version vs LS", TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e10,
"i");
122 gtfe_bx = ibooker.
book1D(
"gtfe_bx",
"GTFE Bx number", 3600, 0., 3600.);
126 ibooker.
bookProfile(
"dbx_module",
"delta Bx of GT modules wrt GTFE", 20, 0., 20., 100, -4000., 4000.,
"i");
150 ibooker.
book2D(
"BST_MasterStatus",
"BST master status over LS", TotalNrBinsLs, 0., totalNrBinsLs, 6, -1., 5.);
157 ibooker.
book2D(
"BST_turnCountNumber",
"BST turn count over LS", TotalNrBinsLs, 0., totalNrBinsLs, 250, 0., 4.3e9);
164 BST_beamMode = ibooker.
book2D(
"BST_beamMode",
"BST beam mode over LS", TotalNrBinsLs, 0., totalNrBinsLs, 25, 1., 26.);
190 ibooker.
book2D(
"BST_beamMomentum",
"BST beam momentum", TotalNrBinsLs, 0., totalNrBinsLs, 100, 0., 7200.);
194 gpsfreq = ibooker.
book1D(
"gpsfreq",
"Clock frequency measured by GPS", 1000, 39.95, 40.2);
197 gpsfreqwide = ibooker.
book1D(
"gpsfreqwide",
"Clock frequency measured by GPS", 1000, -2., 200.);
201 "gpsfreqlum",
"Clock frequency measured by GPS", TotalNrBinsLs, 0., totalNrBinsLs, 100, 39.95, 40.2);
206 ibooker.
book2D(
"BST_intensityBeam1",
"Intensity beam 1", TotalNrBinsLs, 0., totalNrBinsLs, 1000, 0., 5000.);
211 ibooker.
book2D(
"BST_intensityBeam2",
"Intensity beam 2", TotalNrBinsLs, 0., totalNrBinsLs, 1000, 0., 5000.);
218 "L1PrescaleFactorSet",
"Index of L1 prescale factor set", TotalNrBinsLs, 0., totalNrBinsLs, 25, 0., 25.);
222 ibooker.
book1D(
"L1PfIndicesPerLs",
"Number of prescale factor indices used per LS", 10, 0., 10.);
232 "Orbit number difference (TCS - EVM_FDL)",
239 "LS number difference (TCS - EVM_FDL)",
248 "Orbit number difference (TCS - EVM_FDL)",
259 "LS number difference (TCS - EVM_FDL)",
282 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);
283 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);
284 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);
285 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);
286 h_L1TechBX = ibooker.
book2D(
"h_L1TechBX",
"L1 Tech Trigger BX", 64, -0.5, 63.5, 5, -2.5, 2.5);
289 int itrig = (
algo->second).algoBitNumber();
297 }
else if (itrig < 64) {
302 }
else if (itrig < 96) {
307 }
else if (itrig < 128) {
316 for (
CItAlgo techTrig =
menu->gtTechnicalTriggerMap().begin(); techTrig !=
menu->gtTechnicalTriggerMap().end();
318 int itrig = (techTrig->second).algoBitNumber();
334 edm::LogInfo(
"L1TGT") <<
"L1TGT: analyze...." << std::endl;
341 long long int orbitTcs = -1;
342 int orbitEvmFdl = -1;
348 const int lsNumber =
iEvent.luminosityBlock();
354 if (!gtEvmReadoutRecord.
isValid()) {
355 edm::LogInfo(
"L1TGT") <<
"can't find L1GlobalTriggerEvmReadoutRecord";
362 gtfeEvmBx = gtfeEvmWord.
bxNr();
370 tcsBx = tcsWord.
bxNr();
383 static_cast<double>(tcsWord.
eventNr()) / static_cast<double>(tcsWord.
partTrigNr()));
403 edm::LogInfo(
"L1TGT") <<
" check mode = " <<
beam <<
" momentum " << momentum <<
" int2 " << intensity2
408 uint64_t gpshi = (gpsr >> 32) & 0xffffffff;
410 uint64_t gps = gpshi * 1000000 + gpslo;
413 Long64_t delorb = orbitTcs -
preOrb_;
414 Long64_t delgps = gps -
preGps_;
418 freq = ((Double_t)(delorb)) * 3564. / ((Double_t)(delgps));
427 edm::LogInfo(
"L1TGT") <<
" preOrb_ = " <<
preOrb_ <<
" orbitTcs=" << orbitTcs <<
" delorb=" << delorb
429 <<
" delgps=" << delgps <<
" freq=" << freq << std::endl;
442 orbitEvmFdl = fdlWord.
orbitNr();
446 if ((orbitTcs >= 0) && (orbitEvmFdl >= 0)) {
447 int diffOrbit = static_cast<float>(orbitTcs - orbitEvmFdl);
448 edm::LogInfo(
"L1TGT") <<
"\n orbitTcs = " << orbitTcs <<
" orbitEvmFdl = " << orbitEvmFdl
449 <<
" diffOrbit = " << diffOrbit <<
" orbitEvent = " <<
iEvent.orbitNumber() << std::endl;
466 }
else if (orbitEvmFdl >= 0) {
477 if ((lsTcs >= 0) && (lsEvmFdl >= 0)) {
478 int diffLs = static_cast<float>(lsTcs - lsEvmFdl);
479 edm::LogInfo(
"L1TGT") <<
"\n lsTcs = " << lsTcs <<
" lsEvmFdl = " << lsEvmFdl <<
" diffLs = " << diffLs
480 <<
" lsEvent = " << lsNumber << std::endl;
497 }
else if (lsEvmFdl >= 0) {
518 if (!gtReadoutRecord.
isValid()) {
519 edm::LogInfo(
"L1TGT") <<
"can't find L1GlobalTriggerReadoutRecord";
523 if (gtReadoutRecord.
isValid()) {
524 unsigned int NmaxL1AlgoBit = gtReadoutRecord->
decisionWord().size();
530 const std::vector<L1GtFdlWord>& m_gtFdlWord(gtReadoutRecord->
gtFdlVector());
531 int numberBxInEvent = m_gtFdlWord.size();
532 int minBxInEvent = (numberBxInEvent + 1) / 2 - numberBxInEvent;
534 for (
unsigned int iBit = 0; iBit < NmaxL1AlgoBit; ++iBit) {
535 bool accept = dWord[iBit];
546 for (std::vector<L1GtFdlWord>::const_iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
548 bool accept = dWordBX[iBit];
563 for (
unsigned int iBit = 0; iBit < NmaxL1TechBit; ++iBit) {
564 bool accept = technicalTriggerWordBeforeMask[iBit];
574 for (std::vector<L1GtFdlWord>::const_iterator itBx = m_gtFdlWord.begin(); itBx != m_gtFdlWord.end(); ++itBx) {
575 const DecisionWord dWordBX = (*itBx).gtTechnicalTriggerWord();
576 bool accept = dWordBX[iBit];
586 int fdlBx[2] = {-1, -1};
587 int psbBx[2][7] = {{-1, -1, -1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1, -1, -1}};
592 gtfeBx = gtfeWord.
bxNr();
602 if (gmtReadoutCollection.
isValid()) {
610 fdlBx[0] = fdlWord.
bxNr();
618 DecisionWord::const_iterator GTdbitItr;
620 for (GTdbitItr = gtDecisionWord.begin(); GTdbitItr != gtDecisionWord.end(); GTdbitItr++) {
625 DecisionWord::const_iterator GTdbitItr1;
626 for (GTdbitItr1 = gtDecisionWord.begin(); GTdbitItr1 != gtDecisionWord.end(); GTdbitItr1++) {
632 TechnicalTriggerWord::const_iterator GTtbitItr1;
633 for (GTtbitItr1 = gtTTWord.begin(); GTtbitItr1 != gtTTWord.end(); GTtbitItr1++) {
643 TechnicalTriggerWord::const_iterator GTtbitItr;
645 for (GTtbitItr = gtTTWord.begin(); GTtbitItr != gtTTWord.end(); GTtbitItr++) {
650 TechnicalTriggerWord::const_iterator GTtbitItr1;
651 for (GTtbitItr1 = gtTTWord.begin(); GTtbitItr1 != gtTTWord.end(); GTtbitItr1++) {
672 std::pair<int, int> pairLsPfi = std::make_pair(lsNumber, pfIndexAlgoTrig);
684 int psbID[7] = {0xbb09, 0xbb0d, 0xbb0e, 0xbb0f, 0xbb13, 0xbb14, 0xbb15};
685 for (
int i = 0;
i < 7;
i++) {
686 if (
isActive(gtfeActiveBoards, ibit)) {
688 psbBx[0][
i] = psbWord.
bxNr();
699 for (
int i = 0;
i < 2;
i++) {
703 for (
int j = 0;
j < 7;
j++) {
704 for (
int i = 0;
i < 2;
i++) {
705 if (psbBx[
i][
j] > -1)
722 if (
word & (1 << bit))
729 edm::LogInfo(
"L1TGT") <<
"\n Prescale factor indices used in a LS " << std::endl;
732 edm::LogVerbatim(
"L1TGT") <<
" lsNumber = " << (*cIt).first <<
" pfIndex = " << (*cIt).second << std::endl;
743 int previousLsNumber = -1;
744 int previousPfsIndex = -1;
750 int pfsIndicesPerLs = 1;
752 if ((*cIt).first == previousLsNumber) {
753 if ((*cIt).second != previousPfsIndex) {
755 previousPfsIndex = (*cIt).second;
760 if (previousLsNumber != -1) {
765 previousLsNumber = (*cIt).first;
766 previousPfsIndex = (*cIt).second;