Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:21

0001 #include <cstdint>
0002 #include "L1Trigger/L1TNtuples/interface/L1AnalysisGT.h"
0003 #include <cstdint>
0004 
0005 L1Analysis::L1AnalysisGT::L1AnalysisGT() {}
0006 
0007 L1Analysis::L1AnalysisGT::~L1AnalysisGT() {}
0008 
0009 void L1Analysis::L1AnalysisGT::SetEvm(const L1GlobalTriggerEvmReadoutRecord* gtevmrr) {
0010   L1TcsWord tcsw = gtevmrr->tcsWord();
0011 
0012   //bx = tcsw.bxNr();
0013   //lumi = tcsw.luminositySegmentNr();
0014   //runn = tcsw.partRunNr();
0015   //eventn = tcsw.partTrigNr();
0016   //orbitn = tcsw.orbitNr();
0017   gt_.partrig_tcs = tcsw.partTrigNr();
0018   L1GtfeExtWord myGtfeExtWord = gtevmrr->gtfeWord();
0019   uint64_t gpsTime = myGtfeExtWord.gpsTime();
0020 
0021   gt_.gpsTimelo = gpsTime & 0xffffffff;
0022   gt_.gpsTimehi = (gpsTime >> 32) & 0xffffffff;
0023   gt_.bstMasterStatus = 0xffff & (myGtfeExtWord.bstMasterStatus());
0024   gt_.bstturnCountNumber = myGtfeExtWord.turnCountNumber();
0025   gt_.bstlhcFillNumber = myGtfeExtWord.lhcFillNumber();
0026   gt_.bstbeamMode = 0xffff & (myGtfeExtWord.beamMode());
0027   gt_.bstparticleTypeBeam1 = 0xffff & (myGtfeExtWord.particleTypeBeam1());
0028   gt_.bstparticleTypeBeam2 = 0xffff & (myGtfeExtWord.particleTypeBeam2());
0029   gt_.bstbeamMomentum = 0xffff & (myGtfeExtWord.beamMomentum());
0030   gt_.bsttotalIntensityBeam1 = myGtfeExtWord.totalIntensityBeam1();
0031   gt_.bsttotalIntensityBeam2 = myGtfeExtWord.totalIntensityBeam2();
0032 }
0033 
0034 void L1Analysis::L1AnalysisGT::Set(const L1GlobalTriggerReadoutRecord* gtrr) {
0035   for (int ibx = -1; ibx <= 1; ibx++) {
0036     const L1GtPsbWord psb = gtrr->gtPsbWord(0xbb0d, ibx);
0037     const L1GtPsbWord psb2 = gtrr->gtPsbWord(0xbb0e, ibx);
0038 
0039     // ------ ETT, ETM, HTT and HTM from PSB14:
0040 
0041     if (ibx == 0) {
0042       int psb_ett = psb2.aData(4);
0043       int ett_rank = psb_ett & 0xfff;
0044       gt_.RankETT = ett_rank;
0045       gt_.OvETT = (psb_ett >> 12) & 0x1;
0046 
0047       int psb_htt = psb2.bData(4);
0048       int htt_rank = psb_htt & 0xfff;
0049       gt_.RankHTT = htt_rank;
0050       gt_.OvHTT = (psb_htt >> 12) & 0x1;
0051 
0052       int psb_etmis = psb2.aData(5);
0053       int etmis_rank = psb_etmis & 0xfff;
0054       int psb_etmis_phi = psb2.bData(5) & 0x7F;
0055       gt_.RankETM = etmis_rank;
0056       gt_.PhiETM = psb_etmis_phi;
0057       gt_.OvETM = (psb_etmis >> 12) & 0x1;
0058 
0059       int psb_htmis = psb2.aData(3);
0060       int htmis_rank = (psb_htmis >> 5) & 0x7f;
0061       int htmis_phi = psb_htmis & 0x1F;
0062       gt_.RankHTM = htmis_rank;
0063       gt_.PhiHTM = htmis_phi;
0064       gt_.OvHTM = (psb_htmis >> 12) & 0x1;
0065     }
0066 
0067     // =---------------------------------------------
0068 
0069     std::vector<int> psbel;
0070     psbel.push_back(psb.aData(4));
0071     psbel.push_back(psb.aData(5));
0072     psbel.push_back(psb.bData(4));
0073     psbel.push_back(psb.bData(5));
0074     std::vector<int>::const_iterator ipsbel;
0075     for (ipsbel = psbel.begin(); ipsbel != psbel.end(); ipsbel++) {
0076       float rank = (*ipsbel) & 0x3f;
0077       if (rank > 0) {
0078         gt_.Bxel.push_back(ibx);
0079         gt_.Rankel.push_back(rank);
0080         gt_.Phiel.push_back(((*ipsbel) >> 10) & 0x1f);
0081         gt_.Etael.push_back((((*ipsbel >> 9) & 1) ? 10 - (((*ipsbel) >> 6) & 7) : (((*ipsbel) >> 6) & 7) + 11));
0082         gt_.Isoel.push_back(false);
0083       }
0084     }
0085     psbel.clear();
0086     psbel.push_back(psb.aData(6));
0087     psbel.push_back(psb.aData(7));
0088     psbel.push_back(psb.bData(6));
0089     psbel.push_back(psb.bData(7));
0090     for (ipsbel = psbel.begin(); ipsbel != psbel.end(); ipsbel++) {
0091       float rank = (*ipsbel) & 0x3f;
0092       if (rank > 0) {
0093         gt_.Bxel.push_back(ibx);
0094         gt_.Rankel.push_back(rank);
0095         gt_.Phiel.push_back(((*ipsbel) >> 10) & 0x1f);
0096         gt_.Etael.push_back((((*ipsbel >> 9) & 1) ? 10 - (((*ipsbel) >> 6) & 7) : (((*ipsbel) >> 6) & 7) + 11));
0097         gt_.Isoel.push_back(true);
0098       }
0099     }
0100 
0101     // central jets
0102     std::vector<int> psbjet;
0103     psbjet.push_back(psb.aData(2));
0104     psbjet.push_back(psb.aData(3));
0105     psbjet.push_back(psb.bData(2));
0106     psbjet.push_back(psb.bData(3));
0107     std::vector<int>::const_iterator ipsbjet;
0108     for (ipsbjet = psbjet.begin(); ipsbjet != psbjet.end(); ipsbjet++) {
0109       float rank = (*ipsbjet) & 0x3f;
0110       if (rank > 0) {
0111         gt_.Bxjet.push_back(ibx);
0112         gt_.Rankjet.push_back(rank);
0113         gt_.Phijet.push_back(((*ipsbjet) >> 10) & 0x1f);
0114         gt_.Etajet.push_back((((*ipsbjet >> 9) & 1) ? 10 - (((*ipsbjet) >> 6) & 7) : (((*ipsbjet) >> 6) & 7) + 11));
0115         gt_.Taujet.push_back(false);
0116         gt_.Fwdjet.push_back(false);
0117       }
0118     }
0119 
0120     // tau jets
0121     psbjet.clear();
0122     psbjet.push_back(psb2.aData(6));
0123     psbjet.push_back(psb2.aData(7));
0124     psbjet.push_back(psb2.bData(6));
0125     psbjet.push_back(psb2.bData(7));
0126     for (ipsbjet = psbjet.begin(); ipsbjet != psbjet.end(); ipsbjet++) {
0127       float rank = (*ipsbjet) & 0x3f;
0128       if (rank > 0) {
0129         gt_.Bxjet.push_back(ibx);
0130         gt_.Rankjet.push_back(rank);
0131         gt_.Phijet.push_back(((*ipsbjet) >> 10) & 0x1f);
0132         gt_.Etajet.push_back((((*ipsbjet >> 9) & 1) ? 10 - (((*ipsbjet) >> 6) & 7) : (((*ipsbjet) >> 6) & 7) + 11));
0133         gt_.Taujet.push_back(true);
0134         gt_.Fwdjet.push_back(false);
0135       }
0136     }
0137 
0138     // forward jets
0139     psbjet.clear();
0140     psbjet.push_back(psb.aData(0));
0141     psbjet.push_back(psb.aData(1));
0142     psbjet.push_back(psb.bData(0));
0143     psbjet.push_back(psb.bData(1));
0144     for (ipsbjet = psbjet.begin(); ipsbjet != psbjet.end(); ipsbjet++) {
0145       float rank = (*ipsbjet) & 0x3f;
0146       if (rank > 0) {
0147         gt_.Bxjet.push_back(ibx);
0148         gt_.Rankjet.push_back(rank);
0149         gt_.Phijet.push_back(((*ipsbjet) >> 10) & 0x1f);
0150         gt_.Etajet.push_back((((*ipsbjet >> 9) & 1) ? 3 - (((*ipsbjet) >> 6) & 7) : (((*ipsbjet) >> 6) & 7) + 18));
0151         gt_.Taujet.push_back(false);
0152         gt_.Fwdjet.push_back(true);
0153       }
0154     }
0155   }
0156   gt_.Nele = gt_.Bxel.size();
0157   gt_.Njet = gt_.Bxjet.size();
0158 
0159   L1GtFdlWord fdlWord = gtrr->gtFdlWord();
0160 
0161   /// get Global Trigger algo and technical triger bit statistics
0162   gt_.tw1.resize(5, 0);
0163   gt_.tw2.resize(5, 0);
0164   gt_.tt.resize(5, 0);
0165 
0166   for (int iebx = 0; iebx < 5; iebx++) {
0167     DecisionWord gtDecisionWord = gtrr->decisionWord(iebx - 2);
0168 
0169     int dbitNumber = 0;
0170 
0171     DecisionWord::const_iterator GTdbitItr;
0172     for (GTdbitItr = gtDecisionWord.begin(); GTdbitItr != gtDecisionWord.end(); GTdbitItr++) {
0173       if (*GTdbitItr) {
0174         if (dbitNumber < 64) {
0175           gt_.tw1[iebx] |= (1LL << dbitNumber);
0176         } else {
0177           gt_.tw2[iebx] |= (1LL << (dbitNumber - 64));
0178         }
0179       }
0180       dbitNumber++;
0181     }
0182 
0183     dbitNumber = 0;
0184     TechnicalTriggerWord gtTTWord = gtrr->technicalTriggerWord(iebx - 2);
0185     TechnicalTriggerWord::const_iterator GTtbitItr;
0186     for (GTtbitItr = gtTTWord.begin(); GTtbitItr != gtTTWord.end(); GTtbitItr++) {
0187       if (*GTtbitItr) {
0188         gt_.tt[iebx] |= (1LL << dbitNumber);
0189       }
0190       dbitNumber++;
0191     }
0192   }
0193 }