test
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)
 
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_
 
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 34 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:178
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:184
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 1254 of file AntiElectronIDMVA6.cc.

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

Referenced by MVAValue().

1255 {
1256 //--- compute the (unsigned) distance to the closest eta-crack in the ECAL barrel
1257 
1258  // IN: define locations of the eta-cracks
1259  double cracks[5] = { 0., 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00 };
1260 
1261  double retVal = 99.;
1262 
1263  for ( int iCrack = 0; iCrack < 5 ; ++iCrack ) {
1264  double d = minimum(eta - cracks[iCrack], eta + cracks[iCrack]);
1265  if ( std::abs(d) < std::abs(retVal) ) {
1266  retVal = d;
1267  }
1268  }
1269 
1270  return std::abs(retVal);
1271 }
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 1205 of file AntiElectronIDMVA6.cc.

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

Referenced by MVAValue().

1206 {
1207 //--- compute the (unsigned) distance to the closest phi-crack in the ECAL barrel
1208 
1209  constexpr double pi = M_PI; // 3.14159265358979323846;
1210 
1211  // IN: shift of this location if eta < 0
1212  constexpr double delta_cPhi = 0.00638;
1213 
1214  double retVal = 99.;
1215 
1216  if ( eta >= -1.47464 && eta <= 1.47464 ) {
1217 
1218  // the location is shifted
1219  if ( eta < 0. ) phi += delta_cPhi;
1220 
1221  // CV: need to bring-back phi into interval [-pi,+pi]
1222  if ( phi > pi ) phi -= 2.*pi;
1223  if ( phi < -pi ) phi += 2.*pi;
1224 
1225  if ( phi >= -pi && phi <= pi ) {
1226 
1227  // the problem of the extrema:
1228  if ( phi < cPhi[17] || phi >= cPhi[0] ) {
1229  if ( phi < 0. ) phi += 2.*pi;
1230  retVal = minimum(phi - cPhi[0], phi - cPhi[17] - 2.*pi);
1231  } else {
1232  // between these extrema...
1233  bool OK = false;
1234  unsigned iCrack = 16;
1235  while( !OK ) {
1236  if ( phi < cPhi[iCrack] ) {
1237  retVal = minimum(phi - cPhi[iCrack + 1], phi - cPhi[iCrack]);
1238  OK = true;
1239  } else {
1240  iCrack -= 1;
1241  }
1242  }
1243  }
1244  } else {
1245  retVal = 0.; // IN: if there is a problem, we assume that we are in a crack
1246  }
1247  } else {
1248  return -99.;
1249  }
1250 
1251  return std::abs(retVal);
1252 }
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 1182 of file AntiElectronIDMVA6.cc.

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

Referenced by dCrackEta(), and dCrackPhi().

1183 {
1184  if ( std::abs(b) < std::abs(a) ) return b;
1185  else return a;
1186 }
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 i, M_PI, and mathSSE::sqrt().

Referenced by MVAValue().

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

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

299 {
300 
301  if ( !isInitialized_ ) {
302  throw cms::Exception("ClassNotInitialized")
303  << " 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)) : 1.0;
313 
314  if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn == 0 && TauHasGsf < 0.5) {
315  if ( std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
316  Var_NoEleMatch_woGwoGSF_Barrel_[0] = TauEtaAtEcalEntrance;
317  Var_NoEleMatch_woGwoGSF_Barrel_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
318  Var_NoEleMatch_woGwoGSF_Barrel_[2] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
319  Var_NoEleMatch_woGwoGSF_Barrel_[3] = std::log(std::max(float(1.), TauPt));
320  Var_NoEleMatch_woGwoGSF_Barrel_[4] = TauEmFraction;
321  Var_NoEleMatch_woGwoGSF_Barrel_[5] = TauLeadPFChargedHadrHoP;
322  Var_NoEleMatch_woGwoGSF_Barrel_[6] = TauLeadPFChargedHadrEoP;
323  Var_NoEleMatch_woGwoGSF_Barrel_[7] = TauVisMassIn;
324  Var_NoEleMatch_woGwoGSF_Barrel_[8] = TaudCrackEta;
325  Var_NoEleMatch_woGwoGSF_Barrel_[9] = TaudCrackPhi;
327  } else {
328  Var_NoEleMatch_woGwoGSF_Endcap_[0] = TauEtaAtEcalEntrance;
329  Var_NoEleMatch_woGwoGSF_Endcap_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
330  Var_NoEleMatch_woGwoGSF_Endcap_[2] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
331  Var_NoEleMatch_woGwoGSF_Endcap_[3] = std::log(std::max(float(1.), TauPt));
332  Var_NoEleMatch_woGwoGSF_Endcap_[4] = TauEmFraction;
333  Var_NoEleMatch_woGwoGSF_Endcap_[5] = TauLeadPFChargedHadrHoP;
334  Var_NoEleMatch_woGwoGSF_Endcap_[6] = TauLeadPFChargedHadrEoP;
335  Var_NoEleMatch_woGwoGSF_Endcap_[7] = TauVisMassIn;
336  Var_NoEleMatch_woGwoGSF_Endcap_[8] = TaudCrackEta;
338  }
339  }
340  else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCandsIn > 0 && TauHasGsf < 0.5 ) {
341  if ( std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
342  Var_NoEleMatch_wGwoGSF_Barrel_[0] = TauEtaAtEcalEntrance;
343  Var_NoEleMatch_wGwoGSF_Barrel_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
344  Var_NoEleMatch_wGwoGSF_Barrel_[2] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
345  Var_NoEleMatch_wGwoGSF_Barrel_[3] = std::log(std::max(float(1.), TauPt));
346  Var_NoEleMatch_wGwoGSF_Barrel_[4] = TauEmFraction;
347  Var_NoEleMatch_wGwoGSF_Barrel_[5] = TauSignalPFGammaCandsIn;
348  Var_NoEleMatch_wGwoGSF_Barrel_[6] = TauSignalPFGammaCandsOut;
349  Var_NoEleMatch_wGwoGSF_Barrel_[7] = TauLeadPFChargedHadrHoP;
350  Var_NoEleMatch_wGwoGSF_Barrel_[8] = TauLeadPFChargedHadrEoP;
351  Var_NoEleMatch_wGwoGSF_Barrel_[9] = TauVisMassIn;
352  Var_NoEleMatch_wGwoGSF_Barrel_[10] = TauGammaEtaMomIn;
353  Var_NoEleMatch_wGwoGSF_Barrel_[11] = TauGammaEtaMomOut;
354  Var_NoEleMatch_wGwoGSF_Barrel_[12] = TauGammaPhiMomIn;
355  Var_NoEleMatch_wGwoGSF_Barrel_[13] = TauGammaPhiMomOut;
356  Var_NoEleMatch_wGwoGSF_Barrel_[14] = TauGammaEnFracIn;
357  Var_NoEleMatch_wGwoGSF_Barrel_[15] = TauGammaEnFracOut;
358  Var_NoEleMatch_wGwoGSF_Barrel_[16] = TaudCrackEta;
359  Var_NoEleMatch_wGwoGSF_Barrel_[17] = TaudCrackPhi;
361  } else {
362  Var_NoEleMatch_wGwoGSF_Endcap_[0] = TauEtaAtEcalEntrance;
363  Var_NoEleMatch_wGwoGSF_Endcap_[1] = TauLeadChargedPFCandEtaAtEcalEntrance;
364  Var_NoEleMatch_wGwoGSF_Endcap_[2] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
365  Var_NoEleMatch_wGwoGSF_Endcap_[3] = std::log(std::max(float(1.), TauPt));
366  Var_NoEleMatch_wGwoGSF_Endcap_[4] = TauEmFraction;
367  Var_NoEleMatch_wGwoGSF_Endcap_[5] = TauSignalPFGammaCandsIn;
368  Var_NoEleMatch_wGwoGSF_Endcap_[6] = TauSignalPFGammaCandsOut;
369  Var_NoEleMatch_wGwoGSF_Endcap_[7] = TauLeadPFChargedHadrHoP;
370  Var_NoEleMatch_wGwoGSF_Endcap_[8] = TauLeadPFChargedHadrEoP;
371  Var_NoEleMatch_wGwoGSF_Endcap_[9] = TauVisMassIn;
372  Var_NoEleMatch_wGwoGSF_Endcap_[10] = TauGammaEtaMomIn;
373  Var_NoEleMatch_wGwoGSF_Endcap_[11] = TauGammaEtaMomOut;
374  Var_NoEleMatch_wGwoGSF_Endcap_[12] = TauGammaPhiMomIn;
375  Var_NoEleMatch_wGwoGSF_Endcap_[13] = TauGammaPhiMomOut;
376  Var_NoEleMatch_wGwoGSF_Endcap_[14] = TauGammaEnFracIn;
377  Var_NoEleMatch_wGwoGSF_Endcap_[15] = TauGammaEnFracOut;
378  Var_NoEleMatch_wGwoGSF_Endcap_[16] = TaudCrackEta;
380  }
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(ElecChi2NormGSF);
386  Var_woGwGSF_Barrel_[2] = ElecGSFNumHits;
387  Var_woGwGSF_Barrel_[3] = std::log(ElecGSFTrackResol);
388  Var_woGwGSF_Barrel_[4] = ElecGSFTracklnPt;
389  Var_woGwGSF_Barrel_[5] = ElecNumHitsDiffOverSum;
390  Var_woGwGSF_Barrel_[6] = std::log(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(ElecChi2NormGSF);
412  Var_woGwGSF_Endcap_[2] = ElecGSFNumHits;
413  Var_woGwGSF_Endcap_[3] = std::log(ElecGSFTrackResol);
414  Var_woGwGSF_Endcap_[4] = ElecGSFTracklnPt;
415  Var_woGwGSF_Endcap_[5] = ElecNumHitsDiffOverSum;
416  Var_woGwGSF_Endcap_[6] = std::log(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  }
436  else if ( TauSignalPFGammaCandsIn > 0 && TauHasGsf > 0.5 ) {
437  if ( std::abs(TauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ) {
438  Var_wGwGSF_Barrel_[0] = std::max(float(-0.1), ElecEtotOverPin);
439  Var_wGwGSF_Barrel_[1] = std::log(ElecChi2NormGSF);
440  Var_wGwGSF_Barrel_[2] = ElecGSFNumHits;
441  Var_wGwGSF_Barrel_[3] = std::log(ElecGSFTrackResol);
442  Var_wGwGSF_Barrel_[4] = ElecGSFTracklnPt;
443  Var_wGwGSF_Barrel_[5] = ElecNumHitsDiffOverSum;
444  Var_wGwGSF_Barrel_[6] = std::log(ElecChi2NormKF);
445  Var_wGwGSF_Barrel_[7] = std::min(ElecDeltaPinPoutOverPin, float(1.));
446  Var_wGwGSF_Barrel_[8] = std::min(ElecEecalOverPout, float(20.));
447  Var_wGwGSF_Barrel_[9] = ElecDeltaEta;
448  Var_wGwGSF_Barrel_[10] = ElecDeltaPhi;
449  Var_wGwGSF_Barrel_[11] = std::min(ElecMvaInSigmaEtaEta, float(0.01));
450  Var_wGwGSF_Barrel_[12] = std::min(ElecMvaInHadEnergy, float(20.));
451  Var_wGwGSF_Barrel_[13] = std::min(ElecMvaInDeltaEta, float(0.1));
452  Var_wGwGSF_Barrel_[14] = TauEtaAtEcalEntrance;
453  Var_wGwGSF_Barrel_[15] = TauLeadChargedPFCandEtaAtEcalEntrance;
454  Var_wGwGSF_Barrel_[16] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
455  Var_wGwGSF_Barrel_[17] = std::log(std::max(float(1.), TauPt));
456  Var_wGwGSF_Barrel_[18] = TauEmFraction;
457  Var_wGwGSF_Barrel_[19] = TauSignalPFGammaCandsIn;
458  Var_wGwGSF_Barrel_[20] = TauSignalPFGammaCandsOut;
459  Var_wGwGSF_Barrel_[21] = TauLeadPFChargedHadrHoP;
460  Var_wGwGSF_Barrel_[22] = TauLeadPFChargedHadrEoP;
461  Var_wGwGSF_Barrel_[23] = TauVisMassIn;
462  Var_wGwGSF_Barrel_[24] = TauGammaEtaMomIn;
463  Var_wGwGSF_Barrel_[25] = TauGammaEtaMomOut;
464  Var_wGwGSF_Barrel_[26] = TauGammaPhiMomIn;
465  Var_wGwGSF_Barrel_[27] = TauGammaPhiMomOut;
466  Var_wGwGSF_Barrel_[28] = TauGammaEnFracIn;
467  Var_wGwGSF_Barrel_[29] = TauGammaEnFracOut;
468  Var_wGwGSF_Barrel_[30] = TaudCrackEta;
469  Var_wGwGSF_Barrel_[31] = TaudCrackPhi;
471  } else {
472  Var_wGwGSF_Endcap_[0] = std::max(float(-0.1), ElecEtotOverPin);
473  Var_wGwGSF_Endcap_[1] = std::log(ElecChi2NormGSF);
474  Var_wGwGSF_Endcap_[2] = ElecGSFNumHits;
475  Var_wGwGSF_Endcap_[3] = std::log(ElecGSFTrackResol);
476  Var_wGwGSF_Endcap_[4] = ElecGSFTracklnPt;
477  Var_wGwGSF_Endcap_[5] = ElecNumHitsDiffOverSum;
478  Var_wGwGSF_Endcap_[6] = std::log(ElecChi2NormKF);
479  Var_wGwGSF_Endcap_[7] = std::min(ElecDeltaPinPoutOverPin, float(1.));
480  Var_wGwGSF_Endcap_[8] = std::min(ElecEecalOverPout, float(20.));
481  Var_wGwGSF_Endcap_[9] = ElecDeltaEta;
482  Var_wGwGSF_Endcap_[10] = ElecDeltaPhi;
483  Var_wGwGSF_Endcap_[11] = std::min(ElecMvaInSigmaEtaEta, float(0.01));
484  Var_wGwGSF_Endcap_[12] = std::min(ElecMvaInHadEnergy, float(20.));
485  Var_wGwGSF_Endcap_[13] = std::min(ElecMvaInDeltaEta, float(0.1));
486  Var_wGwGSF_Endcap_[14] = TauEtaAtEcalEntrance;
487  Var_wGwGSF_Endcap_[15] = TauLeadChargedPFCandEtaAtEcalEntrance;
488  Var_wGwGSF_Endcap_[16] = std::min(float(2.), TauLeadChargedPFCandPt/std::max(float(1.), TauPt));
489  Var_wGwGSF_Endcap_[17] = std::log(std::max(float(1.), TauPt));
490  Var_wGwGSF_Endcap_[18] = TauEmFraction;
491  Var_wGwGSF_Endcap_[19] = TauSignalPFGammaCandsIn;
492  Var_wGwGSF_Endcap_[20] = TauSignalPFGammaCandsOut;
493  Var_wGwGSF_Endcap_[21] = TauLeadPFChargedHadrHoP;
494  Var_wGwGSF_Endcap_[22] = TauLeadPFChargedHadrEoP;
495  Var_wGwGSF_Endcap_[23] = TauVisMassIn;
496  Var_wGwGSF_Endcap_[24] = TauGammaEtaMomIn;
497  Var_wGwGSF_Endcap_[25] = TauGammaEtaMomOut;
498  Var_wGwGSF_Endcap_[26] = TauGammaPhiMomIn;
499  Var_wGwGSF_Endcap_[27] = TauGammaPhiMomOut;
500  Var_wGwGSF_Endcap_[28] = TauGammaEnFracIn;
501  Var_wGwGSF_Endcap_[29] = TauGammaEnFracOut;
502  Var_wGwGSF_Endcap_[30] = TaudCrackEta;
504  }
505  }
506  return mvaValue;
507 }
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 509 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(), dqm-mbProfile::log, ResonanceBuilder::mass, 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().

512 {
513  // === tau variables ===
514  float TauEtaAtEcalEntrance = -99.;
515  float sumEtaTimesEnergy = 0.;
516  float sumEnergy = 0.;
517  const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.signalPFCands();
518  for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
519  pfCandidate != signalPFCands.end(); ++pfCandidate ) {
520  sumEtaTimesEnergy += (*pfCandidate)->positionAtECALEntrance().eta()*(*pfCandidate)->energy();
521  sumEnergy += (*pfCandidate)->energy();
522  }
523  if ( sumEnergy > 0. ) {
524  TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
525  }
526 
527  float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
528  float TauLeadChargedPFCandPt = -99.;
529  for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
530  pfCandidate != signalPFCands.end(); ++pfCandidate ) {
531  const reco::Track* track = 0;
532  if ( (*pfCandidate)->trackRef().isNonnull() ) track = (*pfCandidate)->trackRef().get();
533  else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->innerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->innerTrack().get();
534  else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->globalTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->globalTrack().get();
535  else if ( (*pfCandidate)->muonRef().isNonnull() && (*pfCandidate)->muonRef()->outerTrack().isNonnull() ) track = (*pfCandidate)->muonRef()->outerTrack().get();
536  else if ( (*pfCandidate)->gsfTrackRef().isNonnull() ) track = (*pfCandidate)->gsfTrackRef().get();
537  if ( track ) {
538  if ( track->pt() > TauLeadChargedPFCandPt ) {
539  TauLeadChargedPFCandEtaAtEcalEntrance = (*pfCandidate)->positionAtECALEntrance().eta();
540  TauLeadChargedPFCandPt = track->pt();
541  }
542  }
543  }
544 
545  Float_t TauPt = thePFTau.pt();
546  Float_t TauEmFraction = std::max(thePFTau.emFraction(), (Float_t)0.);
547  Float_t TauLeadPFChargedHadrHoP = 0.;
548  Float_t TauLeadPFChargedHadrEoP = 0.;
549  if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
550  TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
551  TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
552  }
553 
554  std::vector<Float_t> GammasdEtaInSigCone;
555  std::vector<Float_t> GammasdPhiInSigCone;
556  std::vector<Float_t> GammasPtInSigCone;
557  std::vector<Float_t> GammasdEtaOutSigCone;
558  std::vector<Float_t> GammasdPhiOutSigCone;
559  std::vector<Float_t> GammasPtOutSigCone;
560  reco::Candidate::LorentzVector pfGammaSum(0,0,0,0);
561  reco::Candidate::LorentzVector pfChargedSum(0,0,0,0);
562 
563  for ( unsigned i = 0 ; i < thePFTau.signalPFGammaCands().size(); ++i ) {
564  reco::PFCandidatePtr gamma = thePFTau.signalPFGammaCands().at(i);
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  }
574  else {
575  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.eta());
576  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.phi());
577  }
578  GammasPtInSigCone.push_back(gamma->pt());
579  pfGammaSum += gamma->p4();
580  }
581  // pfGammas outside the tau signal cone
582  else {
583  if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
584  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
585  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
586  }
587  else {
588  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.eta());
589  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.phi());
590  }
591  GammasPtOutSigCone.push_back(gamma->pt());
592  }
593  }
594 
595  for ( unsigned i = 0 ; i < thePFTau.signalPFChargedHadrCands().size(); ++i ) {
596  reco::PFCandidatePtr charged = thePFTau.signalPFChargedHadrCands().at(i);
597  float dR = deltaR(charged->p4(), thePFTau.leadPFChargedHadrCand()->p4());
598  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, thePFTau.pt())));
599 
600  // charged particles inside the tau signal cone
601  if (dR < signalrad) {
602  pfChargedSum += charged->p4();
603  }
604  }
605 
606  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
607  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
608  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
609 
610  Float_t TauPhi = thePFTau.phi();
611  float sumPhiTimesEnergy = 0.;
612  float sumEnergyPhi = 0.;
613  for ( std::vector<reco::PFCandidatePtr>::const_iterator pfCandidate = signalPFCands.begin();
614  pfCandidate != signalPFCands.end(); ++pfCandidate ) {
615  sumPhiTimesEnergy += (*pfCandidate)->positionAtECALEntrance().phi()*(*pfCandidate)->energy();
616  sumEnergyPhi += (*pfCandidate)->energy();
617  }
618  if ( sumEnergyPhi > 0. ) {
619  TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
620  }
621  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
622  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
623  Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
624 
625 
626  // === electron variables ===
627  Float_t ElecEta = theGsfEle.eta();
628  Float_t ElecPhi = theGsfEle.phi();
629 
630  //Variables related to the electron Cluster
631  Float_t ElecEe = 0.;
632  Float_t ElecEgamma = 0.;
633  reco::SuperClusterRef pfSuperCluster = theGsfEle.superCluster();
634  if ( pfSuperCluster.isNonnull() && pfSuperCluster.isAvailable() ) {
635  for ( reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin();
636  pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
637  double pfClusterEn = (*pfCluster)->energy();
638  if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
639  else ElecEgamma += pfClusterEn;
640  }
641  }
642 
643  Float_t ElecPin = std::sqrt(theGsfEle.trackMomentumAtVtx().Mag2());
644  Float_t ElecPout = std::sqrt(theGsfEle.trackMomentumOut().Mag2());
645  Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
646  Float_t ElecEecal = theGsfEle.ecalEnergy();
647  Float_t ElecDeltaEta = theGsfEle.deltaEtaSeedClusterTrackAtCalo();
648  Float_t ElecDeltaPhi = theGsfEle.deltaPhiSeedClusterTrackAtCalo();
649  Float_t ElecMvaInSigmaEtaEta = (theGsfEle).mvaInput().sigmaEtaEta;
650  Float_t ElecMvaInHadEnergy = (theGsfEle).mvaInput().hadEnergy;
651  Float_t ElecMvaInDeltaEta = (theGsfEle).mvaInput().deltaEta;
652 
653  //Variables related to the GsfTrack
654  Float_t ElecChi2NormGSF = -99.;
655  Float_t ElecGSFNumHits = -99.;
656  Float_t ElecGSFTrackResol = -99.;
657  Float_t ElecGSFTracklnPt = -99.;
658  if ( theGsfEle.gsfTrack().isNonnull() ) {
659  ElecChi2NormGSF = (theGsfEle).gsfTrack()->normalizedChi2();
660  ElecGSFNumHits = (theGsfEle).gsfTrack()->numberOfValidHits();
661  if ( theGsfEle.gsfTrack()->pt() > 0. ) {
662  ElecGSFTrackResol = theGsfEle.gsfTrack()->ptError()/theGsfEle.gsfTrack()->pt();
663  ElecGSFTracklnPt = log(theGsfEle.gsfTrack()->pt())*M_LN10;
664  }
665  }
666 
667  //Variables related to the CtfTrack
668  Float_t ElecChi2NormKF = -99.;
669  Float_t ElecKFNumHits = -99.;
670  if ( theGsfEle.closestCtfTrackRef().isNonnull() ) {
671  ElecChi2NormKF = (theGsfEle).closestCtfTrackRef()->normalizedChi2();
672  ElecKFNumHits = (theGsfEle).closestCtfTrackRef()->numberOfValidHits();
673  }
674 
675  return MVAValue(TauPt,
676  TauEtaAtEcalEntrance,
677  TauPhi,
678  TauLeadChargedPFCandPt,
679  TauLeadChargedPFCandEtaAtEcalEntrance,
680  TauEmFraction,
681  TauLeadPFChargedHadrHoP,
682  TauLeadPFChargedHadrEoP,
683  TauVisMassIn,
684  TaudCrackEta,
685  TaudCrackPhi,
686  TauHasGsf,
687  TauSignalPFGammaCandsIn,
688  TauSignalPFGammaCandsOut,
689  GammasdEtaInSigCone,
690  GammasdPhiInSigCone,
691  GammasPtInSigCone,
692  GammasdEtaOutSigCone,
693  GammasdPhiOutSigCone,
694  GammasPtOutSigCone,
695  ElecEta,
696  ElecPhi,
697  ElecEtotOverPin,
698  ElecChi2NormGSF,
699  ElecChi2NormKF,
700  ElecGSFNumHits,
701  ElecKFNumHits,
702  ElecGSFTrackResol,
703  ElecGSFTracklnPt,
704  ElecPin,
705  ElecPout,
706  ElecEecal,
707  ElecDeltaEta,
708  ElecDeltaPhi,
709  ElecMvaInSigmaEtaEta,
710  ElecMvaInHadEnergy,
711  ElecMvaInDeltaEta);
712 }
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
virtual double phi() const final
momentum azimuthal angle
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
TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:199
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:646
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:251
T sqrt(T t)
Definition: SSEVec.h:18
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:616
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
virtual double eta() const final
momentum pseudorapidity
double dCrackEta(double eta)
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
virtual double pt() const final
transverse momentum
double AntiElectronIDMVA6::MVAValue ( const reco::PFTau thePFTau)

Definition at line 714 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(), ResonanceBuilder::mass, bookConverter::max, min(), MVAValue(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::TrackBase::pt(), reco::PFTau::signalPFCands(), reco::PFTau::signalPFChargedHadrCands(), and reco::PFTau::signalPFGammaCands().

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

Definition at line 871 of file AntiElectronIDMVA6.cc.

References funct::abs(), edm::PtrVector< T >::begin(), pat::Electron::closestCtfTrackRef(), compareJSON::const, dCrackEta(), dCrackPhi(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::GsfElectron::ecalEnergy(), pat::Tau::ecalEnergyLeadChargedHadrCand(), pat::Tau::emFraction_MVA(), edm::PtrVector< T >::end(), reco::LeafCandidate::eta(), pat::Tau::etaAtEcalEntrance(), pat::Tau::etaAtEcalEntranceLeadChargedCand(), edm::Ptr< T >::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(), dqm-mbProfile::log, ResonanceBuilder::mass, bookConverter::max, min(), MVAValue(), pat::PackedCandidate::pdgId(), reco::LeafCandidate::phi(), pat::Tau::phiAtEcalEntrance(), reco::LeafCandidate::pt(), pat::Tau::ptLeadChargedCand(), pat::Tau::signalChargedHadrCands(), pat::Tau::signalGammaCands(), mathSSE::sqrt(), pat::Electron::superCluster(), reco::GsfElectron::trackMomentumAtVtx(), and reco::GsfElectron::trackMomentumOut().

872 {
873  // === tau variables ===
874  float TauEtaAtEcalEntrance = theTau.etaAtEcalEntrance();
875 
876  float TauLeadChargedPFCandEtaAtEcalEntrance = theTau.etaAtEcalEntranceLeadChargedCand();
877  float TauLeadChargedPFCandPt = theTau.ptLeadChargedCand();
878 
879  Float_t TauPt = theTau.pt();
880  //Float_t TauEmFraction = std::max(theTau.ecalEnergy()/(theTau.ecalEnergy()+theTau.hcalEnergy()), (Float_t)0.);
881  Float_t TauEmFraction = std::max(theTau.emFraction_MVA(), (Float_t)0.);
882  Float_t TauLeadPFChargedHadrHoP = 0.;
883  Float_t TauLeadPFChargedHadrEoP = 0.;
884  if ( theTau.leadChargedHadrCand()->p() > 0. ) {
885  TauLeadPFChargedHadrHoP = theTau.hcalEnergyLeadChargedHadrCand()/theTau.leadChargedHadrCand()->p();
886  TauLeadPFChargedHadrEoP = theTau.ecalEnergyLeadChargedHadrCand()/theTau.leadChargedHadrCand()->p();
887  }
888 
889  std::vector<Float_t> GammasdEtaInSigCone;
890  std::vector<Float_t> GammasdPhiInSigCone;
891  std::vector<Float_t> GammasPtInSigCone;
892  std::vector<Float_t> GammasdEtaOutSigCone;
893  std::vector<Float_t> GammasdPhiOutSigCone;
894  std::vector<Float_t> GammasPtOutSigCone;
895  reco::Candidate::LorentzVector pfGammaSum(0,0,0,0);
896  reco::Candidate::LorentzVector pfChargedSum(0,0,0,0);
897 
898  const reco::CandidatePtrVector signalGammaCands = theTau.signalGammaCands();
899  for ( reco::CandidatePtrVector::const_iterator gamma = signalGammaCands.begin(); gamma != signalGammaCands.end(); ++gamma ){
900  float dR = deltaR((*gamma)->p4(), theTau.leadChargedHadrCand()->p4());
901  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, theTau.pt())));
902 
903  // pfGammas inside the tau signal cone
904  if (dR < signalrad) {
905  if ( theTau.leadChargedHadrCand().isNonnull() ) {
906  GammasdEtaInSigCone.push_back((*gamma)->eta() - theTau.leadChargedHadrCand()->eta());
907  GammasdPhiInSigCone.push_back((*gamma)->phi() - theTau.leadChargedHadrCand()->phi());
908  //A.-C. please chaekc whether this change is safe against future trainings
909  //GammasdPhiInSigCone.push_back(deltaPhi((*gamma)->phi(), theTau.leadChargedHadrCand()->phi()));
910  }
911  else {
912  GammasdEtaInSigCone.push_back((*gamma)->eta() - theTau.eta());
913  GammasdPhiInSigCone.push_back((*gamma)->phi() - theTau.phi());
914  //A.-C. please chaekc whether this change is safe against future trainings
915  //GammasdPhiInSigCone.push_back(deltaPhi((*gamma)->phi(), theTau.phi()));
916  }
917  GammasPtInSigCone.push_back((*gamma)->pt());
918  pfGammaSum += (*gamma)->p4();
919  }
920  // pfGammas outside the tau signal cone
921  else {
922  if ( theTau.leadChargedHadrCand().isNonnull() ) {
923  GammasdEtaOutSigCone.push_back((*gamma)->eta() - theTau.leadChargedHadrCand()->eta());
924  GammasdPhiOutSigCone.push_back((*gamma)->phi() - theTau.leadChargedHadrCand()->phi());
925  //A.-C. please chaekc whether this change is safe against future trainings
926  //GammasdPhiOutSigCone.push_back(deltaPhi((*gamma)->phi(), theTau.leadChargedHadrCand()->phi()));
927  }
928  else {
929  GammasdEtaOutSigCone.push_back((*gamma)->eta() - theTau.eta());
930  GammasdPhiOutSigCone.push_back((*gamma)->phi() - theTau.phi());
931  //A.-C. please chaekc whether this change is safe against future trainings
932  //GammasdPhiOutSigCone.push_back(deltaPhi((*gamma)->phi(), theTau.phi()));
933  }
934  GammasPtOutSigCone.push_back((*gamma)->pt());
935  }
936  }
937 
938  const reco::CandidatePtrVector signalChargedCands = theTau.signalChargedHadrCands();
939  for ( reco::CandidatePtrVector::const_iterator charged = signalChargedCands.begin(); charged != signalChargedCands.end(); ++charged ){
940  float dR = deltaR((*charged)->p4(), theTau.leadChargedHadrCand()->p4());
941  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, theTau.pt())));
942 
943  // charged particles inside the tau signal cone
944  if (dR < signalrad) {
945  pfChargedSum += (*charged)->p4();
946  }
947  }
948 
949  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
950  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
951  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
952 
953  Float_t TauPhi = theTau.phi();
954 
955  if ( theTau.phiAtEcalEntrance() != -99. ) {
956  TauPhi = theTau.phiAtEcalEntrance();
957  }
958  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
959  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
960 
961  Float_t TauHasGsf = 0;
962  pat::PackedCandidate const* packedLeadTauCand = dynamic_cast<pat::PackedCandidate const*>(theTau.leadChargedHadrCand().get());
963  //const reco::Track & pseudoTrack = packedLeadTauCand->pseudoTrack();
964  if( abs(packedLeadTauCand->pdgId()) == 11 ) TauHasGsf = 1;
965 
966  // === electron variables ===
967  Float_t ElecEta = theEle.eta();
968  Float_t ElecPhi = theEle.phi();
969 
970  //Variables related to the electron Cluster
971  Float_t ElecEe = 0.;
972  Float_t ElecEgamma = 0.;
973  reco::SuperClusterRef pfSuperCluster = theEle.superCluster();
974  if ( pfSuperCluster.isNonnull() && pfSuperCluster.isAvailable() ) {
975  for ( reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin(); pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
976  double pfClusterEn = (*pfCluster)->energy();
977  if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
978  else ElecEgamma += pfClusterEn;
979  }
980  }
981 
982  Float_t ElecPin = std::sqrt(theEle.trackMomentumAtVtx().Mag2());
983  Float_t ElecPout = std::sqrt(theEle.trackMomentumOut().Mag2());
984  Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
985  Float_t ElecEecal = theEle.ecalEnergy();
986  Float_t ElecDeltaEta = theEle.deltaEtaSeedClusterTrackAtCalo();
987  Float_t ElecDeltaPhi = theEle.deltaPhiSeedClusterTrackAtCalo();
988  Float_t ElecMvaInSigmaEtaEta = (theEle).mvaInput().sigmaEtaEta;
989  Float_t ElecMvaInHadEnergy = (theEle).mvaInput().hadEnergy;
990  Float_t ElecMvaInDeltaEta = (theEle).mvaInput().deltaEta;
991 
992  //Variables related to the GsfTrack
993  Float_t ElecChi2NormGSF = -99.;
994  Float_t ElecGSFNumHits = -99.;
995  Float_t ElecGSFTrackResol = -99.;
996  Float_t ElecGSFTracklnPt = -99.;
997  if ( theEle.gsfTrack().isNonnull() ) {
998  ElecChi2NormGSF = (theEle).gsfTrack()->normalizedChi2();
999  ElecGSFNumHits = (theEle).gsfTrack()->numberOfValidHits();
1000  if ( theEle.gsfTrack()->pt() > 0. ) {
1001  ElecGSFTrackResol = theEle.gsfTrack()->ptError()/theEle.gsfTrack()->pt();
1002  ElecGSFTracklnPt = log(theEle.gsfTrack()->pt())*M_LN10;
1003  }
1004  }
1005 
1006  //Variables related to the CtfTrack
1007  Float_t ElecChi2NormKF = -99.;
1008  Float_t ElecKFNumHits = -99.;
1009  if ( theEle.closestCtfTrackRef().isNonnull() ) {
1010  ElecChi2NormKF = (theEle).closestCtfTrackRef()->normalizedChi2();
1011  ElecKFNumHits = (theEle).closestCtfTrackRef()->numberOfValidHits();
1012  }
1013 
1014  return MVAValue(TauPt,
1015  TauEtaAtEcalEntrance,
1016  TauPhi,
1017  TauLeadChargedPFCandPt,
1018  TauLeadChargedPFCandEtaAtEcalEntrance,
1019  TauEmFraction,
1020  TauLeadPFChargedHadrHoP,
1021  TauLeadPFChargedHadrEoP,
1022  TauVisMassIn,
1023  TaudCrackEta,
1024  TaudCrackPhi,
1025  TauHasGsf,
1026  TauSignalPFGammaCandsIn,
1027  TauSignalPFGammaCandsOut,
1028  GammasdEtaInSigCone,
1029  GammasdPhiInSigCone,
1030  GammasPtInSigCone,
1031  GammasdEtaOutSigCone,
1032  GammasdPhiOutSigCone,
1033  GammasPtOutSigCone,
1034  ElecEta,
1035  ElecPhi,
1036  ElecEtotOverPin,
1037  ElecChi2NormGSF,
1038  ElecChi2NormKF,
1039  ElecGSFNumHits,
1040  ElecKFNumHits,
1041  ElecGSFTrackResol,
1042  ElecGSFTracklnPt,
1043  ElecPin,
1044  ElecPout,
1045  ElecEecal,
1046  ElecDeltaEta,
1047  ElecDeltaPhi,
1048  ElecMvaInSigmaEtaEta,
1049  ElecMvaInHadEnergy,
1050  ElecMvaInDeltaEta);
1051 }
bool isAvailable() const
Definition: Ref.h:576
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
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:160
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:289
virtual double phi() const final
momentum azimuthal angle
double dCrackPhi(double phi, double eta)
reco::CandidatePtrVector signalGammaCands() const
const_iterator begin() const
Definition: PtrVector.h:130
reco::SuperClusterRef superCluster() const
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
reco::GsfTrackRef gsfTrack() const
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
reco::TrackRef closestCtfTrackRef() const
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:251
T sqrt(T t)
Definition: SSEVec.h:18
math::XYZVectorF trackMomentumOut() const
Definition: GsfElectron.h:291
float ecalEnergyLeadChargedHadrCand() const
Definition: Tau.h:343
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const_iterator end() const
Definition: PtrVector.h:135
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:169
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)
string const
Definition: compareJSON.py:14
float ecalEnergy() const
Definition: GsfElectron.h:785
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:248
reco::CandidatePtrVector signalChargedHadrCands() const
virtual double eta() const final
momentum pseudorapidity
float etaAtEcalEntrance() const
return etaAtEcalEntrance
Definition: Tau.h:349
float etaAtEcalEntranceLeadChargedCand() const
return etaAtEcalEntrance from LeadChargedCand
Definition: Tau.h:351
double dCrackEta(double eta)
virtual int pdgId() const
PDG identifier.
virtual double pt() const final
transverse momentum
double AntiElectronIDMVA6::MVAValue ( const pat::Tau theTau)

Definition at line 1053 of file AntiElectronIDMVA6.cc.

References funct::abs(), edm::PtrVector< T >::begin(), compareJSON::const, dCrackEta(), dCrackPhi(), deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, pat::Tau::ecalEnergyLeadChargedHadrCand(), pat::Tau::emFraction_MVA(), edm::PtrVector< T >::end(), reco::LeafCandidate::eta(), pat::Tau::etaAtEcalEntrance(), pat::Tau::etaAtEcalEntranceLeadChargedCand(), edm::Ptr< T >::get(), pat::Tau::hcalEnergyLeadChargedHadrCand(), edm::Ptr< T >::isNonnull(), pat::Tau::leadChargedHadrCand(), ResonanceBuilder::mass, bookConverter::max, min(), MVAValue(), pat::PackedCandidate::pdgId(), reco::LeafCandidate::phi(), pat::Tau::phiAtEcalEntrance(), reco::LeafCandidate::pt(), pat::Tau::ptLeadChargedCand(), pat::Tau::signalChargedHadrCands(), and pat::Tau::signalGammaCands().

1054 {
1055  // === tau variables ===
1056  float TauEtaAtEcalEntrance = theTau.etaAtEcalEntrance();
1057 
1058  float TauLeadChargedPFCandEtaAtEcalEntrance = theTau.etaAtEcalEntranceLeadChargedCand();
1059  float TauLeadChargedPFCandPt = theTau.ptLeadChargedCand();
1060 
1061  Float_t TauPt = theTau.pt();
1062  //Float_t TauEmFraction = std::max(theTau.ecalEnergy()/(theTau.ecalEnergy()+theTau.hcalEnergy()), (Float_t)0.);
1063  Float_t TauEmFraction = std::max(theTau.emFraction_MVA(), (Float_t)0.);
1064  Float_t TauLeadPFChargedHadrHoP = 0.;
1065  Float_t TauLeadPFChargedHadrEoP = 0.;
1066  if ( theTau.leadChargedHadrCand()->p() > 0. ) {
1067  TauLeadPFChargedHadrHoP = theTau.hcalEnergyLeadChargedHadrCand()/theTau.leadChargedHadrCand()->p();
1068  TauLeadPFChargedHadrEoP = theTau.ecalEnergyLeadChargedHadrCand()/theTau.leadChargedHadrCand()->p();
1069  }
1070 
1071  std::vector<Float_t> GammasdEtaInSigCone;
1072  std::vector<Float_t> GammasdPhiInSigCone;
1073  std::vector<Float_t> GammasPtInSigCone;
1074  std::vector<Float_t> GammasdEtaOutSigCone;
1075  std::vector<Float_t> GammasdPhiOutSigCone;
1076  std::vector<Float_t> GammasPtOutSigCone;
1077  reco::Candidate::LorentzVector pfGammaSum(0,0,0,0);
1078  reco::Candidate::LorentzVector pfChargedSum(0,0,0,0);
1079 
1080  const reco::CandidatePtrVector signalGammaCands = theTau.signalGammaCands();
1081  for ( reco::CandidatePtrVector::const_iterator gamma = signalGammaCands.begin(); gamma != signalGammaCands.end(); ++gamma ) {
1082  float dR = deltaR((*gamma)->p4(), theTau.leadChargedHadrCand()->p4());
1083  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, theTau.pt())));
1084 
1085  // pfGammas inside the tau signal cone
1086  if (dR < signalrad) {
1087  if ( theTau.leadChargedHadrCand().isNonnull() ) {
1088  GammasdEtaInSigCone.push_back((*gamma)->eta() - theTau.leadChargedHadrCand()->eta());
1089  GammasdPhiInSigCone.push_back((*gamma)->phi() - theTau.leadChargedHadrCand()->phi());
1090  }
1091  else {
1092  GammasdEtaInSigCone.push_back((*gamma)->eta() - theTau.eta());
1093  GammasdPhiInSigCone.push_back((*gamma)->phi() - theTau.phi());
1094  }
1095  GammasPtInSigCone.push_back((*gamma)->pt());
1096  pfGammaSum += (*gamma)->p4();
1097  }
1098  // pfGammas outside the tau signal cone
1099  else {
1100  if ( theTau.leadChargedHadrCand().isNonnull() ) {
1101  GammasdEtaOutSigCone.push_back((*gamma)->eta() - theTau.leadChargedHadrCand()->eta());
1102  GammasdPhiOutSigCone.push_back((*gamma)->phi() - theTau.leadChargedHadrCand()->phi());
1103  }
1104  else {
1105  GammasdEtaOutSigCone.push_back((*gamma)->eta() - theTau.eta());
1106  GammasdPhiOutSigCone.push_back((*gamma)->phi() - theTau.phi());
1107  }
1108  GammasPtOutSigCone.push_back((*gamma)->pt());
1109  }
1110  }
1111 
1112  const reco::CandidatePtrVector signalChargedCands = theTau.signalChargedHadrCands();
1113  for ( reco::CandidatePtrVector::const_iterator charged = signalChargedCands.begin(); charged != signalChargedCands.end(); ++charged ) {
1114  float dR = deltaR((*charged)->p4(), theTau.leadChargedHadrCand()->p4());
1115  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, theTau.pt())));
1116 
1117  // charged particles inside the tau signal cone
1118  if (dR < signalrad) {
1119  pfChargedSum += (*charged)->p4();
1120  }
1121  }
1122 
1123  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
1124  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
1125  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
1126 
1127  Float_t TauPhi = theTau.phi();
1128 
1129  if ( theTau.phiAtEcalEntrance() != -99. ) {
1130  TauPhi = theTau.phiAtEcalEntrance();
1131  }
1132  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1133  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
1134 
1135  Float_t TauHasGsf = 0;
1136  pat::PackedCandidate const* packedLeadTauCand = dynamic_cast<pat::PackedCandidate const*>(theTau.leadChargedHadrCand().get());
1137  //const reco::Track & pseudoTrack = packedLeadTauCand->pseudoTrack();
1138  if( abs(packedLeadTauCand->pdgId()) == 11 ) TauHasGsf = 1;
1139 
1140  // === electron variables ===
1141  Float_t dummyElecEta = 9.9;
1142 
1143  return MVAValue(TauPt,
1144  TauEtaAtEcalEntrance,
1145  TauPhi,
1146  TauLeadChargedPFCandPt,
1147  TauLeadChargedPFCandEtaAtEcalEntrance,
1148  TauEmFraction,
1149  TauLeadPFChargedHadrHoP,
1150  TauLeadPFChargedHadrEoP,
1151  TauVisMassIn,
1152  TaudCrackEta,
1153  TaudCrackPhi,
1154  TauHasGsf,
1155  TauSignalPFGammaCandsIn,
1156  TauSignalPFGammaCandsOut,
1157  GammasdEtaInSigCone,
1158  GammasdPhiInSigCone,
1159  GammasPtInSigCone,
1160  GammasdEtaOutSigCone,
1161  GammasdPhiOutSigCone,
1162  GammasPtOutSigCone,
1163  dummyElecEta,
1164  0.,
1165  0.,
1166  0.,
1167  0.,
1168  0.,
1169  0.,
1170  0.,
1171  0.,
1172  0.,
1173  0.,
1174  0.,
1175  0.,
1176  0.,
1177  0.,
1178  0.,
1179  0.);
1180 }
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:160
virtual double phi() const final
momentum azimuthal angle
double dCrackPhi(double phi, double eta)
reco::CandidatePtrVector signalGammaCands() const
const_iterator begin() const
Definition: PtrVector.h:130
float ecalEnergyLeadChargedHadrCand() const
Definition: Tau.h:343
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const_iterator end() const
Definition: PtrVector.h:135
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:169
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)
string const
Definition: compareJSON.py:14
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
float emFraction_MVA() const
return emFraction_MVA
Definition: Tau.h:355
reco::CandidatePtrVector signalChargedHadrCands() const
virtual double eta() const final
momentum pseudorapidity
float etaAtEcalEntrance() const
return etaAtEcalEntrance
Definition: Tau.h:349
float etaAtEcalEntranceLeadChargedCand() const
return etaAtEcalEntrance from LeadChargedCand
Definition: Tau.h:351
double dCrackEta(double eta)
virtual int pdgId() const
PDG identifier.
virtual double pt() const final
transverse momentum

Member Data Documentation

edm::FileInPath AntiElectronIDMVA6::inputFileName_
private

Definition at line 141 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

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

Definition at line 170 of file AntiElectronIDMVA6.h.

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

bool AntiElectronIDMVA6::isInitialized_
private

Definition at line 139 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), and MVAValue().

bool AntiElectronIDMVA6::loadMVAfromDB_
private

Definition at line 140 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_wGwoGSF_BL_
private

Definition at line 162 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_wGwoGSF_EC_
private

Definition at line 166 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_woGwoGSF_BL_
private

Definition at line 161 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_woGwoGSF_EC_
private

Definition at line 165 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_wGwGSF_BL_
private

Definition at line 164 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_wGwGSF_EC_
private

Definition at line 168 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_woGwGSF_BL_
private

Definition at line 163 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_woGwGSF_EC_
private

Definition at line 167 of file AntiElectronIDMVA6.h.

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

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_wGwoGSF_BL_
private

Definition at line 144 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_wGwoGSF_EC_
private

Definition at line 148 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_woGwoGSF_BL_
private

Definition at line 143 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_woGwoGSF_EC_
private

Definition at line 147 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_wGwGSF_BL_
private

Definition at line 146 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_wGwGSF_EC_
private

Definition at line 150 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_woGwGSF_BL_
private

Definition at line 145 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_woGwGSF_EC_
private

Definition at line 149 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_wGwoGSF_Barrel_
private

Definition at line 153 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_wGwoGSF_Endcap_
private

Definition at line 157 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_woGwoGSF_Barrel_
private

Definition at line 152 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_woGwoGSF_Endcap_
private

Definition at line 156 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_wGwGSF_Barrel_
private

Definition at line 155 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_wGwGSF_Endcap_
private

Definition at line 159 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_woGwGSF_Barrel_
private

Definition at line 154 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_woGwGSF_Endcap_
private

Definition at line 158 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().