Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:15

0001 #include "L1Trigger/L1TNtuples/interface/L1AnalysisGMT.h"
0002 
0003 L1Analysis::L1AnalysisGMT::L1AnalysisGMT() {}
0004 
0005 L1Analysis::L1AnalysisGMT::~L1AnalysisGMT() {}
0006 
0007 void L1Analysis::L1AnalysisGMT::Set(const L1MuGMTReadoutCollection* gmtrc,
0008                                     unsigned maxDTBX,
0009                                     unsigned maxCSC,
0010                                     unsigned maxRPC,
0011                                     unsigned maxGMT,
0012                                     bool physVal) {
0013   std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
0014   std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
0015   for (igmtrr = gmt_records.begin(); igmtrr != gmt_records.end(); igmtrr++) {
0016     std::vector<L1MuRegionalCand>::const_iterator iter1;
0017     std::vector<L1MuRegionalCand> rmc;
0018 
0019     if (igmtrr->getBxInEvent() == 0) {
0020       gmt_.EvBx = igmtrr->getBxNr();
0021     }
0022 
0023     //
0024     // DTBX Trigger
0025     //
0026 
0027     int iidt = 0;
0028     rmc = igmtrr->getDTBXCands();
0029     for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
0030       if ((unsigned)gmt_.Ndt < maxDTBX && !(*iter1).empty()) {
0031         gmt_.Bxdt.push_back((*iter1).bx());
0032         if (physVal) {
0033           gmt_.Etadt.push_back(float((*iter1).etaValue()));
0034           gmt_.Phidt.push_back(float((*iter1).phiValue()));
0035           gmt_.Ptdt.push_back(float((*iter1).ptValue()));
0036         } else {
0037           gmt_.Etadt.push_back(float((*iter1).eta_packed()));
0038           gmt_.Phidt.push_back(float((*iter1).phi_packed()));
0039           gmt_.Ptdt.push_back(float((*iter1).pt_packed()));
0040         }
0041         gmt_.Chadt.push_back((*iter1).chargeValue());
0042         if (!(*iter1).chargeValid())
0043           gmt_.Chadt.push_back(0);
0044         gmt_.FineEtadt.push_back((*iter1).isFineHalo());
0045         gmt_.Qualdt.push_back((*iter1).quality());
0046         gmt_.Dwdt.push_back((*iter1).getDataWord());
0047         gmt_.Chdt.push_back(iidt);
0048 
0049         gmt_.Ndt++;
0050       }
0051       iidt++;
0052     }
0053 
0054     //
0055     // CSC Trigger
0056     //
0057 
0058     rmc = igmtrr->getCSCCands();
0059     for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
0060       if ((unsigned)gmt_.Ncsc < maxCSC && !(*iter1).empty()) {
0061         gmt_.Bxcsc.push_back((*iter1).bx());
0062         if (physVal) {
0063           gmt_.Etacsc.push_back((*iter1).etaValue());
0064           gmt_.Phicsc.push_back((*iter1).phiValue());
0065           gmt_.Ptcsc.push_back((*iter1).ptValue());
0066         } else {
0067           gmt_.Etacsc.push_back((*iter1).eta_packed());
0068           gmt_.Phicsc.push_back((*iter1).phi_packed());
0069           gmt_.Ptcsc.push_back((*iter1).pt_packed());
0070         }
0071         gmt_.Chacsc.push_back((*iter1).chargeValue());
0072         if (!(*iter1).chargeValid())
0073           gmt_.Chacsc.push_back(0);
0074         gmt_.Qualcsc.push_back((*iter1).quality());
0075         gmt_.Dwcsc.push_back((*iter1).getDataWord());
0076 
0077         gmt_.Ncsc++;
0078       }
0079     }
0080 
0081     //
0082     // RPCb Trigger
0083     //
0084 
0085     rmc = igmtrr->getBrlRPCCands();
0086     for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
0087       if ((unsigned)gmt_.Nrpcb < maxRPC && !(*iter1).empty()) {
0088         gmt_.Bxrpcb.push_back((*iter1).bx());
0089         if (physVal) {
0090           gmt_.Etarpcb.push_back((*iter1).etaValue());
0091           gmt_.Phirpcb.push_back((*iter1).phiValue());
0092           gmt_.Ptrpcb.push_back((*iter1).ptValue());
0093         } else {
0094           gmt_.Etarpcb.push_back((*iter1).eta_packed());
0095           gmt_.Phirpcb.push_back((*iter1).phi_packed());
0096           gmt_.Ptrpcb.push_back((*iter1).pt_packed());
0097         }
0098         gmt_.Charpcb.push_back((*iter1).chargeValue());
0099         if (!(*iter1).chargeValid())
0100           gmt_.Charpcb.push_back(0);
0101         gmt_.Qualrpcb.push_back((*iter1).quality());
0102         gmt_.Dwrpcb.push_back((*iter1).getDataWord());
0103 
0104         gmt_.Nrpcb++;
0105       }
0106     }
0107 
0108     //
0109     // RPCf Trigger
0110     //
0111 
0112     rmc = igmtrr->getFwdRPCCands();
0113     for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
0114       if ((unsigned)gmt_.Nrpcf < maxRPC && !(*iter1).empty()) {
0115         gmt_.Bxrpcf.push_back((*iter1).bx());
0116         if (physVal) {
0117           gmt_.Etarpcf.push_back((*iter1).etaValue());
0118           gmt_.Phirpcf.push_back((*iter1).phiValue());
0119           gmt_.Ptrpcf.push_back((*iter1).ptValue());
0120         } else {
0121           gmt_.Etarpcf.push_back((*iter1).eta_packed());
0122           gmt_.Phirpcf.push_back((*iter1).phi_packed());
0123           gmt_.Ptrpcf.push_back((*iter1).pt_packed());
0124         }
0125         gmt_.Charpcf.push_back((*iter1).chargeValue());
0126         if (!(*iter1).chargeValid())
0127           gmt_.Charpcf.push_back(0);
0128         gmt_.Qualrpcf.push_back((*iter1).quality());
0129         gmt_.Dwrpcf.push_back((*iter1).getDataWord());
0130 
0131         gmt_.Nrpcf++;
0132       }
0133     }
0134 
0135     //
0136     // GMT_. Trigger
0137     //
0138 
0139     std::vector<L1MuGMTExtendedCand>::const_iterator gmt_iter;
0140     std::vector<L1MuGMTExtendedCand> exc = igmtrr->getGMTCands();
0141     for (gmt_iter = exc.begin(); gmt_iter != exc.end(); gmt_iter++) {
0142       if ((unsigned)gmt_.N < maxGMT && !(*gmt_iter).empty()) {
0143         gmt_.CandBx.push_back((*gmt_iter).bx());
0144         if (physVal) {
0145           gmt_.Eta.push_back((*gmt_iter).etaValue());
0146           gmt_.Phi.push_back((*gmt_iter).phiValue());
0147           gmt_.Pt.push_back((*gmt_iter).ptValue());
0148         } else {
0149           gmt_.Eta.push_back((*gmt_iter).etaIndex());
0150           gmt_.Phi.push_back((*gmt_iter).phiIndex());
0151           gmt_.Pt.push_back((*gmt_iter).ptIndex());
0152         }
0153         gmt_.Cha.push_back((*gmt_iter).charge());
0154         if (!(*gmt_iter).charge_valid())
0155           gmt_.Cha.push_back(0);
0156         gmt_.Qual.push_back((*gmt_iter).quality());
0157         gmt_.Det.push_back((*gmt_iter).detector());
0158         gmt_.Rank.push_back((*gmt_iter).rank());
0159         gmt_.Isol.push_back((*gmt_iter).isol());
0160         gmt_.Mip.push_back((*gmt_iter).mip());
0161         gmt_.Dw.push_back((*gmt_iter).getDataWord());
0162 
0163         gmt_.IdxRPCb.push_back(-1);
0164         gmt_.IdxRPCf.push_back(-1);
0165         gmt_.IdxDTBX.push_back(-1);
0166         gmt_.IdxCSC.push_back(-1);
0167 
0168         if ((*gmt_iter).isMatchedCand() || (*gmt_iter).isRPC()) {
0169           if ((*gmt_iter).isFwd()) {
0170             gmt_.IdxRPCf.back() = (*gmt_iter).getRPCIndex();
0171           } else {
0172             gmt_.IdxRPCb.back() = (*gmt_iter).getRPCIndex();
0173           }
0174         }
0175 
0176         if ((*gmt_iter).isMatchedCand() || (!(*gmt_iter).isRPC())) {
0177           if ((*gmt_iter).isFwd()) {
0178             gmt_.IdxCSC.back() = (*gmt_iter).getDTCSCIndex();
0179           } else {
0180             gmt_.IdxDTBX.back() = (*gmt_iter).getDTCSCIndex();
0181           }
0182         }
0183         gmt_.N++;
0184       }
0185     }
0186   }
0187 }