Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "L1Trigger/L1TNtuples/interface/L1AnalysisGCT.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 
0004 L1Analysis::L1AnalysisGCT::L1AnalysisGCT() : verbose_(false) {}
0005 
0006 L1Analysis::L1AnalysisGCT::L1AnalysisGCT(bool verbose) { verbose_ = verbose; }
0007 
0008 L1Analysis::L1AnalysisGCT::~L1AnalysisGCT() {}
0009 void L1Analysis::L1AnalysisGCT::SetJet(const edm::Handle<L1GctJetCandCollection> l1CenJets,
0010                                        const edm::Handle<L1GctJetCandCollection> l1ForJets,
0011                                        const edm::Handle<L1GctJetCandCollection> l1TauJets,
0012                                        const edm::Handle<L1GctJetCandCollection> l1IsoTauJets) {
0013   // std::cout << "L1IsoTauJets valid: " << l1IsoTauJets.isValid() <<std::endl;
0014   // edm::LogAbsolute("L1") << "CCLA: " << l1IsoTauJets.isValid() <<std::endl;
0015   // Central jets
0016   if (verbose_) {
0017     edm::LogInfo("L1Prompt") << "L1NtupleProducer: number of central jets = " << l1CenJets->size() << std::endl;
0018   }
0019   gct_.CJetSize = l1CenJets->size();  //1
0020   for (L1GctJetCandCollection::const_iterator cj = l1CenJets->begin(); cj != l1CenJets->end(); cj++) {
0021     gct_.CJetEta.push_back(cj->regionId().ieta());  //2
0022     gct_.CJetPhi.push_back(cj->regionId().iphi());  //3
0023     gct_.CJetRnk.push_back(cj->rank());             //4
0024     gct_.CJetBx.push_back(cj->bx());                //4
0025     if (verbose_) {
0026       edm::LogInfo("L1Prompt") << "L1NtupleProducer: Central jet " << cj->regionId().iphi() << ", "
0027                                << cj->regionId().ieta() << ", " << cj->rank() << std::endl;
0028     }
0029   }
0030 
0031   // Forward jets
0032   if (verbose_) {
0033     edm::LogInfo("L1Prompt") << "L1NtupleProducer: number of forward jets = " << l1ForJets->size() << std::endl;
0034   }
0035   gct_.FJetSize = l1ForJets->size();  //5
0036   for (L1GctJetCandCollection::const_iterator fj = l1ForJets->begin(); fj != l1ForJets->end(); fj++) {
0037     gct_.FJetEta.push_back(fj->regionId().ieta());  //6
0038     gct_.FJetPhi.push_back(fj->regionId().iphi());  //7
0039     gct_.FJetRnk.push_back(fj->rank());             //8
0040     gct_.FJetBx.push_back(fj->bx());                //8
0041     if (verbose_) {
0042       edm::LogInfo("L1Prompt") << "L1NtupleProducer: Forward jet " << fj->regionId().iphi() << ", "
0043                                << fj->regionId().ieta() << ", " << fj->rank() << std::endl;
0044     }
0045   }
0046 
0047   // Tau jets
0048   if (verbose_) {
0049     edm::LogInfo("L1Prompt") << "L1NtupleProducer: number of tau jets = " << l1TauJets->size() << std::endl;
0050   }
0051   gct_.TJetSize = l1TauJets->size();  //9
0052   for (L1GctJetCandCollection::const_iterator tj = l1TauJets->begin(); tj != l1TauJets->end(); tj++) {
0053     //if ( tj->rank() == 0 ) continue;
0054     gct_.TJetEta.push_back(tj->regionId().ieta());  //10
0055     gct_.TJetPhi.push_back(tj->regionId().iphi());  //11
0056     gct_.TJetRnk.push_back(tj->rank());             //12
0057     gct_.TJetBx.push_back(tj->bx());                //
0058     if (verbose_) {
0059       edm::LogInfo("L1Prompt") << "L1NtupleProducer: Tau jet " << tj->regionId().iphi() << ", " << tj->regionId().ieta()
0060                                << ", " << tj->rank() << std::endl;
0061     }
0062   }
0063 
0064   // Isolated Tau Jets
0065   if (l1IsoTauJets.isValid()) {
0066     if (verbose_) {
0067       edm::LogInfo("L1Prompt") << "L1NtupleProducer: number of isoTau jets = " << l1IsoTauJets->size() << std::endl;
0068     }
0069     gct_.IsoTJetSize = l1IsoTauJets->size();  //9
0070     for (L1GctJetCandCollection::const_iterator tj = l1IsoTauJets->begin(); tj != l1IsoTauJets->end(); tj++) {
0071       //if ( tj->rank() == 0 ) continue;
0072       gct_.IsoTJetEta.push_back(tj->regionId().ieta());  //10
0073       gct_.IsoTJetPhi.push_back(tj->regionId().iphi());  //11
0074       gct_.IsoTJetRnk.push_back(tj->rank());             //12
0075       gct_.IsoTJetBx.push_back(tj->bx());                //
0076       if (verbose_) {
0077         edm::LogInfo("L1Prompt") << "L1NtupleProducer: IsoTau jet " << tj->regionId().iphi() << ", "
0078                                  << tj->regionId().ieta() << ", " << tj->rank() << std::endl;
0079       }
0080     }
0081   }
0082 }
0083 
0084 void L1Analysis::L1AnalysisGCT::SetES(const edm::Handle<L1GctEtMissCollection> l1EtMiss,
0085                                       const edm::Handle<L1GctHtMissCollection> l1HtMiss,
0086                                       const edm::Handle<L1GctEtHadCollection> l1EtHad,
0087                                       const edm::Handle<L1GctEtTotalCollection> l1EtTotal) {
0088   // Energy sums
0089   for (L1GctEtMissCollection::const_iterator etm = l1EtMiss->begin(); etm != l1EtMiss->end(); ++etm) {
0090     gct_.EtMiss.push_back(etm->et());
0091     gct_.EtMissPhi.push_back(etm->phi());
0092     gct_.EtMissBX.push_back(etm->bx());
0093     gct_.EtMissSize++;
0094 
0095     if (verbose_) {
0096       edm::LogInfo("L1Prompt") << "L1NtupleProducer: Et Miss " << etm->et() << ", " << etm->phi() << ", " << etm->bx()
0097                                << std::endl;
0098     }
0099   }
0100 
0101   for (L1GctHtMissCollection::const_iterator htm = l1HtMiss->begin(); htm != l1HtMiss->end(); ++htm) {
0102     gct_.HtMiss.push_back(htm->et());
0103     gct_.HtMissPhi.push_back(htm->phi());
0104     gct_.HtMissBX.push_back(htm->bx());
0105     gct_.HtMissSize++;
0106 
0107     if (verbose_) {
0108       edm::LogInfo("L1Prompt") << "L1NtupleProducer: Ht Miss " << htm->et() << ", " << htm->phi() << ", " << htm->bx()
0109                                << std::endl;
0110     }
0111   }
0112 
0113   for (L1GctEtHadCollection::const_iterator ht = l1EtHad->begin(); ht != l1EtHad->end(); ++ht) {
0114     gct_.EtHad.push_back(ht->et());
0115     gct_.EtHadBX.push_back(ht->bx());
0116     gct_.EtHadSize++;
0117 
0118     if (verbose_) {
0119       edm::LogInfo("L1Prompt") << "L1NtupleProducer: Ht Total " << ht->et() << ", " << ht->bx() << std::endl;
0120     }
0121   }
0122 
0123   for (L1GctEtTotalCollection::const_iterator ett = l1EtTotal->begin(); ett != l1EtTotal->end(); ++ett) {
0124     gct_.EtTot.push_back(ett->et());
0125     gct_.EtTotBX.push_back(ett->bx());
0126     gct_.EtTotSize++;
0127 
0128     if (verbose_) {
0129       edm::LogInfo("L1Prompt") << "L1NtupleProducer: Et Total " << ett->et() << ", " << ett->bx() << std::endl;
0130     }
0131   }
0132 }
0133 
0134 void L1Analysis::L1AnalysisGCT::SetHFminbias(const edm::Handle<L1GctHFRingEtSumsCollection> l1HFSums,
0135                                              const edm::Handle<L1GctHFBitCountsCollection> l1HFCounts) {
0136   //Fill HF Ring Histograms
0137   gct_.HFRingEtSumSize = l1HFSums->size();
0138   int ies = 0;
0139   for (L1GctHFRingEtSumsCollection::const_iterator hfs = l1HFSums->begin(); hfs != l1HFSums->end(); hfs++) {
0140     gct_.HFRingEtSumEta.push_back(hfs->etSum(ies));
0141     if (verbose_) {
0142       edm::LogInfo("L1Prompt") << "L1NtupleProducer: HF Sums " << l1HFSums->size() << ", " << hfs->etSum(ies)
0143                                << std::endl;
0144     }
0145     ies++;
0146   }
0147 
0148   int ibc = 0;
0149   gct_.HFBitCountsSize = l1HFCounts->size();
0150   for (L1GctHFBitCountsCollection::const_iterator hfc = l1HFCounts->begin(); hfc != l1HFCounts->end(); hfc++) {
0151     gct_.HFBitCountsEta.push_back(hfc->bitCount(ibc));
0152     if (verbose_) {
0153       edm::LogInfo("L1Prompt") << "L1NtupleProducer: HF Counts " << l1HFCounts->size() << ", " << hfc->bitCount(ibc)
0154                                << std::endl;
0155     }
0156     ibc++;
0157   }
0158 }
0159 
0160 void L1Analysis::L1AnalysisGCT::SetEm(const edm::Handle<L1GctEmCandCollection> l1IsoEm,
0161                                       const edm::Handle<L1GctEmCandCollection> l1NonIsoEm) {
0162   // Isolated EM
0163   if (verbose_) {
0164     edm::LogInfo("L1Prompt") << "L1TGCT: number of iso em cands: " << l1IsoEm->size() << std::endl;
0165   }
0166 
0167   gct_.IsoEmSize = l1IsoEm->size();
0168   for (L1GctEmCandCollection::const_iterator ie = l1IsoEm->begin(); ie != l1IsoEm->end(); ie++) {
0169     gct_.IsoEmEta.push_back(ie->regionId().ieta());
0170     gct_.IsoEmPhi.push_back(ie->regionId().iphi());
0171     gct_.IsoEmRnk.push_back(ie->rank());
0172     gct_.IsoEmBx.push_back(ie->bx());
0173   }
0174 
0175   // Non-isolated EM
0176   if (verbose_) {
0177     edm::LogInfo("L1Prompt") << "L1TGCT: number of non-iso em cands: " << l1NonIsoEm->size() << std::endl;
0178   }
0179   gct_.NonIsoEmSize = l1NonIsoEm->size();
0180 
0181   for (L1GctEmCandCollection::const_iterator ne = l1NonIsoEm->begin(); ne != l1NonIsoEm->end(); ne++) {
0182     gct_.NonIsoEmEta.push_back(ne->regionId().ieta());
0183     gct_.NonIsoEmPhi.push_back(ne->regionId().iphi());
0184     gct_.NonIsoEmRnk.push_back(ne->rank());
0185     gct_.NonIsoEmBx.push_back(ne->bx());
0186   }
0187 }