CMS 3D CMS Logo

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

#include <AntiElectronIDMVA6.h>

Public Member Functions

 AntiElectronIDMVA6 (const edm::ParameterSet &)
 
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)
 
 ~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_
 
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 31 of file AntiElectronIDMVA6.h.

Constructor & Destructor Documentation

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

Definition at line 17 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, 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_.

18  : isInitialized_(false),
21  mva_woGwGSF_BL_(0),
22  mva_wGwGSF_BL_(0),
25  mva_woGwGSF_EC_(0),
26  mva_wGwGSF_EC_(0)
27 {
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 throw cms::Exception("MVA input not defined") << "Requested to load tau MVA input from ROOT file but no file provided in cfg file";
33 
34  }
35 
36  mvaName_NoEleMatch_woGwoGSF_BL_ = cfg.getParameter<std::string>("mvaName_NoEleMatch_woGwoGSF_BL");
37  mvaName_NoEleMatch_wGwoGSF_BL_ = cfg.getParameter<std::string>("mvaName_NoEleMatch_wGwoGSF_BL");
38  mvaName_woGwGSF_BL_ = cfg.getParameter<std::string>("mvaName_woGwGSF_BL");
39  mvaName_wGwGSF_BL_ = cfg.getParameter<std::string>("mvaName_wGwGSF_BL");
40  mvaName_NoEleMatch_woGwoGSF_EC_ = cfg.getParameter<std::string>("mvaName_NoEleMatch_woGwoGSF_EC");
41  mvaName_NoEleMatch_wGwoGSF_EC_ = cfg.getParameter<std::string>("mvaName_NoEleMatch_wGwoGSF_EC");
42  mvaName_woGwGSF_EC_ = cfg.getParameter<std::string>("mvaName_woGwGSF_EC");
43  mvaName_wGwGSF_EC_ = cfg.getParameter<std::string>("mvaName_wGwGSF_EC");
44 
45  Var_NoEleMatch_woGwoGSF_Barrel_ = new Float_t[10];
46  Var_NoEleMatch_wGwoGSF_Barrel_ = new Float_t[18];
47  Var_woGwGSF_Barrel_ = new Float_t[24];
48  Var_wGwGSF_Barrel_ = new Float_t[32];
49  Var_NoEleMatch_woGwoGSF_Endcap_ = new Float_t[9];
50  Var_NoEleMatch_wGwoGSF_Endcap_ = new Float_t[17];
51  Var_woGwGSF_Endcap_ = new Float_t[23];
52  Var_wGwGSF_Endcap_ = new Float_t[31];
53 
54  verbosity_ = 0;
55 }
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 57 of file AntiElectronIDMVA6.cc.

References inputFilesToDelete_, loadMVAfromDB_, 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_.

58 {
61  delete [] Var_woGwGSF_Barrel_;
62  delete [] Var_wGwGSF_Barrel_;
65  delete [] Var_woGwGSF_Endcap_;
66  delete [] Var_wGwGSF_Endcap_;
67 
68  if ( !loadMVAfromDB_ ){
71  delete mva_woGwGSF_BL_;
72  delete mva_wGwGSF_BL_;
75  delete mva_woGwGSF_EC_;
76  delete mva_wGwGSF_EC_;
77  }
78 
79  for ( std::vector<TFile*>::iterator it = inputFilesToDelete_.begin();
80  it != inputFilesToDelete_.end(); ++it ) {
81  delete (*it);
82  }
83 }
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

void AntiElectronIDMVA6::beginEvent ( const edm::Event evt,
const edm::EventSetup es 
)

Definition at line 105 of file AntiElectronIDMVA6.cc.

References edm::FileInPath::fullPath(), inputFileName_, inputFilesToDelete_, isInitialized_, mvaPFMET_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_, and edm::FileInPath::Unknown.

106 {
107  if ( !isInitialized_ ) {
108  if ( loadMVAfromDB_ ) {
117  } else {
118  if ( inputFileName_.location() == edm::FileInPath::Unknown ) throw cms::Exception("PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
119  << " Failed to find File = " << inputFileName_ << " !!\n";
120  TFile* inputFile = new TFile(inputFileName_.fullPath().data());
121 
122  mva_NoEleMatch_woGwoGSF_BL_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_woGwoGSF_BL_);
123  mva_NoEleMatch_wGwoGSF_BL_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_wGwoGSF_BL_);
124  mva_woGwGSF_BL_ = loadMVAfromFile(inputFile, mvaName_woGwGSF_BL_);
125  mva_wGwGSF_BL_ = loadMVAfromFile(inputFile, mvaName_wGwGSF_BL_);
126  mva_NoEleMatch_woGwoGSF_EC_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_woGwoGSF_EC_);
127  mva_NoEleMatch_wGwoGSF_EC_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_wGwoGSF_EC_);
128  mva_woGwGSF_EC_ = loadMVAfromFile(inputFile, mvaName_woGwGSF_EC_);
129  mva_wGwGSF_EC_ = loadMVAfromFile(inputFile, mvaName_wGwGSF_EC_);
130  inputFilesToDelete_.push_back(inputFile);
131  }
132  isInitialized_ = true;
133  }
134 }
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_
const GBRForest * mva_NoEleMatch_woGwoGSF_EC_
std::string mvaName_NoEleMatch_wGwoGSF_EC_
const GBRForest * mva_NoEleMatch_wGwoGSF_BL_
std::vector< TFile * > inputFilesToDelete_
const GBRForest * mva_woGwGSF_EC_
std::string mvaName_wGwGSF_EC_
LocationCode location() const
Where was the file found?
Definition: FileInPath.cc:159
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:165
const GBRForest * mva_NoEleMatch_woGwoGSF_BL_
std::string mvaName_woGwGSF_EC_
tuple loadMVAfromDB
Definition: mvaPFMET_cff.py:84
double AntiElectronIDMVA6::dCrackEta ( double  eta)
private

Definition at line 962 of file AntiElectronIDMVA6.cc.

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

Referenced by MVAValue().

963 {
964 //--- compute the (unsigned) distance to the closest eta-crack in the ECAL barrel
965 
966  // IN: define locations of the eta-cracks
967  double cracks[5] = { 0., 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00 };
968 
969  double retVal = 99.;
970 
971  for ( int iCrack = 0; iCrack < 5 ; ++iCrack ) {
972  double d = minimum(eta - cracks[iCrack], eta + cracks[iCrack]);
973  if ( std::abs(d) < std::abs(retVal) ) {
974  retVal = d;
975  }
976  }
977 
978  return std::abs(retVal);
979 }
double minimum(double a, double b)
tuple d
Definition: ztail.py:151
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double AntiElectronIDMVA6::dCrackPhi ( double  phi,
double  eta 
)
private

Definition at line 913 of file AntiElectronIDMVA6.cc.

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

Referenced by MVAValue().

914 {
915 //--- compute the (unsigned) distance to the closest phi-crack in the ECAL barrel
916 
917  constexpr double pi = M_PI; // 3.14159265358979323846;
918 
919  // IN: shift of this location if eta < 0
920  constexpr double delta_cPhi = 0.00638;
921 
922  double retVal = 99.;
923 
924  if ( eta >= -1.47464 && eta <= 1.47464 ) {
925 
926  // the location is shifted
927  if ( eta < 0. ) phi += delta_cPhi;
928 
929  // CV: need to bring-back phi into interval [-pi,+pi]
930  if ( phi > pi ) phi -= 2.*pi;
931  if ( phi < -pi ) phi += 2.*pi;
932 
933  if ( phi >= -pi && phi <= pi ) {
934 
935  // the problem of the extrema:
936  if ( phi < cPhi[17] || phi >= cPhi[0] ) {
937  if ( phi < 0. ) phi += 2.*pi;
938  retVal = minimum(phi - cPhi[0], phi - cPhi[17] - 2.*pi);
939  } else {
940  // between these extrema...
941  bool OK = false;
942  unsigned iCrack = 16;
943  while( !OK ) {
944  if ( phi < cPhi[iCrack] ) {
945  retVal = minimum(phi - cPhi[iCrack + 1], phi - cPhi[iCrack]);
946  OK = true;
947  } else {
948  iCrack -= 1;
949  }
950  }
951  }
952  } else {
953  retVal = 0.; // IN: if there is a problem, we assume that we are in a crack
954  }
955  } else {
956  return -99.;
957  }
958 
959  return std::abs(retVal);
960 }
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 889 of file AntiElectronIDMVA6.cc.

References a, funct::abs(), and b.

Referenced by dCrackEta(), and dCrackPhi().

890 {
891  if ( std::abs(b) < std::abs(a) ) return b;
892  else return a;
893 }
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 dPhi(), i, M_PI, and mathSSE::sqrt().

Referenced by MVAValue().

173 {
174  double sumPt = 0.;
175  double dEta = 0.;
176  double dEta2 = 0.;
177  double dPhi = 0.;
178  double dPhi2 = 0.;
179  double sumPt2 = 0.;
180  for ( unsigned int i = 0 ; i < GammasPtInSigCone.size() ; ++i ) {
181  double pt_i = GammasPtInSigCone[i];
182  double phi_i = GammasdPhiInSigCone[i];
183  if ( GammasdPhiInSigCone[i] > M_PI ) phi_i = GammasdPhiInSigCone[i] - 2*M_PI;
184  else if ( GammasdPhiInSigCone[i] < -M_PI ) phi_i = GammasdPhiInSigCone[i] + 2*M_PI;
185  double eta_i = GammasdEtaInSigCone[i];
186  sumPt += pt_i;
187  sumPt2 += (pt_i*pt_i);
188  dEta += (pt_i*eta_i);
189  dEta2 += (pt_i*eta_i*eta_i);
190  dPhi += (pt_i*phi_i);
191  dPhi2 += (pt_i*phi_i*phi_i);
192  }
193 
194  Float_t TauGammaEnFracIn = -99.;
195  if ( TauPt > 0. ) {
196  TauGammaEnFracIn = sumPt/TauPt;
197  }
198 
199  if ( sumPt > 0. ) {
200  dEta /= sumPt;
201  dPhi /= sumPt;
202  dEta2 /= sumPt;
203  dPhi2 /= sumPt;
204  }
205 
206  Float_t TauGammaEtaMomIn = std::sqrt(dEta2)*std::sqrt(TauGammaEnFracIn)*TauPt;
207  Float_t TauGammaPhiMomIn = std::sqrt(dPhi2)*std::sqrt(TauGammaEnFracIn)*TauPt;
208 
209  sumPt = 0.;
210  dEta = 0.;
211  dEta2 = 0.;
212  dPhi = 0.;
213  dPhi2 = 0.;
214  sumPt2 = 0.;
215  for ( unsigned int i = 0 ; i < GammasPtOutSigCone.size() ; ++i ) {
216  double pt_i = GammasPtOutSigCone[i];
217  double phi_i = GammasdPhiOutSigCone[i];
218  if ( GammasdPhiOutSigCone[i] > M_PI ) phi_i = GammasdPhiOutSigCone[i] - 2*M_PI;
219  else if ( GammasdPhiOutSigCone[i] < -M_PI ) phi_i = GammasdPhiOutSigCone[i] + 2*M_PI;
220  double eta_i = GammasdEtaOutSigCone[i];
221  sumPt += pt_i;
222  sumPt2 += (pt_i*pt_i);
223  dEta += (pt_i*eta_i);
224  dEta2 += (pt_i*eta_i*eta_i);
225  dPhi += (pt_i*phi_i);
226  dPhi2 += (pt_i*phi_i*phi_i);
227  }
228 
229  Float_t TauGammaEnFracOut = sumPt/TauPt;
230 
231  if ( sumPt > 0. ) {
232  dEta /= sumPt;
233  dPhi /= sumPt;
234  dEta2 /= sumPt;
235  dPhi2 /= sumPt;
236  }
237 
238  Float_t TauGammaEtaMomOut = std::sqrt(dEta2)*std::sqrt(TauGammaEnFracOut)*TauPt;
239  Float_t TauGammaPhiMomOut = std::sqrt(dPhi2)*std::sqrt(TauGammaEnFracOut)*TauPt;
240 
241  return MVAValue(TauPt,
242  TauEtaAtEcalEntrance,
243  TauPhi,
244  TauLeadChargedPFCandPt,
245  TauLeadChargedPFCandEtaAtEcalEntrance,
246  TauEmFraction,
247  TauLeadPFChargedHadrHoP,
248  TauLeadPFChargedHadrEoP,
249  TauVisMassIn,
250  TaudCrackEta,
251  TaudCrackPhi,
252  TauHasGsf,
253  TauSignalPFGammaCandsIn,
254  TauSignalPFGammaCandsOut,
255  TauGammaEtaMomIn,
256  TauGammaEtaMomOut,
257  TauGammaPhiMomIn,
258  TauGammaPhiMomOut,
259  TauGammaEnFracIn,
260  TauGammaEnFracOut,
261  ElecEta,
262  ElecPhi,
263  ElecEtotOverPin,
264  ElecChi2NormGSF,
265  ElecChi2NormKF,
266  ElecGSFNumHits,
267  ElecKFNumHits,
268  ElecGSFTrackResol,
269  ElecGSFTracklnPt,
270  ElecPin,
271  ElecPout,
272  ElecEecal,
273  ElecDeltaEta,
274  ElecDeltaPhi,
275  ElecMvaInSigmaEtaEta,
276  ElecMvaInHadEnergy,
277  ElecMvaInDeltaEta);
278 }
int i
Definition: DBlmapReader.cc:9
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
T sqrt(T t)
Definition: SSEVec.h:48
#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 280 of file AntiElectronIDMVA6.cc.

References funct::abs(), deltaR(), Exception, GBRForest::GetClassifier(), isInitialized_, cmsBatch::log, bookConverter::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_.

317 {
318 
319  if ( !isInitialized_ ) {
320  throw cms::Exception("ClassNotInitialized")
321  << " AntiElectronMVA not properly initialized !!\n";
322  }
323 
324  double mvaValue = -99.;
325 
326  const float ECALBarrelEndcapEtaBorder = 1.479;
327  float ElecDeltaPinPoutOverPin = (ElecPin > 0.0) ? (std::abs(ElecPin - ElecPout)/ElecPin) : 1.0;
328  float ElecEecalOverPout = (ElecPout > 0.0) ? (ElecEecal/ElecPout) : 20.0;
329  float ElecNumHitsDiffOverSum = ((ElecGSFNumHits + ElecKFNumHits) > 0.0) ?
330  ((ElecGSFNumHits - ElecKFNumHits)/(ElecGSFNumHits + ElecKFNumHits)) : 1.0;
331 
332  if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn == 0 && TauHasGsf < 0.5) {
333  if ( std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
334  Var_NoEleMatch_woGwoGSF_Barrel_[0] = TauEtaAtEcalEntrance;
335  Var_NoEleMatch_woGwoGSF_Barrel_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
336  Var_NoEleMatch_woGwoGSF_Barrel_[2] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
337  Var_NoEleMatch_woGwoGSF_Barrel_[3] = std::log(std::max(float(1.), TauPt));
338  Var_NoEleMatch_woGwoGSF_Barrel_[4] = TauEmFraction;
339  Var_NoEleMatch_woGwoGSF_Barrel_[5] = TauLeadPFChargedHadrHoP;
340  Var_NoEleMatch_woGwoGSF_Barrel_[6] = TauLeadPFChargedHadrEoP;
341  Var_NoEleMatch_woGwoGSF_Barrel_[7] = TauVisMassIn;
342  Var_NoEleMatch_woGwoGSF_Barrel_[8] = TaudCrackEta;
343  Var_NoEleMatch_woGwoGSF_Barrel_[9] = TaudCrackPhi;
345  } else {
346  Var_NoEleMatch_woGwoGSF_Endcap_[0] = TauEtaAtEcalEntrance;
347  Var_NoEleMatch_woGwoGSF_Endcap_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
348  Var_NoEleMatch_woGwoGSF_Endcap_[2] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
349  Var_NoEleMatch_woGwoGSF_Endcap_[3] = std::log(std::max(float(1.), TauPt));
350  Var_NoEleMatch_woGwoGSF_Endcap_[4] = TauEmFraction;
351  Var_NoEleMatch_woGwoGSF_Endcap_[5] = TauLeadPFChargedHadrHoP;
352  Var_NoEleMatch_woGwoGSF_Endcap_[6] = TauLeadPFChargedHadrEoP;
353  Var_NoEleMatch_woGwoGSF_Endcap_[7] = TauVisMassIn;
354  Var_NoEleMatch_woGwoGSF_Endcap_[8] = TaudCrackEta;
356  }
357  }
358  else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn > 0 && TauHasGsf < 0.5 ) {
359  if ( std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
360  Var_NoEleMatch_wGwoGSF_Barrel_[0] = TauEtaAtEcalEntrance;
361  Var_NoEleMatch_wGwoGSF_Barrel_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
362  Var_NoEleMatch_wGwoGSF_Barrel_[2] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
363  Var_NoEleMatch_wGwoGSF_Barrel_[3] = std::log(std::max(float(1.), TauPt));
364  Var_NoEleMatch_wGwoGSF_Barrel_[4] = TauEmFraction;
365  Var_NoEleMatch_wGwoGSF_Barrel_[5] = TauSignalPFGammaCandsIn;
366  Var_NoEleMatch_wGwoGSF_Barrel_[6] = TauSignalPFGammaCandsOut;
367  Var_NoEleMatch_wGwoGSF_Barrel_[7] = TauLeadPFChargedHadrHoP;
368  Var_NoEleMatch_wGwoGSF_Barrel_[8] = TauLeadPFChargedHadrEoP;
369  Var_NoEleMatch_wGwoGSF_Barrel_[9] = TauVisMassIn;
370  Var_NoEleMatch_wGwoGSF_Barrel_[10] = TauGammaEtaMomIn;
371  Var_NoEleMatch_wGwoGSF_Barrel_[11] = TauGammaEtaMomOut;
372  Var_NoEleMatch_wGwoGSF_Barrel_[12] = TauGammaPhiMomIn;
373  Var_NoEleMatch_wGwoGSF_Barrel_[13] = TauGammaPhiMomOut;
374  Var_NoEleMatch_wGwoGSF_Barrel_[14] = TauGammaEnFracIn;
375  Var_NoEleMatch_wGwoGSF_Barrel_[15] = TauGammaEnFracOut;
376  Var_NoEleMatch_wGwoGSF_Barrel_[16] = TaudCrackEta;
377  Var_NoEleMatch_wGwoGSF_Barrel_[17] = TaudCrackPhi;
379  } else {
380  Var_NoEleMatch_wGwoGSF_Endcap_[0] = TauEtaAtEcalEntrance;
381  Var_NoEleMatch_wGwoGSF_Endcap_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
382  Var_NoEleMatch_wGwoGSF_Endcap_[2] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
383  Var_NoEleMatch_wGwoGSF_Endcap_[3] = std::log(std::max(float(1.), TauPt));
384  Var_NoEleMatch_wGwoGSF_Endcap_[4] = TauEmFraction;
385  Var_NoEleMatch_wGwoGSF_Endcap_[5] = TauSignalPFGammaCandsIn;
386  Var_NoEleMatch_wGwoGSF_Endcap_[6] = TauSignalPFGammaCandsOut;
387  Var_NoEleMatch_wGwoGSF_Endcap_[7] = TauLeadPFChargedHadrHoP;
388  Var_NoEleMatch_wGwoGSF_Endcap_[8] = TauLeadPFChargedHadrEoP;
389  Var_NoEleMatch_wGwoGSF_Endcap_[9] = TauVisMassIn;
390  Var_NoEleMatch_wGwoGSF_Endcap_[10] = TauGammaEtaMomIn;
391  Var_NoEleMatch_wGwoGSF_Endcap_[11] = TauGammaEtaMomOut;
392  Var_NoEleMatch_wGwoGSF_Endcap_[12] = TauGammaPhiMomIn;
393  Var_NoEleMatch_wGwoGSF_Endcap_[13] = TauGammaPhiMomOut;
394  Var_NoEleMatch_wGwoGSF_Endcap_[14] = TauGammaEnFracIn;
395  Var_NoEleMatch_wGwoGSF_Endcap_[15] = TauGammaEnFracOut;
396  Var_NoEleMatch_wGwoGSF_Endcap_[16] = TaudCrackEta;
398  }
399  }
400  else if ( TauSignalPFGammaCandsIn == 0 && TauHasGsf > 0.5 ) {
401  if ( std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
402  Var_woGwGSF_Barrel_[0] = std::max(float(-0.1), ElecEtotOverPin);
403  Var_woGwGSF_Barrel_[1] = std::log(ElecChi2NormGSF);
404  Var_woGwGSF_Barrel_[2] = ElecGSFNumHits;
405  Var_woGwGSF_Barrel_[3] = std::log(ElecGSFTrackResol);
406  Var_woGwGSF_Barrel_[4] = ElecGSFTracklnPt;
407  Var_woGwGSF_Barrel_[5] = ElecNumHitsDiffOverSum;
408  Var_woGwGSF_Barrel_[6] = std::log(ElecChi2NormKF);
409  Var_woGwGSF_Barrel_[7] = std::min(ElecDeltaPinPoutOverPin, float(1.));
410  Var_woGwGSF_Barrel_[8] = std::min(ElecEecalOverPout, float(20.));
411  Var_woGwGSF_Barrel_[9] = ElecDeltaEta;
412  Var_woGwGSF_Barrel_[10] = ElecDeltaPhi;
413  Var_woGwGSF_Barrel_[11] = std::min(ElecMvaInSigmaEtaEta, float(0.01));
414  Var_woGwGSF_Barrel_[12] = std::min(ElecMvaInHadEnergy, float(20.));
415  Var_woGwGSF_Barrel_[13] = std::min(ElecMvaInDeltaEta, float(0.1));
416  Var_woGwGSF_Barrel_[14] = TauEtaAtEcalEntrance;
417  Var_woGwGSF_Barrel_[15] = TauLeadChargedPFCandEtaAtEcalEntrance;
418  Var_woGwGSF_Barrel_[16] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
419  Var_woGwGSF_Barrel_[17] = std::log(std::max(float(1.), TauPt));
420  Var_woGwGSF_Barrel_[18] = TauEmFraction;
421  Var_woGwGSF_Barrel_[19] = TauLeadPFChargedHadrHoP;
422  Var_woGwGSF_Barrel_[20] = TauLeadPFChargedHadrEoP;
423  Var_woGwGSF_Barrel_[21] = TauVisMassIn;
424  Var_woGwGSF_Barrel_[22] = TaudCrackEta;
425  Var_woGwGSF_Barrel_[23] = TaudCrackPhi;
427  } else {
428  Var_woGwGSF_Endcap_[0] = std::max(float(-0.1), ElecEtotOverPin);
429  Var_woGwGSF_Endcap_[1] = std::log(ElecChi2NormGSF);
430  Var_woGwGSF_Endcap_[2] = ElecGSFNumHits;
431  Var_woGwGSF_Endcap_[3] = std::log(ElecGSFTrackResol);
432  Var_woGwGSF_Endcap_[4] = ElecGSFTracklnPt;
433  Var_woGwGSF_Endcap_[5] = ElecNumHitsDiffOverSum;
434  Var_woGwGSF_Endcap_[6] = std::log(ElecChi2NormKF);
435  Var_woGwGSF_Endcap_[7] = std::min(ElecDeltaPinPoutOverPin, float(1.));
436  Var_woGwGSF_Endcap_[8] = std::min(ElecEecalOverPout, float(20.));
437  Var_woGwGSF_Endcap_[9] = ElecDeltaEta;
438  Var_woGwGSF_Endcap_[10] = ElecDeltaPhi;
439  Var_woGwGSF_Endcap_[11] = std::min(ElecMvaInSigmaEtaEta, float(0.01));
440  Var_woGwGSF_Endcap_[12] = std::min(ElecMvaInHadEnergy, float(20.));
441  Var_woGwGSF_Endcap_[13] = std::min(ElecMvaInDeltaEta, float(0.1));
442  Var_woGwGSF_Endcap_[14] = TauEtaAtEcalEntrance;
443  Var_woGwGSF_Endcap_[15] = TauLeadChargedPFCandEtaAtEcalEntrance;
444  Var_woGwGSF_Endcap_[16] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
445  Var_woGwGSF_Endcap_[17] = std::log(std::max(float(1.), TauPt));
446  Var_woGwGSF_Endcap_[18] = TauEmFraction;
447  Var_woGwGSF_Endcap_[19] = TauLeadPFChargedHadrHoP;
448  Var_woGwGSF_Endcap_[20] = TauLeadPFChargedHadrEoP;
449  Var_woGwGSF_Endcap_[21] = TauVisMassIn;
450  Var_woGwGSF_Endcap_[22] = TaudCrackEta;
452  }
453  }
454  else if ( TauSignalPFGammaCandsIn > 0 && TauHasGsf > 0.5 ) {
455  if ( std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
456  Var_wGwGSF_Barrel_[0] = std::max(float(-0.1), ElecEtotOverPin);
457  Var_wGwGSF_Barrel_[1] = std::log(ElecChi2NormGSF);
458  Var_wGwGSF_Barrel_[2] = ElecGSFNumHits;
459  Var_wGwGSF_Barrel_[3] = std::log(ElecGSFTrackResol);
460  Var_wGwGSF_Barrel_[4] = ElecGSFTracklnPt;
461  Var_wGwGSF_Barrel_[5] = ElecNumHitsDiffOverSum;
462  Var_wGwGSF_Barrel_[6] = std::log(ElecChi2NormKF);
463  Var_wGwGSF_Barrel_[7] = std::min(ElecDeltaPinPoutOverPin, float(1.));
464  Var_wGwGSF_Barrel_[8] = std::min(ElecEecalOverPout, float(20.));
465  Var_wGwGSF_Barrel_[9] = ElecDeltaEta;
466  Var_wGwGSF_Barrel_[10] = ElecDeltaPhi;
467  Var_wGwGSF_Barrel_[11] = std::min(ElecMvaInSigmaEtaEta, float(0.01));
468  Var_wGwGSF_Barrel_[12] = std::min(ElecMvaInHadEnergy, float(20.));
469  Var_wGwGSF_Barrel_[13] = std::min(ElecMvaInDeltaEta, float(0.1));
470  Var_wGwGSF_Barrel_[14] = TauEtaAtEcalEntrance;
471  Var_wGwGSF_Barrel_[15] = TauLeadChargedPFCandEtaAtEcalEntrance;
472  Var_wGwGSF_Barrel_[16] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
473  Var_wGwGSF_Barrel_[17] = std::log(std::max(float(1.), TauPt));
474  Var_wGwGSF_Barrel_[18] = TauEmFraction;
475  Var_wGwGSF_Barrel_[19] = TauSignalPFGammaCandsIn;
476  Var_wGwGSF_Barrel_[20] = TauSignalPFGammaCandsOut;
477  Var_wGwGSF_Barrel_[21] = TauLeadPFChargedHadrHoP;
478  Var_wGwGSF_Barrel_[22] = TauLeadPFChargedHadrEoP;
479  Var_wGwGSF_Barrel_[23] = TauVisMassIn;
480  Var_wGwGSF_Barrel_[24] = TauGammaEtaMomIn;
481  Var_wGwGSF_Barrel_[25] = TauGammaEtaMomOut;
482  Var_wGwGSF_Barrel_[26] = TauGammaPhiMomIn;
483  Var_wGwGSF_Barrel_[27] = TauGammaPhiMomOut;
484  Var_wGwGSF_Barrel_[28] = TauGammaEnFracIn;
485  Var_wGwGSF_Barrel_[29] = TauGammaEnFracOut;
486  Var_wGwGSF_Barrel_[30] = TaudCrackEta;
487  Var_wGwGSF_Barrel_[31] = TaudCrackPhi;
489  } else {
490  Var_wGwGSF_Endcap_[0] = std::max(float(-0.1), ElecEtotOverPin);
491  Var_wGwGSF_Endcap_[1] = std::log(ElecChi2NormGSF);
492  Var_wGwGSF_Endcap_[2] = ElecGSFNumHits;
493  Var_wGwGSF_Endcap_[3] = std::log(ElecGSFTrackResol);
494  Var_wGwGSF_Endcap_[4] = ElecGSFTracklnPt;
495  Var_wGwGSF_Endcap_[5] = ElecNumHitsDiffOverSum;
496  Var_wGwGSF_Endcap_[6] = std::log(ElecChi2NormKF);
497  Var_wGwGSF_Endcap_[7] = std::min(ElecDeltaPinPoutOverPin, float(1.));
498  Var_wGwGSF_Endcap_[8] = std::min(ElecEecalOverPout, float(20.));
499  Var_wGwGSF_Endcap_[9] = ElecDeltaEta;
500  Var_wGwGSF_Endcap_[10] = ElecDeltaPhi;
501  Var_wGwGSF_Endcap_[11] = std::min(ElecMvaInSigmaEtaEta, float(0.01));
502  Var_wGwGSF_Endcap_[12] = std::min(ElecMvaInHadEnergy, float(20.));
503  Var_wGwGSF_Endcap_[13] = std::min(ElecMvaInDeltaEta, float(0.1));
504  Var_wGwGSF_Endcap_[14] = TauEtaAtEcalEntrance;
505  Var_wGwGSF_Endcap_[15] = TauLeadChargedPFCandEtaAtEcalEntrance;
506  Var_wGwGSF_Endcap_[16] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
507  Var_wGwGSF_Endcap_[17] = std::log(std::max(float(1.), TauPt));
508  Var_wGwGSF_Endcap_[18] = TauEmFraction;
509  Var_wGwGSF_Endcap_[19] = TauSignalPFGammaCandsIn;
510  Var_wGwGSF_Endcap_[20] = TauSignalPFGammaCandsOut;
511  Var_wGwGSF_Endcap_[21] = TauLeadPFChargedHadrHoP;
512  Var_wGwGSF_Endcap_[22] = TauLeadPFChargedHadrEoP;
513  Var_wGwGSF_Endcap_[23] = TauVisMassIn;
514  Var_wGwGSF_Endcap_[24] = TauGammaEtaMomIn;
515  Var_wGwGSF_Endcap_[25] = TauGammaEtaMomOut;
516  Var_wGwGSF_Endcap_[26] = TauGammaPhiMomIn;
517  Var_wGwGSF_Endcap_[27] = TauGammaPhiMomOut;
518  Var_wGwGSF_Endcap_[28] = TauGammaEnFracIn;
519  Var_wGwGSF_Endcap_[29] = TauGammaEnFracOut;
520  Var_wGwGSF_Endcap_[30] = TaudCrackEta;
522  }
523  }
524  return mvaValue;
525 }
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
tuple log
Definition: cmsBatch.py:341
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_
double AntiElectronIDMVA6::MVAValue ( const reco::PFTau thePFTau,
const reco::GsfElectron theGsfEle 
)

Definition at line 527 of file AntiElectronIDMVA6.cc.

References reco::GsfElectron::closestCtfTrackRef(), dCrackEta(), dCrackPhi(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::GsfElectron::ecalEnergy(), reco::PFTau::emFraction(), reco::LeafCandidate::eta(), reco::TrackBase::eta(), reco::GsfElectron::gsfTrack(), i, edm::Ref< C, T, F >::isAvailable(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), reco::PFTau::leadPFChargedHadrCand(), cmsBatch::log, bookConverter::max, min(), MVAValue(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::TrackBase::pt(), reco::PFTau::signalPFCands(), reco::PFTau::signalPFChargedHadrCands(), reco::PFTau::signalPFGammaCands(), mathSSE::sqrt(), reco::GsfElectron::superCluster(), reco::GsfElectron::trackMomentumAtVtx(), and reco::GsfElectron::trackMomentumOut().

530 {
531  // === tau variables ===
532  float TauEtaAtEcalEntrance = -99.;
533  float sumEtaTimesEnergy = 0.;
534  float sumEnergy = 0.;
535  const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.signalPFCands();
536  for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
537  pfCandidate != signalPFCands.end(); ++pfCandidate ) {
538  sumEtaTimesEnergy += (*pfCandidate)->positionAtECALEntrance().eta()*(*pfCandidate)->energy();
539  sumEnergy += (*pfCandidate)->energy();
540  }
541  if ( sumEnergy > 0. ) {
542  TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
543  }
544 
545  float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
546  float TauLeadChargedPFCandPt = -99.;
547  for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
548  pfCandidate != signalPFCands.end(); ++pfCandidate ) {
549  const reco::Track* track = 0;
550  if ( (*pfCandidate)->trackRef().isNonnull() ) track = (*pfCandidate)->trackRef().get();
551  else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->innerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->innerTrack().get();
552  else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->globalTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->globalTrack().get();
553  else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->outerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->outerTrack().get();
554  else if ( (*pfCandidate)->gsfTrackRef().isNonnull() ) track = (*pfCandidate)->gsfTrackRef().get();
555  if ( track ) {
556  if ( track->pt() > TauLeadChargedPFCandPt ) {
557  TauLeadChargedPFCandEtaAtEcalEntrance = (*pfCandidate)->positionAtECALEntrance().eta();
558  TauLeadChargedPFCandPt = track->pt();
559  }
560  }
561  }
562 
563  Float_t TauPt = thePFTau.pt();
564  Float_t TauEmFraction = std::max(thePFTau.emFraction(), (Float_t)0.);
565  Float_t TauLeadPFChargedHadrHoP = 0.;
566  Float_t TauLeadPFChargedHadrEoP = 0.;
567  if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
568  TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
569  TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
570  }
571 
572  std::vector<Float_t> GammasdEtaInSigCone;
573  std::vector<Float_t> GammasdPhiInSigCone;
574  std::vector<Float_t> GammasPtInSigCone;
575  std::vector<Float_t> GammasdEtaOutSigCone;
576  std::vector<Float_t> GammasdPhiOutSigCone;
577  std::vector<Float_t> GammasPtOutSigCone;
578  reco::Candidate::LorentzVector pfGammaSum(0,0,0,0);
579  reco::Candidate::LorentzVector pfChargedSum(0,0,0,0);
580 
581  for ( unsigned i = 0 ; i < thePFTau.signalPFGammaCands().size(); ++i ) {
582  reco::PFCandidatePtr gamma = thePFTau.signalPFGammaCands().at(i);
583  float dR = deltaR(gamma->p4(), thePFTau.leadPFChargedHadrCand()->p4());
584  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, thePFTau.pt())));
585 
586  // pfGammas inside the tau signal cone
587  if (dR < signalrad) {
588  if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
589  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
590  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
591  }
592  else {
593  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.eta());
594  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.phi());
595  }
596  GammasPtInSigCone.push_back(gamma->pt());
597  pfGammaSum += gamma->p4();
598  }
599  // pfGammas outside the tau signal cone
600  else {
601  if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
602  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
603  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
604  }
605  else {
606  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.eta());
607  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.phi());
608  }
609  GammasPtOutSigCone.push_back(gamma->pt());
610  }
611  }
612 
613  for ( unsigned i = 0 ; i < thePFTau.signalPFChargedHadrCands().size(); ++i ) {
614  reco::PFCandidatePtr charged = thePFTau.signalPFChargedHadrCands().at(i);
615  float dR = deltaR(charged->p4(), thePFTau.leadPFChargedHadrCand()->p4());
616  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, thePFTau.pt())));
617 
618  // charged particles inside the tau signal cone
619  if (dR < signalrad) {
620  pfChargedSum += charged->p4();
621  }
622  }
623 
624  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
625  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
626  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
627 
628  Float_t TauPhi = thePFTau.phi();
629  float sumPhiTimesEnergy = 0.;
630  float sumEnergyPhi = 0.;
631  for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
632  pfCandidate != signalPFCands.end(); ++pfCandidate ) {
633  sumPhiTimesEnergy += (*pfCandidate)->positionAtECALEntrance().phi()*(*pfCandidate)->energy();
634  sumEnergyPhi += (*pfCandidate)->energy();
635  }
636  if ( sumEnergyPhi > 0. ) {
637  TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
638  }
639  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
640  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
641  Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
642 
643 
644  // === electron variables ===
645  Float_t ElecEta = theGsfEle.eta();
646  Float_t ElecPhi = theGsfEle.phi();
647 
648  //Variables related to the electron Cluster
649  Float_t ElecEe = 0.;
650  Float_t ElecEgamma = 0.;
651  reco::SuperClusterRef pfSuperCluster = theGsfEle.superCluster();
652  if ( pfSuperCluster.isNonnull() && pfSuperCluster.isAvailable() ) {
653  for ( reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin();
654  pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
655  double pfClusterEn = (*pfCluster)->energy();
656  if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
657  else ElecEgamma += pfClusterEn;
658  }
659  }
660 
661  Float_t ElecPin = std::sqrt(theGsfEle.trackMomentumAtVtx().Mag2());
662  Float_t ElecPout = std::sqrt(theGsfEle.trackMomentumOut().Mag2());
663  Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
664  Float_t ElecEecal = theGsfEle.ecalEnergy();
665  Float_t ElecDeltaEta = theGsfEle.deltaEtaSeedClusterTrackAtCalo();
666  Float_t ElecDeltaPhi = theGsfEle.deltaPhiSeedClusterTrackAtCalo();
667  Float_t ElecMvaInSigmaEtaEta = (theGsfEle).mvaInput().sigmaEtaEta;
668  Float_t ElecMvaInHadEnergy = (theGsfEle).mvaInput().hadEnergy;
669  Float_t ElecMvaInDeltaEta = (theGsfEle).mvaInput().deltaEta;
670 
671  //Variables related to the GsfTrack
672  Float_t ElecChi2NormGSF = -99.;
673  Float_t ElecGSFNumHits = -99.;
674  Float_t ElecGSFTrackResol = -99.;
675  Float_t ElecGSFTracklnPt = -99.;
676  if ( theGsfEle.gsfTrack().isNonnull() ) {
677  ElecChi2NormGSF = (theGsfEle).gsfTrack()->normalizedChi2();
678  ElecGSFNumHits = (theGsfEle).gsfTrack()->numberOfValidHits();
679  if ( theGsfEle.gsfTrack()->pt() > 0. ) {
680  ElecGSFTrackResol = theGsfEle.gsfTrack()->ptError()/theGsfEle.gsfTrack()->pt();
681  ElecGSFTracklnPt = log(theGsfEle.gsfTrack()->pt())*M_LN10;
682  }
683  }
684 
685  //Variables related to the CtfTrack
686  Float_t ElecChi2NormKF = -99.;
687  Float_t ElecKFNumHits = -99.;
688  if ( theGsfEle.closestCtfTrackRef().isNonnull() ) {
689  ElecChi2NormKF = (theGsfEle).closestCtfTrackRef()->normalizedChi2();
690  ElecKFNumHits = (theGsfEle).closestCtfTrackRef()->numberOfValidHits();
691  }
692 
693  return MVAValue(TauPt,
694  TauEtaAtEcalEntrance,
695  TauPhi,
696  TauLeadChargedPFCandPt,
697  TauLeadChargedPFCandEtaAtEcalEntrance,
698  TauEmFraction,
699  TauLeadPFChargedHadrHoP,
700  TauLeadPFChargedHadrEoP,
701  TauVisMassIn,
702  TaudCrackEta,
703  TaudCrackPhi,
704  TauHasGsf,
705  TauSignalPFGammaCandsIn,
706  TauSignalPFGammaCandsOut,
707  GammasdEtaInSigCone,
708  GammasdPhiInSigCone,
709  GammasPtInSigCone,
710  GammasdEtaOutSigCone,
711  GammasdPhiOutSigCone,
712  GammasPtOutSigCone,
713  ElecEta,
714  ElecPhi,
715  ElecEtotOverPin,
716  ElecChi2NormGSF,
717  ElecChi2NormKF,
718  ElecGSFNumHits,
719  ElecKFNumHits,
720  ElecGSFTrackResol,
721  ElecGSFTracklnPt,
722  ElecPin,
723  ElecPout,
724  ElecEecal,
725  ElecDeltaEta,
726  ElecDeltaPhi,
727  ElecMvaInSigmaEtaEta,
728  ElecMvaInHadEnergy,
729  ElecMvaInDeltaEta);
730 }
bool isAvailable() const
Definition: Ref.h:576
int i
Definition: DBlmapReader.cc:9
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
const PFCandidatePtr & leadPFChargedHadrCand() const
Definition: PFTau.cc:67
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:289
const std::vector< reco::PFCandidatePtr > & signalPFGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:84
double dCrackPhi(double phi, double eta)
float emFraction() const
Definition: PFTau.cc:227
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
PFCandidates in signal region.
Definition: PFTau.cc:78
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:199
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:638
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:251
T sqrt(T t)
Definition: SSEVec.h:48
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:182
math::XYZVectorF trackMomentumOut() const
Definition: GsfElectron.h:291
double pt() const
track transverse momentum
Definition: TrackBase.h:608
T min(T a, T b)
Definition: MathUtil.h:58
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:169
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:785
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:248
double dCrackEta(double eta)
virtual double phi() const
momentum azimuthal angle
const std::vector< reco::PFCandidatePtr > & signalPFChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:80
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:183
tuple log
Definition: cmsBatch.py:341
double AntiElectronIDMVA6::MVAValue ( const reco::PFTau thePFTau)

Definition at line 732 of file AntiElectronIDMVA6.cc.

References dCrackEta(), dCrackPhi(), deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::PFTau::emFraction(), reco::LeafCandidate::eta(), reco::TrackBase::eta(), i, edm::Ptr< T >::isNonnull(), reco::PFTau::leadPFChargedHadrCand(), bookConverter::max, min(), MVAValue(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::TrackBase::pt(), reco::PFTau::signalPFCands(), reco::PFTau::signalPFChargedHadrCands(), and reco::PFTau::signalPFGammaCands().

733 {
734  // === tau variables ===
735  float TauEtaAtEcalEntrance = -99.;
736  float sumEtaTimesEnergy = 0.;
737  float sumEnergy = 0.;
738  const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.signalPFCands();
739  for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
740  pfCandidate != signalPFCands.end(); ++pfCandidate ) {
741  sumEtaTimesEnergy += (*pfCandidate)->positionAtECALEntrance().eta()*(*pfCandidate)->energy();
742  sumEnergy += (*pfCandidate)->energy();
743  }
744  if ( sumEnergy > 0. ) {
745  TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
746  }
747 
748  float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
749  float TauLeadChargedPFCandPt = -99.;
750  for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
751  pfCandidate != signalPFCands.end(); ++pfCandidate ) {
752  const reco::Track* track = 0;
753  if ( (*pfCandidate)->trackRef().isNonnull() ) track = (*pfCandidate)->trackRef().get();
754  else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->innerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->innerTrack().get();
755  else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->globalTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->globalTrack().get();
756  else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->outerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->outerTrack().get();
757  else if ( (*pfCandidate)->gsfTrackRef().isNonnull() ) track = (*pfCandidate)->gsfTrackRef().get();
758  if ( track ) {
759  if ( track->pt() > TauLeadChargedPFCandPt ) {
760  TauLeadChargedPFCandEtaAtEcalEntrance = (*pfCandidate)->positionAtECALEntrance().eta();
761  TauLeadChargedPFCandPt = track->pt();
762  }
763  }
764  }
765 
766  Float_t TauPt = thePFTau.pt();
767  Float_t TauEmFraction = std::max(thePFTau.emFraction(), (Float_t)0.);
768  Float_t TauLeadPFChargedHadrHoP = 0.;
769  Float_t TauLeadPFChargedHadrEoP = 0.;
770  if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
771  TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
772  TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
773  }
774 
775  std::vector<Float_t> GammasdEtaInSigCone;
776  std::vector<Float_t> GammasdPhiInSigCone;
777  std::vector<Float_t> GammasPtInSigCone;
778  std::vector<Float_t> GammasdEtaOutSigCone;
779  std::vector<Float_t> GammasdPhiOutSigCone;
780  std::vector<Float_t> GammasPtOutSigCone;
781  reco::Candidate::LorentzVector pfGammaSum(0,0,0,0);
782  reco::Candidate::LorentzVector pfChargedSum(0,0,0,0);
783 
784  for ( unsigned i = 0 ; i < thePFTau.signalPFGammaCands().size(); ++i ) {
785  reco::PFCandidatePtr gamma = thePFTau.signalPFGammaCands().at(i);
786  float dR = deltaR(gamma->p4(), thePFTau.leadPFChargedHadrCand()->p4());
787  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, thePFTau.pt())));
788 
789  // pfGammas inside the tau signal cone
790  if (dR < signalrad) {
791  if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
792  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
793  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
794  }
795  else {
796  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.eta());
797  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.phi());
798  }
799  GammasPtInSigCone.push_back(gamma->pt());
800  pfGammaSum += gamma->p4();
801  }
802  // pfGammas outside the tau signal cone
803  else {
804  if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
805  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
806  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
807  }
808  else {
809  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.eta());
810  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.phi());
811  }
812  GammasPtOutSigCone.push_back(gamma->pt());
813  }
814  }
815 
816  for ( unsigned i = 0 ; i < thePFTau.signalPFChargedHadrCands().size(); ++i ) {
817  reco::PFCandidatePtr charged = thePFTau.signalPFChargedHadrCands().at(i);
818  float dR = deltaR(charged->p4(), thePFTau.leadPFChargedHadrCand()->p4());
819  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, thePFTau.pt())));
820 
821  // charged particles inside the tau signal cone
822  if (dR < signalrad) {
823  pfChargedSum += charged->p4();
824  }
825  }
826 
827  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
828  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
829  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
830 
831  Float_t TauPhi = thePFTau.phi();
832  float sumPhiTimesEnergy = 0.;
833  float sumEnergyPhi = 0.;
834  for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
835  pfCandidate != signalPFCands.end(); ++pfCandidate ) {
836  sumPhiTimesEnergy += (*pfCandidate)->positionAtECALEntrance().phi()*(*pfCandidate)->energy();
837  sumEnergyPhi += (*pfCandidate)->energy();
838  }
839  if ( sumEnergyPhi > 0. ) {
840  TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
841  }
842  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
843  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
844  Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
845 
846 
847  // === electron variables ===
848  Float_t dummyElecEta = 9.9;
849 
850  return MVAValue(TauPt,
851  TauEtaAtEcalEntrance,
852  TauPhi,
853  TauLeadChargedPFCandPt,
854  TauLeadChargedPFCandEtaAtEcalEntrance,
855  TauEmFraction,
856  TauLeadPFChargedHadrHoP,
857  TauLeadPFChargedHadrEoP,
858  TauVisMassIn,
859  TaudCrackEta,
860  TaudCrackPhi,
861  TauHasGsf,
862  TauSignalPFGammaCandsIn,
863  TauSignalPFGammaCandsOut,
864  GammasdEtaInSigCone,
865  GammasdPhiInSigCone,
866  GammasPtInSigCone,
867  GammasdEtaOutSigCone,
868  GammasdPhiOutSigCone,
869  GammasPtOutSigCone,
870  dummyElecEta,
871  0.,
872  0.,
873  0.,
874  0.,
875  0.,
876  0.,
877  0.,
878  0.,
879  0.,
880  0.,
881  0.,
882  0.,
883  0.,
884  0.,
885  0.,
886  0.);
887 }
int i
Definition: DBlmapReader.cc:9
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)
float emFraction() const
Definition: PFTau.cc:227
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
PFCandidates in signal region.
Definition: PFTau.cc:78
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:638
double pt() const
track transverse momentum
Definition: TrackBase.h:608
T min(T a, T b)
Definition: MathUtil.h:58
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:169
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
double dCrackEta(double eta)
virtual double phi() const
momentum azimuthal angle
const std::vector< reco::PFCandidatePtr > & signalPFChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:80

Member Data Documentation

edm::FileInPath AntiElectronIDMVA6::inputFileName_
private

Definition at line 132 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

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

Definition at line 161 of file AntiElectronIDMVA6.h.

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

bool AntiElectronIDMVA6::isInitialized_
private

Definition at line 130 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), and MVAValue().

bool AntiElectronIDMVA6::loadMVAfromDB_
private

Definition at line 131 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_wGwoGSF_BL_
private

Definition at line 153 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_wGwoGSF_EC_
private

Definition at line 157 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_woGwoGSF_BL_
private

Definition at line 152 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_woGwoGSF_EC_
private

Definition at line 156 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_wGwGSF_BL_
private

Definition at line 155 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_wGwGSF_EC_
private

Definition at line 159 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_woGwGSF_BL_
private

Definition at line 154 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_woGwGSF_EC_
private

Definition at line 158 of file AntiElectronIDMVA6.h.

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

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_wGwoGSF_BL_
private

Definition at line 135 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_wGwoGSF_EC_
private

Definition at line 139 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_woGwoGSF_BL_
private

Definition at line 134 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_woGwoGSF_EC_
private

Definition at line 138 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_wGwGSF_BL_
private

Definition at line 137 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_wGwGSF_EC_
private

Definition at line 141 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_woGwGSF_BL_
private

Definition at line 136 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_woGwGSF_EC_
private

Definition at line 140 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_wGwoGSF_Barrel_
private

Definition at line 144 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_wGwoGSF_Endcap_
private

Definition at line 148 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_woGwoGSF_Barrel_
private

Definition at line 143 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_woGwoGSF_Endcap_
private

Definition at line 147 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_wGwGSF_Barrel_
private

Definition at line 146 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_wGwGSF_Endcap_
private

Definition at line 150 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_woGwGSF_Barrel_
private

Definition at line 145 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_woGwGSF_Endcap_
private

Definition at line 149 of file AntiElectronIDMVA6.h.

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

int AntiElectronIDMVA6::verbosity_
private

Definition at line 163 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6().