Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "L1Trigger/L1TNtuples/interface/L1AnalysisCaloTP.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 
0004 #include "CondFormats/L1TObjects/interface/L1CaloEcalScale.h"
0005 #include "CondFormats/L1TObjects/interface/L1CaloHcalScale.h"
0006 
0007 L1Analysis::L1AnalysisCaloTP::L1AnalysisCaloTP() : verbose_(false) {}
0008 
0009 L1Analysis::L1AnalysisCaloTP::L1AnalysisCaloTP(bool verbose) { verbose_ = verbose; }
0010 
0011 L1Analysis::L1AnalysisCaloTP::~L1AnalysisCaloTP() {}
0012 
0013 void L1Analysis::L1AnalysisCaloTP::SetHCAL(const HcalTrigPrimDigiCollection& hcalTPs) {
0014   if (verbose_)
0015     edm::LogInfo("L1Ntuple") << "HCAL TPs : " << hcalTPs.size() << std::endl;
0016 
0017   for (unsigned i = 0; i < hcalTPs.size(); ++i) {
0018     short ieta = (short)hcalTPs[i].id().ieta();
0019     unsigned short absIeta = (unsigned short)abs(ieta);
0020     short sign = ieta / absIeta;
0021 
0022     unsigned short cal_iphi = (unsigned short)hcalTPs[i].id().iphi();
0023     unsigned short iphi = (72 + 18 - cal_iphi) % 72;
0024     if (absIeta >= 29) {  // special treatment for HF
0025       iphi = iphi / 4;
0026     }
0027 
0028     unsigned short compEt = hcalTPs[i].SOI_compressedEt();
0029     double et = 0.;
0030     if (hcalScale_ != nullptr)
0031       et = hcalScale_->et(compEt, absIeta, sign);
0032 
0033     unsigned short fineGrain = (unsigned short)hcalTPs[i].SOI_fineGrain();
0034 
0035     tp_.hcalTPieta.push_back(ieta);
0036     tp_.hcalTPCaliphi.push_back(cal_iphi);
0037     tp_.hcalTPiphi.push_back(iphi);
0038     tp_.hcalTPet.push_back(et);
0039     tp_.hcalTPcompEt.push_back(compEt);
0040     tp_.hcalTPfineGrain.push_back(fineGrain);
0041     tp_.nHCALTP++;
0042   }
0043 }
0044 
0045 void L1Analysis::L1AnalysisCaloTP::SetECAL(const EcalTrigPrimDigiCollection& ecalTPs) {
0046   if (verbose_)
0047     edm::LogInfo("L1Ntuple") << "ECAL TPs : " << ecalTPs.size() << std::endl;
0048 
0049   for (unsigned i = 0; i < ecalTPs.size(); ++i) {
0050     short ieta = (short)ecalTPs[i].id().ieta();
0051     unsigned short absIeta = (unsigned short)abs(ieta);
0052     short sign = ieta / absIeta;
0053 
0054     unsigned short cal_iphi = (unsigned short)ecalTPs[i].id().iphi();
0055     unsigned short iphi =
0056         (72 + 18 - cal_iphi) % 72;  // transform TOWERS (not regions) into local rct (intuitive) phi bins
0057 
0058     unsigned short compEt = ecalTPs[i].compressedEt();
0059     double et = 0.;
0060     if (ecalScale_ != nullptr)
0061       et = ecalScale_->et(compEt, absIeta, sign);
0062 
0063     unsigned short fineGrain = (unsigned short)ecalTPs[i].fineGrain();  // 0 or 1
0064 
0065     tp_.ecalTPieta.push_back(ieta);
0066     tp_.ecalTPCaliphi.push_back(cal_iphi);
0067     tp_.ecalTPiphi.push_back(iphi);
0068     tp_.ecalTPet.push_back(et);
0069     tp_.ecalTPcompEt.push_back(compEt);
0070     tp_.ecalTPfineGrain.push_back(fineGrain);
0071     tp_.nECALTP++;
0072   }
0073 }