CMS 3D CMS Logo

AntiElectronIDMVA6.cc
Go to the documentation of this file.
2 
4 
10 
13 
14 #include <TMath.h>
15 #include <TFile.h>
16 #include <array>
17 
19  : isInitialized_(false),
20  mva_NoEleMatch_woGwoGSF_BL_(nullptr),
21  mva_NoEleMatch_wGwoGSF_BL_(nullptr),
22  mva_woGwGSF_BL_(nullptr),
23  mva_wGwGSF_BL_(nullptr),
24  mva_NoEleMatch_woGwoGSF_EC_(nullptr),
25  mva_NoEleMatch_wGwoGSF_EC_(nullptr),
26  mva_woGwGSF_EC_(nullptr),
27  mva_wGwGSF_EC_(nullptr) {
28  loadMVAfromDB_ = cfg.exists("loadMVAfromDB") ? cfg.getParameter<bool>("loadMVAfromDB") : false;
29  if (!loadMVAfromDB_) {
30  if (cfg.exists("inputFileName")) {
31  inputFileName_ = cfg.getParameter<edm::FileInPath>("inputFileName");
32  } else
33  throw cms::Exception("MVA input not defined")
34  << "Requested to load tau MVA input from ROOT file but no file provided in cfg file";
35  }
36 
37  mvaName_NoEleMatch_woGwoGSF_BL_ = cfg.getParameter<std::string>("mvaName_NoEleMatch_woGwoGSF_BL");
38  mvaName_NoEleMatch_wGwoGSF_BL_ = cfg.getParameter<std::string>("mvaName_NoEleMatch_wGwoGSF_BL");
39  mvaName_woGwGSF_BL_ = cfg.getParameter<std::string>("mvaName_woGwGSF_BL");
40  mvaName_wGwGSF_BL_ = cfg.getParameter<std::string>("mvaName_wGwGSF_BL");
41  mvaName_NoEleMatch_woGwoGSF_EC_ = cfg.getParameter<std::string>("mvaName_NoEleMatch_woGwoGSF_EC");
42  mvaName_NoEleMatch_wGwoGSF_EC_ = cfg.getParameter<std::string>("mvaName_NoEleMatch_wGwoGSF_EC");
43  mvaName_woGwGSF_EC_ = cfg.getParameter<std::string>("mvaName_woGwGSF_EC");
44  mvaName_wGwGSF_EC_ = cfg.getParameter<std::string>("mvaName_wGwGSF_EC");
45 
46  usePhiAtEcalEntranceExtrapolation_ = cfg.getParameter<bool>("usePhiAtEcalEntranceExtrapolation");
47 
48  Var_NoEleMatch_woGwoGSF_Barrel_ = new Float_t[10];
49  Var_NoEleMatch_wGwoGSF_Barrel_ = new Float_t[18];
50  Var_woGwGSF_Barrel_ = new Float_t[24];
51  Var_wGwGSF_Barrel_ = new Float_t[32];
52  Var_NoEleMatch_woGwoGSF_Endcap_ = new Float_t[9];
53  Var_NoEleMatch_wGwoGSF_Endcap_ = new Float_t[17];
54  Var_woGwGSF_Endcap_ = new Float_t[23];
55  Var_wGwGSF_Endcap_ = new Float_t[31];
56 
57  verbosity_ = 0;
58 }
59 
63  delete[] Var_woGwGSF_Barrel_;
64  delete[] Var_wGwGSF_Barrel_;
67  delete[] Var_woGwGSF_Endcap_;
68  delete[] Var_wGwGSF_Endcap_;
69 
70  if (!loadMVAfromDB_) {
73  delete mva_woGwGSF_BL_;
74  delete mva_wGwGSF_BL_;
77  delete mva_woGwGSF_EC_;
78  delete mva_wGwGSF_EC_;
79  }
80 
81  for (std::vector<TFile*>::iterator it = inputFilesToDelete_.begin(); it != inputFilesToDelete_.end(); ++it) {
82  delete (*it);
83  }
84 }
85 
86 namespace {
87  const GBRForest* loadMVAfromFile(TFile* inputFile, const std::string& mvaName) {
88  const GBRForest* mva = (GBRForest*)inputFile->Get(mvaName.data());
89  if (!mva)
90  throw cms::Exception("PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
91  << " Failed to load MVA = " << mvaName.data() << " from file "
92  << " !!\n";
93 
94  return mva;
95  }
96 
97  const GBRForest* loadMVAfromDB(const edm::EventSetup& es, const std::string& mvaName) {
100  return mva.product();
101  }
102 } // namespace
103 
105  if (!isInitialized_) {
106  if (loadMVAfromDB_) {
115  } else {
117  throw cms::Exception("PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
118  << " Failed to find File = " << inputFileName_ << " !!\n";
119  TFile* inputFile = new TFile(inputFileName_.fullPath().data());
120 
123  mva_woGwGSF_BL_ = loadMVAfromFile(inputFile, mvaName_woGwGSF_BL_);
124  mva_wGwGSF_BL_ = loadMVAfromFile(inputFile, mvaName_wGwGSF_BL_);
127  mva_woGwGSF_EC_ = loadMVAfromFile(inputFile, mvaName_woGwGSF_EC_);
128  mva_wGwGSF_EC_ = loadMVAfromFile(inputFile, mvaName_wGwGSF_EC_);
129  inputFilesToDelete_.push_back(inputFile);
130  }
131  isInitialized_ = true;
132  }
134 }
135 
136 double AntiElectronIDMVA6::MVAValue(Float_t TauPt,
137  Float_t TauEtaAtEcalEntrance,
138  Float_t TauPhi,
139  Float_t TauLeadChargedPFCandPt,
140  Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
141  Float_t TauEmFraction,
142  Float_t TauLeadPFChargedHadrHoP,
143  Float_t TauLeadPFChargedHadrEoP,
144  Float_t TauVisMassIn,
145  Float_t TaudCrackEta,
146  Float_t TaudCrackPhi,
147  Float_t TauHasGsf,
148  Int_t TauSignalPFGammaCandsIn,
149  Int_t TauSignalPFGammaCandsOut,
150  const std::vector<Float_t>& GammasdEtaInSigCone,
151  const std::vector<Float_t>& GammasdPhiInSigCone,
152  const std::vector<Float_t>& GammasPtInSigCone,
153  const std::vector<Float_t>& GammasdEtaOutSigCone,
154  const std::vector<Float_t>& GammasdPhiOutSigCone,
155  const std::vector<Float_t>& GammasPtOutSigCone,
156  Float_t ElecEta,
157  Float_t ElecPhi,
158  Float_t ElecEtotOverPin,
159  Float_t ElecChi2NormGSF,
160  Float_t ElecChi2NormKF,
161  Float_t ElecGSFNumHits,
162  Float_t ElecKFNumHits,
163  Float_t ElecGSFTrackResol,
164  Float_t ElecGSFTracklnPt,
165  Float_t ElecPin,
166  Float_t ElecPout,
167  Float_t ElecEecal,
168  Float_t ElecDeltaEta,
169  Float_t ElecDeltaPhi,
170  Float_t ElecMvaInSigmaEtaEta,
171  Float_t ElecMvaInHadEnergy,
172  Float_t ElecMvaInDeltaEta) {
173  double sumPt = 0.;
174  double dEta2 = 0.;
175  double dPhi2 = 0.;
176  double sumPt2 = 0.;
177  for (unsigned int i = 0; i < GammasPtInSigCone.size(); ++i) {
178  double pt_i = GammasPtInSigCone[i];
179  double phi_i = GammasdPhiInSigCone[i];
180  if (GammasdPhiInSigCone[i] > M_PI)
181  phi_i = GammasdPhiInSigCone[i] - 2 * M_PI;
182  else if (GammasdPhiInSigCone[i] < -M_PI)
183  phi_i = GammasdPhiInSigCone[i] + 2 * M_PI;
184  double eta_i = GammasdEtaInSigCone[i];
185  sumPt += pt_i;
186  sumPt2 += (pt_i * pt_i);
187  dEta2 += (pt_i * eta_i * eta_i);
188  dPhi2 += (pt_i * phi_i * phi_i);
189  }
190  Float_t TauGammaEnFracIn = -99.;
191  if (TauPt > 0.) {
192  TauGammaEnFracIn = sumPt / TauPt;
193  }
194  if (sumPt > 0.) {
195  dEta2 /= sumPt;
196  dPhi2 /= sumPt;
197  }
198  Float_t TauGammaEtaMomIn = std::sqrt(dEta2) * std::sqrt(TauGammaEnFracIn) * TauPt;
199  Float_t TauGammaPhiMomIn = std::sqrt(dPhi2) * std::sqrt(TauGammaEnFracIn) * TauPt;
200 
201  sumPt = 0.;
202  dEta2 = 0.;
203  dPhi2 = 0.;
204  sumPt2 = 0.;
205  for (unsigned int i = 0; i < GammasPtOutSigCone.size(); ++i) {
206  double pt_i = GammasPtOutSigCone[i];
207  double phi_i = GammasdPhiOutSigCone[i];
208  if (GammasdPhiOutSigCone[i] > M_PI)
209  phi_i = GammasdPhiOutSigCone[i] - 2 * M_PI;
210  else if (GammasdPhiOutSigCone[i] < -M_PI)
211  phi_i = GammasdPhiOutSigCone[i] + 2 * M_PI;
212  double eta_i = GammasdEtaOutSigCone[i];
213  sumPt += pt_i;
214  sumPt2 += (pt_i * pt_i);
215  dEta2 += (pt_i * eta_i * eta_i);
216  dPhi2 += (pt_i * phi_i * phi_i);
217  }
218  Float_t TauGammaEnFracOut = sumPt / TauPt;
219  if (sumPt > 0.) {
220  dEta2 /= sumPt;
221  dPhi2 /= sumPt;
222  }
223  Float_t TauGammaEtaMomOut = std::sqrt(dEta2) * std::sqrt(TauGammaEnFracOut) * TauPt;
224  Float_t TauGammaPhiMomOut = std::sqrt(dPhi2) * std::sqrt(TauGammaEnFracOut) * TauPt;
225 
226  return MVAValue(TauPt,
227  TauEtaAtEcalEntrance,
228  TauPhi,
229  TauLeadChargedPFCandPt,
230  TauLeadChargedPFCandEtaAtEcalEntrance,
231  TauEmFraction,
232  TauLeadPFChargedHadrHoP,
233  TauLeadPFChargedHadrEoP,
234  TauVisMassIn,
235  TaudCrackEta,
236  TaudCrackPhi,
237  TauHasGsf,
238  TauSignalPFGammaCandsIn,
239  TauSignalPFGammaCandsOut,
240  TauGammaEtaMomIn,
241  TauGammaEtaMomOut,
242  TauGammaPhiMomIn,
243  TauGammaPhiMomOut,
244  TauGammaEnFracIn,
245  TauGammaEnFracOut,
246  ElecEta,
247  ElecPhi,
248  ElecEtotOverPin,
249  ElecChi2NormGSF,
250  ElecChi2NormKF,
251  ElecGSFNumHits,
252  ElecKFNumHits,
253  ElecGSFTrackResol,
254  ElecGSFTracklnPt,
255  ElecPin,
256  ElecPout,
257  ElecEecal,
258  ElecDeltaEta,
259  ElecDeltaPhi,
260  ElecMvaInSigmaEtaEta,
261  ElecMvaInHadEnergy,
262  ElecMvaInDeltaEta);
263 }
264 
265 double AntiElectronIDMVA6::MVAValue(Float_t TauPt,
266  Float_t TauEtaAtEcalEntrance,
267  Float_t TauPhi,
268  Float_t TauLeadChargedPFCandPt,
269  Float_t TauLeadChargedPFCandEtaAtEcalEntrance,
270  Float_t TauEmFraction,
271  Float_t TauLeadPFChargedHadrHoP,
272  Float_t TauLeadPFChargedHadrEoP,
273  Float_t TauVisMassIn,
274  Float_t TaudCrackEta,
275  Float_t TaudCrackPhi,
276  Float_t TauHasGsf,
277  Int_t TauSignalPFGammaCandsIn,
278  Int_t TauSignalPFGammaCandsOut,
279  Float_t TauGammaEtaMomIn,
280  Float_t TauGammaEtaMomOut,
281  Float_t TauGammaPhiMomIn,
282  Float_t TauGammaPhiMomOut,
283  Float_t TauGammaEnFracIn,
284  Float_t TauGammaEnFracOut,
285  Float_t ElecEta,
286  Float_t ElecPhi,
287  Float_t ElecEtotOverPin,
288  Float_t ElecChi2NormGSF,
289  Float_t ElecChi2NormKF,
290  Float_t ElecGSFNumHits,
291  Float_t ElecKFNumHits,
292  Float_t ElecGSFTrackResol,
293  Float_t ElecGSFTracklnPt,
294  Float_t ElecPin,
295  Float_t ElecPout,
296  Float_t ElecEecal,
297  Float_t ElecDeltaEta,
298  Float_t ElecDeltaPhi,
299  Float_t ElecMvaInSigmaEtaEta,
300  Float_t ElecMvaInHadEnergy,
301  Float_t ElecMvaInDeltaEta) {
302  if (!isInitialized_) {
303  throw cms::Exception("ClassNotInitialized") << " AntiElectronMVA not properly initialized !!\n";
304  }
305 
306  double mvaValue = -99.;
307 
308  const float ECALBarrelEndcapEtaBorder = 1.479;
309  float ElecDeltaPinPoutOverPin = (ElecPin > 0.0) ? (std::abs(ElecPin - ElecPout) / ElecPin) : 1.0;
310  float ElecEecalOverPout = (ElecPout > 0.0) ? (ElecEecal / ElecPout) : 20.0;
311  float ElecNumHitsDiffOverSum = ((ElecGSFNumHits + ElecKFNumHits) > 0.0)
312  ? ((ElecGSFNumHits - ElecKFNumHits) / (ElecGSFNumHits + ElecKFNumHits))
313  : 1.0;
314 
315  if (deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn == 0 && TauHasGsf < 0.5) {
316  if (std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
317  Var_NoEleMatch_woGwoGSF_Barrel_[0] = TauEtaAtEcalEntrance;
318  Var_NoEleMatch_woGwoGSF_Barrel_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
319  Var_NoEleMatch_woGwoGSF_Barrel_[2] = std::min(float(2.), TauLeadChargedPFCandPt / std::max(float(1.), TauPt));
320  Var_NoEleMatch_woGwoGSF_Barrel_[3] = std::log(std::max(float(1.), TauPt));
321  Var_NoEleMatch_woGwoGSF_Barrel_[4] = TauEmFraction;
322  Var_NoEleMatch_woGwoGSF_Barrel_[5] = TauLeadPFChargedHadrHoP;
323  Var_NoEleMatch_woGwoGSF_Barrel_[6] = TauLeadPFChargedHadrEoP;
324  Var_NoEleMatch_woGwoGSF_Barrel_[7] = TauVisMassIn;
325  Var_NoEleMatch_woGwoGSF_Barrel_[8] = TaudCrackEta;
326  Var_NoEleMatch_woGwoGSF_Barrel_[9] = TaudCrackPhi;
328  } else {
329  Var_NoEleMatch_woGwoGSF_Endcap_[0] = TauEtaAtEcalEntrance;
330  Var_NoEleMatch_woGwoGSF_Endcap_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
331  Var_NoEleMatch_woGwoGSF_Endcap_[2] = std::min(float(2.), TauLeadChargedPFCandPt / std::max(float(1.), TauPt));
332  Var_NoEleMatch_woGwoGSF_Endcap_[3] = std::log(std::max(float(1.), TauPt));
333  Var_NoEleMatch_woGwoGSF_Endcap_[4] = TauEmFraction;
334  Var_NoEleMatch_woGwoGSF_Endcap_[5] = TauLeadPFChargedHadrHoP;
335  Var_NoEleMatch_woGwoGSF_Endcap_[6] = TauLeadPFChargedHadrEoP;
336  Var_NoEleMatch_woGwoGSF_Endcap_[7] = TauVisMassIn;
337  Var_NoEleMatch_woGwoGSF_Endcap_[8] = TaudCrackEta;
339  }
340  } else if (deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn > 0 &&
341  TauHasGsf < 0.5) {
342  if (std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
343  Var_NoEleMatch_wGwoGSF_Barrel_[0] = TauEtaAtEcalEntrance;
344  Var_NoEleMatch_wGwoGSF_Barrel_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
345  Var_NoEleMatch_wGwoGSF_Barrel_[2] = std::min(float(2.), TauLeadChargedPFCandPt / std::max(float(1.), TauPt));
346  Var_NoEleMatch_wGwoGSF_Barrel_[3] = std::log(std::max(float(1.), TauPt));
347  Var_NoEleMatch_wGwoGSF_Barrel_[4] = TauEmFraction;
348  Var_NoEleMatch_wGwoGSF_Barrel_[5] = TauSignalPFGammaCandsIn;
349  Var_NoEleMatch_wGwoGSF_Barrel_[6] = TauSignalPFGammaCandsOut;
350  Var_NoEleMatch_wGwoGSF_Barrel_[7] = TauLeadPFChargedHadrHoP;
351  Var_NoEleMatch_wGwoGSF_Barrel_[8] = TauLeadPFChargedHadrEoP;
352  Var_NoEleMatch_wGwoGSF_Barrel_[9] = TauVisMassIn;
353  Var_NoEleMatch_wGwoGSF_Barrel_[10] = TauGammaEtaMomIn;
354  Var_NoEleMatch_wGwoGSF_Barrel_[11] = TauGammaEtaMomOut;
355  Var_NoEleMatch_wGwoGSF_Barrel_[12] = TauGammaPhiMomIn;
356  Var_NoEleMatch_wGwoGSF_Barrel_[13] = TauGammaPhiMomOut;
357  Var_NoEleMatch_wGwoGSF_Barrel_[14] = TauGammaEnFracIn;
358  Var_NoEleMatch_wGwoGSF_Barrel_[15] = TauGammaEnFracOut;
359  Var_NoEleMatch_wGwoGSF_Barrel_[16] = TaudCrackEta;
360  Var_NoEleMatch_wGwoGSF_Barrel_[17] = TaudCrackPhi;
362  } else {
363  Var_NoEleMatch_wGwoGSF_Endcap_[0] = TauEtaAtEcalEntrance;
364  Var_NoEleMatch_wGwoGSF_Endcap_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
365  Var_NoEleMatch_wGwoGSF_Endcap_[2] = std::min(float(2.), TauLeadChargedPFCandPt / std::max(float(1.), TauPt));
366  Var_NoEleMatch_wGwoGSF_Endcap_[3] = std::log(std::max(float(1.), TauPt));
367  Var_NoEleMatch_wGwoGSF_Endcap_[4] = TauEmFraction;
368  Var_NoEleMatch_wGwoGSF_Endcap_[5] = TauSignalPFGammaCandsIn;
369  Var_NoEleMatch_wGwoGSF_Endcap_[6] = TauSignalPFGammaCandsOut;
370  Var_NoEleMatch_wGwoGSF_Endcap_[7] = TauLeadPFChargedHadrHoP;
371  Var_NoEleMatch_wGwoGSF_Endcap_[8] = TauLeadPFChargedHadrEoP;
372  Var_NoEleMatch_wGwoGSF_Endcap_[9] = TauVisMassIn;
373  Var_NoEleMatch_wGwoGSF_Endcap_[10] = TauGammaEtaMomIn;
374  Var_NoEleMatch_wGwoGSF_Endcap_[11] = TauGammaEtaMomOut;
375  Var_NoEleMatch_wGwoGSF_Endcap_[12] = TauGammaPhiMomIn;
376  Var_NoEleMatch_wGwoGSF_Endcap_[13] = TauGammaPhiMomOut;
377  Var_NoEleMatch_wGwoGSF_Endcap_[14] = TauGammaEnFracIn;
378  Var_NoEleMatch_wGwoGSF_Endcap_[15] = TauGammaEnFracOut;
379  Var_NoEleMatch_wGwoGSF_Endcap_[16] = TaudCrackEta;
381  }
382  } else if (TauSignalPFGammaCandsIn == 0 && TauHasGsf > 0.5) {
383  if (std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
384  Var_woGwGSF_Barrel_[0] = std::max(float(-0.1), ElecEtotOverPin);
385  Var_woGwGSF_Barrel_[1] = std::log(std::max(float(0.01), ElecChi2NormGSF));
386  Var_woGwGSF_Barrel_[2] = ElecGSFNumHits;
387  Var_woGwGSF_Barrel_[3] = std::log(std::max(float(0.01), ElecGSFTrackResol));
388  Var_woGwGSF_Barrel_[4] = ElecGSFTracklnPt;
389  Var_woGwGSF_Barrel_[5] = ElecNumHitsDiffOverSum;
390  Var_woGwGSF_Barrel_[6] = std::log(std::max(float(0.01), ElecChi2NormKF));
391  Var_woGwGSF_Barrel_[7] = std::min(ElecDeltaPinPoutOverPin, float(1.));
392  Var_woGwGSF_Barrel_[8] = std::min(ElecEecalOverPout, float(20.));
393  Var_woGwGSF_Barrel_[9] = ElecDeltaEta;
394  Var_woGwGSF_Barrel_[10] = ElecDeltaPhi;
395  Var_woGwGSF_Barrel_[11] = std::min(ElecMvaInSigmaEtaEta, float(0.01));
396  Var_woGwGSF_Barrel_[12] = std::min(ElecMvaInHadEnergy, float(20.));
397  Var_woGwGSF_Barrel_[13] = std::min(ElecMvaInDeltaEta, float(0.1));
398  Var_woGwGSF_Barrel_[14] = TauEtaAtEcalEntrance;
399  Var_woGwGSF_Barrel_[15] = TauLeadChargedPFCandEtaAtEcalEntrance;
400  Var_woGwGSF_Barrel_[16] = std::min(float(2.), TauLeadChargedPFCandPt / std::max(float(1.), TauPt));
401  Var_woGwGSF_Barrel_[17] = std::log(std::max(float(1.), TauPt));
402  Var_woGwGSF_Barrel_[18] = TauEmFraction;
403  Var_woGwGSF_Barrel_[19] = TauLeadPFChargedHadrHoP;
404  Var_woGwGSF_Barrel_[20] = TauLeadPFChargedHadrEoP;
405  Var_woGwGSF_Barrel_[21] = TauVisMassIn;
406  Var_woGwGSF_Barrel_[22] = TaudCrackEta;
407  Var_woGwGSF_Barrel_[23] = TaudCrackPhi;
409  } else {
410  Var_woGwGSF_Endcap_[0] = std::max(float(-0.1), ElecEtotOverPin);
411  Var_woGwGSF_Endcap_[1] = std::log(std::max(float(0.01), ElecChi2NormGSF));
412  Var_woGwGSF_Endcap_[2] = ElecGSFNumHits;
413  Var_woGwGSF_Endcap_[3] = std::log(std::max(float(0.01), ElecGSFTrackResol));
414  Var_woGwGSF_Endcap_[4] = ElecGSFTracklnPt;
415  Var_woGwGSF_Endcap_[5] = ElecNumHitsDiffOverSum;
416  Var_woGwGSF_Endcap_[6] = std::log(std::max(float(0.01), ElecChi2NormKF));
417  Var_woGwGSF_Endcap_[7] = std::min(ElecDeltaPinPoutOverPin, float(1.));
418  Var_woGwGSF_Endcap_[8] = std::min(ElecEecalOverPout, float(20.));
419  Var_woGwGSF_Endcap_[9] = ElecDeltaEta;
420  Var_woGwGSF_Endcap_[10] = ElecDeltaPhi;
421  Var_woGwGSF_Endcap_[11] = std::min(ElecMvaInSigmaEtaEta, float(0.01));
422  Var_woGwGSF_Endcap_[12] = std::min(ElecMvaInHadEnergy, float(20.));
423  Var_woGwGSF_Endcap_[13] = std::min(ElecMvaInDeltaEta, float(0.1));
424  Var_woGwGSF_Endcap_[14] = TauEtaAtEcalEntrance;
425  Var_woGwGSF_Endcap_[15] = TauLeadChargedPFCandEtaAtEcalEntrance;
426  Var_woGwGSF_Endcap_[16] = std::min(float(2.), TauLeadChargedPFCandPt / std::max(float(1.), TauPt));
427  Var_woGwGSF_Endcap_[17] = std::log(std::max(float(1.), TauPt));
428  Var_woGwGSF_Endcap_[18] = TauEmFraction;
429  Var_woGwGSF_Endcap_[19] = TauLeadPFChargedHadrHoP;
430  Var_woGwGSF_Endcap_[20] = TauLeadPFChargedHadrEoP;
431  Var_woGwGSF_Endcap_[21] = TauVisMassIn;
432  Var_woGwGSF_Endcap_[22] = TaudCrackEta;
434  }
435  } else if (TauSignalPFGammaCandsIn > 0 && TauHasGsf > 0.5) {
436  if (std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder) {
437  Var_wGwGSF_Barrel_[0] = std::max(float(-0.1), ElecEtotOverPin);
438  Var_wGwGSF_Barrel_[1] = std::log(std::max(float(0.01), ElecChi2NormGSF));
439  Var_wGwGSF_Barrel_[2] = ElecGSFNumHits;
440  Var_wGwGSF_Barrel_[3] = std::log(std::max(float(0.01), ElecGSFTrackResol));
441  Var_wGwGSF_Barrel_[4] = ElecGSFTracklnPt;
442  Var_wGwGSF_Barrel_[5] = ElecNumHitsDiffOverSum;
443  Var_wGwGSF_Barrel_[6] = std::log(std::max(float(0.01), ElecChi2NormKF));
444  Var_wGwGSF_Barrel_[7] = std::min(ElecDeltaPinPoutOverPin, float(1.));
445  Var_wGwGSF_Barrel_[8] = std::min(ElecEecalOverPout, float(20.));
446  Var_wGwGSF_Barrel_[9] = ElecDeltaEta;
447  Var_wGwGSF_Barrel_[10] = ElecDeltaPhi;
448  Var_wGwGSF_Barrel_[11] = std::min(ElecMvaInSigmaEtaEta, float(0.01));
449  Var_wGwGSF_Barrel_[12] = std::min(ElecMvaInHadEnergy, float(20.));
450  Var_wGwGSF_Barrel_[13] = std::min(ElecMvaInDeltaEta, float(0.1));
451  Var_wGwGSF_Barrel_[14] = TauEtaAtEcalEntrance;
452  Var_wGwGSF_Barrel_[15] = TauLeadChargedPFCandEtaAtEcalEntrance;
453  Var_wGwGSF_Barrel_[16] = std::min(float(2.), TauLeadChargedPFCandPt / std::max(float(1.), TauPt));
454  Var_wGwGSF_Barrel_[17] = std::log(std::max(float(1.), TauPt));
455  Var_wGwGSF_Barrel_[18] = TauEmFraction;
456  Var_wGwGSF_Barrel_[19] = TauSignalPFGammaCandsIn;
457  Var_wGwGSF_Barrel_[20] = TauSignalPFGammaCandsOut;
458  Var_wGwGSF_Barrel_[21] = TauLeadPFChargedHadrHoP;
459  Var_wGwGSF_Barrel_[22] = TauLeadPFChargedHadrEoP;
460  Var_wGwGSF_Barrel_[23] = TauVisMassIn;
461  Var_wGwGSF_Barrel_[24] = TauGammaEtaMomIn;
462  Var_wGwGSF_Barrel_[25] = TauGammaEtaMomOut;
463  Var_wGwGSF_Barrel_[26] = TauGammaPhiMomIn;
464  Var_wGwGSF_Barrel_[27] = TauGammaPhiMomOut;
465  Var_wGwGSF_Barrel_[28] = TauGammaEnFracIn;
466  Var_wGwGSF_Barrel_[29] = TauGammaEnFracOut;
467  Var_wGwGSF_Barrel_[30] = TaudCrackEta;
468  Var_wGwGSF_Barrel_[31] = TaudCrackPhi;
470  } else {
471  Var_wGwGSF_Endcap_[0] = std::max(float(-0.1), ElecEtotOverPin);
472  Var_wGwGSF_Endcap_[1] = std::log(std::max(float(0.01), ElecChi2NormGSF));
473  Var_wGwGSF_Endcap_[2] = ElecGSFNumHits;
474  Var_wGwGSF_Endcap_[3] = std::log(std::max(float(0.01), ElecGSFTrackResol));
475  Var_wGwGSF_Endcap_[4] = ElecGSFTracklnPt;
476  Var_wGwGSF_Endcap_[5] = ElecNumHitsDiffOverSum;
477  Var_wGwGSF_Endcap_[6] = std::log(std::max(float(0.01), ElecChi2NormKF));
478  Var_wGwGSF_Endcap_[7] = std::min(ElecDeltaPinPoutOverPin, float(1.));
479  Var_wGwGSF_Endcap_[8] = std::min(ElecEecalOverPout, float(20.));
480  Var_wGwGSF_Endcap_[9] = ElecDeltaEta;
481  Var_wGwGSF_Endcap_[10] = ElecDeltaPhi;
482  Var_wGwGSF_Endcap_[11] = std::min(ElecMvaInSigmaEtaEta, float(0.01));
483  Var_wGwGSF_Endcap_[12] = std::min(ElecMvaInHadEnergy, float(20.));
484  Var_wGwGSF_Endcap_[13] = std::min(ElecMvaInDeltaEta, float(0.1));
485  Var_wGwGSF_Endcap_[14] = TauEtaAtEcalEntrance;
486  Var_wGwGSF_Endcap_[15] = TauLeadChargedPFCandEtaAtEcalEntrance;
487  Var_wGwGSF_Endcap_[16] = std::min(float(2.), TauLeadChargedPFCandPt / std::max(float(1.), TauPt));
488  Var_wGwGSF_Endcap_[17] = std::log(std::max(float(1.), TauPt));
489  Var_wGwGSF_Endcap_[18] = TauEmFraction;
490  Var_wGwGSF_Endcap_[19] = TauSignalPFGammaCandsIn;
491  Var_wGwGSF_Endcap_[20] = TauSignalPFGammaCandsOut;
492  Var_wGwGSF_Endcap_[21] = TauLeadPFChargedHadrHoP;
493  Var_wGwGSF_Endcap_[22] = TauLeadPFChargedHadrEoP;
494  Var_wGwGSF_Endcap_[23] = TauVisMassIn;
495  Var_wGwGSF_Endcap_[24] = TauGammaEtaMomIn;
496  Var_wGwGSF_Endcap_[25] = TauGammaEtaMomOut;
497  Var_wGwGSF_Endcap_[26] = TauGammaPhiMomIn;
498  Var_wGwGSF_Endcap_[27] = TauGammaPhiMomOut;
499  Var_wGwGSF_Endcap_[28] = TauGammaEnFracIn;
500  Var_wGwGSF_Endcap_[29] = TauGammaEnFracOut;
501  Var_wGwGSF_Endcap_[30] = TaudCrackEta;
503  }
504  }
505  return mvaValue;
506 }
507 
508 double AntiElectronIDMVA6::MVAValue(const reco::PFTau& thePFTau, const reco::GsfElectron& theGsfEle)
509 
510 {
511  // === tau variables ===
512  float TauEtaAtEcalEntrance = -99.;
513  float sumEtaTimesEnergy = 0.;
514  float sumEnergy = 0.;
515  const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.signalPFCands();
516  for (const auto& pfCandidate : signalPFCands) {
517  sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta() * pfCandidate->energy();
518  sumEnergy += pfCandidate->energy();
519  }
520  if (sumEnergy > 0.) {
521  TauEtaAtEcalEntrance = sumEtaTimesEnergy / sumEnergy;
522  }
523 
524  float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
525  float TauLeadChargedPFCandPt = -99.;
526  for (const auto& pfCandidate : signalPFCands) {
527  const reco::Track* track = nullptr;
528  if (pfCandidate->trackRef().isNonnull())
529  track = pfCandidate->trackRef().get();
530  else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull())
531  track = pfCandidate->muonRef()->innerTrack().get();
532  else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull())
533  track = pfCandidate->muonRef()->globalTrack().get();
534  else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull())
535  track = pfCandidate->muonRef()->outerTrack().get();
536  else if (pfCandidate->gsfTrackRef().isNonnull())
537  track = pfCandidate->gsfTrackRef().get();
538  if (track) {
539  if (track->pt() > TauLeadChargedPFCandPt) {
540  TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().eta();
541  TauLeadChargedPFCandPt = track->pt();
542  }
543  }
544  }
545 
546  Float_t TauPt = thePFTau.pt();
547  Float_t TauEmFraction = std::max(thePFTau.emFraction(), (Float_t)0.);
548  Float_t TauLeadPFChargedHadrHoP = 0.;
549  Float_t TauLeadPFChargedHadrEoP = 0.;
550  if (thePFTau.leadPFChargedHadrCand()->p() > 0.) {
551  TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy() / thePFTau.leadPFChargedHadrCand()->p();
552  TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy() / thePFTau.leadPFChargedHadrCand()->p();
553  }
554 
555  std::vector<Float_t> GammasdEtaInSigCone;
556  std::vector<Float_t> GammasdPhiInSigCone;
557  std::vector<Float_t> GammasPtInSigCone;
558  std::vector<Float_t> GammasdEtaOutSigCone;
559  std::vector<Float_t> GammasdPhiOutSigCone;
560  std::vector<Float_t> GammasPtOutSigCone;
561  reco::Candidate::LorentzVector pfGammaSum(0, 0, 0, 0);
562  reco::Candidate::LorentzVector pfChargedSum(0, 0, 0, 0);
563 
564  for (const auto& gamma : thePFTau.signalGammaCands()) {
565  float dR = deltaR(gamma->p4(), thePFTau.leadChargedHadrCand()->p4());
566  float signalrad = std::max(0.05, std::min(0.10, 3.0 / std::max(1.0, thePFTau.pt())));
567 
568  // pfGammas inside the tau signal cone
569  if (dR < signalrad) {
570  if (thePFTau.leadChargedHadrCand().isNonnull()) {
571  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.leadChargedHadrCand()->eta());
572  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.leadChargedHadrCand()->phi());
573  } else {
574  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.eta());
575  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.phi());
576  }
577  GammasPtInSigCone.push_back(gamma->pt());
578  pfGammaSum += gamma->p4();
579  }
580  // pfGammas outside the tau signal cone
581  else {
582  if (thePFTau.leadChargedHadrCand().isNonnull()) {
583  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.leadChargedHadrCand()->eta());
584  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.leadChargedHadrCand()->phi());
585  } else {
586  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.eta());
587  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.phi());
588  }
589  GammasPtOutSigCone.push_back(gamma->pt());
590  }
591  }
592 
593  for (const auto& charged : thePFTau.signalChargedHadrCands()) {
594  float dR = deltaR(charged->p4(), thePFTau.leadChargedHadrCand()->p4());
595  float signalrad = std::max(0.05, std::min(0.10, 3.0 / std::max(1.0, thePFTau.pt())));
596 
597  // charged particles inside the tau signal cone
598  if (dR < signalrad) {
599  pfChargedSum += charged->p4();
600  }
601  }
602 
603  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
604  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
605  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
606 
607  Float_t TauPhi = thePFTau.phi();
608  float sumPhiTimesEnergy = 0.;
609  float sumEnergyPhi = 0.;
611  for (const auto& pfc : signalPFCands) {
612  sumPhiTimesEnergy += pfc->positionAtECALEntrance().phi() * pfc->energy();
613  sumEnergyPhi += pfc->energy();
614  }
615  } else {
616  TauPhi = -99.;
617  for (const auto& signalPFCand : signalPFCands) {
618  reco::Candidate const* signalCand = signalPFCand.get();
619  float phi = thePFTau.phi();
620  bool success = false;
622  if (success) {
623  phi = aPos.Phi();
624  }
625  sumPhiTimesEnergy += phi * signalCand->energy();
626  sumEnergy += signalCand->energy();
627  }
628  }
629  if (sumEnergyPhi > 0.) {
630  TauPhi = sumPhiTimesEnergy / sumEnergyPhi;
631  }
632  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
633  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
634  Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
635 
636  // === electron variables ===
637  Float_t ElecEta = theGsfEle.eta();
638  Float_t ElecPhi = theGsfEle.phi();
639 
640  //Variables related to the electron Cluster
641  Float_t ElecEe = 0.;
642  Float_t ElecEgamma = 0.;
643  reco::SuperClusterRef pfSuperCluster = theGsfEle.superCluster();
644  if (pfSuperCluster.isNonnull() && pfSuperCluster.isAvailable()) {
645  for (reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin();
646  pfCluster != pfSuperCluster->clustersEnd();
647  ++pfCluster) {
648  double pfClusterEn = (*pfCluster)->energy();
649  if (pfCluster == pfSuperCluster->clustersBegin())
650  ElecEe += pfClusterEn;
651  else
652  ElecEgamma += pfClusterEn;
653  }
654  }
655 
656  Float_t ElecPin = std::sqrt(theGsfEle.trackMomentumAtVtx().Mag2());
657  Float_t ElecPout = std::sqrt(theGsfEle.trackMomentumOut().Mag2());
658  Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma) / ElecPin) : -0.1;
659  Float_t ElecEecal = theGsfEle.ecalEnergy();
660  Float_t ElecDeltaEta = theGsfEle.deltaEtaSeedClusterTrackAtCalo();
661  Float_t ElecDeltaPhi = theGsfEle.deltaPhiSeedClusterTrackAtCalo();
662  Float_t ElecMvaInSigmaEtaEta = (theGsfEle).mvaInput().sigmaEtaEta;
663  Float_t ElecMvaInHadEnergy = (theGsfEle).mvaInput().hadEnergy;
664  Float_t ElecMvaInDeltaEta = (theGsfEle).mvaInput().deltaEta;
665 
666  //Variables related to the GsfTrack
667  Float_t ElecChi2NormGSF = -99.;
668  Float_t ElecGSFNumHits = -99.;
669  Float_t ElecGSFTrackResol = -99.;
670  Float_t ElecGSFTracklnPt = -99.;
671  if (theGsfEle.gsfTrack().isNonnull()) {
672  ElecChi2NormGSF = (theGsfEle).gsfTrack()->normalizedChi2();
673  ElecGSFNumHits = (theGsfEle).gsfTrack()->numberOfValidHits();
674  if (theGsfEle.gsfTrack()->pt() > 0.) {
675  ElecGSFTrackResol = theGsfEle.gsfTrack()->ptError() / theGsfEle.gsfTrack()->pt();
676  ElecGSFTracklnPt = log(theGsfEle.gsfTrack()->pt()) * M_LN10;
677  }
678  }
679 
680  //Variables related to the CtfTrack
681  Float_t ElecChi2NormKF = -99.;
682  Float_t ElecKFNumHits = -99.;
683  if (theGsfEle.closestCtfTrackRef().isNonnull()) {
684  ElecChi2NormKF = (theGsfEle).closestCtfTrackRef()->normalizedChi2();
685  ElecKFNumHits = (theGsfEle).closestCtfTrackRef()->numberOfValidHits();
686  }
687 
688  return MVAValue(TauPt,
689  TauEtaAtEcalEntrance,
690  TauPhi,
691  TauLeadChargedPFCandPt,
692  TauLeadChargedPFCandEtaAtEcalEntrance,
693  TauEmFraction,
694  TauLeadPFChargedHadrHoP,
695  TauLeadPFChargedHadrEoP,
696  TauVisMassIn,
697  TaudCrackEta,
698  TaudCrackPhi,
699  TauHasGsf,
700  TauSignalPFGammaCandsIn,
701  TauSignalPFGammaCandsOut,
702  GammasdEtaInSigCone,
703  GammasdPhiInSigCone,
704  GammasPtInSigCone,
705  GammasdEtaOutSigCone,
706  GammasdPhiOutSigCone,
707  GammasPtOutSigCone,
708  ElecEta,
709  ElecPhi,
710  ElecEtotOverPin,
711  ElecChi2NormGSF,
712  ElecChi2NormKF,
713  ElecGSFNumHits,
714  ElecKFNumHits,
715  ElecGSFTrackResol,
716  ElecGSFTracklnPt,
717  ElecPin,
718  ElecPout,
719  ElecEecal,
720  ElecDeltaEta,
721  ElecDeltaPhi,
722  ElecMvaInSigmaEtaEta,
723  ElecMvaInHadEnergy,
724  ElecMvaInDeltaEta);
725 }
726 
727 double AntiElectronIDMVA6::MVAValue(const reco::PFTau& thePFTau) {
728  // === tau variables ===
729  float TauEtaAtEcalEntrance = -99.;
730  float sumEtaTimesEnergy = 0.;
731  float sumEnergy = 0.;
732  const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.signalPFCands();
733  for (const auto& pfCandidate : signalPFCands) {
734  sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta() * pfCandidate->energy();
735  sumEnergy += pfCandidate->energy();
736  }
737  if (sumEnergy > 0.) {
738  TauEtaAtEcalEntrance = sumEtaTimesEnergy / sumEnergy;
739  }
740 
741  float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
742  float TauLeadChargedPFCandPt = -99.;
743  for (const auto& pfCandidate : signalPFCands) {
744  const reco::Track* track = nullptr;
745  if (pfCandidate->trackRef().isNonnull())
746  track = pfCandidate->trackRef().get();
747  else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull())
748  track = pfCandidate->muonRef()->innerTrack().get();
749  else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull())
750  track = pfCandidate->muonRef()->globalTrack().get();
751  else if (pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull())
752  track = pfCandidate->muonRef()->outerTrack().get();
753  else if (pfCandidate->gsfTrackRef().isNonnull())
754  track = pfCandidate->gsfTrackRef().get();
755  if (track) {
756  if (track->pt() > TauLeadChargedPFCandPt) {
757  TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().eta();
758  TauLeadChargedPFCandPt = track->pt();
759  }
760  }
761  }
762 
763  Float_t TauPt = thePFTau.pt();
764  Float_t TauEmFraction = std::max(thePFTau.emFraction(), (Float_t)0.);
765  Float_t TauLeadPFChargedHadrHoP = 0.;
766  Float_t TauLeadPFChargedHadrEoP = 0.;
767  if (thePFTau.leadPFChargedHadrCand()->p() > 0.) {
768  TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy() / thePFTau.leadPFChargedHadrCand()->p();
769  TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy() / thePFTau.leadPFChargedHadrCand()->p();
770  }
771 
772  std::vector<Float_t> GammasdEtaInSigCone;
773  std::vector<Float_t> GammasdPhiInSigCone;
774  std::vector<Float_t> GammasPtInSigCone;
775  std::vector<Float_t> GammasdEtaOutSigCone;
776  std::vector<Float_t> GammasdPhiOutSigCone;
777  std::vector<Float_t> GammasPtOutSigCone;
778  reco::Candidate::LorentzVector pfGammaSum(0, 0, 0, 0);
779  reco::Candidate::LorentzVector pfChargedSum(0, 0, 0, 0);
780 
781  for (const auto& gamma : thePFTau.signalGammaCands()) {
782  float dR = deltaR(gamma->p4(), thePFTau.leadChargedHadrCand()->p4());
783  float signalrad = std::max(0.05, std::min(0.10, 3.0 / std::max(1.0, thePFTau.pt())));
784 
785  // pfGammas inside the tau signal cone
786  if (dR < signalrad) {
787  if (thePFTau.leadChargedHadrCand().isNonnull()) {
788  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.leadChargedHadrCand()->eta());
789  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.leadChargedHadrCand()->phi());
790  } else {
791  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.eta());
792  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.phi());
793  }
794  GammasPtInSigCone.push_back(gamma->pt());
795  pfGammaSum += gamma->p4();
796  }
797  // pfGammas outside the tau signal cone
798  else {
799  if (thePFTau.leadChargedHadrCand().isNonnull()) {
800  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.leadChargedHadrCand()->eta());
801  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.leadChargedHadrCand()->phi());
802  } else {
803  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.eta());
804  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.phi());
805  }
806  GammasPtOutSigCone.push_back(gamma->pt());
807  }
808  }
809 
810  for (const auto& charged : thePFTau.signalChargedHadrCands()) {
811  float dR = deltaR(charged->p4(), thePFTau.leadChargedHadrCand()->p4());
812  float signalrad = std::max(0.05, std::min(0.10, 3.0 / std::max(1.0, thePFTau.pt())));
813 
814  // charged particles inside the tau signal cone
815  if (dR < signalrad) {
816  pfChargedSum += charged->p4();
817  }
818  }
819 
820  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
821  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
822  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
823 
824  Float_t TauPhi = thePFTau.phi();
825  float sumPhiTimesEnergy = 0.;
826  float sumEnergyPhi = 0.;
828  for (const auto& pfCandidate : signalPFCands) {
829  sumPhiTimesEnergy += pfCandidate->positionAtECALEntrance().phi() * pfCandidate->energy();
830  sumEnergyPhi += pfCandidate->energy();
831  }
832  } else {
833  TauPhi = -99.;
834  for (const auto& signalPFCand : signalPFCands) {
835  reco::Candidate const* signalCand = signalPFCand.get();
836  float phi = thePFTau.phi();
837  bool success = false;
839  if (success) {
840  phi = aPos.Phi();
841  }
842  sumPhiTimesEnergy += phi * signalCand->energy();
843  sumEnergy += signalCand->energy();
844  }
845  }
846  if (sumEnergyPhi > 0.) {
847  TauPhi = sumPhiTimesEnergy / sumEnergyPhi;
848  }
849  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
850  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
851  Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
852 
853  // === electron variables ===
854  Float_t dummyElecEta = 9.9;
855 
856  return MVAValue(TauPt,
857  TauEtaAtEcalEntrance,
858  TauPhi,
859  TauLeadChargedPFCandPt,
860  TauLeadChargedPFCandEtaAtEcalEntrance,
861  TauEmFraction,
862  TauLeadPFChargedHadrHoP,
863  TauLeadPFChargedHadrEoP,
864  TauVisMassIn,
865  TaudCrackEta,
866  TaudCrackPhi,
867  TauHasGsf,
868  TauSignalPFGammaCandsIn,
869  TauSignalPFGammaCandsOut,
870  GammasdEtaInSigCone,
871  GammasdPhiInSigCone,
872  GammasPtInSigCone,
873  GammasdEtaOutSigCone,
874  GammasdPhiOutSigCone,
875  GammasPtOutSigCone,
876  dummyElecEta,
877  0.,
878  0.,
879  0.,
880  0.,
881  0.,
882  0.,
883  0.,
884  0.,
885  0.,
886  0.,
887  0.,
888  0.,
889  0.,
890  0.,
891  0.,
892  0.);
893 }
894 
895 double AntiElectronIDMVA6::MVAValue(const pat::Tau& theTau, const pat::Electron& theEle) {
896  // === tau variables ===
897  float TauEtaAtEcalEntrance = theTau.etaAtEcalEntrance();
898 
899  float TauLeadChargedPFCandEtaAtEcalEntrance = theTau.etaAtEcalEntranceLeadChargedCand();
900  float TauLeadChargedPFCandPt = theTau.ptLeadChargedCand();
901 
902  Float_t TauPt = theTau.pt();
903  //Float_t TauEmFraction = std::max(theTau.ecalEnergy()/(theTau.ecalEnergy()+theTau.hcalEnergy()), (Float_t)0.);
904  Float_t TauEmFraction = std::max(theTau.emFraction_MVA(), (Float_t)0.);
905  Float_t TauLeadPFChargedHadrHoP = 0.;
906  Float_t TauLeadPFChargedHadrEoP = 0.;
907  if (theTau.leadChargedHadrCand()->p() > 0.) {
908  TauLeadPFChargedHadrHoP = theTau.hcalEnergyLeadChargedHadrCand() / theTau.leadChargedHadrCand()->p();
909  TauLeadPFChargedHadrEoP = theTau.ecalEnergyLeadChargedHadrCand() / theTau.leadChargedHadrCand()->p();
910  }
911 
912  std::vector<Float_t> GammasdEtaInSigCone;
913  std::vector<Float_t> GammasdPhiInSigCone;
914  std::vector<Float_t> GammasPtInSigCone;
915  std::vector<Float_t> GammasdEtaOutSigCone;
916  std::vector<Float_t> GammasdPhiOutSigCone;
917  std::vector<Float_t> GammasPtOutSigCone;
918  reco::Candidate::LorentzVector pfGammaSum(0, 0, 0, 0);
919  reco::Candidate::LorentzVector pfChargedSum(0, 0, 0, 0);
920 
921  const reco::CandidatePtrVector signalGammaCands = theTau.signalGammaCands();
922  for (const auto& gamma : signalGammaCands) {
923  float dR = deltaR(gamma->p4(), theTau.leadChargedHadrCand()->p4());
924  float signalrad = std::max(0.05, std::min(0.10, 3.0 / std::max(1.0, theTau.pt())));
925 
926  // pfGammas inside the tau signal cone
927  if (dR < signalrad) {
928  if (theTau.leadChargedHadrCand().isNonnull()) {
929  GammasdEtaInSigCone.push_back(gamma->eta() - theTau.leadChargedHadrCand()->eta());
930  GammasdPhiInSigCone.push_back(gamma->phi() - theTau.leadChargedHadrCand()->phi());
931  //A.-C. please check whether this change is safe against future trainings
932  //GammasdPhiInSigCone.push_back(deltaPhi((*gamma)->phi(), theTau.leadChargedHadrCand()->phi()));
933  } else {
934  GammasdEtaInSigCone.push_back(gamma->eta() - theTau.eta());
935  GammasdPhiInSigCone.push_back(gamma->phi() - theTau.phi());
936  //A.-C. please check whether this change is safe against future trainings
937  //GammasdPhiInSigCone.push_back(deltaPhi(gamma->phi(), theTau.phi()));
938  }
939  GammasPtInSigCone.push_back(gamma->pt());
940  pfGammaSum += gamma->p4();
941  }
942  // pfGammas outside the tau signal cone
943  else {
944  if (theTau.leadChargedHadrCand().isNonnull()) {
945  GammasdEtaOutSigCone.push_back(gamma->eta() - theTau.leadChargedHadrCand()->eta());
946  GammasdPhiOutSigCone.push_back(gamma->phi() - theTau.leadChargedHadrCand()->phi());
947  //A.-C. please check whether this change is safe against future trainings
948  //GammasdPhiOutSigCone.push_back(deltaPhi(gamma->phi(), theTau.leadChargedHadrCand()->phi()));
949  } else {
950  GammasdEtaOutSigCone.push_back(gamma->eta() - theTau.eta());
951  GammasdPhiOutSigCone.push_back(gamma->phi() - theTau.phi());
952  //A.-C. please chaekc whether this change is safe against future trainings
953  //GammasdPhiOutSigCone.push_back(deltaPhi(gamma->phi(), theTau.phi()));
954  }
955  GammasPtOutSigCone.push_back(gamma->pt());
956  }
957  }
958 
959  const reco::CandidatePtrVector signalChargedCands = theTau.signalChargedHadrCands();
960  for (const auto& charged : signalChargedCands) {
961  float dR = deltaR(charged->p4(), theTau.leadChargedHadrCand()->p4());
962  float signalrad = std::max(0.05, std::min(0.10, 3.0 / std::max(1.0, theTau.pt())));
963 
964  // charged particles inside the tau signal cone
965  if (dR < signalrad) {
966  pfChargedSum += charged->p4();
967  }
968  }
969 
970  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
971  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
972  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
973  Float_t TauPhi = -99.;
975  float sumPhiTimesEnergy = 0.;
976  float sumEnergy = 0.;
977  const reco::CandidatePtrVector signalCands = theTau.signalCands();
978  for (const auto& signalCandPtr : signalCands) {
979  reco::Candidate const* signalCand = signalCandPtr.get();
980  float phi = theTau.phi();
981  bool success = false;
983  if (success) {
984  phi = aPos.Phi();
985  }
986  sumPhiTimesEnergy += phi * signalCand->energy();
987  sumEnergy += signalCand->energy();
988  }
989  if (sumEnergy > 0.) {
990  TauPhi = sumPhiTimesEnergy / sumEnergy;
991  }
992  } else {
993  TauPhi = theTau.phiAtEcalEntrance();
994  }
995 
996  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
997  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
998 
999  Float_t TauHasGsf = 0;
1000  pat::PackedCandidate const* packedLeadTauCand =
1001  dynamic_cast<pat::PackedCandidate const*>(theTau.leadChargedHadrCand().get());
1002  if (abs(packedLeadTauCand->pdgId()) == 11)
1003  TauHasGsf = 1;
1004 
1005  // === electron variables ===
1006  Float_t ElecEta = theEle.eta();
1007  Float_t ElecPhi = theEle.phi();
1008 
1009  //Variables related to the electron Cluster
1010  Float_t ElecEe = 0.;
1011  Float_t ElecEgamma = 0.;
1012  reco::SuperClusterRef pfSuperCluster = theEle.superCluster();
1013  if (pfSuperCluster.isNonnull() && pfSuperCluster.isAvailable()) {
1014  for (reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin();
1015  pfCluster != pfSuperCluster->clustersEnd();
1016  ++pfCluster) {
1017  double pfClusterEn = (*pfCluster)->energy();
1018  if (pfCluster == pfSuperCluster->clustersBegin())
1019  ElecEe += pfClusterEn;
1020  else
1021  ElecEgamma += pfClusterEn;
1022  }
1023  }
1024 
1025  Float_t ElecPin = std::sqrt(theEle.trackMomentumAtVtx().Mag2());
1026  Float_t ElecPout = std::sqrt(theEle.trackMomentumOut().Mag2());
1027  Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma) / ElecPin) : -0.1;
1028  Float_t ElecEecal = theEle.ecalEnergy();
1029  Float_t ElecDeltaEta = theEle.deltaEtaSeedClusterTrackAtCalo();
1030  Float_t ElecDeltaPhi = theEle.deltaPhiSeedClusterTrackAtCalo();
1031  Float_t ElecMvaInSigmaEtaEta = (theEle).mvaInput().sigmaEtaEta;
1032  Float_t ElecMvaInHadEnergy = (theEle).mvaInput().hadEnergy;
1033  Float_t ElecMvaInDeltaEta = (theEle).mvaInput().deltaEta;
1034 
1035  //Variables related to the GsfTrack
1036  Float_t ElecChi2NormGSF = -99.;
1037  Float_t ElecGSFNumHits = -99.;
1038  Float_t ElecGSFTrackResol = -99.;
1039  Float_t ElecGSFTracklnPt = -99.;
1040  if (theEle.gsfTrack().isNonnull()) {
1041  ElecChi2NormGSF = (theEle).gsfTrack()->normalizedChi2();
1042  ElecGSFNumHits = (theEle).gsfTrack()->numberOfValidHits();
1043  if (theEle.gsfTrack()->pt() > 0.) {
1044  ElecGSFTrackResol = theEle.gsfTrack()->ptError() / theEle.gsfTrack()->pt();
1045  ElecGSFTracklnPt = log(theEle.gsfTrack()->pt()) * M_LN10;
1046  }
1047  }
1048 
1049  //Variables related to the CtfTrack
1050  Float_t ElecChi2NormKF = -99.;
1051  Float_t ElecKFNumHits = -99.;
1052  if (theEle.closestCtfTrackRef().isNonnull()) {
1053  ElecChi2NormKF = (theEle).closestCtfTrackRef()->normalizedChi2();
1054  ElecKFNumHits = (theEle).closestCtfTrackRef()->numberOfValidHits();
1055  }
1056 
1057  return MVAValue(TauPt,
1058  TauEtaAtEcalEntrance,
1059  TauPhi,
1060  TauLeadChargedPFCandPt,
1061  TauLeadChargedPFCandEtaAtEcalEntrance,
1062  TauEmFraction,
1063  TauLeadPFChargedHadrHoP,
1064  TauLeadPFChargedHadrEoP,
1065  TauVisMassIn,
1066  TaudCrackEta,
1067  TaudCrackPhi,
1068  TauHasGsf,
1069  TauSignalPFGammaCandsIn,
1070  TauSignalPFGammaCandsOut,
1071  GammasdEtaInSigCone,
1072  GammasdPhiInSigCone,
1073  GammasPtInSigCone,
1074  GammasdEtaOutSigCone,
1075  GammasdPhiOutSigCone,
1076  GammasPtOutSigCone,
1077  ElecEta,
1078  ElecPhi,
1079  ElecEtotOverPin,
1080  ElecChi2NormGSF,
1081  ElecChi2NormKF,
1082  ElecGSFNumHits,
1083  ElecKFNumHits,
1084  ElecGSFTrackResol,
1085  ElecGSFTracklnPt,
1086  ElecPin,
1087  ElecPout,
1088  ElecEecal,
1089  ElecDeltaEta,
1090  ElecDeltaPhi,
1091  ElecMvaInSigmaEtaEta,
1092  ElecMvaInHadEnergy,
1093  ElecMvaInDeltaEta);
1094 }
1095 
1097  // === tau variables ===
1098  float TauEtaAtEcalEntrance = theTau.etaAtEcalEntrance();
1099 
1100  float TauLeadChargedPFCandEtaAtEcalEntrance = theTau.etaAtEcalEntranceLeadChargedCand();
1101  float TauLeadChargedPFCandPt = theTau.ptLeadChargedCand();
1102 
1103  Float_t TauPt = theTau.pt();
1104  //Float_t TauEmFraction = std::max(theTau.ecalEnergy()/(theTau.ecalEnergy()+theTau.hcalEnergy()), (Float_t)0.);
1105  Float_t TauEmFraction = std::max(theTau.emFraction_MVA(), (Float_t)0.);
1106  Float_t TauLeadPFChargedHadrHoP = 0.;
1107  Float_t TauLeadPFChargedHadrEoP = 0.;
1108  if (theTau.leadChargedHadrCand()->p() > 0.) {
1109  TauLeadPFChargedHadrHoP = theTau.hcalEnergyLeadChargedHadrCand() / theTau.leadChargedHadrCand()->p();
1110  TauLeadPFChargedHadrEoP = theTau.ecalEnergyLeadChargedHadrCand() / theTau.leadChargedHadrCand()->p();
1111  }
1112 
1113  std::vector<Float_t> GammasdEtaInSigCone;
1114  std::vector<Float_t> GammasdPhiInSigCone;
1115  std::vector<Float_t> GammasPtInSigCone;
1116  std::vector<Float_t> GammasdEtaOutSigCone;
1117  std::vector<Float_t> GammasdPhiOutSigCone;
1118  std::vector<Float_t> GammasPtOutSigCone;
1119  reco::Candidate::LorentzVector pfGammaSum(0, 0, 0, 0);
1120  reco::Candidate::LorentzVector pfChargedSum(0, 0, 0, 0);
1121 
1122  const reco::CandidatePtrVector signalGammaCands = theTau.signalGammaCands();
1123  for (const auto& gamma : signalGammaCands) {
1124  float dR = deltaR(gamma->p4(), theTau.leadChargedHadrCand()->p4());
1125  float signalrad = std::max(0.05, std::min(0.10, 3.0 / std::max(1.0, theTau.pt())));
1126 
1127  // pfGammas inside the tau signal cone
1128  if (dR < signalrad) {
1129  if (theTau.leadChargedHadrCand().isNonnull()) {
1130  GammasdEtaInSigCone.push_back(gamma->eta() - theTau.leadChargedHadrCand()->eta());
1131  GammasdPhiInSigCone.push_back(gamma->phi() - theTau.leadChargedHadrCand()->phi());
1132  } else {
1133  GammasdEtaInSigCone.push_back(gamma->eta() - theTau.eta());
1134  GammasdPhiInSigCone.push_back(gamma->phi() - theTau.phi());
1135  }
1136  GammasPtInSigCone.push_back(gamma->pt());
1137  pfGammaSum += gamma->p4();
1138  }
1139  // pfGammas outside the tau signal cone
1140  else {
1141  if (theTau.leadChargedHadrCand().isNonnull()) {
1142  GammasdEtaOutSigCone.push_back(gamma->eta() - theTau.leadChargedHadrCand()->eta());
1143  GammasdPhiOutSigCone.push_back(gamma->phi() - theTau.leadChargedHadrCand()->phi());
1144  } else {
1145  GammasdEtaOutSigCone.push_back(gamma->eta() - theTau.eta());
1146  GammasdPhiOutSigCone.push_back(gamma->phi() - theTau.phi());
1147  }
1148  GammasPtOutSigCone.push_back(gamma->pt());
1149  }
1150  }
1151 
1152  const reco::CandidatePtrVector signalChargedCands = theTau.signalChargedHadrCands();
1153  for (const auto& charged : signalChargedCands) {
1154  float dR = deltaR(charged->p4(), theTau.leadChargedHadrCand()->p4());
1155  float signalrad = std::max(0.05, std::min(0.10, 3.0 / std::max(1.0, theTau.pt())));
1156 
1157  // charged particles inside the tau signal cone
1158  if (dR < signalrad) {
1159  pfChargedSum += charged->p4();
1160  }
1161  }
1162 
1163  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
1164  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
1165  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
1166  Float_t TauPhi = -99.;
1168  float sumPhiTimesEnergy = 0.;
1169  float sumEnergy = 0.;
1170  const reco::CandidatePtrVector signalCands = theTau.signalCands();
1171  for (const auto& signalCandPtr : signalCands) {
1172  reco::Candidate const* signalCand = signalCandPtr.get();
1173  float phi = theTau.phi();
1174  bool success = false;
1176  if (success) {
1177  phi = aPos.Phi();
1178  }
1179  sumPhiTimesEnergy += phi * signalCand->energy();
1180  sumEnergy += signalCand->energy();
1181  }
1182  if (sumEnergy > 0.) {
1183  TauPhi = sumPhiTimesEnergy / sumEnergy;
1184  }
1185  } else {
1186  TauPhi = theTau.phiAtEcalEntrance();
1187  }
1188 
1189  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1190  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
1191 
1192  Float_t TauHasGsf = 0;
1193  pat::PackedCandidate const* packedLeadTauCand =
1194  dynamic_cast<pat::PackedCandidate const*>(theTau.leadChargedHadrCand().get());
1195  //const reco::Track & pseudoTrack = packedLeadTauCand->pseudoTrack();
1196  if (abs(packedLeadTauCand->pdgId()) == 11)
1197  TauHasGsf = 1;
1198 
1199  // === electron variables ===
1200  Float_t dummyElecEta = 9.9;
1201 
1202  return MVAValue(TauPt,
1203  TauEtaAtEcalEntrance,
1204  TauPhi,
1205  TauLeadChargedPFCandPt,
1206  TauLeadChargedPFCandEtaAtEcalEntrance,
1207  TauEmFraction,
1208  TauLeadPFChargedHadrHoP,
1209  TauLeadPFChargedHadrEoP,
1210  TauVisMassIn,
1211  TaudCrackEta,
1212  TaudCrackPhi,
1213  TauHasGsf,
1214  TauSignalPFGammaCandsIn,
1215  TauSignalPFGammaCandsOut,
1216  GammasdEtaInSigCone,
1217  GammasdPhiInSigCone,
1218  GammasPtInSigCone,
1219  GammasdEtaOutSigCone,
1220  GammasdPhiOutSigCone,
1221  GammasPtOutSigCone,
1222  dummyElecEta,
1223  0.,
1224  0.,
1225  0.,
1226  0.,
1227  0.,
1228  0.,
1229  0.,
1230  0.,
1231  0.,
1232  0.,
1233  0.,
1234  0.,
1235  0.,
1236  0.,
1237  0.,
1238  0.);
1239 }
1240 
1241 double AntiElectronIDMVA6::minimum(double a, double b) {
1242  if (std::abs(b) < std::abs(a))
1243  return b;
1244  else
1245  return a;
1246 }
1247 
1248 namespace {
1249 
1250  // IN: define locations of the 18 phi-cracks
1251  std::array<double, 18> fill_cPhi() {
1252  constexpr double pi = M_PI; // 3.14159265358979323846;
1253  std::array<double, 18> cPhi;
1254  // IN: define locations of the 18 phi-cracks
1255  cPhi[0] = 2.97025;
1256  for (unsigned iCrack = 1; iCrack <= 17; ++iCrack) {
1257  cPhi[iCrack] = cPhi[0] - 2. * iCrack * pi / 18;
1258  }
1259  return cPhi;
1260  }
1261 
1262  const std::array<double, 18> cPhi = fill_cPhi();
1263 
1264 } // namespace
1265 
1266 double AntiElectronIDMVA6::dCrackPhi(double phi, double eta) {
1267  //--- compute the (unsigned) distance to the closest phi-crack in the ECAL barrel
1268 
1269  constexpr double pi = M_PI; // 3.14159265358979323846;
1270 
1271  // IN: shift of this location if eta < 0
1272  constexpr double delta_cPhi = 0.00638;
1273 
1274  double retVal = 99.;
1275 
1276  if (eta >= -1.47464 && eta <= 1.47464) {
1277  // the location is shifted
1278  if (eta < 0.)
1279  phi += delta_cPhi;
1280 
1281  // CV: need to bring-back phi into interval [-pi,+pi]
1282  if (phi > pi)
1283  phi -= 2. * pi;
1284  if (phi < -pi)
1285  phi += 2. * pi;
1286 
1287  if (phi >= -pi && phi <= pi) {
1288  // the problem of the extrema:
1289  if (phi < cPhi[17] || phi >= cPhi[0]) {
1290  if (phi < 0.)
1291  phi += 2. * pi;
1292  retVal = minimum(phi - cPhi[0], phi - cPhi[17] - 2. * pi);
1293  } else {
1294  // between these extrema...
1295  bool OK = false;
1296  unsigned iCrack = 16;
1297  while (!OK) {
1298  if (phi < cPhi[iCrack]) {
1299  retVal = minimum(phi - cPhi[iCrack + 1], phi - cPhi[iCrack]);
1300  OK = true;
1301  } else {
1302  iCrack -= 1;
1303  }
1304  }
1305  }
1306  } else {
1307  retVal = 0.; // IN: if there is a problem, we assume that we are in a crack
1308  }
1309  } else {
1310  return -99.;
1311  }
1312 
1313  return std::abs(retVal);
1314 }
1315 
1317  //--- compute the (unsigned) distance to the closest eta-crack in the ECAL barrel
1318 
1319  // IN: define locations of the eta-cracks
1320  double cracks[5] = {0., 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00};
1321 
1322  double retVal = 99.;
1323 
1324  for (int iCrack = 0; iCrack < 5; ++iCrack) {
1325  double d = minimum(eta - cracks[iCrack], eta + cracks[iCrack]);
1326  if (std::abs(d) < std::abs(retVal)) {
1327  retVal = d;
1328  }
1329  }
1330 
1331  return std::abs(retVal);
1332 }
reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:234
pat::Tau::leadChargedHadrCand
const reco::CandidatePtr leadChargedHadrCand() const
reco::Candidate::energy
virtual double energy() const =0
energy
taus_updatedMVAIds_cff.loadMVAfromDB
loadMVAfromDB
Definition: taus_updatedMVAIds_cff.py:16
reco::PFTau::signalPFCands
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
Definition: PFTau.cc:182
AntiElectronIDMVA6.h
mps_fire.i
i
Definition: mps_fire.py:355
Muon.h
reco::GsfElectron::gsfTrack
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:164
reco::GsfElectron::trackMomentumOut
math::XYZVectorF trackMomentumOut() const
Definition: GsfElectron.h:278
funct::false
false
Definition: Factorize.h:34
GBRForest::GetClassifier
double GetClassifier(const float *vector) const
Definition: GBRForest.h:34
ESHandle.h
PFCandidate.h
pat::Tau::ecalEnergyLeadChargedHadrCand
float ecalEnergyLeadChargedHadrCand() const
Definition: Tau.h:306
pat::PackedCandidate::pdgId
int pdgId() const override
PDG identifier.
Definition: PackedCandidate.h:832
edm::Ref::isAvailable
bool isAvailable() const
Definition: Ref.h:537
min
T min(T a, T b)
Definition: MathUtil.h:58
AntiElectronIDMVA6::inputFilesToDelete_
std::vector< TFile * > inputFilesToDelete_
Definition: AntiElectronIDMVA6.h:168
AntiElectronIDMVA6::positionAtECalEntrance_
PositionAtECalEntranceComputer positionAtECalEntrance_
Definition: AntiElectronIDMVA6.h:170
GBRWrapperRcd.h
AntiElectronIDMVA6::mvaName_woGwGSF_EC_
std::string mvaName_woGwGSF_EC_
Definition: AntiElectronIDMVA6.h:145
GBRForest
Definition: GBRForest.h:25
pat::Tau
Analysis-level tau class.
Definition: Tau.h:53
pat::Electron::gsfTrack
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster
pat::Tau::emFraction_MVA
float emFraction_MVA() const
return emFraction_MVA
Definition: Tau.h:318
pat::Tau::signalChargedHadrCands
reco::CandidatePtrVector signalChargedHadrCands() const
reco::PFTau::signalChargedHadrCands
const std::vector< reco::CandidatePtr > & signalChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:75
AntiElectronIDMVA6::mva_NoEleMatch_wGwoGSF_BL_
const GBRForest * mva_NoEleMatch_wGwoGSF_BL_
Definition: AntiElectronIDMVA6.h:160
CustomPhysics_cfi.gamma
gamma
Definition: CustomPhysics_cfi.py:17
edm::PtrVectorItr
Definition: PtrVector.h:51
reco::PFTau
Definition: PFTau.h:36
reco::Candidate::get
T get() const
get a component
Definition: Candidate.h:221
reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:237
AntiElectronIDMVA6::~AntiElectronIDMVA6
~AntiElectronIDMVA6()
Definition: AntiElectronIDMVA6.cc:60
edm::Ptr::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
AntiElectronIDMVA6::verbosity_
int verbosity_
Definition: AntiElectronIDMVA6.h:172
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
pat::Electron::closestCtfTrackRef
reco::TrackRef closestCtfTrackRef() const override
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
beam_dqm_sourceclient-live_cfg.mva
mva
Definition: beam_dqm_sourceclient-live_cfg.py:116
AntiElectronIDMVA6::MVAValue
double MVAValue(Float_t TauPt, Float_t TauEtaAtEcalEntrance, Float_t TauPhi, Float_t TauLeadChargedPFCandPt, Float_t TauLeadChargedPFCandEtaAtEcalEntrance, Float_t TauEmFraction, Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP, Float_t TauVisMassIn, Float_t TaudCrackEta, Float_t TaudCrackPhi, Float_t TauHasGsf, Int_t TauSignalPFGammaCandsIn, Int_t TauSignalPFGammaCandsOut, const std::vector< Float_t > &GammasdEtaInSigCone, const std::vector< Float_t > &GammasdPhiInSigCone, const std::vector< Float_t > &GammasPtInSigCone, const std::vector< Float_t > &GammasdEtaOutSigCone, const std::vector< Float_t > &GammasdPhiOutSigCone, const std::vector< Float_t > &GammasPtOutSigCone, Float_t ElecEta, Float_t ElecPhi, Float_t ElecEtotOverPin, Float_t ElecChi2NormGSF, Float_t ElecChi2NormKF, Float_t ElecGSFNumHits, Float_t ElecKFNumHits, Float_t ElecGSFTrackResol, Float_t ElecGSFTracklnPt, Float_t ElecPin, Float_t ElecPout, Float_t ElecEecal, Float_t ElecDeltaEta, Float_t ElecDeltaPhi, Float_t ElecMvaInSigmaEtaEta, Float_t ElecMvaInHadEnergy, Float_t ElecMvaInDeltaEta)
Definition: AntiElectronIDMVA6.cc:136
AntiElectronIDMVA6::mvaName_NoEleMatch_wGwoGSF_BL_
std::string mvaName_NoEleMatch_wGwoGSF_BL_
Definition: AntiElectronIDMVA6.h:140
AntiElectronIDMVA6::mva_NoEleMatch_wGwoGSF_EC_
const GBRForest * mva_NoEleMatch_wGwoGSF_EC_
Definition: AntiElectronIDMVA6.h:164
reco::PFTau::emFraction
float emFraction() const
Definition: PFTau.cc:339
reco::OK
std::pair< int, edm::FunctionWithDict > OK
Definition: findMethod.cc:126
edm::Ref< SuperClusterCollection >
TtFullHadEvtBuilder_cfi.sumPt
sumPt
Definition: TtFullHadEvtBuilder_cfi.py:38
AntiElectronIDMVA6::isInitialized_
bool isInitialized_
Definition: AntiElectronIDMVA6.h:135
PositionAtECalEntranceComputer::beginEvent
void beginEvent(const edm::EventSetup &)
Definition: PositionAtECalEntranceComputer.cc:13
pat::Tau::hcalEnergyLeadChargedHadrCand
float hcalEnergyLeadChargedHadrCand() const
return hcal energy from LeadChargedHadrCand
Definition: Tau.h:308
pat::Tau::signalCands
reco::CandidatePtrVector signalCands() const
edm::FileInPath
Definition: FileInPath.h:64
AntiElectronIDMVA6::mva_wGwGSF_BL_
const GBRForest * mva_wGwGSF_BL_
Definition: AntiElectronIDMVA6.h:162
Track.h
AntiElectronIDMVA6::Var_wGwGSF_Endcap_
Float_t * Var_wGwGSF_Endcap_
Definition: AntiElectronIDMVA6.h:157
AntiElectronIDMVA6::mvaName_wGwGSF_BL_
std::string mvaName_wGwGSF_BL_
Definition: AntiElectronIDMVA6.h:142
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
AntiElectronIDMVA6::mvaName_NoEleMatch_wGwoGSF_EC_
std::string mvaName_NoEleMatch_wGwoGSF_EC_
Definition: AntiElectronIDMVA6.h:144
edm::PtrVector< Candidate >
PVValHelper::eta
Definition: PVValidationHelpers.h:69
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::GsfElectron::trackMomentumAtVtx
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:276
AntiElectronIDMVA6::minimum
double minimum(double a, double b)
Definition: AntiElectronIDMVA6.cc:1241
reco::Track
Definition: Track.h:27
edm::ESHandle< GBRForest >
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
AntiElectronIDMVA6::mvaName_NoEleMatch_woGwoGSF_BL_
std::string mvaName_NoEleMatch_woGwoGSF_BL_
Definition: AntiElectronIDMVA6.h:139
taus_updatedMVAIds_cff.mvaName
mvaName
Definition: taus_updatedMVAIds_cff.py:17
AntiElectronIDMVA6::Var_woGwGSF_Endcap_
Float_t * Var_woGwGSF_Endcap_
Definition: AntiElectronIDMVA6.h:156
reco::GsfElectron
Definition: GsfElectron.h:35
AntiElectronIDMVA6::Var_NoEleMatch_wGwoGSF_Barrel_
Float_t * Var_NoEleMatch_wGwoGSF_Barrel_
Definition: AntiElectronIDMVA6.h:151
b
double b
Definition: hdecay.h:118
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
reco::PFTau::leadChargedHadrCand
const CandidatePtr & leadChargedHadrCand() const
Definition: PFTau.cc:62
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
AntiElectronIDMVA6::Var_NoEleMatch_woGwoGSF_Barrel_
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_
Definition: AntiElectronIDMVA6.h:150
edm::FileInPath::location
LocationCode location() const
Where was the file found?
Definition: FileInPath.cc:161
AntiElectronIDMVA6::mvaName_woGwGSF_BL_
std::string mvaName_woGwGSF_BL_
Definition: AntiElectronIDMVA6.h:141
edm::ParameterSet
Definition: ParameterSet.h:36
AntiElectronIDMVA6::Var_wGwGSF_Barrel_
Float_t * Var_wGwGSF_Barrel_
Definition: AntiElectronIDMVA6.h:153
a
double a
Definition: hdecay.h:119
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
PVValHelper::phi
Definition: PVValidationHelpers.h:68
AntiElectronIDMVA6::mva_wGwGSF_EC_
const GBRForest * mva_wGwGSF_EC_
Definition: AntiElectronIDMVA6.h:166
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
pat::PackedCandidate
Definition: PackedCandidate.h:22
AntiElectronIDMVA6::mva_woGwGSF_BL_
const GBRForest * mva_woGwGSF_BL_
Definition: AntiElectronIDMVA6.h:161
pat::Tau::etaAtEcalEntrance
float etaAtEcalEntrance() const
return etaAtEcalEntrance
Definition: Tau.h:312
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
AntiElectronIDMVA6::loadMVAfromDB_
bool loadMVAfromDB_
Definition: AntiElectronIDMVA6.h:136
AntiElectronIDMVA6::Var_NoEleMatch_woGwoGSF_Endcap_
Float_t * Var_NoEleMatch_woGwoGSF_Endcap_
Definition: AntiElectronIDMVA6.h:154
AntiElectronIDMVA6::Var_NoEleMatch_wGwoGSF_Endcap_
Float_t * Var_NoEleMatch_wGwoGSF_Endcap_
Definition: AntiElectronIDMVA6.h:155
dtResolutionTest_cfi.inputFile
inputFile
Definition: dtResolutionTest_cfi.py:14
GsfTrack.h
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
AntiElectronIDMVA6::Var_woGwGSF_Barrel_
Float_t * Var_woGwGSF_Barrel_
Definition: AntiElectronIDMVA6.h:152
edm::EventSetup
Definition: EventSetup.h:57
reco::GsfElectron::closestCtfTrackRef
virtual TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:188
get
#define get
pat::Tau::phiAtEcalEntrance
float phiAtEcalEntrance() const
return phiAtEcalEntrance
Definition: Tau.h:310
looper.cfg
cfg
Definition: looper.py:297
reco::Candidate
Definition: Candidate.h:27
AntiElectronIDMVA6::dCrackPhi
double dCrackPhi(double phi, double eta)
Definition: AntiElectronIDMVA6.cc:1266
DDAxes::phi
AntiElectronIDMVA6::mva_NoEleMatch_woGwoGSF_EC_
const GBRForest * mva_NoEleMatch_woGwoGSF_EC_
Definition: AntiElectronIDMVA6.h:163
reco::PFTau::leadPFChargedHadrCand
const PFCandidatePtr leadPFChargedHadrCand() const
Getters for different PFCandidates for PFTaus made from PFCandidates.
Definition: PFTau.cc:164
AntiElectronIDMVA6::inputFileName_
edm::FileInPath inputFileName_
Definition: AntiElectronIDMVA6.h:137
pat::Electron::superCluster
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
edm::FileInPath::Unknown
Definition: FileInPath.h:66
AntiElectronIDMVA6::mva_NoEleMatch_woGwoGSF_BL_
const GBRForest * mva_NoEleMatch_woGwoGSF_BL_
Definition: AntiElectronIDMVA6.h:159
pat::Tau::etaAtEcalEntranceLeadChargedCand
float etaAtEcalEntranceLeadChargedCand() const
return etaAtEcalEntrance from LeadChargedCand
Definition: Tau.h:314
AntiElectronIDMVA6::AntiElectronIDMVA6
AntiElectronIDMVA6(const edm::ParameterSet &)
Definition: AntiElectronIDMVA6.cc:18
Exception
Definition: hltDiff.cc:246
AntiElectronIDMVA6::beginEvent
void beginEvent(const edm::Event &, const edm::EventSetup &)
Definition: AntiElectronIDMVA6.cc:104
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
GBRWrapperRcd
Definition: GBRWrapperRcd.h:24
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
pat::Tau::signalGammaCands
reco::CandidatePtrVector signalGammaCands() const
Exception.h
reco::GsfElectron::superCluster
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:163
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
AntiElectronIDMVA6::mvaName_wGwGSF_EC_
std::string mvaName_wGwGSF_EC_
Definition: AntiElectronIDMVA6.h:146
pat::Tau::ptLeadChargedCand
float ptLeadChargedCand() const
return pt from LeadChargedCand
Definition: Tau.h:316
AntiElectronIDMVA6::mvaName_NoEleMatch_woGwoGSF_EC_
std::string mvaName_NoEleMatch_woGwoGSF_EC_
Definition: AntiElectronIDMVA6.h:143
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
ztail.d
d
Definition: ztail.py:151
pi
const Double_t pi
Definition: trackSplitPlot.h:36
cms::Exception
Definition: Exception.h:70
pat::Electron
Analysis-level electron class.
Definition: Electron.h:51
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
AntiElectronIDMVA6::usePhiAtEcalEntranceExtrapolation_
bool usePhiAtEcalEntranceExtrapolation_
Definition: AntiElectronIDMVA6.h:148
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
reco::Candidate::Point
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
edm::Event
Definition: Event.h:73
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
AntiElectronIDMVA6::mva_woGwGSF_EC_
const GBRForest * mva_woGwGSF_EC_
Definition: AntiElectronIDMVA6.h:165
PFCandidateFwd.h
reco::GsfElectron::ecalEnergy
float ecalEnergy() const
Definition: GsfElectron.h:820
reco::PFTau::signalGammaCands
const std::vector< reco::CandidatePtr > & signalGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:83
AntiElectronIDMVA6::dCrackEta
double dCrackEta(double eta)
Definition: AntiElectronIDMVA6.cc:1316