CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFClusterEMEnergyCorrector Class Reference

#include <PFClusterEMEnergyCorrector.h>

Public Member Functions

void correctEnergies (const edm::Event &evt, const edm::EventSetup &es, const reco::PFCluster::EEtoPSAssociation &assoc, reco::PFClusterCollection &cs)
 
PFClusterEMEnergyCorrectoroperator= (const PFClusterEMEnergyCorrector &)=delete
 
 PFClusterEMEnergyCorrector (const edm::ParameterSet &conf, edm::ConsumesCollector &&cc)
 
 PFClusterEMEnergyCorrector (const PFClusterEMEnergyCorrector &)=delete
 

Private Member Functions

void getAssociatedPSEnergy (const size_t clusIdx, const reco::PFCluster::EEtoPSAssociation &assoc, float &e1, float &e2)
 

Private Attributes

bool applyCrackCorrections_
 
bool applyMVACorrections_
 
bool autoDetectBunchSpacing_
 
edm::EDGetTokenT< unsigned int > bunchSpacing_
 
int bunchSpacingManual_
 
std::unique_ptr< PFEnergyCalibrationcalibrator_
 
std::vector< std::string > condnames_mean_
 
std::vector< std::string > condnames_mean_25ns_
 
std::vector< std::string > condnames_mean_50ns_
 
std::vector< std::string > condnames_sigma_
 
std::vector< std::string > condnames_sigma_25ns_
 
std::vector< std::string > condnames_sigma_50ns_
 
edm::EDGetTokenT< EBSrFlagCollectionebSrFlagToken_
 
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
 
const EcalReadoutTools::ESGetTokens ecalReadoutToolsESGetTokens_
 
edm::EDGetTokenT< EESrFlagCollectioneeSrFlagToken_
 
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestMeanTokens_25ns_
 
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestMeanTokens_50ns_
 
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestSigmaTokens_25ns_
 
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestSigmaTokens_50ns_
 
double maxPtForMVAEvaluation_
 
double meanlimhighEB_
 
double meanlimhighEE_
 
double meanlimlowEB_
 
double meanlimlowEE_
 
double meanoffsetEB_
 
double meanoffsetEE_
 
double meanscaleEB_
 
double meanscaleEE_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitsEB_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitsEE_
 
bool setEnergyUncertainty_
 
double sigmalimhighEB_
 
double sigmalimhighEE_
 
double sigmalimlowEB_
 
double sigmalimlowEE_
 
double sigmaoffsetEB_
 
double sigmaoffsetEE_
 
double sigmascaleEB_
 
double sigmascaleEE_
 
bool srfAwareCorrection_
 

Detailed Description

Definition at line 28 of file PFClusterEMEnergyCorrector.h.

Constructor & Destructor Documentation

◆ PFClusterEMEnergyCorrector() [1/2]

PFClusterEMEnergyCorrector::PFClusterEMEnergyCorrector ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  cc 
)

Definition at line 14 of file PFClusterEMEnergyCorrector.cc.

18  applyCrackCorrections_ = conf.getParameter<bool>("applyCrackCorrections");
19  applyMVACorrections_ = conf.getParameter<bool>("applyMVACorrections");
20  srfAwareCorrection_ = conf.getParameter<bool>("srfAwareCorrection");
21  setEnergyUncertainty_ = conf.getParameter<bool>("setEnergyUncertainty");
22  maxPtForMVAEvaluation_ = conf.getParameter<double>("maxPtForMVAEvaluation");
23 
25  meanlimlowEB_ = -0.336;
26  meanlimhighEB_ = 0.916;
29 
30  meanlimlowEE_ = -0.336;
31  meanlimhighEE_ = 0.916;
34 
35  sigmalimlowEB_ = 0.001;
36  sigmalimhighEB_ = 0.4;
39 
40  sigmalimlowEE_ = 0.001;
41  sigmalimhighEE_ = 0.4;
44 
45  recHitsEB_ = cc.consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("recHitsEBLabel"));
46  recHitsEE_ = cc.consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("recHitsEELabel"));
47  autoDetectBunchSpacing_ = conf.getParameter<bool>("autoDetectBunchSpacing");
48 
50  bunchSpacing_ = cc.consumes<unsigned int>(edm::InputTag("bunchSpacingProducer"));
52  } else {
53  bunchSpacingManual_ = conf.getParameter<int>("bunchSpacing");
54  }
55 
57  {"ecalPFClusterCorV2_EB_pfSize1_mean_25ns",
58  "ecalPFClusterCorV2_EB_pfSize2_mean_25ns",
59  "ecalPFClusterCorV2_EB_pfSize3_ptbin1_mean_25ns",
60  "ecalPFClusterCorV2_EB_pfSize3_ptbin2_mean_25ns",
61  "ecalPFClusterCorV2_EB_pfSize3_ptbin3_mean_25ns",
62  "ecalPFClusterCorV2_EE_pfSize1_mean_25ns",
63  "ecalPFClusterCorV2_EE_pfSize2_mean_25ns",
64  "ecalPFClusterCorV2_EE_pfSize3_ptbin1_mean_25ns",
65  "ecalPFClusterCorV2_EE_pfSize3_ptbin2_mean_25ns",
66  "ecalPFClusterCorV2_EE_pfSize3_ptbin3_mean_25ns"});
68  {"ecalPFClusterCorV2_EB_pfSize1_sigma_25ns",
69  "ecalPFClusterCorV2_EB_pfSize2_sigma_25ns",
70  "ecalPFClusterCorV2_EB_pfSize3_ptbin1_sigma_25ns",
71  "ecalPFClusterCorV2_EB_pfSize3_ptbin2_sigma_25ns",
72  "ecalPFClusterCorV2_EB_pfSize3_ptbin3_sigma_25ns",
73  "ecalPFClusterCorV2_EE_pfSize1_sigma_25ns",
74  "ecalPFClusterCorV2_EE_pfSize2_sigma_25ns",
75  "ecalPFClusterCorV2_EE_pfSize3_ptbin1_sigma_25ns",
76  "ecalPFClusterCorV2_EE_pfSize3_ptbin2_sigma_25ns",
77  "ecalPFClusterCorV2_EE_pfSize3_ptbin3_sigma_25ns"});
79  {"ecalPFClusterCorV2_EB_pfSize1_mean_50ns",
80  "ecalPFClusterCorV2_EB_pfSize2_mean_50ns",
81  "ecalPFClusterCorV2_EB_pfSize3_ptbin1_mean_50ns",
82  "ecalPFClusterCorV2_EB_pfSize3_ptbin2_mean_50ns",
83  "ecalPFClusterCorV2_EB_pfSize3_ptbin3_mean_50ns",
84  "ecalPFClusterCorV2_EE_pfSize1_mean_50ns",
85  "ecalPFClusterCorV2_EE_pfSize2_mean_50ns",
86  "ecalPFClusterCorV2_EE_pfSize3_ptbin1_mean_50ns",
87  "ecalPFClusterCorV2_EE_pfSize3_ptbin2_mean_50ns",
88  "ecalPFClusterCorV2_EE_pfSize3_ptbin3_mean_50ns"});
90  {"ecalPFClusterCorV2_EB_pfSize1_sigma_50ns",
91  "ecalPFClusterCorV2_EB_pfSize2_sigma_50ns",
92  "ecalPFClusterCorV2_EB_pfSize3_ptbin1_sigma_50ns",
93  "ecalPFClusterCorV2_EB_pfSize3_ptbin2_sigma_50ns",
94  "ecalPFClusterCorV2_EB_pfSize3_ptbin3_sigma_50ns",
95  "ecalPFClusterCorV2_EE_pfSize1_sigma_50ns",
96  "ecalPFClusterCorV2_EE_pfSize2_sigma_50ns",
97  "ecalPFClusterCorV2_EE_pfSize3_ptbin1_sigma_50ns",
98  "ecalPFClusterCorV2_EE_pfSize3_ptbin2_sigma_50ns",
99  "ecalPFClusterCorV2_EE_pfSize3_ptbin3_sigma_50ns"});
100 
101  if (srfAwareCorrection_) {
102  sigmalimlowEE_ = 0.001;
103  sigmalimhighEE_ = 0.1;
106 
107  ebSrFlagToken_ = cc.consumes<EBSrFlagCollection>(conf.getParameter<edm::InputTag>("ebSrFlagLabel"));
108  eeSrFlagToken_ = cc.consumes<EESrFlagCollection>(conf.getParameter<edm::InputTag>("eeSrFlagLabel"));
109 
110  condnames_mean_.insert(condnames_mean_.end(),
111  {"ecalPFClusterCor2017V2_EB_ZS_mean_25ns",
112  "ecalPFClusterCor2017V2_EB_Full_ptbin1_mean_25ns",
113  "ecalPFClusterCor2017V2_EB_Full_ptbin2_mean_25ns",
114  "ecalPFClusterCor2017V2_EB_Full_ptbin3_mean_25ns",
115  "ecalPFClusterCor2017V2_EE_ZS_mean_25ns",
116  "ecalPFClusterCor2017V2_EE_Full_ptbin1_mean_25ns",
117  "ecalPFClusterCor2017V2_EE_Full_ptbin2_mean_25ns",
118  "ecalPFClusterCor2017V2_EE_Full_ptbin3_mean_25ns"});
119 
120  condnames_sigma_.insert(condnames_sigma_.end(),
121  {"ecalPFClusterCor2017V2_EB_ZS_sigma_25ns",
122  "ecalPFClusterCor2017V2_EB_Full_ptbin1_sigma_25ns",
123  "ecalPFClusterCor2017V2_EB_Full_ptbin2_sigma_25ns",
124  "ecalPFClusterCor2017V2_EB_Full_ptbin3_sigma_25ns",
125  "ecalPFClusterCor2017V2_EE_ZS_sigma_25ns",
126  "ecalPFClusterCor2017V2_EE_Full_ptbin1_sigma_25ns",
127  "ecalPFClusterCor2017V2_EE_Full_ptbin2_sigma_25ns",
128  "ecalPFClusterCor2017V2_EE_Full_ptbin3_sigma_25ns"});
129 
130  for (short i = 0; i < (short)condnames_mean_.size(); i++) {
131  forestMeanTokens_25ns_.emplace_back(cc.esConsumes(edm::ESInputTag("", condnames_mean_[i])));
132  forestSigmaTokens_25ns_.emplace_back(cc.esConsumes(edm::ESInputTag("", condnames_sigma_[i])));
133  }
134  } else {
135  for (short i = 0; i < (short)condnames_mean_25ns_.size(); i++) {
136  forestMeanTokens_25ns_.emplace_back(cc.esConsumes(edm::ESInputTag("", condnames_mean_25ns_[i])));
137  forestSigmaTokens_25ns_.emplace_back(cc.esConsumes(edm::ESInputTag("", condnames_sigma_25ns_[i])));
138  }
139  for (short i = 0; i < (short)condnames_mean_50ns_.size(); i++) {
140  forestMeanTokens_50ns_.emplace_back(cc.esConsumes(edm::ESInputTag("", condnames_mean_50ns_[i])));
141  forestSigmaTokens_50ns_.emplace_back(cc.esConsumes(edm::ESInputTag("", condnames_sigma_50ns_[i])));
142  }
143  }
144  }
145 }

References eostools::move().

◆ PFClusterEMEnergyCorrector() [2/2]

PFClusterEMEnergyCorrector::PFClusterEMEnergyCorrector ( const PFClusterEMEnergyCorrector )
delete

Member Function Documentation

◆ correctEnergies()

void PFClusterEMEnergyCorrector::correctEnergies ( const edm::Event evt,
const edm::EventSetup es,
const reco::PFCluster::EEtoPSAssociation assoc,
reco::PFClusterCollection cs 
)

a hit can be ZS or forced ZS. A hit can be in Full readout or Forced to be FULL readout if it is ZS, then clusFlag (in binary) = 0001 if it is forced ZS, then clusFlag (in binary) = 0101 if it is FR, then clusFlag (in binary) = 0011 if it is forced FR, then clusFlag (in binary) = 0111 i.e 3rd bit is set. Even if it is forced, we should mark it is as ZS or FR. To take care of it, just check the LSB and second LSB(SLSB)

it is clusFlag==1, 5

Definition at line 147 of file PFClusterEMEnergyCorrector.cc.

150  {
151  // First deal with pre-MVA corrections
152  // Kept for backward compatibility (and for HLT)
153  if (!applyMVACorrections_) {
154  for (unsigned int idx = 0; idx < cs.size(); ++idx) {
155  reco::PFCluster &cluster = cs[idx];
156  bool iseb = cluster.layer() == PFLayer::ECAL_BARREL;
157  float ePS1 = 0., ePS2 = 0.;
158  if (!iseb)
159  getAssociatedPSEnergy(idx, assoc, ePS1, ePS2);
160  double correctedEnergy = calibrator_->energyEm(cluster, ePS1, ePS2, applyCrackCorrections_);
161  cluster.setCorrectedEnergy(correctedEnergy);
162  }
163  return;
164  }
165 
166  // Common objects for SRF-aware and old style corrections
168  EcalReadoutTools readoutTool(evt, es, ecalReadoutToolsESGetTokens_);
169 
170  if (!srfAwareCorrection_) {
171  int bunchspacing = 450;
173  edm::Handle<unsigned int> bunchSpacingH;
174  evt.getByToken(bunchSpacing_, bunchSpacingH);
175  bunchspacing = *bunchSpacingH;
176  } else {
177  bunchspacing = bunchSpacingManual_;
178  }
179 
180  const unsigned int ncor = (bunchspacing == 25) ? condnames_mean_25ns_.size() : condnames_mean_50ns_.size();
181 
182  std::vector<edm::ESHandle<GBRForestD> > forestH_mean(ncor);
183  std::vector<edm::ESHandle<GBRForestD> > forestH_sigma(ncor);
184 
185  if (bunchspacing == 25) {
186  for (unsigned int icor = 0; icor < ncor; ++icor) {
187  forestH_mean[icor] = es.getHandle(forestMeanTokens_25ns_[icor]);
188  forestH_sigma[icor] = es.getHandle(forestSigmaTokens_25ns_[icor]);
189  }
190  } else {
191  for (unsigned int icor = 0; icor < ncor; ++icor) {
192  forestH_mean[icor] = es.getHandle(forestMeanTokens_50ns_[icor]);
193  forestH_sigma[icor] = es.getHandle(forestSigmaTokens_50ns_[icor]);
194  }
195  }
196 
197  std::array<float, 5> eval;
198  for (unsigned int idx = 0; idx < cs.size(); ++idx) {
199  reco::PFCluster &cluster = cs[idx];
200  bool iseb = cluster.layer() == PFLayer::ECAL_BARREL;
201  float ePS1 = 0., ePS2 = 0.;
202  if (!iseb)
203  getAssociatedPSEnergy(idx, assoc, ePS1, ePS2);
204 
205  double e = cluster.energy();
206  double pt = cluster.pt();
207  double evale = e;
209  evale *= maxPtForMVAEvaluation_ / pt;
210  }
211  double invE = (e == 0.) ? 0. : 1. / e; //guard against dividing by 0.
212  int size = lazyTool.n5x5(cluster);
213 
214  int ietaix = 0;
215  int iphiiy = 0;
216  if (iseb) {
217  EBDetId ebseed(cluster.seed());
218  ietaix = ebseed.ieta();
219  iphiiy = ebseed.iphi();
220  } else {
221  EEDetId eeseed(cluster.seed());
222  ietaix = eeseed.ix();
223  iphiiy = eeseed.iy();
224  }
225 
226  //find index of corrections (0-4 for EB, 5-9 for EE, depending on cluster size and raw pt)
227  int coridx = std::min(size, 3) - 1;
228  if (coridx == 2) {
229  if (pt > 4.5) {
230  coridx += 1;
231  }
232  if (pt > 18.) {
233  coridx += 1;
234  }
235  }
236  if (!iseb) {
237  coridx += 5;
238  }
239 
240  const GBRForestD &meanforest = *forestH_mean[coridx].product();
241  const GBRForestD &sigmaforest = *forestH_sigma[coridx].product();
242 
243  //fill array for forest evaluation
244  eval[0] = evale;
245  eval[1] = ietaix;
246  eval[2] = iphiiy;
247  if (!iseb) {
248  eval[3] = ePS1 * invE;
249  eval[4] = ePS2 * invE;
250  }
251 
252  //these are the actual BDT responses
253  double rawmean = meanforest.GetResponse(eval.data());
254  double rawsigma = sigmaforest.GetResponse(eval.data());
255 
256  //apply transformation to limited output range (matching the training)
257  double mean = iseb ? meanoffsetEB_ + meanscaleEB_ * vdt::fast_sin(rawmean)
258  : meanoffsetEE_ + meanscaleEE_ * vdt::fast_sin(rawmean);
259  double sigma = iseb ? sigmaoffsetEB_ + sigmascaleEB_ * vdt::fast_sin(rawsigma)
260  : sigmaoffsetEE_ + sigmascaleEE_ * vdt::fast_sin(rawsigma);
261 
262  //regression target is ln(Etrue/Eraw)
263  //so corrected energy is ecor=exp(mean)*e, uncertainty is exp(mean)*eraw*sigma=ecor*sigma
264  double ecor = vdt::fast_exp(mean) * e;
265  double sigmacor = sigma * ecor;
266 
267  cluster.setCorrectedEnergy(ecor);
269  cluster.setCorrectedEnergyUncertainty(sigmacor);
270  else
271  cluster.setCorrectedEnergyUncertainty(0.);
272  }
273  return;
274  }
275 
276  // Selective Readout Flags
279  evt.getByToken(ebSrFlagToken_, ebSrFlags);
280  evt.getByToken(eeSrFlagToken_, eeSrFlags);
281  if (!ebSrFlags.isValid() || !eeSrFlags.isValid())
282  throw cms::Exception("PFClusterEMEnergyCorrector")
283  << "This version of PFCluster corrections requires the SrFlagCollection information to proceed!\n";
284 
285  const unsigned int ncor = forestMeanTokens_25ns_.size();
286  std::vector<edm::ESHandle<GBRForestD> > forestH_mean(ncor);
287  std::vector<edm::ESHandle<GBRForestD> > forestH_sigma(ncor);
288 
289  for (unsigned int icor = 0; icor < ncor; ++icor) {
290  forestH_mean[icor] = es.getHandle(forestMeanTokens_25ns_[icor]);
291  forestH_sigma[icor] = es.getHandle(forestSigmaTokens_25ns_[icor]);
292  }
293 
294  std::array<float, 6> evalEB;
295  std::array<float, 5> evalEE;
296 
297  for (unsigned int idx = 0; idx < cs.size(); ++idx) {
298  reco::PFCluster &cluster = cs[idx];
299  bool iseb = cluster.layer() == PFLayer::ECAL_BARREL;
300  float ePS1 = 0., ePS2 = 0.;
301  if (!iseb)
302  getAssociatedPSEnergy(idx, assoc, ePS1, ePS2);
303 
304  double e = cluster.energy();
305  double pt = cluster.pt();
306  double evale = e;
308  evale *= maxPtForMVAEvaluation_ / pt;
309  }
310  double invE = (e == 0.) ? 0. : 1. / e; //guard against dividing by 0.
311  int size = lazyTool.n5x5(cluster);
312  int reducedHits = size;
313  if (size >= 3)
314  reducedHits = 3;
315 
316  int ietaix = 0;
317  int iphiiy = 0;
318  if (iseb) {
319  EBDetId ebseed(cluster.seed());
320  ietaix = ebseed.ieta();
321  iphiiy = ebseed.iphi();
322  } else {
323  EEDetId eeseed(cluster.seed());
324  ietaix = eeseed.ix();
325  iphiiy = eeseed.iy();
326  }
327 
328  // Hardcoded number are positions of modules boundaries of ECAL
329  int signeta = (ietaix > 0) ? 1 : -1;
330  int ietamod20 = (std::abs(ietaix) < 26) ? ietaix - signeta : (ietaix - 26 * signeta) % 20;
331  int iphimod20 = (iphiiy - 1) % 20;
332 
333  int clusFlag = 0;
334  if (iseb) {
335  auto ecalUnit = readoutTool.readOutUnitOf(static_cast<EBDetId>(cluster.seed()));
336  EBSrFlagCollection::const_iterator srf = ebSrFlags->find(ecalUnit);
337  if (srf != ebSrFlags->end())
338  clusFlag = srf->value();
339  else
340  clusFlag = 3;
341  } else {
342  auto ecalUnit = readoutTool.readOutUnitOf(static_cast<EEDetId>(cluster.seed()));
343  EESrFlagCollection::const_iterator srf = eeSrFlags->find(ecalUnit);
344  if (srf != eeSrFlags->end())
345  clusFlag = srf->value();
346  else
347  clusFlag = 3;
348  }
349 
350  //find index of corrections (0-3 for EB, 4-7 for EE, depending on cluster size and raw pt)
351  int coridx = 0;
352  int regind = 0;
353  if (!iseb)
354  regind = 4;
355 
365  int ZS_bit = clusFlag >> 0 & 1;
366  int FR_bit = clusFlag >> 1 & 1;
367 
368  if (ZS_bit != 0 && FR_bit == 0)
369  coridx = 0 + regind;
370  else {
371  if (pt < 2.5)
372  coridx = 1 + regind;
373  else if (pt >= 2.5 && pt < 6.)
374  coridx = 2 + regind;
375  else if (pt >= 6.)
376  coridx = 3 + regind;
377  }
378  if (ZS_bit == 0 || clusFlag > 7) {
379  edm::LogWarning("PFClusterEMEnergyCorrector")
380  << "We can only correct regions readout in ZS (flag 1,5) or FULL readout (flag 3,7). Flag " << clusFlag
381  << " is not recognized."
382  << "\n"
383  << "Assuming FULL readout and continuing";
384  }
385 
386  const GBRForestD &meanforest = *forestH_mean[coridx].product();
387  const GBRForestD &sigmaforest = *forestH_sigma[coridx].product();
388 
389  //fill array for forest evaluation
390  if (iseb) {
391  evalEB[0] = evale;
392  evalEB[1] = ietaix;
393  evalEB[2] = iphiiy;
394  evalEB[3] = ietamod20;
395  evalEB[4] = iphimod20;
396  evalEB[5] = reducedHits;
397  } else {
398  evalEE[0] = evale;
399  evalEE[1] = ietaix;
400  evalEE[2] = iphiiy;
401  evalEE[3] = (ePS1 + ePS2) * invE;
402  evalEE[4] = reducedHits;
403  }
404 
405  //these are the actual BDT responses
406  double rawmean = 1;
407  double rawsigma = 0;
408 
409  if (iseb) {
410  rawmean = meanforest.GetResponse(evalEB.data());
411  rawsigma = sigmaforest.GetResponse(evalEB.data());
412  } else {
413  rawmean = meanforest.GetResponse(evalEE.data());
414  rawsigma = sigmaforest.GetResponse(evalEE.data());
415  }
416 
417  //apply transformation to limited output range (matching the training)
418  //the training was done with different transformations for EB and EE (width only)
419  //makes a the code a bit more cumbersome, but it is not a problem per se
420  double mean = iseb ? meanoffsetEB_ + meanscaleEB_ * vdt::fast_sin(rawmean)
421  : meanoffsetEE_ + meanscaleEE_ * vdt::fast_sin(rawmean);
422  double sigma = iseb ? sigmaoffsetEB_ + sigmascaleEB_ * vdt::fast_sin(rawsigma)
423  : sigmaoffsetEE_ + sigmascaleEE_ * vdt::fast_sin(rawsigma);
424 
425  //regression target is ln(Etrue/Eraw)
426  //so corrected energy is ecor=exp(mean)*e, uncertainty is exp(mean)*eraw*sigma=ecor*sigma
427  double ecor = iseb ? vdt::fast_exp(mean) * e : vdt::fast_exp(mean) * (e + ePS1 + ePS2);
428  double sigmacor = sigma * ecor;
429 
430  LogDebug("PFClusterEMEnergyCorrector")
431  << "ieta : iphi : ietamod20 : iphimod20 : size : reducedHits = " << ietaix << " " << iphiiy << " " << ietamod20
432  << " " << iphimod20 << " " << size << " " << reducedHits << "\n"
433  << "isEB : eraw : ePS1 : ePS2 : (eps1+eps2)/raw : Flag = " << iseb << " " << evale << " " << ePS1 << " " << ePS2
434  << " " << (ePS1 + ePS2) / evale << " " << clusFlag << "\n"
435  << "response : correction = " << exp(mean) << " " << ecor;
436 
437  cluster.setCorrectedEnergy(ecor);
439  cluster.setCorrectedEnergyUncertainty(sigmacor);
440  else
441  cluster.setCorrectedEnergyUncertainty(0.);
442  }
443 }

References funct::abs(), applyCrackCorrections_, applyMVACorrections_, trackingPlots::assoc, autoDetectBunchSpacing_, bunchSpacing_, bunchSpacingManual_, calibrator_, condnames_mean_25ns_, condnames_mean_50ns_, fwrapper::cs, MillePedeFileConverter_cfg::e, ebSrFlagToken_, PFLayer::ECAL_BARREL, ecalClusterToolsESGetTokens_, ecalReadoutToolsESGetTokens_, eeSrFlagToken_, edm::SortedCollection< T, SORT >::end(), reco::PFCluster::energy(), JetChargeProducer_cfi::exp, edm::SortedCollection< T, SORT >::find(), forestMeanTokens_25ns_, forestMeanTokens_50ns_, forestSigmaTokens_25ns_, forestSigmaTokens_50ns_, EcalClusterLazyToolsBase::ESGetTokens::get(), getAssociatedPSEnergy(), edm::Event::getByToken(), edm::EventSetup::getHandle(), GBRForestD::GetResponse(), heavyIonCSV_trainingSettings::idx, EBDetId::ieta(), edm::HandleBase::isValid(), EEDetId::ix(), reco::PFCluster::layer(), LogDebug, maxPtForMVAEvaluation_, SiStripPI::mean, meanoffsetEB_, meanoffsetEE_, meanscaleEB_, meanscaleEE_, min(), DiDispStaMuonMonitor_cfi::pt, reco::PFCluster::pt(), recHitsEB_, recHitsEE_, reco::CaloCluster::seed(), reco::CaloCluster::setCorrectedEnergy(), reco::CaloCluster::setCorrectedEnergyUncertainty(), setEnergyUncertainty_, sigmaoffsetEB_, sigmaoffsetEE_, sigmascaleEB_, sigmascaleEE_, findQualityFiles::size, and srfAwareCorrection_.

◆ getAssociatedPSEnergy()

void PFClusterEMEnergyCorrector::getAssociatedPSEnergy ( const size_t  clusIdx,
const reco::PFCluster::EEtoPSAssociation assoc,
float &  e1,
float &  e2 
)
private

Definition at line 445 of file PFClusterEMEnergyCorrector.cc.

448  {
449  e1 = 0;
450  e2 = 0;
451  auto ee_key_val = std::make_pair(clusIdx, edm::Ptr<reco::PFCluster>());
452  const auto clustops = std::equal_range(assoc.begin(), assoc.end(), ee_key_val, sortByKey);
453  for (auto i_ps = clustops.first; i_ps != clustops.second; ++i_ps) {
454  edm::Ptr<reco::PFCluster> psclus(i_ps->second);
455  switch (psclus->layer()) {
456  case PFLayer::PS1:
457  e1 += psclus->energy();
458  break;
459  case PFLayer::PS2:
460  e2 += psclus->energy();
461  break;
462  default:
463  break;
464  }
465  }
466 }

References trackingPlots::assoc, StorageManager_cfg::e1, reco::PFCluster::energy(), reco::PFCluster::layer(), PFLayer::PS1, PFLayer::PS2, and sortByKey().

Referenced by correctEnergies().

◆ operator=()

PFClusterEMEnergyCorrector& PFClusterEMEnergyCorrector::operator= ( const PFClusterEMEnergyCorrector )
delete

Member Data Documentation

◆ applyCrackCorrections_

bool PFClusterEMEnergyCorrector::applyCrackCorrections_
private

Definition at line 62 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ applyMVACorrections_

bool PFClusterEMEnergyCorrector::applyMVACorrections_
private

Definition at line 63 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ autoDetectBunchSpacing_

bool PFClusterEMEnergyCorrector::autoDetectBunchSpacing_
private

Definition at line 66 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ bunchSpacing_

edm::EDGetTokenT<unsigned int> PFClusterEMEnergyCorrector::bunchSpacing_
private

Definition at line 48 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ bunchSpacingManual_

int PFClusterEMEnergyCorrector::bunchSpacingManual_
private

Definition at line 67 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ calibrator_

std::unique_ptr<PFEnergyCalibration> PFClusterEMEnergyCorrector::calibrator_
private

Definition at line 69 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ condnames_mean_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_mean_
private

Definition at line 53 of file PFClusterEMEnergyCorrector.h.

◆ condnames_mean_25ns_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_mean_25ns_
private

Definition at line 56 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ condnames_mean_50ns_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_mean_50ns_
private

Definition at line 58 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ condnames_sigma_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_sigma_
private

Definition at line 54 of file PFClusterEMEnergyCorrector.h.

◆ condnames_sigma_25ns_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_sigma_25ns_
private

Definition at line 57 of file PFClusterEMEnergyCorrector.h.

◆ condnames_sigma_50ns_

std::vector<std::string> PFClusterEMEnergyCorrector::condnames_sigma_50ns_
private

Definition at line 59 of file PFClusterEMEnergyCorrector.h.

◆ ebSrFlagToken_

edm::EDGetTokenT<EBSrFlagCollection> PFClusterEMEnergyCorrector::ebSrFlagToken_
private

Definition at line 42 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ ecalClusterToolsESGetTokens_

const EcalClusterLazyTools::ESGetTokens PFClusterEMEnergyCorrector::ecalClusterToolsESGetTokens_
private

Definition at line 50 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ ecalReadoutToolsESGetTokens_

const EcalReadoutTools::ESGetTokens PFClusterEMEnergyCorrector::ecalReadoutToolsESGetTokens_
private

Definition at line 51 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ eeSrFlagToken_

edm::EDGetTokenT<EESrFlagCollection> PFClusterEMEnergyCorrector::eeSrFlagToken_
private

Definition at line 43 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ forestMeanTokens_25ns_

std::vector<edm::ESGetToken<GBRForestD, GBRDWrapperRcd> > PFClusterEMEnergyCorrector::forestMeanTokens_25ns_
private

Definition at line 96 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ forestMeanTokens_50ns_

std::vector<edm::ESGetToken<GBRForestD, GBRDWrapperRcd> > PFClusterEMEnergyCorrector::forestMeanTokens_50ns_
private

Definition at line 98 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ forestSigmaTokens_25ns_

std::vector<edm::ESGetToken<GBRForestD, GBRDWrapperRcd> > PFClusterEMEnergyCorrector::forestSigmaTokens_25ns_
private

Definition at line 97 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ forestSigmaTokens_50ns_

std::vector<edm::ESGetToken<GBRForestD, GBRDWrapperRcd> > PFClusterEMEnergyCorrector::forestSigmaTokens_50ns_
private

Definition at line 99 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ maxPtForMVAEvaluation_

double PFClusterEMEnergyCorrector::maxPtForMVAEvaluation_
private

Definition at line 40 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ meanlimhighEB_

double PFClusterEMEnergyCorrector::meanlimhighEB_
private

Definition at line 76 of file PFClusterEMEnergyCorrector.h.

◆ meanlimhighEE_

double PFClusterEMEnergyCorrector::meanlimhighEE_
private

Definition at line 81 of file PFClusterEMEnergyCorrector.h.

◆ meanlimlowEB_

double PFClusterEMEnergyCorrector::meanlimlowEB_
private

Definition at line 75 of file PFClusterEMEnergyCorrector.h.

◆ meanlimlowEE_

double PFClusterEMEnergyCorrector::meanlimlowEE_
private

Definition at line 80 of file PFClusterEMEnergyCorrector.h.

◆ meanoffsetEB_

double PFClusterEMEnergyCorrector::meanoffsetEB_
private

Definition at line 77 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ meanoffsetEE_

double PFClusterEMEnergyCorrector::meanoffsetEE_
private

Definition at line 82 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ meanscaleEB_

double PFClusterEMEnergyCorrector::meanscaleEB_
private

Definition at line 78 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ meanscaleEE_

double PFClusterEMEnergyCorrector::meanscaleEE_
private

Definition at line 83 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ recHitsEB_

edm::EDGetTokenT<EcalRecHitCollection> PFClusterEMEnergyCorrector::recHitsEB_
private

Definition at line 46 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ recHitsEE_

edm::EDGetTokenT<EcalRecHitCollection> PFClusterEMEnergyCorrector::recHitsEE_
private

Definition at line 47 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ setEnergyUncertainty_

bool PFClusterEMEnergyCorrector::setEnergyUncertainty_
private

Definition at line 64 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ sigmalimhighEB_

double PFClusterEMEnergyCorrector::sigmalimhighEB_
private

Definition at line 86 of file PFClusterEMEnergyCorrector.h.

◆ sigmalimhighEE_

double PFClusterEMEnergyCorrector::sigmalimhighEE_
private

Definition at line 91 of file PFClusterEMEnergyCorrector.h.

◆ sigmalimlowEB_

double PFClusterEMEnergyCorrector::sigmalimlowEB_
private

Definition at line 85 of file PFClusterEMEnergyCorrector.h.

◆ sigmalimlowEE_

double PFClusterEMEnergyCorrector::sigmalimlowEE_
private

Definition at line 90 of file PFClusterEMEnergyCorrector.h.

◆ sigmaoffsetEB_

double PFClusterEMEnergyCorrector::sigmaoffsetEB_
private

Definition at line 87 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ sigmaoffsetEE_

double PFClusterEMEnergyCorrector::sigmaoffsetEE_
private

Definition at line 92 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ sigmascaleEB_

double PFClusterEMEnergyCorrector::sigmascaleEB_
private

Definition at line 88 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ sigmascaleEE_

double PFClusterEMEnergyCorrector::sigmascaleEE_
private

Definition at line 93 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

◆ srfAwareCorrection_

bool PFClusterEMEnergyCorrector::srfAwareCorrection_
private

Definition at line 61 of file PFClusterEMEnergyCorrector.h.

Referenced by correctEnergies().

PFClusterEMEnergyCorrector::ecalClusterToolsESGetTokens_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
Definition: PFClusterEMEnergyCorrector.h:50
PFClusterEMEnergyCorrector::sigmalimhighEE_
double sigmalimhighEE_
Definition: PFClusterEMEnergyCorrector.h:91
EBDetId::ieta
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
PFClusterEMEnergyCorrector::meanoffsetEE_
double meanoffsetEE_
Definition: PFClusterEMEnergyCorrector.h:82
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
GBRForestD::GetResponse
double GetResponse(const float *vector) const
Definition: GBRForestD.h:49
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
PFClusterEMEnergyCorrector::calibrator_
std::unique_ptr< PFEnergyCalibration > calibrator_
Definition: PFClusterEMEnergyCorrector.h:69
fwrapper::cs
unique_ptr< ClusterSequence > cs
Definition: fastjetfortran_madfks.cc:47
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
reco::PFCluster::layer
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:56
min
T min(T a, T b)
Definition: MathUtil.h:58
EBDetId
Definition: EBDetId.h:17
reco::CaloCluster::setCorrectedEnergy
void setCorrectedEnergy(double cenergy)
Definition: CaloCluster.h:137
PFClusterEMEnergyCorrector::sigmalimlowEB_
double sigmalimlowEB_
Definition: PFClusterEMEnergyCorrector.h:85
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
PFClusterEMEnergyCorrector::autoDetectBunchSpacing_
bool autoDetectBunchSpacing_
Definition: PFClusterEMEnergyCorrector.h:66
PFClusterEMEnergyCorrector::applyMVACorrections_
bool applyMVACorrections_
Definition: PFClusterEMEnergyCorrector.h:63
edm::SortedCollection< EcalRecHit >
PFClusterEMEnergyCorrector::getAssociatedPSEnergy
void getAssociatedPSEnergy(const size_t clusIdx, const reco::PFCluster::EEtoPSAssociation &assoc, float &e1, float &e2)
Definition: PFClusterEMEnergyCorrector.cc:445
PFClusterEMEnergyCorrector::meanlimlowEB_
double meanlimlowEB_
Definition: PFClusterEMEnergyCorrector.h:75
PFClusterEMEnergyCorrector::srfAwareCorrection_
bool srfAwareCorrection_
Definition: PFClusterEMEnergyCorrector.h:61
EEDetId::ix
int ix() const
Definition: EEDetId.h:77
edm::Handle
Definition: AssociativeIterator.h:50
PFClusterEMEnergyCorrector::forestMeanTokens_50ns_
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestMeanTokens_50ns_
Definition: PFClusterEMEnergyCorrector.h:98
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
PFClusterEMEnergyCorrector::recHitsEB_
edm::EDGetTokenT< EcalRecHitCollection > recHitsEB_
Definition: PFClusterEMEnergyCorrector.h:46
PFClusterEMEnergyCorrector::meanscaleEE_
double meanscaleEE_
Definition: PFClusterEMEnergyCorrector.h:83
PFLayer::ECAL_BARREL
Definition: PFLayer.h:33
PFClusterEMEnergyCorrector::sigmalimlowEE_
double sigmalimlowEE_
Definition: PFClusterEMEnergyCorrector.h:90
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
trackingPlots.assoc
assoc
Definition: trackingPlots.py:183
PFClusterEMEnergyCorrector::meanscaleEB_
double meanscaleEB_
Definition: PFClusterEMEnergyCorrector.h:78
reco::PFCluster::energy
double energy() const
cluster energy
Definition: PFCluster.h:74
PFLayer::PS1
Definition: PFLayer.h:31
PFClusterEMEnergyCorrector::setEnergyUncertainty_
bool setEnergyUncertainty_
Definition: PFClusterEMEnergyCorrector.h:64
PFClusterEMEnergyCorrector::sigmascaleEB_
double sigmascaleEB_
Definition: PFClusterEMEnergyCorrector.h:88
PFEnergyCalibration
Definition: PFEnergyCalibration.h:42
GBRForestD
Definition: GBRForestD.h:25
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
PFClusterEMEnergyCorrector::bunchSpacing_
edm::EDGetTokenT< unsigned int > bunchSpacing_
Definition: PFClusterEMEnergyCorrector.h:48
EcalClusterLazyTools
EEDetId
Definition: EEDetId.h:14
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
PFClusterEMEnergyCorrector::condnames_mean_25ns_
std::vector< std::string > condnames_mean_25ns_
Definition: PFClusterEMEnergyCorrector.h:56
PFClusterEMEnergyCorrector::condnames_mean_50ns_
std::vector< std::string > condnames_mean_50ns_
Definition: PFClusterEMEnergyCorrector.h:58
PFClusterEMEnergyCorrector::ebSrFlagToken_
edm::EDGetTokenT< EBSrFlagCollection > ebSrFlagToken_
Definition: PFClusterEMEnergyCorrector.h:42
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
reco::CaloCluster::setCorrectedEnergyUncertainty
void setCorrectedEnergyUncertainty(float energyerr)
Definition: CaloCluster.h:138
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
PFClusterEMEnergyCorrector::meanlimhighEB_
double meanlimhighEB_
Definition: PFClusterEMEnergyCorrector.h:76
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
PFClusterEMEnergyCorrector::condnames_sigma_50ns_
std::vector< std::string > condnames_sigma_50ns_
Definition: PFClusterEMEnergyCorrector.h:59
PFClusterEMEnergyCorrector::sigmalimhighEB_
double sigmalimhighEB_
Definition: PFClusterEMEnergyCorrector.h:86
PFClusterEMEnergyCorrector::meanoffsetEB_
double meanoffsetEB_
Definition: PFClusterEMEnergyCorrector.h:77
cc
PFClusterEMEnergyCorrector::sigmaoffsetEE_
double sigmaoffsetEE_
Definition: PFClusterEMEnergyCorrector.h:92
reco::CaloCluster::seed
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:219
EcalClusterLazyToolsBase::ESGetTokens::get
ESData get(edm::EventSetup const &eventSetup) const
Definition: EcalClusterLazyTools.h:64
edm::Ptr< reco::PFCluster >
PFClusterEMEnergyCorrector::meanlimlowEE_
double meanlimlowEE_
Definition: PFClusterEMEnergyCorrector.h:80
PFClusterEMEnergyCorrector::ecalReadoutToolsESGetTokens_
const EcalReadoutTools::ESGetTokens ecalReadoutToolsESGetTokens_
Definition: PFClusterEMEnergyCorrector.h:51
PFClusterEMEnergyCorrector::forestMeanTokens_25ns_
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestMeanTokens_25ns_
Definition: PFClusterEMEnergyCorrector.h:96
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
eostools.move
def move(src, dest)
Definition: eostools.py:511
PFClusterEMEnergyCorrector::condnames_sigma_25ns_
std::vector< std::string > condnames_sigma_25ns_
Definition: PFClusterEMEnergyCorrector.h:57
PFClusterEMEnergyCorrector::recHitsEE_
edm::EDGetTokenT< EcalRecHitCollection > recHitsEE_
Definition: PFClusterEMEnergyCorrector.h:47
reco::PFCluster::pt
double pt() const
transverse momentum, massless approximation
Definition: PFCluster.h:110
PFClusterEMEnergyCorrector::applyCrackCorrections_
bool applyCrackCorrections_
Definition: PFClusterEMEnergyCorrector.h:62
PFClusterEMEnergyCorrector::forestSigmaTokens_50ns_
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestSigmaTokens_50ns_
Definition: PFClusterEMEnergyCorrector.h:99
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
PFClusterEMEnergyCorrector::condnames_mean_
std::vector< std::string > condnames_mean_
Definition: PFClusterEMEnergyCorrector.h:53
PFClusterEMEnergyCorrector::meanlimhighEE_
double meanlimhighEE_
Definition: PFClusterEMEnergyCorrector.h:81
PFClusterEMEnergyCorrector::sigmascaleEE_
double sigmascaleEE_
Definition: PFClusterEMEnergyCorrector.h:93
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
sortByKey
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
Definition: PFClusterMatchedToPhotonsSelector.cc:41
PFClusterEMEnergyCorrector::condnames_sigma_
std::vector< std::string > condnames_sigma_
Definition: PFClusterEMEnergyCorrector.h:54
PFClusterEMEnergyCorrector::forestSigmaTokens_25ns_
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestSigmaTokens_25ns_
Definition: PFClusterEMEnergyCorrector.h:97
cms::Exception
Definition: Exception.h:70
PFClusterEMEnergyCorrector::maxPtForMVAEvaluation_
double maxPtForMVAEvaluation_
Definition: PFClusterEMEnergyCorrector.h:40
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
PFClusterEMEnergyCorrector::sigmaoffsetEB_
double sigmaoffsetEB_
Definition: PFClusterEMEnergyCorrector.h:87
EcalReadoutTools
Definition: EcalReadoutTools.h:12
PFClusterEMEnergyCorrector::eeSrFlagToken_
edm::EDGetTokenT< EESrFlagCollection > eeSrFlagToken_
Definition: PFClusterEMEnergyCorrector.h:43
PFLayer::PS2
Definition: PFLayer.h:30
edm::InputTag
Definition: InputTag.h:15
PFClusterEMEnergyCorrector::bunchSpacingManual_
int bunchSpacingManual_
Definition: PFClusterEMEnergyCorrector.h:67
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37