25 Stage1Layer2EGammaAlgorithmImpHW::Stage1Layer2EGammaAlgorithmImpHW(
CaloParamsHelper* params) : params_(params) {};
34 std::vector<l1t::CaloRegion> *subRegions =
new std::vector<l1t::CaloRegion>();
35 std::vector<l1t::EGamma> *preSortEGammas =
new std::vector<l1t::EGamma>();
36 std::vector<l1t::EGamma> *preGtEGammas =
new std::vector<l1t::EGamma>();
44 std::vector<l1t::Jet> *unCorrJets =
new std::vector<l1t::Jet>();
51 egCand != EMCands.end(); egCand++) {
53 int eg_et = egCand->hwPt();
54 int eg_eta = egCand->hwEta();
55 int eg_phi = egCand->hwPhi();
56 int index = (egCand->hwIso()*4 + egCand->hwQual()) ;
61 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > egLorentz(0,0,0,0);
64 int ijet_pt=AssociatedJetPt(eg_eta,eg_phi,unCorrJets);
65 bool isinBarrel = (eg_eta>=7 && eg_eta<=14);
66 unsigned int lutAddress = isoLutIndex(eg_et,ijet_pt);
69 enum {MAX_LUT_ADDRESS = 0x7fff};
70 enum {LUT_BARREL_OFFSET = 0x0, LUT_ENDCAP_OFFSET = 0x8000};
71 enum {LUT_RCT_OFFSET = 0x10000};
73 unsigned int rct_offset=0;
74 if (egCand->hwIso()) rct_offset=LUT_RCT_OFFSET;
77 if (lutAddress > MAX_LUT_ADDRESS) lutAddress = MAX_LUT_ADDRESS;
80 isoFlag= params_->egIsolationLUT()->data(LUT_BARREL_OFFSET + rct_offset + lutAddress);
82 isoFlag= params_->egIsolationLUT()->data(LUT_ENDCAP_OFFSET + rct_offset + lutAddress);
88 l1t::EGamma theEG(*&egLorentz, eg_et, eg_eta, eg_phi, index, isoFlag);
89 preSortEGammas->push_back(theEG);
113 printf(
"EGammas Isolated\n");
114 for(std::vector<l1t::EGamma>::const_iterator itEGamma = egammas->begin();
115 itEGamma != egammas->end(); ++itEGamma){
116 if(itEGamma->hwIso() != 1)
continue;
118 unsigned int packed =
pack15bits(itEGamma->hwPt(), itEGamma->hwEta(), itEGamma->hwPhi());
119 cout << bitset<15>(packed).
to_string() << endl;
120 if(cEGammas == 4)
break;
123 printf(
"EGammas Non-isolated\n");
124 for(std::vector<l1t::EGamma>::const_iterator itEGamma = egammas->begin();
125 itEGamma != egammas->end(); ++itEGamma){
126 if(itEGamma->hwIso() != 0)
continue;
128 unsigned int packed =
pack15bits(itEGamma->hwPt(), itEGamma->hwEta(), itEGamma->hwPhi());
129 cout << bitset<15>(packed).
to_string() << endl;
130 if(fEGammas == 4)
break;
136 delete preSortEGammas;
144 const unsigned int nbitsEG=6;
148 if(jetPt > 511) jetPt = 511;
149 unsigned int address= (jetPt << nbitsEG) + egPt;
155 const std::vector<l1t::Jet> *
jets)
const {
159 if (Debug)
cout <<
"Number of jets: " << jets->size() << endl;
164 itJet != jets->end(); ++itJet){
166 int jetEta = itJet->hwEta();
167 int jetPhi = itJet->hwPhi();
168 if (Debug)
cout <<
"Matching ETA: " << ieta <<
" " << jetEta << endl;
169 if (Debug)
cout <<
"Matching PHI: " << iphi <<
" " << jetPhi << endl;
170 if ((jetEta == ieta) && (jetPhi == iphi)){
void RegionCorrection(const std::vector< l1t::CaloRegion > ®ions, std::vector< l1t::CaloRegion > *subRegions, CaloParamsHelper *params)
------— New region correction (PUsub, no response correction at the moment) --------— ...
void EGammaToGtScales(CaloParamsHelper *params, const std::vector< l1t::EGamma > *input, std::vector< l1t::EGamma > *output)
void TwelveByTwelveFinder(const int, const std::vector< l1t::CaloRegion > *regions, std::vector< l1t::Jet > *uncalibjets)
std::string to_string(const T &t)
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
unsigned int pack15bits(int pt, int eta, int phi)
virtual ~Stage1Layer2EGammaAlgorithmImpHW()
virtual void processEvent(const std::vector< l1t::CaloEmCand > &EMCands, const std::vector< l1t::CaloRegion > ®ions, const std::vector< l1t::Jet > *jets, std::vector< l1t::EGamma > *egammas)
std::vector< CaloEmCand >::const_iterator const_iterator