CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1t::Stage1Layer2EGammaAlgorithmImpHW Class Reference

#include <Stage1Layer2EGammaAlgorithmImp.h>

Inheritance diagram for l1t::Stage1Layer2EGammaAlgorithmImpHW:
l1t::Stage1Layer2EGammaAlgorithm

Public Member Functions

void processEvent (const std::vector< l1t::CaloEmCand > &EMCands, const std::vector< l1t::CaloRegion > &regions, const std::vector< l1t::Jet > *jets, std::vector< l1t::EGamma > *egammas) override
 
 Stage1Layer2EGammaAlgorithmImpHW (CaloParamsHelper const *params)
 
 ~Stage1Layer2EGammaAlgorithmImpHW () override=default
 
- Public Member Functions inherited from l1t::Stage1Layer2EGammaAlgorithm
virtual ~Stage1Layer2EGammaAlgorithm ()
 

Private Member Functions

int AssociatedJetPt (int ieta, int iphi, const std::vector< l1t::Jet > *jets) const
 
unsigned isoLutIndex (unsigned int etaPt, unsigned int jetPt) const
 

Private Attributes

CaloParamsHelper const *const params_
 

Detailed Description

Definition at line 66 of file Stage1Layer2EGammaAlgorithmImp.h.

Constructor & Destructor Documentation

Stage1Layer2EGammaAlgorithmImpHW::Stage1Layer2EGammaAlgorithmImpHW ( CaloParamsHelper const *  params)

Definition at line 25 of file Stage1Layer2EGammaAlgorithmImpHW.cc.

25 : params_(params) {};
l1t::Stage1Layer2EGammaAlgorithmImpHW::~Stage1Layer2EGammaAlgorithmImpHW ( )
overridedefault

Member Function Documentation

int l1t::Stage1Layer2EGammaAlgorithmImpHW::AssociatedJetPt ( int  ieta,
int  iphi,
const std::vector< l1t::Jet > *  jets 
) const
private

Definition at line 100 of file Stage1Layer2EGammaAlgorithmImpHW.cc.

References reco::btau::jetEta, reco::btau::jetPhi, and EnergyCorrector::pt.

Referenced by processEvent().

101  {
102 
103  int pt = 0;
104 
105 
106  for(JetBxCollection::const_iterator itJet = jets->begin();
107  itJet != jets->end(); ++itJet){
108 
109  int jetEta = itJet->hwEta();
110  int jetPhi = itJet->hwPhi();
111  if ((jetEta == ieta) && (jetPhi == iphi)){
112  pt = itJet->hwPt();
113  break;
114  }
115  }
116 
117  // set output
118  return pt;
119 }
vector< PseudoJet > jets
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:20
unsigned l1t::Stage1Layer2EGammaAlgorithmImpHW::isoLutIndex ( unsigned int  etaPt,
unsigned int  jetPt 
) const
private

Definition at line 89 of file Stage1Layer2EGammaAlgorithmImpHW.cc.

Referenced by processEvent().

90 {
91  const unsigned int nbitsEG=6; // number of bits used for EG bins in LUT file (needed for left shift operation)
92  // const unsigned int nbitsJet=9; // not used but here for info number of bits used for Jet bins in LUT file
93 
94  //jetPt &= 511; // Take only the LSB 9 bits to match firmware.
95  if(jetPt > 511) jetPt = 511;
96  unsigned int address= (jetPt << nbitsEG) + egPt;
97  return address;
98 }
void l1t::Stage1Layer2EGammaAlgorithmImpHW::processEvent ( const std::vector< l1t::CaloEmCand > &  EMCands,
const std::vector< l1t::CaloRegion > &  regions,
const std::vector< l1t::Jet > *  jets,
std::vector< l1t::EGamma > *  egammas 
)
overridevirtual

Implements l1t::Stage1Layer2EGammaAlgorithm.

Definition at line 28 of file Stage1Layer2EGammaAlgorithmImpHW.cc.

References AssociatedJetPt(), l1t::LUT::data(), l1t::EGammaToGtScales(), l1t::CaloParamsHelper::egIsolationLUT(), isoLutIndex(), params_, l1t::RegionCorrection(), l1t::SortEGammas(), and l1t::TwelveByTwelveFinder().

28  {
29 
30 
31  std::vector<l1t::CaloRegion> subRegions;
32  std::vector<l1t::EGamma> preSortEGammas;
33  std::vector<l1t::EGamma> preGtEGammas;
34 
35 
36  //Region Correction will return uncorrected subregions if
37  //regionPUSType is set to None in the config
38  RegionCorrection(regions, &subRegions, params_);
39 
40  // ----- need to cluster jets in order to compute jet isolation ----
41  std::vector<l1t::Jet> *unCorrJets = new std::vector<l1t::Jet>();
42  TwelveByTwelveFinder(0, &subRegions, unCorrJets);
43 
44 
45  for(CaloEmCandBxCollection::const_iterator egCand = EMCands.begin();
46  egCand != EMCands.end(); egCand++) {
47 
48  int eg_et = egCand->hwPt();
49  int eg_eta = egCand->hwEta();
50  int eg_phi = egCand->hwPhi();
51  int index = (egCand->hwIso()*4 + egCand->hwQual()) ;
52 
53  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > egLorentz(0,0,0,0);
54 
55  int isoFlag = 0;
56  int ijet_pt=AssociatedJetPt(eg_eta,eg_phi,unCorrJets);
57  bool isinBarrel = (eg_eta>=7 && eg_eta<=14);
58  unsigned int lutAddress = isoLutIndex(eg_et,ijet_pt);
59 
60  // Combined Barrel/Endcap LUT uses upper bit to indicate Barrel / Endcap:
61  enum {MAX_LUT_ADDRESS = 0x7fff};
62  enum {LUT_BARREL_OFFSET = 0x0, LUT_ENDCAP_OFFSET = 0x8000};
63  enum {LUT_RCT_OFFSET = 0x10000};
64 
65  unsigned int rct_offset=0;
66  if (egCand->hwIso()) rct_offset=LUT_RCT_OFFSET;
67 
68  if (eg_et >0){
69  if (lutAddress > MAX_LUT_ADDRESS) lutAddress = MAX_LUT_ADDRESS;
70 
71  if (isinBarrel){
72  isoFlag= params_->egIsolationLUT()->data(LUT_BARREL_OFFSET + rct_offset + lutAddress);
73  } else{
74  isoFlag= params_->egIsolationLUT()->data(LUT_ENDCAP_OFFSET + rct_offset + lutAddress);
75  }
76  }
77 
78  l1t::EGamma theEG(*&egLorentz, eg_et, eg_eta, eg_phi, index, isoFlag);
79  preSortEGammas.push_back(theEG);
80  }
81 
82  SortEGammas(&preSortEGammas, &preGtEGammas);
83 
84  EGammaToGtScales(params_, &preGtEGammas, egammas);
85 
86 }
void TwelveByTwelveFinder(const int, const std::vector< l1t::CaloRegion > *regions, std::vector< l1t::Jet > *uncalibjets)
l1t::LUT const * egIsolationLUT() const
void RegionCorrection(const std::vector< l1t::CaloRegion > &regions, std::vector< l1t::CaloRegion > *subRegions, CaloParamsHelper const *params)
------— New region correction (PUsub, no response correction at the moment) --------— ...
unsigned isoLutIndex(unsigned int etaPt, unsigned int jetPt) const
void SortEGammas(std::vector< l1t::EGamma > *input, std::vector< l1t::EGamma > *output)
int AssociatedJetPt(int ieta, int iphi, const std::vector< l1t::Jet > *jets) const
int data(unsigned int address) const
Definition: LUT.h:46
void EGammaToGtScales(CaloParamsHelper const *params, const std::vector< l1t::EGamma > *input, std::vector< l1t::EGamma > *output)
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:20

Member Data Documentation

CaloParamsHelper const* const l1t::Stage1Layer2EGammaAlgorithmImpHW::params_
private

Definition at line 75 of file Stage1Layer2EGammaAlgorithmImp.h.

Referenced by processEvent().