CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
EGEnergyCorrector Class Reference

#include <EGEnergyCorrector.h>

Public Member Functions

std::pair< double, double > CorrectedEnergyWithError (const reco::Photon &p, const reco::VertexCollection &vtxcol, EcalClusterLazyTools &clustertools, const edm::EventSetup &es)
 
std::pair< double, double > CorrectedEnergyWithError (const reco::GsfElectron &e, const reco::VertexCollection &vtxcol, EcalClusterLazyTools &clustertools, const edm::EventSetup &es)
 
std::pair< double, double > CorrectedEnergyWithErrorV3 (const reco::Photon &p, const reco::VertexCollection &vtxcol, double rho, EcalClusterLazyTools &clustertools, const edm::EventSetup &es, bool applyRescale=false)
 
std::pair< double, double > CorrectedEnergyWithErrorV3 (const reco::GsfElectron &e, const reco::VertexCollection &vtxcol, double rho, EcalClusterLazyTools &clustertools, const edm::EventSetup &es)
 
 EGEnergyCorrector ()
 
void Initialize (const edm::EventSetup &iSetup, std::string regweights, bool weightsFromDB=false)
 
Bool_t IsInitialized () const
 
 ~EGEnergyCorrector ()
 

Protected Attributes

EcalClusterLocal _ecalLocal
 
Bool_t fIsInitialized
 
Bool_t fOwnsForests
 
const GBRForestfReadereb
 
const GBRForestfReaderebvariance
 
const GBRForestfReaderee
 
const GBRForestfReadereevariance
 
Float_t * fVals
 

Detailed Description

Definition at line 22 of file EGEnergyCorrector.h.

Constructor & Destructor Documentation

EGEnergyCorrector::EGEnergyCorrector ( )

Definition at line 17 of file EGEnergyCorrector.cc.

17  :
18 fReadereb(0),
20 fReaderee(0),
22 fIsInitialized(kFALSE),
23 fOwnsForests(kFALSE),
24 fVals(0)
25 {
26  // Constructor.
27 }
const GBRForest * fReaderee
const GBRForest * fReadereb
const GBRForest * fReaderebvariance
const GBRForest * fReadereevariance
EGEnergyCorrector::~EGEnergyCorrector ( )

Definition at line 31 of file EGEnergyCorrector.cc.

References fOwnsForests, fReadereb, fReaderebvariance, fReaderee, fReadereevariance, and fVals.

32 {
33 
34  if (fVals) delete [] fVals;
35 
36  if (fOwnsForests) {
37  if (fReadereb) delete fReadereb;
39  if (fReaderee) delete fReaderee;
41  }
42 
43 }
const GBRForest * fReaderee
const GBRForest * fReadereb
const GBRForest * fReaderebvariance
const GBRForest * fReadereevariance

Member Function Documentation

std::pair< double, double > EGEnergyCorrector::CorrectedEnergyWithError ( const reco::Photon p,
const reco::VertexCollection vtxcol,
EcalClusterLazyTools clustertools,
const edm::EventSetup es 
)

Definition at line 91 of file EGEnergyCorrector.cc.

References _ecalLocal, b, reco::deltaPhi(), EcalClusterLazyTools::e2nd(), EcalClusterLazyTools::e3x3(), EcalClusterLazyTools::e5x5(), reco::Photon::e5x5(), EcalClusterLazyTools::eBottom(), EcalBarrel, EcalClusterLazyTools::eLeft(), EcalClusterLazyTools::eMax(), EcalClusterLazyTools::eRight(), EcalClusterLazyTools::eTop(), fReadereb, fReaderebvariance, fReaderee, fReadereevariance, fVals, GBRForest::GetResponse(), reco::Photon::hadronicOverEm(), edm::Ptr< T >::isNonnull(), EcalClusterLocal::localCoordsEB(), EcalClusterLazyTools::localCovariances(), create_public_lumi_plots::log, reco::Photon::r9(), matplotRender::reader, alignCSCRings::s, mathSSE::sqrt(), and reco::Photon::superCluster().

Referenced by EGEnergyAnalyzer::analyze(), and PhotonEnergyCorrector::calculate().

91  {
92 
93  const SuperClusterRef s = p.superCluster();
94  const CaloClusterPtr b = s->seed(); //seed basic cluster
95 
96  //highest energy basic cluster excluding seed basic cluster
97  CaloClusterPtr b2;
98  Double_t ebcmax = -99.;
99  for (reco::CaloCluster_iterator bit = s->clustersBegin(); bit!=s->clustersEnd(); ++bit) {
100  const CaloClusterPtr bc = *bit;
101  if (bc->energy() > ebcmax && bc !=b) {
102  b2 = bc;
103  ebcmax = bc->energy();
104  }
105  }
106 
107  //lowest energy basic cluster excluding seed (for pileup mitigation)
108  CaloClusterPtr bclast;
109  Double_t ebcmin = 1e6;
110  for (reco::CaloCluster_iterator bit = s->clustersBegin(); bit!=s->clustersEnd(); ++bit) {
111  const CaloClusterPtr bc = *bit;
112  if (bc->energy() < ebcmin && bc !=b) {
113  bclast = bc;
114  ebcmin = bc->energy();
115  }
116  }
117 
118  //2nd lowest energy basic cluster excluding seed (for pileup mitigation)
119  CaloClusterPtr bclast2;
120  ebcmin = 1e6;
121  for (reco::CaloCluster_iterator bit = s->clustersBegin(); bit!=s->clustersEnd(); ++bit) {
122  const CaloClusterPtr bc = *bit;
123  if (bc->energy() < ebcmin && bc !=b && bc!=bclast) {
124  bclast2 = bc;
125  ebcmin = bc->energy();
126  }
127  }
128 
129  Bool_t isbarrel = b->hitsAndFractions().at(0).first.subdetId()==EcalBarrel;
130  Bool_t hasbc2 = b2.isNonnull() && b2->energy()>0.;
131  Bool_t hasbclast = bclast.isNonnull() && bclast->energy()>0.;
132  Bool_t hasbclast2 = bclast2.isNonnull() && bclast2->energy()>0.;
133 
134 
135  if (isbarrel) {
136 
137  //basic supercluster variables
138  fVals[0] = s->rawEnergy();
139  fVals[1] = p.r9();
140  fVals[2] = s->eta();
141  fVals[3] = s->phi();
142  fVals[4] = p.e5x5()/s->rawEnergy();
143  fVals[5] = p.hadronicOverEm();
144  fVals[6] = s->etaWidth();
145  fVals[7] = s->phiWidth();
146 
147 
148  //seed basic cluster variables
149  double bemax = clustertools.eMax(*b);
150  double be2nd = clustertools.e2nd(*b);
151  double betop = clustertools.eTop(*b);
152  double bebottom = clustertools.eBottom(*b);
153  double beleft = clustertools.eLeft(*b);
154  double beright = clustertools.eRight(*b);
155 
156 
157  fVals[8] = b->eta()-s->eta();
158  fVals[9] = reco::deltaPhi(b->phi(),s->phi());
159  fVals[10] = b->energy()/s->rawEnergy();
160  fVals[11] = clustertools.e3x3(*b)/b->energy();
161  fVals[12] = clustertools.e5x5(*b)/b->energy();
162  fVals[13] = sqrt(clustertools.localCovariances(*b)[0]); //sigietaieta
163  fVals[14] = sqrt(clustertools.localCovariances(*b)[2]); //sigiphiiphi
164  fVals[15] = clustertools.localCovariances(*b)[1]; //sigietaiphi
165  fVals[16] = bemax/b->energy(); //crystal energy ratio gap variables
166  fVals[17] = log(be2nd/bemax);
167  fVals[18] = log(betop/bemax);
168  fVals[19] = log(bebottom/bemax);
169  fVals[20] = log(beleft/bemax);
170  fVals[21] = log(beright/bemax);
171  fVals[22] = (betop-bebottom)/(betop+bebottom);
172  fVals[23] = (beleft-beright)/(beleft+beright);
173 
174 
175  double bc2emax = hasbc2 ? clustertools.eMax(*b2) : 0.;
176  double bc2e2nd = hasbc2 ? clustertools.e2nd(*b2) : 0.;
177  double bc2etop = hasbc2 ? clustertools.eTop(*b2) : 0.;
178  double bc2ebottom = hasbc2 ? clustertools.eBottom(*b2) : 0.;
179  double bc2eleft = hasbc2 ? clustertools.eLeft(*b2) : 0.;
180  double bc2eright = hasbc2 ? clustertools.eRight(*b2) : 0.;
181 
182  fVals[24] = hasbc2 ? (b2->eta()-s->eta()) : 0.;
183  fVals[25] = hasbc2 ? reco::deltaPhi(b2->phi(),s->phi()) : 0.;
184  fVals[26] = hasbc2 ? b2->energy()/s->rawEnergy() : 0.;
185  fVals[27] = hasbc2 ? clustertools.e3x3(*b2)/b2->energy() : 0.;
186  fVals[28] = hasbc2 ? clustertools.e5x5(*b2)/b2->energy() : 0.;
187  fVals[29] = hasbc2 ? sqrt(clustertools.localCovariances(*b2)[0]) : 0.;
188  fVals[30] = hasbc2 ? sqrt(clustertools.localCovariances(*b2)[2]) : 0.;
189  fVals[31] = hasbc2 ? clustertools.localCovariances(*b)[1] : 0.;
190  fVals[32] = hasbc2 ? bc2emax/b2->energy() : 0.;
191  fVals[33] = hasbc2 ? log(bc2e2nd/bc2emax) : 0.;
192  fVals[34] = hasbc2 ? log(bc2etop/bc2emax) : 0.;
193  fVals[35] = hasbc2 ? log(bc2ebottom/bc2emax) : 0.;
194  fVals[36] = hasbc2 ? log(bc2eleft/bc2emax) : 0.;
195  fVals[37] = hasbc2 ? log(bc2eright/bc2emax) : 0.;
196  fVals[38] = hasbc2 ? (bc2etop-bc2ebottom)/(bc2etop+bc2ebottom) : 0.;
197  fVals[39] = hasbc2 ? (bc2eleft-bc2eright)/(bc2eleft+bc2eright) : 0.;
198 
199  fVals[40] = hasbclast ? (bclast->eta()-s->eta()) : 0.;
200  fVals[41] = hasbclast ? reco::deltaPhi(bclast->phi(),s->phi()) : 0.;
201  fVals[42] = hasbclast ? bclast->energy()/s->rawEnergy() : 0.;
202  fVals[43] = hasbclast ? clustertools.e3x3(*bclast)/bclast->energy() : 0.;
203  fVals[44] = hasbclast ? clustertools.e5x5(*bclast)/bclast->energy() : 0.;
204  fVals[45] = hasbclast ? sqrt(clustertools.localCovariances(*bclast)[0]) : 0.;
205  fVals[46] = hasbclast ? sqrt(clustertools.localCovariances(*bclast)[2]) : 0.;
206  fVals[47] = hasbclast ? clustertools.localCovariances(*bclast)[1] : 0.;
207 
208  fVals[48] = hasbclast2 ? (bclast2->eta()-s->eta()) : 0.;
209  fVals[49] = hasbclast2 ? reco::deltaPhi(bclast2->phi(),s->phi()) : 0.;
210  fVals[50] = hasbclast2 ? bclast2->energy()/s->rawEnergy() : 0.;
211  fVals[51] = hasbclast2 ? clustertools.e3x3(*bclast2)/bclast2->energy() : 0.;
212  fVals[52] = hasbclast2 ? clustertools.e5x5(*bclast2)/bclast2->energy() : 0.;
213  fVals[53] = hasbclast2 ? sqrt(clustertools.localCovariances(*bclast2)[0]) : 0.;
214  fVals[54] = hasbclast2 ? sqrt(clustertools.localCovariances(*bclast2)[2]) : 0.;
215  fVals[55] = hasbclast2 ? clustertools.localCovariances(*bclast2)[1] : 0.;
216 
217 
218  //local coordinates and crystal indices
219 
220 
221  //seed cluster
222  float betacry, bphicry, bthetatilt, bphitilt;
223  int bieta, biphi;
224  _ecalLocal.localCoordsEB(*b,es,betacry,bphicry,bieta,biphi,bthetatilt,bphitilt);
225 
226  fVals[56] = bieta; //crystal ieta
227  fVals[57] = biphi; //crystal iphi
228  fVals[58] = bieta%5; //submodule boundary eta symmetry
229  fVals[59] = biphi%2; //submodule boundary phi symmetry
230  fVals[60] = (TMath::Abs(bieta)<=25)*(bieta%25) + (TMath::Abs(bieta)>25)*((bieta-25*TMath::Abs(bieta)/bieta)%20); //module boundary eta approximate symmetry
231  fVals[61] = biphi%20; //module boundary phi symmetry
232  fVals[62] = betacry; //local coordinates with respect to closest crystal center at nominal shower depth
233  fVals[63] = bphicry;
234 
235 
236  //2nd cluster (meaningful gap corrections for converted photons)
237  float bc2etacry, bc2phicry, bc2thetatilt, bc2phitilt;
238  int bc2ieta, bc2iphi;
239  if (hasbc2) _ecalLocal.localCoordsEB(*b2,es,bc2etacry,bc2phicry,bc2ieta,bc2iphi,bc2thetatilt,bc2phitilt);
240 
241  fVals[64] = hasbc2 ? bc2ieta : 0.;
242  fVals[65] = hasbc2 ? bc2iphi : 0.;
243  fVals[66] = hasbc2 ? bc2ieta%5 : 0.;
244  fVals[67] = hasbc2 ? bc2iphi%2 : 0.;
245  fVals[68] = hasbc2 ? (TMath::Abs(bc2ieta)<=25)*(bc2ieta%25) + (TMath::Abs(bc2ieta)>25)*((bc2ieta-25*TMath::Abs(bc2ieta)/bc2ieta)%20) : 0.;
246  fVals[69] = hasbc2 ? bc2iphi%20 : 0.;
247  fVals[70] = hasbc2 ? bc2etacry : 0.;
248  fVals[71] = hasbc2 ? bc2phicry : 0.;
249 
250  fVals[72] = vtxcol.size();
251 
252  }
253  else {
254  fVals[0] = s->rawEnergy();
255  fVals[1] = p.r9();
256  fVals[2] = s->eta();
257  fVals[3] = s->phi();
258  fVals[4] = p.e5x5()/s->rawEnergy();
259  fVals[5] = s->etaWidth();
260  fVals[6] = s->phiWidth();
261  fVals[7] = vtxcol.size();
262  }
263 
264 
265  const Double_t varscale = 1.253;
266  Double_t den;
267  const GBRForest *reader;
268  const GBRForest *readervar;
269  if (isbarrel) {
270  den = s->rawEnergy();
271  reader = fReadereb;
272  readervar = fReaderebvariance;
273  }
274  else {
275  den = s->rawEnergy() + s->preshowerEnergy();
276  reader = fReaderee;
277  readervar = fReadereevariance;
278  }
279 
280  Double_t ecor = reader->GetResponse(fVals)*den;
281  Double_t ecorerr = readervar->GetResponse(fVals)*den*varscale;
282 
283  //printf("ecor = %5f, ecorerr = %5f\n",ecor,ecorerr);
284 
285  return std::pair<double,double>(ecor,ecorerr);
286 }
std::vector< float > localCovariances(const reco::BasicCluster &cluster, float w0=4.7)
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
float eBottom(const reco::BasicCluster &cluster)
float e2nd(const reco::BasicCluster &cluster)
float e5x5() const
Definition: Photon.h:185
const GBRForest * fReaderee
const GBRForest * fReadereb
const GBRForest * fReaderebvariance
float eRight(const reco::BasicCluster &cluster)
float e3x3(const reco::BasicCluster &cluster)
float eMax(const reco::BasicCluster &cluster)
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
Definition: Photon.cc:58
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:152
T sqrt(T t)
Definition: SSEVec.h:48
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
Definition: Photon.h:167
float eTop(const reco::BasicCluster &cluster)
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
float e5x5(const reco::BasicCluster &cluster)
float eLeft(const reco::BasicCluster &cluster)
double b
Definition: hdecay.h:120
void localCoordsEB(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt) const
const GBRForest * fReadereevariance
EcalClusterLocal _ecalLocal
float r9() const
Definition: Photon.h:191
std::pair< double, double > EGEnergyCorrector::CorrectedEnergyWithError ( const reco::GsfElectron e,
const reco::VertexCollection vtxcol,
EcalClusterLazyTools clustertools,
const edm::EventSetup es 
)

Definition at line 290 of file EGEnergyCorrector.cc.

References _ecalLocal, b, reco::deltaPhi(), EcalClusterLazyTools::e2nd(), EcalClusterLazyTools::e3x3(), EcalClusterLazyTools::e5x5(), EcalClusterLazyTools::eBottom(), EcalBarrel, reco::GsfElectron::ecalDrivenSeed(), EcalClusterLazyTools::eLeft(), EcalClusterLazyTools::eMax(), EcalClusterLazyTools::eRight(), EcalClusterLazyTools::eTop(), fReadereb, fReaderebvariance, fReaderee, fReadereevariance, fVals, GBRForest::GetResponse(), reco::GsfElectron::hcalOverEcal(), edm::Ptr< T >::isNonnull(), EcalClusterLocal::localCoordsEB(), EcalClusterLazyTools::localCovariances(), create_public_lumi_plots::log, matplotRender::reader, alignCSCRings::s, mathSSE::sqrt(), and reco::GsfElectron::superCluster().

290  {
291 
292  //apply v2 regression to electrons
293  //mostly duplicated from photon function above //TODO, make common underlying function
294 
295  //protection, this doesn't work properly on non-egamma-seeded electrons
296  if (!e.ecalDrivenSeed()) return std::pair<double,double>(0.,0.);
297 
298 
299  const SuperClusterRef s = e.superCluster();
300  const CaloClusterPtr b = s->seed();
301 
302  CaloClusterPtr b2;
303  Double_t ebcmax = -99.;
304  for (reco::CaloCluster_iterator bit = s->clustersBegin(); bit!=s->clustersEnd(); ++bit) {
305  const CaloClusterPtr bc = *bit;
306  if (bc->energy() > ebcmax && bc !=b) {
307  b2 = bc;
308  ebcmax = bc->energy();
309  }
310  }
311 
312  CaloClusterPtr bclast;
313  Double_t ebcmin = 1e6;
314  for (reco::CaloCluster_iterator bit = s->clustersBegin(); bit!=s->clustersEnd(); ++bit) {
315  const CaloClusterPtr bc = *bit;
316  if (bc->energy() < ebcmin && bc !=b) {
317  bclast = bc;
318  ebcmin = bc->energy();
319  }
320  }
321 
322  CaloClusterPtr bclast2;
323  ebcmin = 1e6;
324  for (reco::CaloCluster_iterator bit = s->clustersBegin(); bit!=s->clustersEnd(); ++bit) {
325  const CaloClusterPtr bc = *bit;
326  if (bc->energy() < ebcmin && bc !=b && bc!=bclast) {
327  bclast2 = bc;
328  ebcmin = bc->energy();
329  }
330  }
331 
332  Bool_t isbarrel = b->hitsAndFractions().at(0).first.subdetId()==EcalBarrel;
333  Bool_t hasbc2 = b2.isNonnull() && b2->energy()>0.;
334  Bool_t hasbclast = bclast.isNonnull() && bclast->energy()>0.;
335  Bool_t hasbclast2 = bclast2.isNonnull() && bclast2->energy()>0.;
336 
337 
338  if (isbarrel) {
339  fVals[0] = s->rawEnergy();
340  fVals[1] = clustertools.e3x3(*b)/s->rawEnergy(); //r9
341  fVals[2] = s->eta();
342  fVals[3] = s->phi();
343  fVals[4] = clustertools.e5x5(*b)/s->rawEnergy();
344  fVals[5] = e.hcalOverEcal();
345  fVals[6] = s->etaWidth();
346  fVals[7] = s->phiWidth();
347 
348 
349  double bemax = clustertools.eMax(*b);
350  double be2nd = clustertools.e2nd(*b);
351  double betop = clustertools.eTop(*b);
352  double bebottom = clustertools.eBottom(*b);
353  double beleft = clustertools.eLeft(*b);
354  double beright = clustertools.eRight(*b);
355 
356 
357  fVals[8] = b->eta()-s->eta();
358  fVals[9] = reco::deltaPhi(b->phi(),s->phi());
359  fVals[10] = b->energy()/s->rawEnergy();
360  fVals[11] = clustertools.e3x3(*b)/b->energy();
361  fVals[12] = clustertools.e5x5(*b)/b->energy();
362  fVals[13] = sqrt(clustertools.localCovariances(*b)[0]);
363  fVals[14] = sqrt(clustertools.localCovariances(*b)[2]);
364  fVals[15] = clustertools.localCovariances(*b)[1];
365  fVals[16] = bemax/b->energy();
366  fVals[17] = log(be2nd/bemax);
367  fVals[18] = log(betop/bemax);
368  fVals[19] = log(bebottom/bemax);
369  fVals[20] = log(beleft/bemax);
370  fVals[21] = log(beright/bemax);
371  fVals[22] = (betop-bebottom)/(betop+bebottom);
372  fVals[23] = (beleft-beright)/(beleft+beright);
373 
374 
375  double bc2emax = hasbc2 ? clustertools.eMax(*b2) : 0.;
376  double bc2e2nd = hasbc2 ? clustertools.e2nd(*b2) : 0.;
377  double bc2etop = hasbc2 ? clustertools.eTop(*b2) : 0.;
378  double bc2ebottom = hasbc2 ? clustertools.eBottom(*b2) : 0.;
379  double bc2eleft = hasbc2 ? clustertools.eLeft(*b2) : 0.;
380  double bc2eright = hasbc2 ? clustertools.eRight(*b2) : 0.;
381 
382  fVals[24] = hasbc2 ? (b2->eta()-s->eta()) : 0.;
383  fVals[25] = hasbc2 ? reco::deltaPhi(b2->phi(),s->phi()) : 0.;
384  fVals[26] = hasbc2 ? b2->energy()/s->rawEnergy() : 0.;
385  fVals[27] = hasbc2 ? clustertools.e3x3(*b2)/b2->energy() : 0.;
386  fVals[28] = hasbc2 ? clustertools.e5x5(*b2)/b2->energy() : 0.;
387  fVals[29] = hasbc2 ? sqrt(clustertools.localCovariances(*b2)[0]) : 0.;
388  fVals[30] = hasbc2 ? sqrt(clustertools.localCovariances(*b2)[2]) : 0.;
389  fVals[31] = hasbc2 ? clustertools.localCovariances(*b)[1] : 0.;
390  fVals[32] = hasbc2 ? bc2emax/b2->energy() : 0.;
391  fVals[33] = hasbc2 ? log(bc2e2nd/bc2emax) : 0.;
392  fVals[34] = hasbc2 ? log(bc2etop/bc2emax) : 0.;
393  fVals[35] = hasbc2 ? log(bc2ebottom/bc2emax) : 0.;
394  fVals[36] = hasbc2 ? log(bc2eleft/bc2emax) : 0.;
395  fVals[37] = hasbc2 ? log(bc2eright/bc2emax) : 0.;
396  fVals[38] = hasbc2 ? (bc2etop-bc2ebottom)/(bc2etop+bc2ebottom) : 0.;
397  fVals[39] = hasbc2 ? (bc2eleft-bc2eright)/(bc2eleft+bc2eright) : 0.;
398 
399  fVals[40] = hasbclast ? (bclast->eta()-s->eta()) : 0.;
400  fVals[41] = hasbclast ? reco::deltaPhi(bclast->phi(),s->phi()) : 0.;
401  fVals[42] = hasbclast ? bclast->energy()/s->rawEnergy() : 0.;
402  fVals[43] = hasbclast ? clustertools.e3x3(*bclast)/bclast->energy() : 0.;
403  fVals[44] = hasbclast ? clustertools.e5x5(*bclast)/bclast->energy() : 0.;
404  fVals[45] = hasbclast ? sqrt(clustertools.localCovariances(*bclast)[0]) : 0.;
405  fVals[46] = hasbclast ? sqrt(clustertools.localCovariances(*bclast)[2]) : 0.;
406  fVals[47] = hasbclast ? clustertools.localCovariances(*bclast)[1] : 0.;
407 
408  fVals[48] = hasbclast2 ? (bclast2->eta()-s->eta()) : 0.;
409  fVals[49] = hasbclast2 ? reco::deltaPhi(bclast2->phi(),s->phi()) : 0.;
410  fVals[50] = hasbclast2 ? bclast2->energy()/s->rawEnergy() : 0.;
411  fVals[51] = hasbclast2 ? clustertools.e3x3(*bclast2)/bclast2->energy() : 0.;
412  fVals[52] = hasbclast2 ? clustertools.e5x5(*bclast2)/bclast2->energy() : 0.;
413  fVals[53] = hasbclast2 ? sqrt(clustertools.localCovariances(*bclast2)[0]) : 0.;
414  fVals[54] = hasbclast2 ? sqrt(clustertools.localCovariances(*bclast2)[2]) : 0.;
415  fVals[55] = hasbclast2 ? clustertools.localCovariances(*bclast2)[1] : 0.;
416 
417 
418  float betacry, bphicry, bthetatilt, bphitilt;
419  int bieta, biphi;
420  _ecalLocal.localCoordsEB(*b,es,betacry,bphicry,bieta,biphi,bthetatilt,bphitilt);
421 
422  fVals[56] = bieta;
423  fVals[57] = biphi;
424  fVals[58] = bieta%5;
425  fVals[59] = biphi%2;
426  fVals[60] = (TMath::Abs(bieta)<=25)*(bieta%25) + (TMath::Abs(bieta)>25)*((bieta-25*TMath::Abs(bieta)/bieta)%20);
427  fVals[61] = biphi%20;
428  fVals[62] = betacry;
429  fVals[63] = bphicry;
430 
431  float bc2etacry, bc2phicry, bc2thetatilt, bc2phitilt;
432  int bc2ieta, bc2iphi;
433  if (hasbc2) _ecalLocal.localCoordsEB(*b2,es,bc2etacry,bc2phicry,bc2ieta,bc2iphi,bc2thetatilt,bc2phitilt);
434 
435  fVals[64] = hasbc2 ? bc2ieta : 0.;
436  fVals[65] = hasbc2 ? bc2iphi : 0.;
437  fVals[66] = hasbc2 ? bc2ieta%5 : 0.;
438  fVals[67] = hasbc2 ? bc2iphi%2 : 0.;
439  fVals[68] = hasbc2 ? (TMath::Abs(bc2ieta)<=25)*(bc2ieta%25) + (TMath::Abs(bc2ieta)>25)*((bc2ieta-25*TMath::Abs(bc2ieta)/bc2ieta)%20) : 0.;
440  fVals[69] = hasbc2 ? bc2iphi%20 : 0.;
441  fVals[70] = hasbc2 ? bc2etacry : 0.;
442  fVals[71] = hasbc2 ? bc2phicry : 0.;
443 
444  fVals[72] = vtxcol.size();
445 
446  }
447  else {
448  fVals[0] = s->rawEnergy();
449  fVals[1] = clustertools.e3x3(*b)/s->rawEnergy(); //r9
450  fVals[2] = s->eta();
451  fVals[3] = s->phi();
452  fVals[4] = clustertools.e5x5(*b)/s->rawEnergy();
453  fVals[5] = s->etaWidth();
454  fVals[6] = s->phiWidth();
455  fVals[7] = vtxcol.size();
456  }
457 
458 
459  const Double_t varscale = 1.253;
460  Double_t den;
461  const GBRForest *reader;
462  const GBRForest *readervar;
463  if (isbarrel) {
464  den = s->rawEnergy();
465  reader = fReadereb;
466  readervar = fReaderebvariance;
467  }
468  else {
469  den = s->rawEnergy() + s->preshowerEnergy();
470  reader = fReaderee;
471  readervar = fReadereevariance;
472  }
473 
474  Double_t ecor = reader->GetResponse(fVals)*den;
475  Double_t ecorerr = readervar->GetResponse(fVals)*den*varscale;
476 
477  //printf("ecor = %5f, ecorerr = %5f\n",ecor,ecorerr);
478 
479  return std::pair<double,double>(ecor,ecorerr);
480 
481 }
std::vector< float > localCovariances(const reco::BasicCluster &cluster, float w0=4.7)
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
float eBottom(const reco::BasicCluster &cluster)
float e2nd(const reco::BasicCluster &cluster)
const GBRForest * fReaderee
const GBRForest * fReadereb
const GBRForest * fReaderebvariance
float eRight(const reco::BasicCluster &cluster)
float e3x3(const reco::BasicCluster &cluster)
float eMax(const reco::BasicCluster &cluster)
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:152
T sqrt(T t)
Definition: SSEVec.h:48
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
float hcalOverEcal() const
Definition: GsfElectron.h:390
float eTop(const reco::BasicCluster &cluster)
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
float e5x5(const reco::BasicCluster &cluster)
float eLeft(const reco::BasicCluster &cluster)
double b
Definition: hdecay.h:120
void localCoordsEB(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt) const
const GBRForest * fReadereevariance
EcalClusterLocal _ecalLocal
bool ecalDrivenSeed() const
Definition: GsfElectron.h:172
std::pair< double, double > EGEnergyCorrector::CorrectedEnergyWithErrorV3 ( const reco::Photon p,
const reco::VertexCollection vtxcol,
double  rho,
EcalClusterLazyTools clustertools,
const edm::EventSetup es,
bool  applyRescale = false 
)

Definition at line 484 of file EGEnergyCorrector.cc.

References _ecalLocal, b, reco::deltaPhi(), EcalClusterLazyTools::e2nd(), EcalClusterLazyTools::e2x5Bottom(), EcalClusterLazyTools::e2x5Left(), EcalClusterLazyTools::e2x5Max(), EcalClusterLazyTools::e2x5Right(), EcalClusterLazyTools::e2x5Top(), EcalClusterLazyTools::e3x3(), EcalClusterLazyTools::e5x5(), reco::Photon::e5x5(), EcalClusterLazyTools::eBottom(), EcalBarrel, EcalClusterLazyTools::eLeft(), EcalClusterLazyTools::eMax(), EcalClusterLazyTools::eRight(), EcalClusterLazyTools::eTop(), fReadereb, fReaderebvariance, fReaderee, fReadereevariance, fVals, GBRForest::GetResponse(), reco::Photon::hadTowOverEm(), EcalClusterLocal::localCoordsEB(), EcalClusterLazyTools::localCovariances(), siStripFEDMonitor_P5_cff::Min, reco::Photon::r9(), matplotRender::reader, rho, alignCSCRings::s, mathSSE::sqrt(), and reco::Photon::superCluster().

484  {
485 
486  const SuperClusterRef s = p.superCluster();
487  const CaloClusterPtr b = s->seed(); //seed basic cluster
488 
489  Bool_t isbarrel = b->hitsAndFractions().at(0).first.subdetId()==EcalBarrel;
490 
491  //basic supercluster variables
492  fVals[0] = s->rawEnergy();
493  fVals[1] = s->eta();
494  fVals[2] = s->phi();
495  fVals[3] = p.r9();
496  fVals[4] = p.e5x5()/s->rawEnergy();
497  fVals[5] = s->etaWidth();
498  fVals[6] = s->phiWidth();
499  fVals[7] = s->clustersSize();
500  fVals[8] = p.hadTowOverEm();
501  fVals[9] = rho;
502  fVals[10] = vtxcol.size();
503 
504  //seed basic cluster variables
505  double bemax = clustertools.eMax(*b);
506  double be2nd = clustertools.e2nd(*b);
507  double betop = clustertools.eTop(*b);
508  double bebottom = clustertools.eBottom(*b);
509  double beleft = clustertools.eLeft(*b);
510  double beright = clustertools.eRight(*b);
511 
512  double be2x5max = clustertools.e2x5Max(*b);
513  double be2x5top = clustertools.e2x5Top(*b);
514  double be2x5bottom = clustertools.e2x5Bottom(*b);
515  double be2x5left = clustertools.e2x5Left(*b);
516  double be2x5right = clustertools.e2x5Right(*b);
517 
518  fVals[11] = b->eta()-s->eta();
519  fVals[12] = reco::deltaPhi(b->phi(),s->phi());
520  fVals[13] = b->energy()/s->rawEnergy();
521  fVals[14] = clustertools.e3x3(*b)/b->energy();
522  fVals[15] = clustertools.e5x5(*b)/b->energy();
523  fVals[16] = sqrt(clustertools.localCovariances(*b)[0]); //sigietaieta
524  fVals[17] = sqrt(clustertools.localCovariances(*b)[2]); //sigiphiiphi
525  fVals[18] = clustertools.localCovariances(*b)[1]; //sigietaiphi
526  fVals[19] = bemax/b->energy(); //crystal energy ratio gap variables
527  fVals[20] = be2nd/b->energy();
528  fVals[21] = betop/b->energy();
529  fVals[22] = bebottom/b->energy();
530  fVals[23] = beleft/b->energy();
531  fVals[24] = beright/b->energy();
532  fVals[25] = be2x5max/b->energy(); //crystal energy ratio gap variables
533  fVals[26] = be2x5top/b->energy();
534  fVals[27] = be2x5bottom/b->energy();
535  fVals[28] = be2x5left/b->energy();
536  fVals[29] = be2x5right/b->energy();
537 
538  if (isbarrel) {
539  //local coordinates and crystal indices (barrel only)
540 
541  //seed cluster
542  float betacry, bphicry, bthetatilt, bphitilt;
543  int bieta, biphi;
544  _ecalLocal.localCoordsEB(*b,es,betacry,bphicry,bieta,biphi,bthetatilt,bphitilt);
545 
546  fVals[30] = bieta; //crystal ieta
547  fVals[31] = biphi; //crystal iphi
548  fVals[32] = bieta%5; //submodule boundary eta symmetry
549  fVals[33] = biphi%2; //submodule boundary phi symmetry
550  fVals[34] = (TMath::Abs(bieta)<=25)*(bieta%25) + (TMath::Abs(bieta)>25)*((bieta-25*TMath::Abs(bieta)/bieta)%20); //module boundary eta approximate symmetry
551  fVals[35] = biphi%20; //module boundary phi symmetry
552  fVals[36] = betacry; //local coordinates with respect to closest crystal center at nominal shower depth
553  fVals[37] = bphicry;
554 
555  }
556  else {
557  //preshower energy ratio (endcap only)
558  fVals[30] = s->preshowerEnergy()/s->rawEnergy();
559  }
560 
561 // if (isbarrel) {
562 // for (int i=0; i<38; ++i) printf("%i: %5f\n",i,fVals[i]);
563 // }
564 // else for (int i=0; i<31; ++i) printf("%i: %5f\n",i,fVals[i]);
565 
566  Double_t den;
567  const GBRForest *reader;
568  const GBRForest *readervar;
569  if (isbarrel) {
570  den = s->rawEnergy();
571  reader = fReadereb;
572  readervar = fReaderebvariance;
573  }
574  else {
575  den = s->rawEnergy() + s->preshowerEnergy();
576  reader = fReaderee;
577  readervar = fReadereevariance;
578  }
579 
580  Double_t ecor = reader->GetResponse(fVals)*den;
581 
582 
583  //apply shower shape rescaling - for Monte Carlo only, and only for calculation of energy uncertainty
584  if (applyRescale) {
585  if (isbarrel) {
586  fVals[3] = 1.0045*p.r9() +0.001; //r9
587  fVals[5] = 1.04302*s->etaWidth() - 0.000618; //etawidth
588  fVals[6] = 1.00002*s->phiWidth() - 0.000371; //phiwidth
589  fVals[14] = fVals[3]*s->rawEnergy()/b->energy(); //compute consistent e3x3/eseed after r9 rescaling
590  if (fVals[15]<=1.0) // rescale e5x5/eseed only if value is <=1.0, don't allow scaled values to exceed 1.0
591  fVals[15] = TMath::Min(1.0,1.0022*p.e5x5()/b->energy());
592 
593  fVals[4] = fVals[15]*b->energy()/s->rawEnergy(); // compute consistent e5x5()/rawEnergy() after e5x5/eseed resacling
594 
595  fVals[16] = 0.891832*sqrt(clustertools.localCovariances(*b)[0]) + 0.0009133; //sigietaieta
596  fVals[17] = 0.993*sqrt(clustertools.localCovariances(*b)[2]); //sigiphiiphi
597 
598  fVals[19] = 1.012*bemax/b->energy(); //crystal energy ratio gap variables
599  fVals[20] = 1.0*be2nd/b->energy();
600  fVals[21] = 0.94*betop/b->energy();
601  fVals[22] = 0.94*bebottom/b->energy();
602  fVals[23] = 0.94*beleft/b->energy();
603  fVals[24] = 0.94*beright/b->energy();
604  fVals[25] = 1.006*be2x5max/b->energy(); //crystal energy ratio gap variables
605  fVals[26] = 1.09*be2x5top/b->energy();
606  fVals[27] = 1.09*be2x5bottom/b->energy();
607  fVals[28] = 1.09*be2x5left/b->energy();
608  fVals[29] = 1.09*be2x5right/b->energy();
609 
610  }
611  else {
612  fVals[3] = 1.0086*p.r9() -0.0007; //r9
613  fVals[4] = TMath::Min(1.0,1.0022*p.e5x5()/s->rawEnergy()); //e5x5/rawenergy
614  fVals[5] = 0.903254*s->etaWidth() +0.001346; //etawidth
615  fVals[6] = 0.99992*s->phiWidth() + 4.8e-07; //phiwidth
616  fVals[13] = TMath::Min(1.0,1.0022*b->energy()/s->rawEnergy()); //eseed/rawenergy (practically equivalent to e5x5)
617 
618 
619  fVals[14] = fVals[3]*s->rawEnergy()/b->energy(); //compute consistent e3x3/eseed after r9 rescaling
620 
621  fVals[16] = 0.9947*sqrt(clustertools.localCovariances(*b)[0]) + 0.00003; //sigietaieta
622 
623  fVals[19] = 1.005*bemax/b->energy(); //crystal energy ratio gap variables
624  fVals[20] = 1.02*be2nd/b->energy();
625  fVals[21] = 0.96*betop/b->energy();
626  fVals[22] = 0.96*bebottom/b->energy();
627  fVals[23] = 0.96*beleft/b->energy();
628  fVals[24] = 0.96*beright/b->energy();
629  fVals[25] = 1.0075*be2x5max/b->energy(); //crystal energy ratio gap variables
630  fVals[26] = 1.13*be2x5top/b->energy();
631  fVals[27] = 1.13*be2x5bottom/b->energy();
632  fVals[28] = 1.13*be2x5left/b->energy();
633  fVals[29] = 1.13*be2x5right/b->energy();
634  }
635 
636  }
637 
638  Double_t ecorerr = readervar->GetResponse(fVals)*den;
639 
640  //printf("ecor = %5f, ecorerr = %5f\n",ecor,ecorerr);
641 
642  return std::pair<double,double>(ecor,ecorerr);
643 }
std::vector< float > localCovariances(const reco::BasicCluster &cluster, float w0=4.7)
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
float eBottom(const reco::BasicCluster &cluster)
float e2nd(const reco::BasicCluster &cluster)
float e5x5() const
Definition: Photon.h:185
const GBRForest * fReaderee
const GBRForest * fReadereb
const GBRForest * fReaderebvariance
float eRight(const reco::BasicCluster &cluster)
Definition: DDAxes.h:10
float e3x3(const reco::BasicCluster &cluster)
float eMax(const reco::BasicCluster &cluster)
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
Definition: Photon.cc:58
float e2x5Max(const reco::BasicCluster &cluster)
T sqrt(T t)
Definition: SSEVec.h:48
float e2x5Right(const reco::BasicCluster &cluster)
float hadTowOverEm() const
the ration of hadronic energy in towers behind the BCs in the SC and the SC energy ...
Definition: Photon.h:174
float eTop(const reco::BasicCluster &cluster)
float e2x5Bottom(const reco::BasicCluster &cluster)
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
float e2x5Left(const reco::BasicCluster &cluster)
float e5x5(const reco::BasicCluster &cluster)
float eLeft(const reco::BasicCluster &cluster)
double b
Definition: hdecay.h:120
void localCoordsEB(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt) const
const GBRForest * fReadereevariance
EcalClusterLocal _ecalLocal
float r9() const
Definition: Photon.h:191
float e2x5Top(const reco::BasicCluster &cluster)
std::pair< double, double > EGEnergyCorrector::CorrectedEnergyWithErrorV3 ( const reco::GsfElectron e,
const reco::VertexCollection vtxcol,
double  rho,
EcalClusterLazyTools clustertools,
const edm::EventSetup es 
)

Definition at line 646 of file EGEnergyCorrector.cc.

References _ecalLocal, b, reco::deltaPhi(), EcalClusterLazyTools::e2nd(), EcalClusterLazyTools::e2x5Bottom(), EcalClusterLazyTools::e2x5Left(), EcalClusterLazyTools::e2x5Max(), EcalClusterLazyTools::e2x5Right(), EcalClusterLazyTools::e2x5Top(), EcalClusterLazyTools::e3x3(), EcalClusterLazyTools::e5x5(), EcalClusterLazyTools::eBottom(), EcalBarrel, EcalClusterLazyTools::eLeft(), EcalClusterLazyTools::eMax(), EcalClusterLazyTools::eRight(), EcalClusterLazyTools::eTop(), fReadereb, fReaderebvariance, fReaderee, fReadereevariance, fVals, GBRForest::GetResponse(), reco::GsfElectron::hcalOverEcalBc(), EcalClusterLocal::localCoordsEB(), EcalClusterLazyTools::localCovariances(), matplotRender::reader, rho, alignCSCRings::s, mathSSE::sqrt(), and reco::GsfElectron::superCluster().

646  {
647 
648  const SuperClusterRef s = e.superCluster();
649  const CaloClusterPtr b = s->seed(); //seed basic cluster
650 
651  Bool_t isbarrel = b->hitsAndFractions().at(0).first.subdetId()==EcalBarrel;
652 
653  //basic supercluster variables
654  fVals[0] = s->rawEnergy();
655  fVals[1] = s->eta();
656  fVals[2] = s->phi();
657  fVals[3] = clustertools.e3x3(*b)/s->rawEnergy(); //r9
658  fVals[4] = clustertools.e5x5(*b)/s->rawEnergy();
659  fVals[5] = s->etaWidth();
660  fVals[6] = s->phiWidth();
661  fVals[7] = s->clustersSize();
662  fVals[8] = e.hcalOverEcalBc();
663  fVals[9] = rho;
664  fVals[10] = vtxcol.size();
665 
666  //seed basic cluster variables
667  double bemax = clustertools.eMax(*b);
668  double be2nd = clustertools.e2nd(*b);
669  double betop = clustertools.eTop(*b);
670  double bebottom = clustertools.eBottom(*b);
671  double beleft = clustertools.eLeft(*b);
672  double beright = clustertools.eRight(*b);
673 
674  double be2x5max = clustertools.e2x5Max(*b);
675  double be2x5top = clustertools.e2x5Top(*b);
676  double be2x5bottom = clustertools.e2x5Bottom(*b);
677  double be2x5left = clustertools.e2x5Left(*b);
678  double be2x5right = clustertools.e2x5Right(*b);
679 
680  fVals[11] = b->eta()-s->eta();
681  fVals[12] = reco::deltaPhi(b->phi(),s->phi());
682  fVals[13] = b->energy()/s->rawEnergy();
683  fVals[14] = clustertools.e3x3(*b)/b->energy();
684  fVals[15] = clustertools.e5x5(*b)/b->energy();
685  fVals[16] = sqrt(clustertools.localCovariances(*b)[0]); //sigietaieta
686  fVals[17] = sqrt(clustertools.localCovariances(*b)[2]); //sigiphiiphi
687  fVals[18] = clustertools.localCovariances(*b)[1]; //sigietaiphi
688  fVals[19] = bemax/b->energy(); //crystal energy ratio gap variables
689  fVals[20] = be2nd/b->energy();
690  fVals[21] = betop/b->energy();
691  fVals[22] = bebottom/b->energy();
692  fVals[23] = beleft/b->energy();
693  fVals[24] = beright/b->energy();
694  fVals[25] = be2x5max/b->energy(); //crystal energy ratio gap variables
695  fVals[26] = be2x5top/b->energy();
696  fVals[27] = be2x5bottom/b->energy();
697  fVals[28] = be2x5left/b->energy();
698  fVals[29] = be2x5right/b->energy();
699 
700  if (isbarrel) {
701  //local coordinates and crystal indices (barrel only)
702 
703  //seed cluster
704  float betacry, bphicry, bthetatilt, bphitilt;
705  int bieta, biphi;
706  _ecalLocal.localCoordsEB(*b,es,betacry,bphicry,bieta,biphi,bthetatilt,bphitilt);
707 
708  fVals[30] = bieta; //crystal ieta
709  fVals[31] = biphi; //crystal iphi
710  fVals[32] = bieta%5; //submodule boundary eta symmetry
711  fVals[33] = biphi%2; //submodule boundary phi symmetry
712  fVals[34] = (TMath::Abs(bieta)<=25)*(bieta%25) + (TMath::Abs(bieta)>25)*((bieta-25*TMath::Abs(bieta)/bieta)%20); //module boundary eta approximate symmetry
713  fVals[35] = biphi%20; //module boundary phi symmetry
714  fVals[36] = betacry; //local coordinates with respect to closest crystal center at nominal shower depth
715  fVals[37] = bphicry;
716 
717  }
718  else {
719  //preshower energy ratio (endcap only)
720  fVals[30] = s->preshowerEnergy()/s->rawEnergy();
721  }
722 
723  Double_t den;
724  const GBRForest *reader;
725  const GBRForest *readervar;
726  if (isbarrel) {
727  den = s->rawEnergy();
728  reader = fReadereb;
729  readervar = fReaderebvariance;
730  }
731  else {
732  den = s->rawEnergy() + s->preshowerEnergy();
733  reader = fReaderee;
734  readervar = fReadereevariance;
735  }
736 
737  Double_t ecor = reader->GetResponse(fVals)*den;
738  Double_t ecorerr = readervar->GetResponse(fVals)*den;
739 
740  //printf("ecor = %5f, ecorerr = %5f\n",ecor,ecorerr);
741 
742  return std::pair<double,double>(ecor,ecorerr);
743 }
std::vector< float > localCovariances(const reco::BasicCluster &cluster, float w0=4.7)
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
float eBottom(const reco::BasicCluster &cluster)
float e2nd(const reco::BasicCluster &cluster)
const GBRForest * fReaderee
const GBRForest * fReadereb
const GBRForest * fReaderebvariance
float eRight(const reco::BasicCluster &cluster)
Definition: DDAxes.h:10
float e3x3(const reco::BasicCluster &cluster)
float eMax(const reco::BasicCluster &cluster)
float e2x5Max(const reco::BasicCluster &cluster)
T sqrt(T t)
Definition: SSEVec.h:48
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
float e2x5Right(const reco::BasicCluster &cluster)
float hcalOverEcalBc() const
Definition: GsfElectron.h:394
float eTop(const reco::BasicCluster &cluster)
float e2x5Bottom(const reco::BasicCluster &cluster)
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
float e2x5Left(const reco::BasicCluster &cluster)
float e5x5(const reco::BasicCluster &cluster)
float eLeft(const reco::BasicCluster &cluster)
double b
Definition: hdecay.h:120
void localCoordsEB(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt) const
const GBRForest * fReadereevariance
EcalClusterLocal _ecalLocal
float e2x5Top(const reco::BasicCluster &cluster)
void EGEnergyCorrector::Initialize ( const edm::EventSetup iSetup,
std::string  regweights,
bool  weightsFromDB = false 
)

Definition at line 46 of file EGEnergyCorrector.cc.

References fIsInitialized, fOwnsForests, fReadereb, fReaderebvariance, fReaderee, fReadereevariance, fVals, edm::EventSetup::get(), edm::ESHandle< class >::product(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EGEnergyAnalyzer::analyze(), and PhotonEnergyCorrector::init().

46  {
47  fIsInitialized = kTRUE;
48 
49  if (fVals) delete [] fVals;
50  if (fOwnsForests) {
51  if (fReadereb) delete fReadereb;
53  if (fReaderee) delete fReaderee;
55  }
56 
57  fVals = new Float_t[73];
58 
59  if (weightsFromDB) { //weights from event setup
60 
61  edm::ESHandle<GBRForest> readereb;
62  edm::ESHandle<GBRForest> readerebvar;
63  edm::ESHandle<GBRForest> readeree;
64  edm::ESHandle<GBRForest> readereevar;
65 
66  iSetup.get<GBRWrapperRcd>().get(std::string(TString::Format("%s_EBCorrection",regweights.c_str())),readereb);
67  iSetup.get<GBRWrapperRcd>().get(std::string(TString::Format("%s_EBUncertainty",regweights.c_str())),readerebvar);
68  iSetup.get<GBRWrapperRcd>().get(std::string(TString::Format("%s_EECorrection",regweights.c_str())),readeree);
69  iSetup.get<GBRWrapperRcd>().get(std::string(TString::Format("%s_EEUncertainty",regweights.c_str())),readereevar);
70 
71  fReadereb = readereb.product();
72  fReaderebvariance = readerebvar.product();
73  fReaderee = readeree.product();
74  fReadereevariance = readereevar.product();
75 
76  }
77  else { //weights from root file
78  fOwnsForests = kTRUE;
79 
80  TFile *fgbr = TFile::Open(regweights.c_str(),"READ");
81  fReadereb = (GBRForest*)fgbr->Get("EBCorrection");
82  fReaderebvariance = (GBRForest*)fgbr->Get("EBUncertainty");
83  fReaderee = (GBRForest*)fgbr->Get("EECorrection");
84  fReadereevariance = (GBRForest*)fgbr->Get("EEUncertainty");
85  fgbr->Close();
86  }
87 
88 }
const GBRForest * fReaderee
const GBRForest * fReadereb
const GBRForest * fReaderebvariance
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
const GBRForest * fReadereevariance
Bool_t EGEnergyCorrector::IsInitialized ( ) const
inline

Definition at line 28 of file EGEnergyCorrector.h.

References fIsInitialized.

Referenced by EGEnergyAnalyzer::analyze(), and PhotonEnergyCorrector::init().

28 { return fIsInitialized; }

Member Data Documentation

EcalClusterLocal EGEnergyCorrector::_ecalLocal
protected

Definition at line 46 of file EGEnergyCorrector.h.

Referenced by CorrectedEnergyWithError(), and CorrectedEnergyWithErrorV3().

Bool_t EGEnergyCorrector::fIsInitialized
protected

Definition at line 42 of file EGEnergyCorrector.h.

Referenced by Initialize(), and IsInitialized().

Bool_t EGEnergyCorrector::fOwnsForests
protected

Definition at line 43 of file EGEnergyCorrector.h.

Referenced by Initialize(), and ~EGEnergyCorrector().

const GBRForest* EGEnergyCorrector::fReadereb
protected
const GBRForest* EGEnergyCorrector::fReaderebvariance
protected
const GBRForest* EGEnergyCorrector::fReaderee
protected
const GBRForest* EGEnergyCorrector::fReadereevariance
protected
Float_t* EGEnergyCorrector::fVals
protected