CMS 3D CMS Logo

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

#include <AntiElectronIDMVA6.h>

Public Member Functions

 AntiElectronIDMVA6 (const edm::ParameterSet &)
 
bool atECalEntrance (const reco::Candidate *part, math::XYZPoint &pos)
 
void beginEvent (const edm::Event &, const edm::EventSetup &)
 
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)
 
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, Float_t TauGammaEtaMomIn, Float_t TauGammaEtaMomOut, Float_t TauGammaPhiMomIn, Float_t TauGammaPhiMomOut, Float_t TauGammaEnFracIn, Float_t TauGammaEnFracOut, 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)
 
double MVAValue (const reco::PFTau &thePFTau, const reco::GsfElectron &theGsfEle)
 
double MVAValue (const reco::PFTau &thePFTau)
 
double MVAValue (const pat::Tau &theTau, const pat::Electron &theEle)
 
double MVAValue (const pat::Tau &theTau)
 
 ~AntiElectronIDMVA6 ()
 

Private Member Functions

double dCrackEta (double eta)
 
double dCrackPhi (double phi, double eta)
 
double minimum (double a, double b)
 

Private Attributes

edm::FileInPath inputFileName_
 
std::vector< TFile * > inputFilesToDelete_
 
bool isInitialized_
 
bool loadMVAfromDB_
 
const GBRForestmva_NoEleMatch_wGwoGSF_BL_
 
const GBRForestmva_NoEleMatch_wGwoGSF_EC_
 
const GBRForestmva_NoEleMatch_woGwoGSF_BL_
 
const GBRForestmva_NoEleMatch_woGwoGSF_EC_
 
const GBRForestmva_wGwGSF_BL_
 
const GBRForestmva_wGwGSF_EC_
 
const GBRForestmva_woGwGSF_BL_
 
const GBRForestmva_woGwGSF_EC_
 
std::string mvaName_NoEleMatch_wGwoGSF_BL_
 
std::string mvaName_NoEleMatch_wGwoGSF_EC_
 
std::string mvaName_NoEleMatch_woGwoGSF_BL_
 
std::string mvaName_NoEleMatch_woGwoGSF_EC_
 
std::string mvaName_wGwGSF_BL_
 
std::string mvaName_wGwGSF_EC_
 
std::string mvaName_woGwGSF_BL_
 
std::string mvaName_woGwGSF_EC_
 
PositionAtECalEntranceComputer positionAtECalEntrance_
 
bool usePhiAtEcalEntranceExtrapolation_
 
Float_t * Var_NoEleMatch_wGwoGSF_Barrel_
 
Float_t * Var_NoEleMatch_wGwoGSF_Endcap_
 
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_
 
Float_t * Var_NoEleMatch_woGwoGSF_Endcap_
 
Float_t * Var_wGwGSF_Barrel_
 
Float_t * Var_wGwGSF_Endcap_
 
Float_t * Var_woGwGSF_Barrel_
 
Float_t * Var_woGwGSF_Endcap_
 
int verbosity_
 

Detailed Description

Definition at line 35 of file AntiElectronIDMVA6.h.

Constructor & Destructor Documentation

AntiElectronIDMVA6::AntiElectronIDMVA6 ( const edm::ParameterSet cfg)

Definition at line 18 of file AntiElectronIDMVA6.cc.

References Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), inputFileName_, loadMVAfromDB_, mvaName_NoEleMatch_wGwoGSF_BL_, mvaName_NoEleMatch_wGwoGSF_EC_, mvaName_NoEleMatch_woGwoGSF_BL_, mvaName_NoEleMatch_woGwoGSF_EC_, mvaName_wGwGSF_BL_, mvaName_wGwGSF_EC_, mvaName_woGwGSF_BL_, mvaName_woGwGSF_EC_, AlCaHLTBitMon_QueryRunRegistry::string, usePhiAtEcalEntranceExtrapolation_, Var_NoEleMatch_wGwoGSF_Barrel_, Var_NoEleMatch_wGwoGSF_Endcap_, Var_NoEleMatch_woGwoGSF_Barrel_, Var_NoEleMatch_woGwoGSF_Endcap_, Var_wGwGSF_Barrel_, Var_wGwGSF_Endcap_, Var_woGwGSF_Barrel_, Var_woGwGSF_Endcap_, and verbosity_.

19  : isInitialized_(false),
22  mva_woGwGSF_BL_(nullptr),
23  mva_wGwGSF_BL_(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 }
T getParameter(std::string const &) const
std::string mvaName_woGwGSF_BL_
std::string mvaName_NoEleMatch_woGwoGSF_BL_
std::string mvaName_NoEleMatch_woGwoGSF_EC_
edm::FileInPath inputFileName_
const GBRForest * mva_wGwGSF_EC_
bool exists(std::string const &parameterName) const
checks if a parameter exists
Float_t * Var_NoEleMatch_wGwoGSF_Barrel_
const GBRForest * mva_NoEleMatch_woGwoGSF_EC_
std::string mvaName_NoEleMatch_wGwoGSF_EC_
const GBRForest * mva_NoEleMatch_wGwoGSF_BL_
Float_t * Var_NoEleMatch_woGwoGSF_Endcap_
const GBRForest * mva_woGwGSF_EC_
std::string mvaName_wGwGSF_EC_
Float_t * Var_NoEleMatch_wGwoGSF_Endcap_
const GBRForest * mva_wGwGSF_BL_
const GBRForest * mva_woGwGSF_BL_
const GBRForest * mva_NoEleMatch_wGwoGSF_EC_
std::string mvaName_wGwGSF_BL_
std::string mvaName_NoEleMatch_wGwoGSF_BL_
const GBRForest * mva_NoEleMatch_woGwoGSF_BL_
std::string mvaName_woGwGSF_EC_
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_
AntiElectronIDMVA6::~AntiElectronIDMVA6 ( )

Definition at line 60 of file AntiElectronIDMVA6.cc.

References Exception, edm::EventSetup::get(), analyzePatCleaning_cfg::inputFile, inputFilesToDelete_, taus_updatedMVAIds_cff::loadMVAfromDB, loadMVAfromDB_, DetachedQuadStep_cff::mva, mva_NoEleMatch_wGwoGSF_BL_, mva_NoEleMatch_wGwoGSF_EC_, mva_NoEleMatch_woGwoGSF_BL_, mva_NoEleMatch_woGwoGSF_EC_, mva_wGwGSF_BL_, mva_wGwGSF_EC_, mva_woGwGSF_BL_, mva_woGwGSF_EC_, taus_updatedMVAIds_cff::mvaName, edm::ESHandle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, Var_NoEleMatch_wGwoGSF_Barrel_, Var_NoEleMatch_wGwoGSF_Endcap_, Var_NoEleMatch_woGwoGSF_Barrel_, Var_NoEleMatch_woGwoGSF_Endcap_, Var_wGwGSF_Barrel_, Var_wGwGSF_Endcap_, Var_woGwGSF_Barrel_, and Var_woGwGSF_Endcap_.

60  {
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 }
const GBRForest * mva_wGwGSF_EC_
Float_t * Var_NoEleMatch_wGwoGSF_Barrel_
const GBRForest * mva_NoEleMatch_woGwoGSF_EC_
const GBRForest * mva_NoEleMatch_wGwoGSF_BL_
Float_t * Var_NoEleMatch_woGwoGSF_Endcap_
std::vector< TFile * > inputFilesToDelete_
const GBRForest * mva_woGwGSF_EC_
Float_t * Var_NoEleMatch_wGwoGSF_Endcap_
const GBRForest * mva_wGwGSF_BL_
const GBRForest * mva_woGwGSF_BL_
const GBRForest * mva_NoEleMatch_wGwoGSF_EC_
const GBRForest * mva_NoEleMatch_woGwoGSF_BL_
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_

Member Function Documentation

bool AntiElectronIDMVA6::atECalEntrance ( const reco::Candidate part,
math::XYZPoint pos 
)
void AntiElectronIDMVA6::beginEvent ( const edm::Event evt,
const edm::EventSetup es 
)

Definition at line 104 of file AntiElectronIDMVA6.cc.

References PositionAtECalEntranceComputer::beginEvent(), edm::FileInPath::fullPath(), analyzePatCleaning_cfg::inputFile, inputFileName_, inputFilesToDelete_, isInitialized_, taus_updatedMVAIds_cff::loadMVAfromDB, loadMVAfromDB_, edm::FileInPath::location(), mva_NoEleMatch_wGwoGSF_BL_, mva_NoEleMatch_wGwoGSF_EC_, mva_NoEleMatch_woGwoGSF_BL_, mva_NoEleMatch_woGwoGSF_EC_, mva_wGwGSF_BL_, mva_wGwGSF_EC_, mva_woGwGSF_BL_, mva_woGwGSF_EC_, mvaName_NoEleMatch_wGwoGSF_BL_, mvaName_NoEleMatch_wGwoGSF_EC_, mvaName_NoEleMatch_woGwoGSF_BL_, mvaName_NoEleMatch_woGwoGSF_EC_, mvaName_wGwGSF_BL_, mvaName_wGwGSF_EC_, mvaName_woGwGSF_BL_, mvaName_woGwGSF_EC_, positionAtECalEntrance_, and edm::FileInPath::Unknown.

104  {
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 
121  mva_NoEleMatch_woGwoGSF_BL_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_woGwoGSF_BL_);
122  mva_NoEleMatch_wGwoGSF_BL_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_wGwoGSF_BL_);
123  mva_woGwGSF_BL_ = loadMVAfromFile(inputFile, mvaName_woGwGSF_BL_);
124  mva_wGwGSF_BL_ = loadMVAfromFile(inputFile, mvaName_wGwGSF_BL_);
125  mva_NoEleMatch_woGwoGSF_EC_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_woGwoGSF_EC_);
126  mva_NoEleMatch_wGwoGSF_EC_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_wGwoGSF_EC_);
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 }
std::string mvaName_woGwGSF_BL_
std::string mvaName_NoEleMatch_woGwoGSF_BL_
void beginEvent(const edm::EventSetup &)
std::string mvaName_NoEleMatch_woGwoGSF_EC_
edm::FileInPath inputFileName_
const GBRForest * mva_wGwGSF_EC_
const GBRForest * mva_NoEleMatch_woGwoGSF_EC_
std::string mvaName_NoEleMatch_wGwoGSF_EC_
PositionAtECalEntranceComputer positionAtECalEntrance_
const GBRForest * mva_NoEleMatch_wGwoGSF_BL_
std::vector< TFile * > inputFilesToDelete_
const GBRForest * mva_woGwGSF_EC_
LocationCode location() const
Where was the file found?
Definition: FileInPath.cc:191
std::string mvaName_wGwGSF_EC_
const GBRForest * mva_wGwGSF_BL_
const GBRForest * mva_woGwGSF_BL_
const GBRForest * mva_NoEleMatch_wGwoGSF_EC_
std::string mvaName_wGwGSF_BL_
std::string mvaName_NoEleMatch_wGwoGSF_BL_
std::string fullPath() const
Definition: FileInPath.cc:197
const GBRForest * mva_NoEleMatch_woGwoGSF_BL_
std::string mvaName_woGwGSF_EC_
double AntiElectronIDMVA6::dCrackEta ( double  eta)
private

Definition at line 1316 of file AntiElectronIDMVA6.cc.

References funct::abs(), edmIntegrityCheck::d, and minimum().

Referenced by MVAValue().

1316  {
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 }
double minimum(double a, double b)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double AntiElectronIDMVA6::dCrackPhi ( double  phi,
double  eta 
)
private

Definition at line 1266 of file AntiElectronIDMVA6.cc.

References funct::abs(), constexpr, M_PI, minimum(), and pi.

Referenced by MVAValue().

1266  {
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 }
double minimum(double a, double b)
#define constexpr
const Double_t pi
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
std::pair< int, edm::FunctionWithDict > OK
Definition: findMethod.cc:136
double AntiElectronIDMVA6::minimum ( double  a,
double  b 
)
private

Definition at line 1241 of file AntiElectronIDMVA6.cc.

References a, funct::abs(), b, constexpr, M_PI, and pi.

Referenced by dCrackEta(), and dCrackPhi().

1241  {
1242  if (std::abs(b) < std::abs(a))
1243  return b;
1244  else
1245  return a;
1246 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
double AntiElectronIDMVA6::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 at line 136 of file AntiElectronIDMVA6.cc.

References mps_fire::i, M_PI, mathSSE::sqrt(), and TtFullHadEvtBuilder_cfi::sumPt.

Referenced by MVAValue().

172  {
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 }
T sqrt(T t)
Definition: SSEVec.h:18
#define M_PI
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)
double AntiElectronIDMVA6::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,
Float_t  TauGammaEtaMomIn,
Float_t  TauGammaEtaMomOut,
Float_t  TauGammaPhiMomIn,
Float_t  TauGammaPhiMomOut,
Float_t  TauGammaEnFracIn,
Float_t  TauGammaEnFracOut,
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 at line 265 of file AntiElectronIDMVA6.cc.

References funct::abs(), deltaR(), Exception, GBRForest::GetClassifier(), isInitialized_, cmsBatch::log, SiStripPI::max, min(), mva_NoEleMatch_wGwoGSF_BL_, mva_NoEleMatch_wGwoGSF_EC_, mva_NoEleMatch_woGwoGSF_BL_, mva_NoEleMatch_woGwoGSF_EC_, mva_wGwGSF_BL_, mva_wGwGSF_EC_, mva_woGwGSF_BL_, mva_woGwGSF_EC_, Var_NoEleMatch_wGwoGSF_Barrel_, Var_NoEleMatch_wGwoGSF_Endcap_, Var_NoEleMatch_woGwoGSF_Barrel_, Var_NoEleMatch_woGwoGSF_Endcap_, Var_wGwGSF_Barrel_, Var_wGwGSF_Endcap_, Var_woGwGSF_Barrel_, and Var_woGwGSF_Endcap_.

301  {
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 }
const GBRForest * mva_wGwGSF_EC_
Float_t * Var_NoEleMatch_wGwoGSF_Barrel_
const GBRForest * mva_NoEleMatch_woGwoGSF_EC_
const GBRForest * mva_NoEleMatch_wGwoGSF_BL_
Float_t * Var_NoEleMatch_woGwoGSF_Endcap_
const GBRForest * mva_woGwGSF_EC_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
Float_t * Var_NoEleMatch_wGwoGSF_Endcap_
const GBRForest * mva_wGwGSF_BL_
const GBRForest * mva_woGwGSF_BL_
const GBRForest * mva_NoEleMatch_wGwoGSF_EC_
const GBRForest * mva_NoEleMatch_woGwoGSF_BL_
double GetClassifier(const float *vector) const
Definition: GBRForest.h:43
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_
double AntiElectronIDMVA6::MVAValue ( const reco::PFTau thePFTau,
const reco::GsfElectron theGsfEle 
)

Definition at line 508 of file AntiElectronIDMVA6.cc.

References reco::GsfElectron::closestCtfTrackRef(), dCrackEta(), dCrackPhi(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), deltaR(), PATTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::GsfElectron::ecalEnergy(), reco::PFTau::emFraction(), reco::Candidate::energy(), reco::LeafCandidate::eta(), reco::TrackBase::eta(), CustomPhysics_cfi::gamma, reco::Candidate::get(), reco::GsfElectron::gsfTrack(), edm::Ref< C, T, F >::isAvailable(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), reco::PFTau::leadPFChargedHadrCand(), cmsBatch::log, ResonanceBuilder::mass, SiStripPI::max, min(), MVAValue(), phi, reco::LeafCandidate::phi(), positionAtECalEntrance_, reco::LeafCandidate::pt(), reco::TrackBase::pt(), reco::PFTau::signalPFCands(), reco::PFTau::signalPFChargedHadrCands(), reco::PFTau::signalPFGammaCands(), mathSSE::sqrt(), summarizeEdmComparisonLogfiles::success, reco::GsfElectron::superCluster(), HiIsolationCommonParameters_cff::track, reco::GsfElectron::trackMomentumAtVtx(), reco::GsfElectron::trackMomentumOut(), and usePhiAtEcalEntranceExtrapolation_.

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.signalPFGammaCands()) {
565  float dR = deltaR(gamma->p4(), thePFTau.leadPFChargedHadrCand()->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.leadPFChargedHadrCand().isNonnull()) {
571  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
572  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->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.leadPFChargedHadrCand().isNonnull()) {
583  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
584  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->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.signalPFChargedHadrCands()) {
594  float dR = deltaR(charged->p4(), thePFTau.leadPFChargedHadrCand()->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;
621  reco::Candidate::Point aPos = positionAtECalEntrance_(signalCand, success);
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 }
bool isAvailable() const
Definition: Ref.h:577
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:185
virtual TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:201
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
double eta() const final
momentum pseudorapidity
const PFCandidatePtr & leadPFChargedHadrCand() const
Definition: PFTau.cc:67
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:291
const std::vector< reco::PFCandidatePtr > & signalPFGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:84
double dCrackPhi(double phi, double eta)
double pt() const final
transverse momentum
float emFraction() const
Definition: PFTau.cc:227
PositionAtECalEntranceComputer positionAtECalEntrance_
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
PFCandidates in signal region.
Definition: PFTau.cc:78
virtual double energy() const =0
energy
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:651
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:253
T sqrt(T t)
Definition: SSEVec.h:18
math::XYZVectorF trackMomentumOut() const
Definition: GsfElectron.h:293
double pt() const
track transverse momentum
Definition: TrackBase.h:621
T min(T a, T b)
Definition: MathUtil.h:58
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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)
float ecalEnergy() const
Definition: GsfElectron.h:848
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:250
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
T get() const
get a component
Definition: Candidate.h:217
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
double dCrackEta(double eta)
double phi() const final
momentum azimuthal angle
const std::vector< reco::PFCandidatePtr > & signalPFChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:80
double AntiElectronIDMVA6::MVAValue ( const reco::PFTau thePFTau)

Definition at line 727 of file AntiElectronIDMVA6.cc.

References dCrackEta(), dCrackPhi(), deltaR(), PATTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::PFTau::emFraction(), reco::Candidate::energy(), reco::LeafCandidate::eta(), reco::TrackBase::eta(), CustomPhysics_cfi::gamma, reco::Candidate::get(), edm::Ptr< T >::isNonnull(), reco::PFTau::leadPFChargedHadrCand(), ResonanceBuilder::mass, SiStripPI::max, min(), MVAValue(), phi, reco::LeafCandidate::phi(), positionAtECalEntrance_, reco::LeafCandidate::pt(), reco::TrackBase::pt(), reco::PFTau::signalPFCands(), reco::PFTau::signalPFChargedHadrCands(), reco::PFTau::signalPFGammaCands(), summarizeEdmComparisonLogfiles::success, HiIsolationCommonParameters_cff::track, and usePhiAtEcalEntranceExtrapolation_.

727  {
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.signalPFGammaCands()) {
782  float dR = deltaR(gamma->p4(), thePFTau.leadPFChargedHadrCand()->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.leadPFChargedHadrCand().isNonnull()) {
788  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
789  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->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.leadPFChargedHadrCand().isNonnull()) {
800  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
801  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->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.signalPFChargedHadrCands()) {
811  float dR = deltaR(charged->p4(), thePFTau.leadPFChargedHadrCand()->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;
838  reco::Candidate::Point aPos = positionAtECalEntrance_(signalCand, success);
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 }
double eta() const final
momentum pseudorapidity
const PFCandidatePtr & leadPFChargedHadrCand() const
Definition: PFTau.cc:67
const std::vector< reco::PFCandidatePtr > & signalPFGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:84
double dCrackPhi(double phi, double eta)
double pt() const final
transverse momentum
float emFraction() const
Definition: PFTau.cc:227
PositionAtECalEntranceComputer positionAtECalEntrance_
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
PFCandidates in signal region.
Definition: PFTau.cc:78
virtual double energy() const =0
energy
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:651
double pt() const
track transverse momentum
Definition: TrackBase.h:621
T min(T a, T b)
Definition: MathUtil.h:58
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
T get() const
get a component
Definition: Candidate.h:217
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
double dCrackEta(double eta)
double phi() const final
momentum azimuthal angle
const std::vector< reco::PFCandidatePtr > & signalPFChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:80
double AntiElectronIDMVA6::MVAValue ( const pat::Tau theTau,
const pat::Electron theEle 
)

Definition at line 895 of file AntiElectronIDMVA6.cc.

References funct::abs(), pat::Electron::closestCtfTrackRef(), dCrackEta(), dCrackPhi(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), deltaR(), PATTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::GsfElectron::ecalEnergy(), pat::Tau::ecalEnergyLeadChargedHadrCand(), pat::Tau::emFraction_MVA(), reco::Candidate::energy(), reco::LeafCandidate::eta(), pat::Tau::etaAtEcalEntrance(), pat::Tau::etaAtEcalEntranceLeadChargedCand(), CustomPhysics_cfi::gamma, edm::Ptr< T >::get(), reco::Candidate::get(), pat::Electron::gsfTrack(), pat::Tau::hcalEnergyLeadChargedHadrCand(), edm::Ref< C, T, F >::isAvailable(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), pat::Tau::leadChargedHadrCand(), cmsBatch::log, ResonanceBuilder::mass, SiStripPI::max, min(), MVAValue(), pat::PackedCandidate::pdgId(), phi, reco::LeafCandidate::phi(), pat::Tau::phiAtEcalEntrance(), positionAtECalEntrance_, reco::LeafCandidate::pt(), pat::Tau::ptLeadChargedCand(), pat::Tau::signalCands(), pat::Tau::signalChargedHadrCands(), pat::Tau::signalGammaCands(), mathSSE::sqrt(), summarizeEdmComparisonLogfiles::success, pat::Electron::superCluster(), reco::GsfElectron::trackMomentumAtVtx(), reco::GsfElectron::trackMomentumOut(), and usePhiAtEcalEntranceExtrapolation_.

895  {
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;
982  reco::Candidate::Point aPos = positionAtECalEntrance_(signalCand, success);
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 }
bool isAvailable() const
Definition: Ref.h:577
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
double eta() const final
momentum pseudorapidity
int pdgId() const override
PDG identifier.
float hcalEnergyLeadChargedHadrCand() const
return hcal energy from LeadChargedHadrCand
Definition: Tau.h:345
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:159
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:291
double dCrackPhi(double phi, double eta)
double pt() const final
transverse momentum
reco::CandidatePtrVector signalCands() const
PositionAtECalEntranceComputer positionAtECalEntrance_
reco::CandidatePtrVector signalGammaCands() const
virtual double energy() const =0
energy
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:253
T sqrt(T t)
Definition: SSEVec.h:18
math::XYZVectorF trackMomentumOut() const
Definition: GsfElectron.h:293
float ecalEnergyLeadChargedHadrCand() const
Definition: Tau.h:343
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
float phiAtEcalEntrance() const
return phiAtEcalEntrance
Definition: Tau.h:347
const reco::CandidatePtr leadChargedHadrCand() const
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
float ptLeadChargedCand() const
return pt from LeadChargedCand
Definition: Tau.h:353
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)
reco::TrackRef closestCtfTrackRef() const override
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
float ecalEnergy() const
Definition: GsfElectron.h:848
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
float emFraction_MVA() const
return emFraction_MVA
Definition: Tau.h:355
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:250
T get() const
get a component
Definition: Candidate.h:217
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
reco::CandidatePtrVector signalChargedHadrCands() const
float etaAtEcalEntrance() const
return etaAtEcalEntrance
Definition: Tau.h:349
float etaAtEcalEntranceLeadChargedCand() const
return etaAtEcalEntrance from LeadChargedCand
Definition: Tau.h:351
double dCrackEta(double eta)
double phi() const final
momentum azimuthal angle
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
double AntiElectronIDMVA6::MVAValue ( const pat::Tau theTau)

Definition at line 1096 of file AntiElectronIDMVA6.cc.

References funct::abs(), dCrackEta(), dCrackPhi(), deltaR(), PATTauDiscriminationAgainstElectronDeadECAL_cfi::dR, pat::Tau::ecalEnergyLeadChargedHadrCand(), pat::Tau::emFraction_MVA(), reco::Candidate::energy(), reco::LeafCandidate::eta(), pat::Tau::etaAtEcalEntrance(), pat::Tau::etaAtEcalEntranceLeadChargedCand(), CustomPhysics_cfi::gamma, edm::Ptr< T >::get(), reco::Candidate::get(), pat::Tau::hcalEnergyLeadChargedHadrCand(), edm::Ptr< T >::isNonnull(), pat::Tau::leadChargedHadrCand(), ResonanceBuilder::mass, SiStripPI::max, min(), MVAValue(), pat::PackedCandidate::pdgId(), phi, reco::LeafCandidate::phi(), pat::Tau::phiAtEcalEntrance(), positionAtECalEntrance_, reco::LeafCandidate::pt(), pat::Tau::ptLeadChargedCand(), pat::Tau::signalCands(), pat::Tau::signalChargedHadrCands(), pat::Tau::signalGammaCands(), summarizeEdmComparisonLogfiles::success, and usePhiAtEcalEntranceExtrapolation_.

1096  {
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;
1175  reco::Candidate::Point aPos = positionAtECalEntrance_(signalCand, success);
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 }
double eta() const final
momentum pseudorapidity
int pdgId() const override
PDG identifier.
float hcalEnergyLeadChargedHadrCand() const
return hcal energy from LeadChargedHadrCand
Definition: Tau.h:345
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:159
double dCrackPhi(double phi, double eta)
double pt() const final
transverse momentum
reco::CandidatePtrVector signalCands() const
PositionAtECalEntranceComputer positionAtECalEntrance_
reco::CandidatePtrVector signalGammaCands() const
virtual double energy() const =0
energy
float ecalEnergyLeadChargedHadrCand() const
Definition: Tau.h:343
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
float phiAtEcalEntrance() const
return phiAtEcalEntrance
Definition: Tau.h:347
const reco::CandidatePtr leadChargedHadrCand() const
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
float ptLeadChargedCand() const
return pt from LeadChargedCand
Definition: Tau.h:353
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)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
float emFraction_MVA() const
return emFraction_MVA
Definition: Tau.h:355
T get() const
get a component
Definition: Candidate.h:217
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
reco::CandidatePtrVector signalChargedHadrCands() const
float etaAtEcalEntrance() const
return etaAtEcalEntrance
Definition: Tau.h:349
float etaAtEcalEntranceLeadChargedCand() const
return etaAtEcalEntrance from LeadChargedCand
Definition: Tau.h:351
double dCrackEta(double eta)
double phi() const final
momentum azimuthal angle

Member Data Documentation

edm::FileInPath AntiElectronIDMVA6::inputFileName_
private

Definition at line 137 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::vector<TFile*> AntiElectronIDMVA6::inputFilesToDelete_
private

Definition at line 168 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), and ~AntiElectronIDMVA6().

bool AntiElectronIDMVA6::isInitialized_
private

Definition at line 135 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), and MVAValue().

bool AntiElectronIDMVA6::loadMVAfromDB_
private

Definition at line 136 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), beginEvent(), and ~AntiElectronIDMVA6().

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_wGwoGSF_BL_
private

Definition at line 160 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), MVAValue(), and ~AntiElectronIDMVA6().

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_wGwoGSF_EC_
private

Definition at line 164 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), MVAValue(), and ~AntiElectronIDMVA6().

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_woGwoGSF_BL_
private

Definition at line 159 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), MVAValue(), and ~AntiElectronIDMVA6().

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_woGwoGSF_EC_
private

Definition at line 163 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), MVAValue(), and ~AntiElectronIDMVA6().

const GBRForest* AntiElectronIDMVA6::mva_wGwGSF_BL_
private

Definition at line 162 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), MVAValue(), and ~AntiElectronIDMVA6().

const GBRForest* AntiElectronIDMVA6::mva_wGwGSF_EC_
private

Definition at line 166 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), MVAValue(), and ~AntiElectronIDMVA6().

const GBRForest* AntiElectronIDMVA6::mva_woGwGSF_BL_
private

Definition at line 161 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), MVAValue(), and ~AntiElectronIDMVA6().

const GBRForest* AntiElectronIDMVA6::mva_woGwGSF_EC_
private

Definition at line 165 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), MVAValue(), and ~AntiElectronIDMVA6().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_wGwoGSF_BL_
private

Definition at line 140 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_wGwoGSF_EC_
private

Definition at line 144 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_woGwoGSF_BL_
private

Definition at line 139 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_woGwoGSF_EC_
private

Definition at line 143 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_wGwGSF_BL_
private

Definition at line 142 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_wGwGSF_EC_
private

Definition at line 146 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_woGwGSF_BL_
private

Definition at line 141 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_woGwGSF_EC_
private

Definition at line 145 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

PositionAtECalEntranceComputer AntiElectronIDMVA6::positionAtECalEntrance_
private

Definition at line 170 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), and MVAValue().

bool AntiElectronIDMVA6::usePhiAtEcalEntranceExtrapolation_
private

Definition at line 148 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and MVAValue().

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_wGwoGSF_Barrel_
private

Definition at line 151 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), MVAValue(), and ~AntiElectronIDMVA6().

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_wGwoGSF_Endcap_
private

Definition at line 155 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), MVAValue(), and ~AntiElectronIDMVA6().

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_woGwoGSF_Barrel_
private

Definition at line 150 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), MVAValue(), and ~AntiElectronIDMVA6().

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_woGwoGSF_Endcap_
private

Definition at line 154 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), MVAValue(), and ~AntiElectronIDMVA6().

Float_t* AntiElectronIDMVA6::Var_wGwGSF_Barrel_
private

Definition at line 153 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), MVAValue(), and ~AntiElectronIDMVA6().

Float_t* AntiElectronIDMVA6::Var_wGwGSF_Endcap_
private

Definition at line 157 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), MVAValue(), and ~AntiElectronIDMVA6().

Float_t* AntiElectronIDMVA6::Var_woGwGSF_Barrel_
private

Definition at line 152 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), MVAValue(), and ~AntiElectronIDMVA6().

Float_t* AntiElectronIDMVA6::Var_woGwGSF_Endcap_
private

Definition at line 156 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), MVAValue(), and ~AntiElectronIDMVA6().

int AntiElectronIDMVA6::verbosity_
private

Definition at line 172 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6().