Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:36:51

0001 ///step03
0002 /// \class l1t::Stage1Layer2EGammaAlgorithm
0003 ///
0004 /// Description: interface for MP firmware
0005 ///
0006 /// Implementation:
0007 ///
0008 /// \author: Kalanand Mishra - Fermilab
0009 ///
0010 
0011 #include "L1Trigger/L1TCalorimeter/interface/Stage1Layer2EGammaAlgorithmImp.h"
0012 #include "DataFormats/L1TCalorimeter/interface/CaloRegion.h"
0013 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h"
0014 #include "L1Trigger/L1TCalorimeter/interface/PUSubtractionMethods.h"
0015 #include "L1Trigger/L1TCalorimeter/interface/HardwareSortingMethods.h"
0016 #include "L1Trigger/L1TCalorimeter/interface/JetFinderMethods.h"
0017 #include "L1Trigger/L1TCalorimeter/interface/legacyGtHelper.h"
0018 
0019 #include <bitset>
0020 
0021 using namespace std;
0022 using namespace l1t;
0023 
0024 Stage1Layer2EGammaAlgorithmImpHI::Stage1Layer2EGammaAlgorithmImpHI(CaloParamsHelper const* params) : params_(params) {}
0025 
0026 void l1t::Stage1Layer2EGammaAlgorithmImpHI::processEvent(const std::vector<l1t::CaloEmCand>& EMCands,
0027                                                          const std::vector<l1t::CaloRegion>& regions,
0028                                                          const std::vector<l1t::Jet>* jets,
0029                                                          std::vector<l1t::EGamma>* egammas) {
0030   int egEtaCut = params_->egEtaCut();
0031 
0032   std::vector<l1t::EGamma> preSortEGammas;
0033   std::vector<l1t::EGamma> preGtEGammas;
0034 
0035   for (CaloEmCandBxCollection::const_iterator egCand = EMCands.begin(); egCand != EMCands.end(); egCand++) {
0036     int eg_et = egCand->hwPt();
0037     int eg_eta = egCand->hwEta();
0038     int eg_phi = egCand->hwPhi();
0039     int index = (egCand->hwIso() * 4 + egCand->hwQual());
0040 
0041     ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > egLorentz(0, 0, 0, 0);
0042 
0043     int isoFlag = 0;
0044     bool isinBarrel = false;
0045     if ((egEtaCut & (1 << eg_eta)) >> eg_eta) {
0046       isinBarrel = true;
0047     }
0048 
0049     isoFlag = isinBarrel;
0050     l1t::EGamma theEG(*&egLorentz, eg_et, eg_eta, eg_phi, index, isoFlag);
0051     preSortEGammas.push_back(theEG);
0052   }
0053 
0054   SortEGammas(&preSortEGammas, &preGtEGammas);
0055   EGammaToGtScales(params_, &preGtEGammas, egammas);
0056 }