CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1 Class Reference

#include <Stage2Layer2EGammaAlgorithmFirmware.h>

Inheritance diagram for l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1:
l1t::Stage2Layer2EGammaAlgorithm

Public Member Functions

virtual void processEvent (const std::vector< CaloCluster > &clusters, const std::vector< CaloTower > &towers, std::vector< EGamma > &egammas)
 
 Stage2Layer2EGammaAlgorithmFirmwareImp1 (CaloParamsHelper *params)
 
virtual ~Stage2Layer2EGammaAlgorithmFirmwareImp1 ()
 
- Public Member Functions inherited from l1t::Stage2Layer2EGammaAlgorithm
virtual ~Stage2Layer2EGammaAlgorithm ()
 

Private Member Functions

int calibratedPt (const l1t::CaloCluster &clus, int hwPt)
 
unsigned int calibrationLutIndex (int iEta, int E, int shape)
 
bool idHOverE (const l1t::CaloCluster &clus, int hwPt)
 
unsigned int idHOverELutIndex (int iEta, int E)
 
bool idShape (const l1t::CaloCluster &clus, int hwPt)
 
unsigned int idShapeLutIndex (int iEta, int E, int shape)
 
int isoCalEgHwFootPrint (const l1t::CaloCluster &, const std::vector< l1t::CaloTower > &)
 
unsigned isoLutIndex (int iEta, unsigned int nrTowers)
 
l1t::CaloCluster trimCluster (const l1t::CaloCluster &clus)
 
unsigned int trimmingLutIndex (unsigned int shape, int iEta)
 

Private Attributes

CaloParamsHelperparams_
 

Detailed Description

Author
: Jim Brooke

Description: first iteration of stage 2 jet algo

Definition at line 23 of file Stage2Layer2EGammaAlgorithmFirmware.h.

Constructor & Destructor Documentation

l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::Stage2Layer2EGammaAlgorithmFirmwareImp1 ( CaloParamsHelper params)

Definition at line 17 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

17  :
18  params_(params)
19 /*****************************************************************/
20 {
21 
22 }
l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::~Stage2Layer2EGammaAlgorithmFirmwareImp1 ( )
virtual

Definition at line 25 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

27 {
28 }

Member Function Documentation

int l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::calibratedPt ( const l1t::CaloCluster clus,
int  hwPt 
)
private

Definition at line 249 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References l1t::CaloCluster::checkClusterFlag(), corr, l1t::L1Candidate::hwEta(), l1t::CaloCluster::INCLUDE_E, l1t::CaloCluster::INCLUDE_N, l1t::CaloCluster::INCLUDE_NE, l1t::CaloCluster::INCLUDE_NN, l1t::CaloCluster::INCLUDE_NW, l1t::CaloCluster::INCLUDE_S, l1t::CaloCluster::INCLUDE_SE, l1t::CaloCluster::INCLUDE_SS, l1t::CaloCluster::INCLUDE_SW, l1t::CaloCluster::INCLUDE_W, and l1t::CaloCluster::TRIM_LEFT.

251 {
252  unsigned int shape = 0;
253  if( (clus.checkClusterFlag(CaloCluster::INCLUDE_N)) ) shape |= (0x1);
254  if( (clus.checkClusterFlag(CaloCluster::INCLUDE_S)) ) shape |= (0x1<<1);
255  if( clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_E)) ) shape |= (0x1<<2);
256  if( !clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_W)) ) shape |= (0x1<<2);
257  if( clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_NE)) ) shape |= (0x1<<3);
258  if( !clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_NW)) ) shape |= (0x1<<3);
259  if( clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_SE)) ) shape |= (0x1<<4);
260  if( !clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_SW)) ) shape |= (0x1<<4);
261  if( clus.checkClusterFlag(CaloCluster::INCLUDE_NN) ) shape |= (0x1<<5);
262  if( clus.checkClusterFlag(CaloCluster::INCLUDE_SS) ) shape |= (0x1<<6);
263 
264  unsigned int lutAddress = calibrationLutIndex(clus.hwEta(), hwPt, shape);
265  int corr = params_->egCalibrationLUT()->data(lutAddress); // 9 bits. [0,1]. corrPt = (1+corr)*rawPt
266  // the correction can only increase the energy, and it cannot increase it more than a factor two
267  int rawPt = hwPt;
268  int corrXrawPt = corr*rawPt;// 17 bits
269  // round corr*rawPt
270  int addPt = corrXrawPt>>9;// 8 MS bits (truncation)
271  int remainder = corrXrawPt & 0x1FF; // 9 LS bits
272  if(remainder>=0x100) addPt += 1;
273  int corrPt = rawPt + addPt;
274  if(corrPt>255) corrPt = 255;// 8 bits threshold
275  return corrPt;
276 }
bool checkClusterFlag(ClusterFlag flag) const
Definition: CaloCluster.cc:66
int hwEta() const
Definition: L1Candidate.cc:74
JetCorrectorParameters corr
Definition: classes.h:5
l1t::LUT * egCalibrationLUT()
int data(unsigned int address) const
Definition: LUT.h:46
unsigned int l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::calibrationLutIndex ( int  iEta,
int  E,
int  shape 
)
private

Definition at line 279 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References funct::abs().

281 {
282  unsigned int iEtaNormed = abs(iEta);
283  if(iEtaNormed>28) iEtaNormed = 28;
284  if(E>255) E = 255;
285  if(E<22) E = 22;
286  unsigned int compressedShape = params_->egCompressShapesLUT()->data(shape);
287  if(compressedShape>31) compressedShape = 31;
288  return (E-20)+compressedShape*236+(iEtaNormed-1)*236*32;
289 }
l1t::LUT * egCompressShapesLUT()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int data(unsigned int address) const
Definition: LUT.h:46
bool l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::idHOverE ( const l1t::CaloCluster clus,
int  hwPt 
)
private

Definition at line 152 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References l1t::CaloCluster::hOverE(), l1t::L1Candidate::hwEta(), and l1t::L1Candidate::hwPt().

154 {
155  unsigned int lutAddress = idHOverELutIndex(clus.hwEta(), hwPt);
156  bool hOverEBit = ( clus.hOverE() <= params_->egMaxHOverELUT()->data(lutAddress) );
157  hOverEBit |= ( clus.hwPt()>=floor(params_->egMaxPtHOverE()/params_->egLsb()) );
158  return hOverEBit;
159 }
double egLsb() const
int hOverE() const
Definition: CaloCluster.cc:101
int hwEta() const
Definition: L1Candidate.cc:74
l1t::LUT * egMaxHOverELUT()
int hwPt() const
Definition: L1Candidate.cc:69
double egMaxPtHOverE() const
int data(unsigned int address) const
Definition: LUT.h:46
unsigned int l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::idHOverELutIndex ( int  iEta,
int  E 
)
private

Definition at line 162 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References funct::abs().

164 {
165  unsigned int iEtaNormed = abs(iEta);
166  if(iEtaNormed>28) iEtaNormed = 28;
167  if(E>255) E = 255;
168  return E+(iEtaNormed-1)*256;
169 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::idShape ( const l1t::CaloCluster clus,
int  hwPt 
)
private

Definition at line 172 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References l1t::CaloCluster::checkClusterFlag(), l1t::L1Candidate::hwEta(), l1t::CaloCluster::INCLUDE_E, l1t::CaloCluster::INCLUDE_N, l1t::CaloCluster::INCLUDE_NE, l1t::CaloCluster::INCLUDE_NN, l1t::CaloCluster::INCLUDE_NW, l1t::CaloCluster::INCLUDE_S, l1t::CaloCluster::INCLUDE_SE, l1t::CaloCluster::INCLUDE_SS, l1t::CaloCluster::INCLUDE_SW, l1t::CaloCluster::INCLUDE_W, and l1t::CaloCluster::TRIM_LEFT.

174 {
175  unsigned int shape = 0;
176  if( (clus.checkClusterFlag(CaloCluster::INCLUDE_N)) ) shape |= (0x1);
177  if( (clus.checkClusterFlag(CaloCluster::INCLUDE_S)) ) shape |= (0x1<<1);
178  if( clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_E)) ) shape |= (0x1<<2);
179  if( !clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_W)) ) shape |= (0x1<<2);
180  if( clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_NE)) ) shape |= (0x1<<3);
181  if( !clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_NW)) ) shape |= (0x1<<3);
182  if( clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_SE)) ) shape |= (0x1<<4);
183  if( !clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_SW)) ) shape |= (0x1<<4);
184  if( clus.checkClusterFlag(CaloCluster::INCLUDE_NN) ) shape |= (0x1<<5);
185  if( clus.checkClusterFlag(CaloCluster::INCLUDE_SS) ) shape |= (0x1<<6);
186 
187  unsigned int lutAddress = idShapeLutIndex(clus.hwEta(), hwPt, shape);
188  bool shapeBit = params_->egShapeIdLUT()->data(lutAddress);
189  return shapeBit;
190 }
bool checkClusterFlag(ClusterFlag flag) const
Definition: CaloCluster.cc:66
int hwEta() const
Definition: L1Candidate.cc:74
int data(unsigned int address) const
Definition: LUT.h:46
unsigned int l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::idShapeLutIndex ( int  iEta,
int  E,
int  shape 
)
private

Definition at line 193 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References funct::abs().

195 {
196  unsigned int iEtaNormed = abs(iEta);
197  if(iEtaNormed>28) iEtaNormed = 28;
198  if(E>255) E = 255;
199  unsigned int compressedShape = params_->egCompressShapesLUT()->data(shape);
200  return E+compressedShape*256+(iEtaNormed-1)*256*64;
201 }
l1t::LUT * egCompressShapesLUT()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int data(unsigned int address) const
Definition: LUT.h:46
int l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::isoCalEgHwFootPrint ( const l1t::CaloCluster clus,
const std::vector< l1t::CaloTower > &  towers 
)
private

Definition at line 205 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References l1t::CaloTools::calHwEtSum(), l1t::CaloCluster::checkClusterFlag(), l1t::CaloTools::ECAL, l1t::CaloTools::HCAL, l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), and l1t::CaloCluster::TRIM_LEFT.

207 {
208  int iEta=clus.hwEta();
209  int iPhi=clus.hwPhi();
210 
211  // hwEmEtSumLeft = CaloTools::calHwEtSum(iEta,iPhi,towers,-1,-1,-1,1,CaloTools::ECAL);
212  // int hwEmEtSumRight = CaloTools::calHwEtSum(iEta,iPhi,towers,1,1,-1,1,CaloTools::ECAL);
213 
214  int etaSide = clus.checkClusterFlag(CaloCluster::TRIM_LEFT) ? 1 : -1; //if we trimed left, its the right (ie +ve) side we want
215  int phiSide = iEta>0 ? 1 : -1;
216 
217  int ecalHwFootPrint = CaloTools::calHwEtSum(iEta,iPhi,towers,0,0,
220  CaloTools::calHwEtSum(iEta,iPhi,towers,etaSide,etaSide,
223  int hcalHwFootPrint = CaloTools::calHwEtSum(iEta,iPhi,towers,0,0,0,0,params_->egPUSParam(2),CaloTools::HCAL) +
224  CaloTools::calHwEtSum(iEta,iPhi,towers,0,0,phiSide,phiSide,params_->egPUSParam(2),CaloTools::HCAL);
225  return ecalHwFootPrint+hcalHwFootPrint;
226 }
static int calHwEtSum(int iEta, int iPhi, const std::vector< l1t::CaloTower > &towers, int localEtaMin, int localEtaMax, int localPhiMin, int localPhiMax, SubDet etMode=CALO)
Definition: CaloTools.cc:81
int hwPhi() const
Definition: L1Candidate.cc:79
bool checkClusterFlag(ClusterFlag flag) const
Definition: CaloCluster.cc:66
unsigned egIsoVetoNrTowersPhi() const
int hwEta() const
Definition: L1Candidate.cc:74
double egPUSParam(int ipar) const
unsigned l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::isoLutIndex ( int  iEta,
unsigned int  nrTowers 
)
private

Definition at line 230 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References funct::abs().

232 {
233  const unsigned int kNrTowersInSum=72*params_->egPUSParam(1)*2;
234  const unsigned int kTowerGranularity=params_->egPUSParam(0);
235  const unsigned int kMaxAddress = kNrTowersInSum%kTowerGranularity==0 ? (kNrTowersInSum/kTowerGranularity+1)*28*2 :
236  (kNrTowersInSum/kTowerGranularity)*28*2;
237 
238  unsigned int nrTowersNormed = nrTowers/kTowerGranularity;
239 
240  unsigned int iEtaNormed = iEta+28;
241  if(iEta>0) iEtaNormed--; //we skip zero
242 
243  if(std::abs(iEta)>28 || iEta==0 || nrTowers>kNrTowersInSum) return kMaxAddress;
244  else return iEtaNormed*(kNrTowersInSum/kTowerGranularity+1)+nrTowersNormed;
245 
246 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double egPUSParam(int ipar) const
void l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent ( const std::vector< CaloCluster > &  clusters,
const std::vector< CaloTower > &  towers,
std::vector< EGamma > &  egammas 
)
virtual

Implements l1t::Stage2Layer2EGammaAlgorithm.

Definition at line 31 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References l1t::CaloTools::calHwEtSum(), l1t::CaloTools::calNrTowers(), l1t::CaloTools::CALO, l1t::CaloCluster::checkClusterFlag(), eta, l1t::CaloTools::getTower(), l1t::L1Candidate::hwEta(), l1t::CaloTower::hwEtEm(), l1t::L1Candidate::hwPt(), l1t::CaloCluster::INCLUDE_E, l1t::CaloCluster::INCLUDE_N, l1t::CaloCluster::INCLUDE_NE, l1t::CaloCluster::INCLUDE_NN, l1t::CaloCluster::INCLUDE_NW, l1t::CaloCluster::INCLUDE_S, l1t::CaloCluster::INCLUDE_SE, l1t::CaloCluster::INCLUDE_SS, l1t::CaloCluster::INCLUDE_SW, l1t::CaloCluster::INCLUDE_W, l1t::CaloStage2Nav::offsetIEta(), l1t::CaloStage2Nav::offsetIPhi(), phi(), fileCollector::seed, l1t::L1Candidate::setHwIso(), l1t::L1Candidate::setHwPt(), l1t::L1Candidate::setHwQual(), reco::LeafCandidate::setP4(), l1t::CaloTools::towerEta(), l1t::CaloTools::towerEtaSize(), l1t::CaloTools::towerPhi(), l1t::CaloTools::towerPhiSize(), and HLT_25ns14e33_v1_cff::towers.

33 {
34  l1t::CaloStage2Nav caloNav;
35  egammas.clear();
36  for(const auto& cluster : clusters)
37  {
38  // Keep only valid clusters
39  if(cluster.isValid())
40  {
41  // need tower energies to recompute egamma trimmed energy
42  int iEta = cluster.hwEta();
43  int iPhi = cluster.hwPhi();
44  int iEtaP = caloNav.offsetIEta(iEta, 1);
45  int iEtaM = caloNav.offsetIEta(iEta, -1);
46  int iPhiP = caloNav.offsetIPhi(iPhi, 1);
47  int iPhiP2 = caloNav.offsetIPhi(iPhi, 2);
48  int iPhiM = caloNav.offsetIPhi(iPhi, -1);
49  int iPhiM2 = caloNav.offsetIPhi(iPhi, -2);
50  const l1t::CaloTower& seed = l1t::CaloTools::getTower(towers, iEta , iPhi );
51  const l1t::CaloTower& towerNW = l1t::CaloTools::getTower(towers, iEtaM, iPhiM);
52  const l1t::CaloTower& towerN = l1t::CaloTools::getTower(towers, iEta , iPhiM);
53  const l1t::CaloTower& towerNE = l1t::CaloTools::getTower(towers, iEtaP, iPhiM);
54  const l1t::CaloTower& towerE = l1t::CaloTools::getTower(towers, iEtaP, iPhi );
55  const l1t::CaloTower& towerSE = l1t::CaloTools::getTower(towers, iEtaP, iPhiP);
56  const l1t::CaloTower& towerS = l1t::CaloTools::getTower(towers, iEta , iPhiP);
57  const l1t::CaloTower& towerSW = l1t::CaloTools::getTower(towers, iEtaM, iPhiP);
58  const l1t::CaloTower& towerW = l1t::CaloTools::getTower(towers, iEtaM, iPhi );
59  const l1t::CaloTower& towerNN = l1t::CaloTools::getTower(towers, iEta , iPhiM2);
60  const l1t::CaloTower& towerSS = l1t::CaloTools::getTower(towers, iEta , iPhiP2);
61  //
62  int seedEt = seed .hwEtEm();
63  int towerEtNW = towerNW.hwEtEm();
64  int towerEtN = towerN .hwEtEm();
65  int towerEtNE = towerNE.hwEtEm();
66  int towerEtE = towerE .hwEtEm();
67  int towerEtSE = towerSE.hwEtEm();
68  int towerEtS = towerS .hwEtEm();
69  int towerEtSW = towerSW.hwEtEm();
70  int towerEtW = towerW .hwEtEm();
71  int towerEtNN = towerNN.hwEtEm();
72  int towerEtSS = towerSS.hwEtEm();
73 
74  // initialize egamma from cluster
75  egammas.push_back(cluster);
76  l1t::EGamma& egamma = egammas.back();
77 
78  // Trim cluster (only for egamma energy computation, the original cluster is unchanged)
79  l1t::CaloCluster clusterTrim = trimCluster(cluster);
80 
81  // Recompute hw energy (of the trimmed cluster) from towers
82  egamma.setHwPt(seedEt);
83  if(clusterTrim.checkClusterFlag(CaloCluster::INCLUDE_NW)) egamma.setHwPt(egamma.hwPt() + towerEtNW);
84  if(clusterTrim.checkClusterFlag(CaloCluster::INCLUDE_N)) egamma.setHwPt(egamma.hwPt() + towerEtN);
85  if(clusterTrim.checkClusterFlag(CaloCluster::INCLUDE_NE)) egamma.setHwPt(egamma.hwPt() + towerEtNE);
86  if(clusterTrim.checkClusterFlag(CaloCluster::INCLUDE_E)) egamma.setHwPt(egamma.hwPt() + towerEtE);
87  if(clusterTrim.checkClusterFlag(CaloCluster::INCLUDE_SE)) egamma.setHwPt(egamma.hwPt() + towerEtSE);
88  if(clusterTrim.checkClusterFlag(CaloCluster::INCLUDE_S)) egamma.setHwPt(egamma.hwPt() + towerEtS);
89  if(clusterTrim.checkClusterFlag(CaloCluster::INCLUDE_SW)) egamma.setHwPt(egamma.hwPt() + towerEtSW);
90  if(clusterTrim.checkClusterFlag(CaloCluster::INCLUDE_W)) egamma.setHwPt(egamma.hwPt() + towerEtW);
91  if(clusterTrim.checkClusterFlag(CaloCluster::INCLUDE_NN)) egamma.setHwPt(egamma.hwPt() + towerEtNN);
92  if(clusterTrim.checkClusterFlag(CaloCluster::INCLUDE_SS)) egamma.setHwPt(egamma.hwPt() + towerEtSS);
93 
94 
95  // Identification of the egamma
96  // Based on the seed tower FG bit, the H/E ratio of the seed toswer, and the shape of the cluster
97  bool hOverEBit = idHOverE(cluster, egamma.hwPt());
98  bool shapeBit = idShape(cluster, egamma.hwPt());
99  bool fgBit = !(cluster.hwSeedPt()>6 && cluster.fgECAL());
100  int qual = 0;
101  if(fgBit) qual |= (0x1); // first bit = FG
102  if(hOverEBit) qual |= (0x1<<1); // second bit = H/E
103  if(shapeBit) qual |= (0x1<<2); // third bit = shape
104  egamma.setHwQual( qual );
105 
106 
107  // Isolation
108  int hwEtSum = CaloTools::calHwEtSum(cluster.hwEta(), cluster.hwPhi(), towers,
111  params_->egPUSParam(2));
112  int hwFootPrint = isoCalEgHwFootPrint(cluster,towers);
113 
114  int nrTowers = CaloTools::calNrTowers(-1*params_->egPUSParam(1),
115  params_->egPUSParam(1),
116  1,72,towers,1,999,CaloTools::CALO);
117  unsigned int lutAddress = isoLutIndex(egamma.hwEta(), nrTowers);
118 
119  int isolBit = hwEtSum-hwFootPrint <= params_->egIsolationLUT()->data(lutAddress);
120  // std::cout <<"hwEtSum "<<hwEtSum<<" hwFootPrint "<<hwFootPrint<<" isol "<<hwEtSum-hwFootPrint<<" bit "<<isolBit<<" area "<<params_->egIsoAreaNrTowersEta()<<" "<<params_->egIsoAreaNrTowersPhi()<< " veto "<<params_->egIsoVetoNrTowersPhi()<<std::endl;
121 
122  egamma.setHwIso(isolBit);
123  // egammas.back().setHwIso(hwEtSum-hwFootPrint); //naughtly little debug hack, shouldnt be in release, comment out if it is
124 
125  // Energy calibration
126  // Corrections function of ieta, ET, and cluster shape
127  int calibPt = calibratedPt(cluster, egamma.hwPt());
128 
129  // Physical eta/phi. Computed from ieta/iphi of the seed tower and the fine-grain position within the seed
130  double eta = 0.;
131  double phi = 0.;
132  double seedEta = CaloTools::towerEta(cluster.hwEta());
133  double seedEtaSize = CaloTools::towerEtaSize(cluster.hwEta());
134  double seedPhi = CaloTools::towerPhi(cluster.hwEta(), cluster.hwPhi());
135  double seedPhiSize = CaloTools::towerPhiSize(cluster.hwEta());
136  if(cluster.fgEta()==0) eta = seedEta; // center
137  else if(cluster.fgEta()==2) eta = seedEta + seedEtaSize*0.25; // center + 1/4
138  else if(cluster.fgEta()==1) eta = seedEta - seedEtaSize*0.25; // center - 1/4
139  if(cluster.fgPhi()==0) phi = seedPhi; // center
140  else if(cluster.fgPhi()==2) phi = seedPhi + seedPhiSize*0.25; // center + 1/4
141  else if(cluster.fgPhi()==1) phi = seedPhi - seedPhiSize*0.25; // center - 1/4
142 
143  // Set 4-vector
144  math::PtEtaPhiMLorentzVector calibP4((double)calibPt*params_->egLsb(), eta, phi, 0.);
145  egamma.setP4(calibP4);
146 
147  }//end of cuts on cluster to make EGamma
148  }//end of cluster loop
149 }
static float towerEta(int ieta)
Definition: CaloTools.cc:141
static float towerPhi(int ieta, int iphi)
Definition: CaloTools.cc:149
static int offsetIEta(int iEta, int offset)
Definition: CaloStage2Nav.h:43
static float towerEtaSize(int ieta)
Definition: CaloTools.cc:154
static int calHwEtSum(int iEta, int iPhi, const std::vector< l1t::CaloTower > &towers, int localEtaMin, int localEtaMax, int localPhiMin, int localPhiMax, SubDet etMode=CALO)
Definition: CaloTools.cc:81
unsigned egIsoAreaNrTowersPhi() const
virtual void setP4(const LorentzVector &p4)
set 4-momentum
void setHwQual(int qual)
Definition: L1Candidate.cc:64
int isoCalEgHwFootPrint(const l1t::CaloCluster &, const std::vector< l1t::CaloTower > &)
int hwEtEm() const
Definition: CaloTower.cc:64
double egLsb() const
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
bool checkClusterFlag(ClusterFlag flag) const
Definition: CaloCluster.cc:66
static int offsetIPhi(int iPhi, int offset)
Definition: CaloStage2Nav.h:32
static size_t calNrTowers(int iEtaMin, int iEtaMax, int iPhiMin, int iPhiMax, const std::vector< l1t::CaloTower > &towers, int minHwEt, int maxHwEt, SubDet etMode=CALO)
Definition: CaloTools.cc:110
l1t::CaloCluster trimCluster(const l1t::CaloCluster &clus)
int hwEta() const
Definition: L1Candidate.cc:74
double egPUSParam(int ipar) const
static float towerPhiSize(int ieta)
Definition: CaloTools.cc:161
void setHwIso(int iso)
Definition: L1Candidate.cc:59
int hwPt() const
Definition: L1Candidate.cc:69
static const l1t::CaloTower & getTower(const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
Definition: CaloTools.cc:11
void setHwPt(int pt)
Definition: L1Candidate.cc:44
int data(unsigned int address) const
Definition: LUT.h:46
unsigned egIsoAreaNrTowersEta() const
l1t::CaloCluster l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::trimCluster ( const l1t::CaloCluster clus)
private

Definition at line 292 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References l1t::CaloCluster::checkClusterFlag(), l1t::L1Candidate::hwEta(), l1t::CaloCluster::INCLUDE_E, l1t::CaloCluster::INCLUDE_N, l1t::CaloCluster::INCLUDE_NE, l1t::CaloCluster::INCLUDE_NN, l1t::CaloCluster::INCLUDE_NW, l1t::CaloCluster::INCLUDE_S, l1t::CaloCluster::INCLUDE_SE, l1t::CaloCluster::INCLUDE_SS, l1t::CaloCluster::INCLUDE_SW, l1t::CaloCluster::INCLUDE_W, l1t::CaloCluster::setClusterFlag(), and l1t::CaloCluster::TRIM_LEFT.

294 {
295  l1t::CaloCluster clusCopy = clus;
296 
297  unsigned int shape = 0;
298  if( (clus.checkClusterFlag(CaloCluster::INCLUDE_N)) ) shape |= (0x1);
299  if( (clus.checkClusterFlag(CaloCluster::INCLUDE_S)) ) shape |= (0x1<<1);
300  if( clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_E)) ) shape |= (0x1<<2);
301  if( !clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_W)) ) shape |= (0x1<<2);
302  if( clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_NE)) ) shape |= (0x1<<3);
303  if( !clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_NW)) ) shape |= (0x1<<3);
304  if( clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_SE)) ) shape |= (0x1<<4);
305  if( !clus.checkClusterFlag(CaloCluster::TRIM_LEFT) && (clus.checkClusterFlag(CaloCluster::INCLUDE_SW)) ) shape |= (0x1<<4);
306  if( clus.checkClusterFlag(CaloCluster::INCLUDE_NN) ) shape |= (0x1<<5);
307  if( clus.checkClusterFlag(CaloCluster::INCLUDE_SS) ) shape |= (0x1<<6);
308 
309  unsigned int lutAddress = trimmingLutIndex(shape, clus.hwEta());
310  unsigned int shapeTrim = params_->egTrimmingLUT()->data(lutAddress);
311  // apply trimming flags
312  clusCopy.setClusterFlag(CaloCluster::INCLUDE_N, ( shapeTrim&(0x1) ) ? true : false);
313  clusCopy.setClusterFlag(CaloCluster::INCLUDE_S, ( shapeTrim&(0x1<<1) ) ? true : false);
314  clusCopy.setClusterFlag(CaloCluster::INCLUDE_NN, ( shapeTrim&(0x1<<5) ) ? true : false);
315  clusCopy.setClusterFlag(CaloCluster::INCLUDE_SS, ( shapeTrim&(0x1<<6) ) ? true : false);
317  {
318  clusCopy.setClusterFlag(CaloCluster::INCLUDE_E, ( shapeTrim&(0x1<<2) ) ? true : false);
319  clusCopy.setClusterFlag(CaloCluster::INCLUDE_NE, ( shapeTrim&(0x1<<3) ) ? true : false);
320  clusCopy.setClusterFlag(CaloCluster::INCLUDE_SE, ( shapeTrim&(0x1<<4) ) ? true : false);
321  }
322  else
323  {
324  clusCopy.setClusterFlag(CaloCluster::INCLUDE_W, ( shapeTrim&(0x1<<2) ) ? true : false);
325  clusCopy.setClusterFlag(CaloCluster::INCLUDE_NW, ( shapeTrim&(0x1<<3) ) ? true : false);
326  clusCopy.setClusterFlag(CaloCluster::INCLUDE_SW, ( shapeTrim&(0x1<<4) ) ? true : false);
327  }
328  return clusCopy;
329 }
bool checkClusterFlag(ClusterFlag flag) const
Definition: CaloCluster.cc:66
int hwEta() const
Definition: L1Candidate.cc:74
l1t::LUT * egTrimmingLUT()
int data(unsigned int address) const
Definition: LUT.h:46
void setClusterFlag(ClusterFlag flag, bool val=true)
Definition: CaloCluster.cc:19
unsigned int l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::trimmingLutIndex ( unsigned int  shape,
int  iEta 
)
private

Definition at line 332 of file Stage2Layer2EGammaAlgorithmFirmwareImp1.cc.

References funct::abs(), and cmsHarvester::index.

334 {
335  unsigned int iEtaNormed = abs(iEta)-1;
336  if(iEtaNormed>31) iEtaNormed = 31;
337  if(shape>127) shape = 127;
338  unsigned int index = iEtaNormed*128+shape;
339  return index;
340 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

CaloParamsHelper* l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::params_
private

Definition at line 47 of file Stage2Layer2EGammaAlgorithmFirmware.h.