CMS 3D CMS Logo

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

#include <AntiElectronIDMVA6.h>

Public Member Functions

 AntiElectronIDMVA6 (const edm::ParameterSet &)
 
bool atECalEntrance (const reco::Candidate *part, math::XYZPoint &pos)
 
void beginEvent (const edm::Event &, const edm::EventSetup &)
 
double MVAValue (Float_t TauPt, Float_t TauEtaAtEcalEntrance, Float_t TauPhi, Float_t TauLeadChargedPFCandPt, Float_t TauLeadChargedPFCandEtaAtEcalEntrance, Float_t TauEmFraction, Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP, Float_t TauVisMassIn, Float_t TaudCrackEta, Float_t TaudCrackPhi, Float_t TauHasGsf, Int_t TauSignalPFGammaCandsIn, Int_t TauSignalPFGammaCandsOut, const std::vector< Float_t > &GammasdEtaInSigCone, const std::vector< Float_t > &GammasdPhiInSigCone, const std::vector< Float_t > &GammasPtInSigCone, const std::vector< Float_t > &GammasdEtaOutSigCone, const std::vector< Float_t > &GammasdPhiOutSigCone, const std::vector< Float_t > &GammasPtOutSigCone, Float_t ElecEta, Float_t ElecPhi, Float_t ElecEtotOverPin, Float_t ElecChi2NormGSF, Float_t ElecChi2NormKF, Float_t ElecGSFNumHits, Float_t ElecKFNumHits, Float_t ElecGSFTrackResol, Float_t ElecGSFTracklnPt, Float_t ElecPin, Float_t ElecPout, Float_t ElecEecal, Float_t ElecDeltaEta, Float_t ElecDeltaPhi, Float_t ElecMvaInSigmaEtaEta, Float_t ElecMvaInHadEnergy, Float_t ElecMvaInDeltaEta)
 
double MVAValue (Float_t TauPt, Float_t TauEtaAtEcalEntrance, Float_t TauPhi, Float_t TauLeadChargedPFCandPt, Float_t TauLeadChargedPFCandEtaAtEcalEntrance, Float_t TauEmFraction, Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP, Float_t TauVisMassIn, Float_t TaudCrackEta, Float_t TaudCrackPhi, Float_t TauHasGsf, Int_t TauSignalPFGammaCandsIn, Int_t TauSignalPFGammaCandsOut, Float_t TauGammaEtaMomIn, Float_t TauGammaEtaMomOut, Float_t TauGammaPhiMomIn, Float_t TauGammaPhiMomOut, Float_t TauGammaEnFracIn, Float_t TauGammaEnFracOut, Float_t ElecEta, Float_t ElecPhi, Float_t ElecEtotOverPin, Float_t ElecChi2NormGSF, Float_t ElecChi2NormKF, Float_t ElecGSFNumHits, Float_t ElecKFNumHits, Float_t ElecGSFTrackResol, Float_t ElecGSFTracklnPt, Float_t ElecPin, Float_t ElecPout, Float_t ElecEecal, Float_t ElecDeltaEta, Float_t ElecDeltaPhi, Float_t ElecMvaInSigmaEtaEta, Float_t ElecMvaInHadEnergy, Float_t ElecMvaInDeltaEta)
 
double MVAValue (const reco::PFTau &thePFTau, const reco::GsfElectron &theGsfEle)
 
double MVAValue (const reco::PFTau &thePFTau)
 
double MVAValue (const pat::Tau &theTau, const pat::Electron &theEle)
 
double MVAValue (const pat::Tau &theTau)
 
 ~AntiElectronIDMVA6 ()
 

Private Member Functions

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

Private Attributes

double bField_
 
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_
 
bool usePhiAtEcalEntranceExtrapolation_
 
Float_t * Var_NoEleMatch_wGwoGSF_Barrel_
 
Float_t * Var_NoEleMatch_wGwoGSF_Endcap_
 
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_
 
Float_t * Var_NoEleMatch_woGwoGSF_Endcap_
 
Float_t * Var_wGwGSF_Barrel_
 
Float_t * Var_wGwGSF_Endcap_
 
Float_t * Var_woGwGSF_Barrel_
 
Float_t * Var_woGwGSF_Endcap_
 
int verbosity_
 

Detailed Description

Definition at line 36 of file AntiElectronIDMVA6.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file AntiElectronIDMVA6.cc.

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

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

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

65 {
68  delete [] Var_woGwGSF_Barrel_;
69  delete [] Var_wGwGSF_Barrel_;
72  delete [] Var_woGwGSF_Endcap_;
73  delete [] Var_wGwGSF_Endcap_;
74 
75  if ( !loadMVAfromDB_ ){
78  delete mva_woGwGSF_BL_;
79  delete mva_wGwGSF_BL_;
82  delete mva_woGwGSF_EC_;
83  delete mva_wGwGSF_EC_;
84  }
85 
86  for ( std::vector<TFile*>::iterator it = inputFilesToDelete_.begin();
87  it != inputFilesToDelete_.end(); ++it ) {
88  delete (*it);
89  }
90 }
const GBRForest * mva_wGwGSF_EC_
Float_t * Var_NoEleMatch_wGwoGSF_Barrel_
const GBRForest * mva_NoEleMatch_woGwoGSF_EC_
const GBRForest * mva_NoEleMatch_wGwoGSF_BL_
Float_t * Var_NoEleMatch_woGwoGSF_Endcap_
std::vector< TFile * > inputFilesToDelete_
const GBRForest * mva_woGwGSF_EC_
Float_t * Var_NoEleMatch_wGwoGSF_Endcap_
const GBRForest * mva_wGwGSF_BL_
const GBRForest * mva_woGwGSF_BL_
const GBRForest * mva_NoEleMatch_wGwoGSF_EC_
const GBRForest * mva_NoEleMatch_woGwoGSF_BL_
Float_t * Var_NoEleMatch_woGwoGSF_Barrel_

Member Function Documentation

bool AntiElectronIDMVA6::atECalEntrance ( const reco::Candidate part,
math::XYZPoint pos 
)

Definition at line 1329 of file AntiElectronIDMVA6.cc.

References bField_, reco::Candidate::charge(), reco::Candidate::energy(), BaseParticlePropagator::getSuccess(), BaseParticlePropagator::particle(), BaseParticlePropagator::propagateToEcalEntrance(), reco::Candidate::px(), reco::Candidate::py(), reco::Candidate::pz(), mps_fire::result, reco::Candidate::vertex(), and RawParticle::vertex().

Referenced by MVAValue().

1330 {
1331  bool result = false;
1332  BaseParticlePropagator theParticle =
1334  part->py(),
1335  part->pz(),
1336  part->energy()),
1337  math::XYZTLorentzVector(part->vertex().x(),
1338  part->vertex().y(),
1339  part->vertex().z(),
1340  0.),
1341  part->charge()),
1342  0.,0.,bField_);
1343  theParticle.propagateToEcalEntrance(false);
1344  if(theParticle.getSuccess()!=0){
1345  pos = math::XYZPoint(theParticle.particle().vertex());
1346  result = true;
1347  }
1348  else {
1349  result = false;
1350  }
1351  return result;
1352 }
virtual double pz() const =0
z coordinate of momentum vector
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
RawParticle const & particle() const
The particle being propagated.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual double energy() const =0
energy
virtual double py() const =0
y coordinate of momentum vector
bool propagateToEcalEntrance(bool first=true)
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:339
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
virtual int charge() const =0
electric charge
virtual const Point & vertex() const =0
vertex position
virtual double px() const =0
x coordinate of momentum vector
void AntiElectronIDMVA6::beginEvent ( const edm::Event evt,
const edm::EventSetup es 
)

Definition at line 112 of file AntiElectronIDMVA6.cc.

References bField_, edm::FileInPath::fullPath(), edm::EventSetup::get(), analyzePatCleaning_cfg::inputFile, inputFileName_, inputFilesToDelete_, MagneticField::inTesla(), isInitialized_, taus_updatedMVAIds_cff::loadMVAfromDB, loadMVAfromDB_, edm::FileInPath::location(), mva_NoEleMatch_wGwoGSF_BL_, mva_NoEleMatch_wGwoGSF_EC_, mva_NoEleMatch_woGwoGSF_BL_, mva_NoEleMatch_woGwoGSF_EC_, mva_wGwGSF_BL_, mva_wGwGSF_EC_, mva_woGwGSF_BL_, mva_woGwGSF_EC_, mvaName_NoEleMatch_wGwoGSF_BL_, mvaName_NoEleMatch_wGwoGSF_EC_, mvaName_NoEleMatch_woGwoGSF_BL_, mvaName_NoEleMatch_woGwoGSF_EC_, mvaName_wGwGSF_BL_, mvaName_wGwGSF_EC_, mvaName_woGwGSF_BL_, mvaName_woGwGSF_EC_, edm::FileInPath::Unknown, and PV3DBase< T, PVType, FrameType >::z().

113 {
114  if ( !isInitialized_ ) {
115  if ( loadMVAfromDB_ ) {
124  } else {
125  if ( inputFileName_.location() == edm::FileInPath::Unknown ) throw cms::Exception("PFRecoTauDiscriminationAgainstElectronMVA6::loadMVA")
126  << " Failed to find File = " << inputFileName_ << " !!\n";
127  TFile* inputFile = new TFile(inputFileName_.fullPath().data());
128 
129  mva_NoEleMatch_woGwoGSF_BL_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_woGwoGSF_BL_);
130  mva_NoEleMatch_wGwoGSF_BL_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_wGwoGSF_BL_);
131  mva_woGwGSF_BL_ = loadMVAfromFile(inputFile, mvaName_woGwGSF_BL_);
132  mva_wGwGSF_BL_ = loadMVAfromFile(inputFile, mvaName_wGwGSF_BL_);
133  mva_NoEleMatch_woGwoGSF_EC_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_woGwoGSF_EC_);
134  mva_NoEleMatch_wGwoGSF_EC_ = loadMVAfromFile(inputFile, mvaName_NoEleMatch_wGwoGSF_EC_);
135  mva_woGwGSF_EC_ = loadMVAfromFile(inputFile, mvaName_woGwGSF_EC_);
136  mva_wGwGSF_EC_ = loadMVAfromFile(inputFile, mvaName_wGwGSF_EC_);
137  inputFilesToDelete_.push_back(inputFile);
138  }
139  isInitialized_ = true;
140  }
141 
143  es.get<IdealMagneticFieldRecord>().get(pSetup);
144  bField_ = pSetup->inTesla(GlobalPoint(0,0,0)).z();
145 }
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_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
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_
T z() const
Definition: PV3DBase.h:64
LocationCode location() const
Where was the file found?
Definition: FileInPath.cc:161
std::string mvaName_wGwGSF_EC_
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
const GBRForest * mva_wGwGSF_BL_
const GBRForest * mva_woGwGSF_BL_
const GBRForest * mva_NoEleMatch_wGwoGSF_EC_
T get() const
Definition: EventSetup.h:71
std::string mvaName_wGwGSF_BL_
std::string mvaName_NoEleMatch_wGwoGSF_BL_
std::string fullPath() const
Definition: FileInPath.cc:163
const GBRForest * mva_NoEleMatch_woGwoGSF_BL_
std::string mvaName_woGwGSF_EC_
double AntiElectronIDMVA6::dCrackEta ( double  eta)
private

Definition at line 1310 of file AntiElectronIDMVA6.cc.

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

Referenced by MVAValue().

1311 {
1312 //--- compute the (unsigned) distance to the closest eta-crack in the ECAL barrel
1313 
1314  // IN: define locations of the eta-cracks
1315  double cracks[5] = { 0., 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00 };
1316 
1317  double retVal = 99.;
1318 
1319  for ( int iCrack = 0; iCrack < 5 ; ++iCrack ) {
1320  double d = minimum(eta - cracks[iCrack], eta + cracks[iCrack]);
1321  if ( std::abs(d) < std::abs(retVal) ) {
1322  retVal = d;
1323  }
1324  }
1325 
1326  return std::abs(retVal);
1327 }
double minimum(double a, double b)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double AntiElectronIDMVA6::dCrackPhi ( double  phi,
double  eta 
)
private

Definition at line 1261 of file AntiElectronIDMVA6.cc.

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

Referenced by MVAValue().

1262 {
1263 //--- compute the (unsigned) distance to the closest phi-crack in the ECAL barrel
1264 
1265  constexpr double pi = M_PI; // 3.14159265358979323846;
1266 
1267  // IN: shift of this location if eta < 0
1268  constexpr double delta_cPhi = 0.00638;
1269 
1270  double retVal = 99.;
1271 
1272  if ( eta >= -1.47464 && eta <= 1.47464 ) {
1273 
1274  // the location is shifted
1275  if ( eta < 0. ) phi += delta_cPhi;
1276 
1277  // CV: need to bring-back phi into interval [-pi,+pi]
1278  if ( phi > pi ) phi -= 2.*pi;
1279  if ( phi < -pi ) phi += 2.*pi;
1280 
1281  if ( phi >= -pi && phi <= pi ) {
1282 
1283  // the problem of the extrema:
1284  if ( phi < cPhi[17] || phi >= cPhi[0] ) {
1285  if ( phi < 0. ) phi += 2.*pi;
1286  retVal = minimum(phi - cPhi[0], phi - cPhi[17] - 2.*pi);
1287  } else {
1288  // between these extrema...
1289  bool OK = false;
1290  unsigned iCrack = 16;
1291  while( !OK ) {
1292  if ( phi < cPhi[iCrack] ) {
1293  retVal = minimum(phi - cPhi[iCrack + 1], phi - cPhi[iCrack]);
1294  OK = true;
1295  } else {
1296  iCrack -= 1;
1297  }
1298  }
1299  }
1300  } else {
1301  retVal = 0.; // IN: if there is a problem, we assume that we are in a crack
1302  }
1303  } else {
1304  return -99.;
1305  }
1306 
1307  return std::abs(retVal);
1308 }
double minimum(double a, double b)
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
#define constexpr
double AntiElectronIDMVA6::minimum ( double  a,
double  b 
)
private

Definition at line 1237 of file AntiElectronIDMVA6.cc.

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

Referenced by dCrackEta(), and dCrackPhi().

1238 {
1239  if ( std::abs(b) < std::abs(a) ) return b;
1240  else return a;
1241 }
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 147 of file AntiElectronIDMVA6.cc.

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

Referenced by MVAValue().

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

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

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

Definition at line 520 of file AntiElectronIDMVA6.cc.

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

523 {
524  // === tau variables ===
525  float TauEtaAtEcalEntrance = -99.;
526  float sumEtaTimesEnergy = 0.;
527  float sumEnergy = 0.;
528  const std::vector<reco::PFCandidatePtr>& signalPFCands = thePFTau.signalPFCands();
529  for ( const auto & pfCandidate : signalPFCands ) {
530  sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta()*pfCandidate->energy();
531  sumEnergy += pfCandidate->energy();
532  }
533  if ( sumEnergy > 0. ) {
534  TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
535  }
536 
537  float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
538  float TauLeadChargedPFCandPt = -99.;
539  for ( const auto & pfCandidate : signalPFCands ) {
540  const reco::Track* track = nullptr;
541  if ( pfCandidate->trackRef().isNonnull() ) track = pfCandidate->trackRef().get();
542  else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull() ) track = pfCandidate->muonRef()->innerTrack().get();
543  else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull() ) track = pfCandidate->muonRef()->globalTrack().get();
544  else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull() ) track = pfCandidate->muonRef()->outerTrack().get();
545  else if ( pfCandidate->gsfTrackRef().isNonnull() ) track = pfCandidate->gsfTrackRef().get();
546  if ( track ) {
547  if ( track->pt() > TauLeadChargedPFCandPt ) {
548  TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().eta();
549  TauLeadChargedPFCandPt = track->pt();
550  }
551  }
552  }
553 
554  Float_t TauPt = thePFTau.pt();
555  Float_t TauEmFraction = std::max(thePFTau.emFraction(), (Float_t)0.);
556  Float_t TauLeadPFChargedHadrHoP = 0.;
557  Float_t TauLeadPFChargedHadrEoP = 0.;
558  if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
559  TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
560  TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
561  }
562 
563  std::vector<Float_t> GammasdEtaInSigCone;
564  std::vector<Float_t> GammasdPhiInSigCone;
565  std::vector<Float_t> GammasPtInSigCone;
566  std::vector<Float_t> GammasdEtaOutSigCone;
567  std::vector<Float_t> GammasdPhiOutSigCone;
568  std::vector<Float_t> GammasPtOutSigCone;
569  reco::Candidate::LorentzVector pfGammaSum(0,0,0,0);
570  reco::Candidate::LorentzVector pfChargedSum(0,0,0,0);
571 
572  for ( const auto & gamma : thePFTau.signalGammaCands() ) {
573  float dR = deltaR(gamma->p4(), thePFTau.leadChargedHadrCand()->p4());
574  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, thePFTau.pt())));
575 
576  // pfGammas inside the tau signal cone
577  if (dR < signalrad) {
578  if ( thePFTau.leadChargedHadrCand().isNonnull() ) {
579  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.leadChargedHadrCand()->eta());
580  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.leadChargedHadrCand()->phi());
581  }
582  else {
583  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.eta());
584  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.phi());
585  }
586  GammasPtInSigCone.push_back(gamma->pt());
587  pfGammaSum += gamma->p4();
588  }
589  // pfGammas outside the tau signal cone
590  else {
591  if ( thePFTau.leadChargedHadrCand().isNonnull() ) {
592  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.leadChargedHadrCand()->eta());
593  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.leadChargedHadrCand()->phi());
594  }
595  else {
596  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.eta());
597  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.phi());
598  }
599  GammasPtOutSigCone.push_back(gamma->pt());
600  }
601  }
602 
603  for ( const auto & charged : thePFTau.signalChargedHadrCands() ) {
604  float dR = deltaR(charged->p4(), thePFTau.leadChargedHadrCand()->p4());
605  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, thePFTau.pt())));
606 
607  // charged particles inside the tau signal cone
608  if (dR < signalrad) {
609  pfChargedSum += charged->p4();
610  }
611  }
612 
613  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
614  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
615  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
616 
617  Float_t TauPhi = thePFTau.phi();
618  float sumPhiTimesEnergy = 0.;
619  float sumEnergyPhi = 0.;
621  for ( const auto & pfc : signalPFCands ) {
622  sumPhiTimesEnergy += pfc->positionAtECALEntrance().phi()*pfc->energy();
623  sumEnergyPhi += pfc->energy();
624  }
625  }
626  else{
627  TauPhi= -99.;
628  for ( const auto & signalPFCand : signalPFCands ) {
629  reco::Candidate const* signalCand = signalPFCand.get();
630  float phi = thePFTau.phi();
631  math::XYZPoint aPos;
632  if ( atECalEntrance(signalCand, aPos) ) phi = aPos.Phi();
633  sumPhiTimesEnergy += phi*signalCand->energy();
634  sumEnergy += signalCand->energy();
635  }
636  }
637  if ( sumEnergyPhi > 0. ) {
638  TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
639  }
640  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
641  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
642  Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
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:575
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:186
virtual TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:205
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
bool atECalEntrance(const reco::Candidate *part, math::XYZPoint &pos)
double eta() const final
momentum pseudorapidity
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:295
double dCrackPhi(double phi, double eta)
double pt() const final
transverse momentum
float emFraction() const
Definition: PFTau.cc:330
const std::vector< reco::CandidatePtr > & signalGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:84
virtual double energy() const =0
energy
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:684
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:257
const CandidatePtr & leadChargedHadrCand() const
Definition: PFTau.cc:67
T sqrt(T t)
Definition: SSEVec.h:18
math::XYZVectorF trackMomentumOut() const
Definition: GsfElectron.h:297
double pt() const
track transverse momentum
Definition: TrackBase.h:654
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
Definition: PFTau.cc:172
T min(T a, T b)
Definition: MathUtil.h:58
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
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)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
float ecalEnergy() const
Definition: GsfElectron.h:859
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
const std::vector< reco::CandidatePtr > & signalChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:80
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:254
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185
T get() const
get a component
Definition: Candidate.h:217
const PFCandidatePtr leadPFChargedHadrCand() const
Getters for different PFCandidates for PFTaus made from PFCandidates.
Definition: PFTau.cc:154
double dCrackEta(double eta)
double phi() const final
momentum azimuthal angle
double AntiElectronIDMVA6::MVAValue ( const reco::PFTau thePFTau)

Definition at line 732 of file AntiElectronIDMVA6.cc.

References atECalEntrance(), dCrackEta(), dCrackPhi(), boostedElectronIsolation_cff::deltaR, PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::PFTau::emFraction(), reco::Candidate::energy(), reco::LeafCandidate::eta(), reco::TrackBase::eta(), CustomPhysics_cfi::gamma, reco::Candidate::get(), edm::Ptr< T >::isNonnull(), reco::PFTau::leadChargedHadrCand(), reco::PFTau::leadPFChargedHadrCand(), ResonanceBuilder::mass, SiStripPI::max, min(), MVAValue(), phi, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::TrackBase::pt(), reco::PFTau::signalChargedHadrCands(), reco::PFTau::signalGammaCands(), reco::PFTau::signalPFCands(), HiIsolationCommonParameters_cff::track, and usePhiAtEcalEntranceExtrapolation_.

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 ( const auto & pfCandidate : signalPFCands ) {
740  sumEtaTimesEnergy += pfCandidate->positionAtECALEntrance().eta()*pfCandidate->energy();
741  sumEnergy += pfCandidate->energy();
742  }
743  if ( sumEnergy > 0. ) {
744  TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
745  }
746 
747  float TauLeadChargedPFCandEtaAtEcalEntrance = -99.;
748  float TauLeadChargedPFCandPt = -99.;
749  for ( const auto & pfCandidate : signalPFCands ) {
750  const reco::Track* track = nullptr;
751  if ( pfCandidate->trackRef().isNonnull() ) track = pfCandidate->trackRef().get();
752  else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->innerTrack().isNonnull() ) track = pfCandidate->muonRef()->innerTrack().get();
753  else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->globalTrack().isNonnull() ) track = pfCandidate->muonRef()->globalTrack().get();
754  else if ( pfCandidate->muonRef().isNonnull() && pfCandidate->muonRef()->outerTrack().isNonnull() ) track = pfCandidate->muonRef()->outerTrack().get();
755  else if ( pfCandidate->gsfTrackRef().isNonnull() ) track = pfCandidate->gsfTrackRef().get();
756  if ( track ) {
757  if ( track->pt() > TauLeadChargedPFCandPt ) {
758  TauLeadChargedPFCandEtaAtEcalEntrance = pfCandidate->positionAtECALEntrance().eta();
759  TauLeadChargedPFCandPt = track->pt();
760  }
761  }
762  }
763 
764  Float_t TauPt = thePFTau.pt();
765  Float_t TauEmFraction = std::max(thePFTau.emFraction(), (Float_t)0.);
766  Float_t TauLeadPFChargedHadrHoP = 0.;
767  Float_t TauLeadPFChargedHadrEoP = 0.;
768  if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
769  TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
770  TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
771  }
772 
773  std::vector<Float_t> GammasdEtaInSigCone;
774  std::vector<Float_t> GammasdPhiInSigCone;
775  std::vector<Float_t> GammasPtInSigCone;
776  std::vector<Float_t> GammasdEtaOutSigCone;
777  std::vector<Float_t> GammasdPhiOutSigCone;
778  std::vector<Float_t> GammasPtOutSigCone;
779  reco::Candidate::LorentzVector pfGammaSum(0,0,0,0);
780  reco::Candidate::LorentzVector pfChargedSum(0,0,0,0);
781 
782  for ( const auto & gamma : thePFTau.signalGammaCands() ) {
783  float dR = deltaR(gamma->p4(), thePFTau.leadChargedHadrCand()->p4());
784  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, thePFTau.pt())));
785 
786  // pfGammas inside the tau signal cone
787  if (dR < signalrad) {
788  if ( thePFTau.leadChargedHadrCand().isNonnull() ) {
789  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.leadChargedHadrCand()->eta());
790  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.leadChargedHadrCand()->phi());
791  }
792  else {
793  GammasdEtaInSigCone.push_back(gamma->eta() - thePFTau.eta());
794  GammasdPhiInSigCone.push_back(gamma->phi() - thePFTau.phi());
795  }
796  GammasPtInSigCone.push_back(gamma->pt());
797  pfGammaSum += gamma->p4();
798  }
799  // pfGammas outside the tau signal cone
800  else {
801  if ( thePFTau.leadChargedHadrCand().isNonnull() ) {
802  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.leadChargedHadrCand()->eta());
803  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.leadChargedHadrCand()->phi());
804  }
805  else {
806  GammasdEtaOutSigCone.push_back(gamma->eta() - thePFTau.eta());
807  GammasdPhiOutSigCone.push_back(gamma->phi() - thePFTau.phi());
808  }
809  GammasPtOutSigCone.push_back(gamma->pt());
810  }
811  }
812 
813  for ( const auto & charged : thePFTau.signalChargedHadrCands() ) {
814  float dR = deltaR(charged->p4(), thePFTau.leadChargedHadrCand()->p4());
815  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, thePFTau.pt())));
816 
817  // charged particles inside the tau signal cone
818  if (dR < signalrad) {
819  pfChargedSum += charged->p4();
820  }
821  }
822 
823  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
824  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
825  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
826 
827  Float_t TauPhi = thePFTau.phi();
828  float sumPhiTimesEnergy = 0.;
829  float sumEnergyPhi = 0.;
831  for ( const auto & pfCandidate : signalPFCands ) {
832  sumPhiTimesEnergy += pfCandidate->positionAtECALEntrance().phi()*pfCandidate->energy();
833  sumEnergyPhi += pfCandidate->energy();
834  }
835  }
836  else{
837  TauPhi= -99.;
838  for ( const auto & signalPFCand : signalPFCands ) {
839  reco::Candidate const* signalCand = signalPFCand.get();
840  float phi = thePFTau.phi();
841  math::XYZPoint aPos;
842  if ( atECalEntrance(signalCand, aPos) == true ) phi = aPos.Phi();
843  sumPhiTimesEnergy += phi*signalCand->energy();
844  sumEnergy += signalCand->energy();
845  }
846  }
847  if ( sumEnergyPhi > 0. ) {
848  TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
849  }
850  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
851  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
852  Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
853 
854 
855  // === electron variables ===
856  Float_t dummyElecEta = 9.9;
857 
858  return MVAValue(TauPt,
859  TauEtaAtEcalEntrance,
860  TauPhi,
861  TauLeadChargedPFCandPt,
862  TauLeadChargedPFCandEtaAtEcalEntrance,
863  TauEmFraction,
864  TauLeadPFChargedHadrHoP,
865  TauLeadPFChargedHadrEoP,
866  TauVisMassIn,
867  TaudCrackEta,
868  TaudCrackPhi,
869  TauHasGsf,
870  TauSignalPFGammaCandsIn,
871  TauSignalPFGammaCandsOut,
872  GammasdEtaInSigCone,
873  GammasdPhiInSigCone,
874  GammasPtInSigCone,
875  GammasdEtaOutSigCone,
876  GammasdPhiOutSigCone,
877  GammasPtOutSigCone,
878  dummyElecEta,
879  0.,
880  0.,
881  0.,
882  0.,
883  0.,
884  0.,
885  0.,
886  0.,
887  0.,
888  0.,
889  0.,
890  0.,
891  0.,
892  0.,
893  0.,
894  0.);
895 }
bool atECalEntrance(const reco::Candidate *part, math::XYZPoint &pos)
double eta() const final
momentum pseudorapidity
double dCrackPhi(double phi, double eta)
double pt() const final
transverse momentum
float emFraction() const
Definition: PFTau.cc:330
const std::vector< reco::CandidatePtr > & signalGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:84
virtual double energy() const =0
energy
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:684
const CandidatePtr & leadChargedHadrCand() const
Definition: PFTau.cc:67
double pt() const
track transverse momentum
Definition: TrackBase.h:654
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
Definition: PFTau.cc:172
T min(T a, T b)
Definition: MathUtil.h:58
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
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)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
const std::vector< reco::CandidatePtr > & signalChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:80
T get() const
get a component
Definition: Candidate.h:217
const PFCandidatePtr leadPFChargedHadrCand() const
Getters for different PFCandidates for PFTaus made from PFCandidates.
Definition: PFTau.cc:154
double dCrackEta(double eta)
double phi() const final
momentum azimuthal angle
double AntiElectronIDMVA6::MVAValue ( const pat::Tau theTau,
const pat::Electron theEle 
)

Definition at line 897 of file AntiElectronIDMVA6.cc.

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

898 {
899  // === tau variables ===
900  float TauEtaAtEcalEntrance = theTau.etaAtEcalEntrance();
901 
902  float TauLeadChargedPFCandEtaAtEcalEntrance = theTau.etaAtEcalEntranceLeadChargedCand();
903  float TauLeadChargedPFCandPt = theTau.ptLeadChargedCand();
904 
905  Float_t TauPt = theTau.pt();
906  //Float_t TauEmFraction = std::max(theTau.ecalEnergy()/(theTau.ecalEnergy()+theTau.hcalEnergy()), (Float_t)0.);
907  Float_t TauEmFraction = std::max(theTau.emFraction_MVA(), (Float_t)0.);
908  Float_t TauLeadPFChargedHadrHoP = 0.;
909  Float_t TauLeadPFChargedHadrEoP = 0.;
910  if ( theTau.leadChargedHadrCand()->p() > 0. ) {
911  TauLeadPFChargedHadrHoP = theTau.hcalEnergyLeadChargedHadrCand()/theTau.leadChargedHadrCand()->p();
912  TauLeadPFChargedHadrEoP = theTau.ecalEnergyLeadChargedHadrCand()/theTau.leadChargedHadrCand()->p();
913  }
914 
915  std::vector<Float_t> GammasdEtaInSigCone;
916  std::vector<Float_t> GammasdPhiInSigCone;
917  std::vector<Float_t> GammasPtInSigCone;
918  std::vector<Float_t> GammasdEtaOutSigCone;
919  std::vector<Float_t> GammasdPhiOutSigCone;
920  std::vector<Float_t> GammasPtOutSigCone;
921  reco::Candidate::LorentzVector pfGammaSum(0,0,0,0);
922  reco::Candidate::LorentzVector pfChargedSum(0,0,0,0);
923 
924  const reco::CandidatePtrVector signalGammaCands = theTau.signalGammaCands();
925  for ( const auto & gamma : signalGammaCands ) {
926  float dR = deltaR(gamma->p4(), theTau.leadChargedHadrCand()->p4());
927  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, theTau.pt())));
928 
929  // pfGammas inside the tau signal cone
930  if (dR < signalrad) {
931  if ( theTau.leadChargedHadrCand().isNonnull() ) {
932  GammasdEtaInSigCone.push_back(gamma->eta() - theTau.leadChargedHadrCand()->eta());
933  GammasdPhiInSigCone.push_back(gamma->phi() - theTau.leadChargedHadrCand()->phi());
934  //A.-C. please check whether this change is safe against future trainings
935  //GammasdPhiInSigCone.push_back(deltaPhi((*gamma)->phi(), theTau.leadChargedHadrCand()->phi()));
936  }
937  else {
938  GammasdEtaInSigCone.push_back(gamma->eta() - theTau.eta());
939  GammasdPhiInSigCone.push_back(gamma->phi() - theTau.phi());
940  //A.-C. please check whether this change is safe against future trainings
941  //GammasdPhiInSigCone.push_back(deltaPhi(gamma->phi(), theTau.phi()));
942  }
943  GammasPtInSigCone.push_back(gamma->pt());
944  pfGammaSum += gamma->p4();
945  }
946  // pfGammas outside the tau signal cone
947  else {
948  if ( theTau.leadChargedHadrCand().isNonnull() ) {
949  GammasdEtaOutSigCone.push_back(gamma->eta() - theTau.leadChargedHadrCand()->eta());
950  GammasdPhiOutSigCone.push_back(gamma->phi() - theTau.leadChargedHadrCand()->phi());
951  //A.-C. please check whether this change is safe against future trainings
952  //GammasdPhiOutSigCone.push_back(deltaPhi(gamma->phi(), theTau.leadChargedHadrCand()->phi()));
953  }
954  else {
955  GammasdEtaOutSigCone.push_back(gamma->eta() - theTau.eta());
956  GammasdPhiOutSigCone.push_back(gamma->phi() - theTau.phi());
957  //A.-C. please chaekc whether this change is safe against future trainings
958  //GammasdPhiOutSigCone.push_back(deltaPhi(gamma->phi(), theTau.phi()));
959  }
960  GammasPtOutSigCone.push_back(gamma->pt());
961  }
962  }
963 
964  const reco::CandidatePtrVector signalChargedCands = theTau.signalChargedHadrCands();
965  for ( const auto & charged : signalChargedCands ) {
966  float dR = deltaR(charged->p4(), theTau.leadChargedHadrCand()->p4());
967  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, theTau.pt())));
968 
969  // charged particles inside the tau signal cone
970  if (dR < signalrad) {
971  pfChargedSum += charged->p4();
972  }
973  }
974 
975  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
976  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
977  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
978  Float_t TauPhi = -99.;
980  float sumPhiTimesEnergy = 0.;
981  float sumEnergy = 0.;
982  const reco::CandidatePtrVector signalCands = theTau.signalCands();
983  for ( const auto & signalCandPtr : signalCands ) {
984  reco::Candidate const* signalCand = signalCandPtr.get();
985  float phi = theTau.phi();
986  math::XYZPoint aPos;
987  if ( atECalEntrance(signalCand, aPos) == true ) phi = aPos.Phi();
988  sumPhiTimesEnergy += phi*signalCand->energy();
989  sumEnergy += signalCand->energy();
990  }
991  if ( sumEnergy > 0. ) {
992  TauPhi = sumPhiTimesEnergy/sumEnergy;
993  }
994  }
995  else {
996  TauPhi = theTau.phiAtEcalEntrance();
997  }
998 
999  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1000  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
1001 
1002  Float_t TauHasGsf = 0;
1003  pat::PackedCandidate const* packedLeadTauCand = dynamic_cast<pat::PackedCandidate const*>(theTau.leadChargedHadrCand().get());
1004  if( abs(packedLeadTauCand->pdgId()) == 11 ) TauHasGsf = 1;
1005 
1006  // === electron variables ===
1007  Float_t ElecEta = theEle.eta();
1008  Float_t ElecPhi = theEle.phi();
1009 
1010  //Variables related to the electron Cluster
1011  Float_t ElecEe = 0.;
1012  Float_t ElecEgamma = 0.;
1013  reco::SuperClusterRef pfSuperCluster = theEle.superCluster();
1014  if ( pfSuperCluster.isNonnull() && pfSuperCluster.isAvailable() ) {
1015  for ( reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin(); pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
1016  double pfClusterEn = (*pfCluster)->energy();
1017  if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
1018  else ElecEgamma += pfClusterEn;
1019  }
1020  }
1021 
1022  Float_t ElecPin = std::sqrt(theEle.trackMomentumAtVtx().Mag2());
1023  Float_t ElecPout = std::sqrt(theEle.trackMomentumOut().Mag2());
1024  Float_t ElecEtotOverPin = (ElecPin > 0.0) ? ((ElecEe + ElecEgamma)/ElecPin) : -0.1;
1025  Float_t ElecEecal = theEle.ecalEnergy();
1026  Float_t ElecDeltaEta = theEle.deltaEtaSeedClusterTrackAtCalo();
1027  Float_t ElecDeltaPhi = theEle.deltaPhiSeedClusterTrackAtCalo();
1028  Float_t ElecMvaInSigmaEtaEta = (theEle).mvaInput().sigmaEtaEta;
1029  Float_t ElecMvaInHadEnergy = (theEle).mvaInput().hadEnergy;
1030  Float_t ElecMvaInDeltaEta = (theEle).mvaInput().deltaEta;
1031 
1032  //Variables related to the GsfTrack
1033  Float_t ElecChi2NormGSF = -99.;
1034  Float_t ElecGSFNumHits = -99.;
1035  Float_t ElecGSFTrackResol = -99.;
1036  Float_t ElecGSFTracklnPt = -99.;
1037  if ( theEle.gsfTrack().isNonnull() ) {
1038  ElecChi2NormGSF = (theEle).gsfTrack()->normalizedChi2();
1039  ElecGSFNumHits = (theEle).gsfTrack()->numberOfValidHits();
1040  if ( theEle.gsfTrack()->pt() > 0. ) {
1041  ElecGSFTrackResol = theEle.gsfTrack()->ptError()/theEle.gsfTrack()->pt();
1042  ElecGSFTracklnPt = log(theEle.gsfTrack()->pt())*M_LN10;
1043  }
1044  }
1045 
1046  //Variables related to the CtfTrack
1047  Float_t ElecChi2NormKF = -99.;
1048  Float_t ElecKFNumHits = -99.;
1049  if ( theEle.closestCtfTrackRef().isNonnull() ) {
1050  ElecChi2NormKF = (theEle).closestCtfTrackRef()->normalizedChi2();
1051  ElecKFNumHits = (theEle).closestCtfTrackRef()->numberOfValidHits();
1052  }
1053 
1054  return MVAValue(TauPt,
1055  TauEtaAtEcalEntrance,
1056  TauPhi,
1057  TauLeadChargedPFCandPt,
1058  TauLeadChargedPFCandEtaAtEcalEntrance,
1059  TauEmFraction,
1060  TauLeadPFChargedHadrHoP,
1061  TauLeadPFChargedHadrEoP,
1062  TauVisMassIn,
1063  TaudCrackEta,
1064  TaudCrackPhi,
1065  TauHasGsf,
1066  TauSignalPFGammaCandsIn,
1067  TauSignalPFGammaCandsOut,
1068  GammasdEtaInSigCone,
1069  GammasdPhiInSigCone,
1070  GammasPtInSigCone,
1071  GammasdEtaOutSigCone,
1072  GammasdPhiOutSigCone,
1073  GammasPtOutSigCone,
1074  ElecEta,
1075  ElecPhi,
1076  ElecEtotOverPin,
1077  ElecChi2NormGSF,
1078  ElecChi2NormKF,
1079  ElecGSFNumHits,
1080  ElecKFNumHits,
1081  ElecGSFTrackResol,
1082  ElecGSFTracklnPt,
1083  ElecPin,
1084  ElecPout,
1085  ElecEecal,
1086  ElecDeltaEta,
1087  ElecDeltaPhi,
1088  ElecMvaInSigmaEtaEta,
1089  ElecMvaInHadEnergy,
1090  ElecMvaInDeltaEta);
1091 }
bool isAvailable() const
Definition: Ref.h:575
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
bool atECalEntrance(const reco::Candidate *part, math::XYZPoint &pos)
double eta() const final
momentum pseudorapidity
int pdgId() const override
PDG identifier.
float hcalEnergyLeadChargedHadrCand() const
return hcal energy from LeadChargedHadrCand
Definition: Tau.h:346
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:159
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:295
double dCrackPhi(double phi, double eta)
double pt() const final
transverse momentum
reco::CandidatePtrVector signalCands() const
reco::CandidatePtrVector signalGammaCands() const
virtual double energy() const =0
energy
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:257
T sqrt(T t)
Definition: SSEVec.h:18
math::XYZVectorF trackMomentumOut() const
Definition: GsfElectron.h:297
float ecalEnergyLeadChargedHadrCand() const
Definition: Tau.h:344
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
float phiAtEcalEntrance() const
return phiAtEcalEntrance
Definition: Tau.h:348
const reco::CandidatePtr leadChargedHadrCand() const
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
float ptLeadChargedCand() const
return pt from LeadChargedCand
Definition: Tau.h:354
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)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::TrackRef closestCtfTrackRef() const override
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
float ecalEnergy() const
Definition: GsfElectron.h:859
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
float emFraction_MVA() const
return emFraction_MVA
Definition: Tau.h:356
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:254
T get() const
get a component
Definition: Candidate.h:217
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
reco::CandidatePtrVector signalChargedHadrCands() const
float etaAtEcalEntrance() const
return etaAtEcalEntrance
Definition: Tau.h:350
float etaAtEcalEntranceLeadChargedCand() const
return etaAtEcalEntrance from LeadChargedCand
Definition: Tau.h:352
double dCrackEta(double eta)
double phi() const final
momentum azimuthal angle
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
double AntiElectronIDMVA6::MVAValue ( const pat::Tau theTau)

Definition at line 1093 of file AntiElectronIDMVA6.cc.

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

1094 {
1095  // === tau variables ===
1096  float TauEtaAtEcalEntrance = theTau.etaAtEcalEntrance();
1097 
1098  float TauLeadChargedPFCandEtaAtEcalEntrance = theTau.etaAtEcalEntranceLeadChargedCand();
1099  float TauLeadChargedPFCandPt = theTau.ptLeadChargedCand();
1100 
1101  Float_t TauPt = theTau.pt();
1102  //Float_t TauEmFraction = std::max(theTau.ecalEnergy()/(theTau.ecalEnergy()+theTau.hcalEnergy()), (Float_t)0.);
1103  Float_t TauEmFraction = std::max(theTau.emFraction_MVA(), (Float_t)0.);
1104  Float_t TauLeadPFChargedHadrHoP = 0.;
1105  Float_t TauLeadPFChargedHadrEoP = 0.;
1106  if ( theTau.leadChargedHadrCand()->p() > 0. ) {
1107  TauLeadPFChargedHadrHoP = theTau.hcalEnergyLeadChargedHadrCand()/theTau.leadChargedHadrCand()->p();
1108  TauLeadPFChargedHadrEoP = theTau.ecalEnergyLeadChargedHadrCand()/theTau.leadChargedHadrCand()->p();
1109  }
1110 
1111  std::vector<Float_t> GammasdEtaInSigCone;
1112  std::vector<Float_t> GammasdPhiInSigCone;
1113  std::vector<Float_t> GammasPtInSigCone;
1114  std::vector<Float_t> GammasdEtaOutSigCone;
1115  std::vector<Float_t> GammasdPhiOutSigCone;
1116  std::vector<Float_t> GammasPtOutSigCone;
1117  reco::Candidate::LorentzVector pfGammaSum(0,0,0,0);
1118  reco::Candidate::LorentzVector pfChargedSum(0,0,0,0);
1119 
1120  const reco::CandidatePtrVector signalGammaCands = theTau.signalGammaCands();
1121  for ( const auto & gamma : signalGammaCands ) {
1122  float dR = deltaR(gamma->p4(), theTau.leadChargedHadrCand()->p4());
1123  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, theTau.pt())));
1124 
1125  // pfGammas inside the tau signal cone
1126  if (dR < signalrad) {
1127  if ( theTau.leadChargedHadrCand().isNonnull() ) {
1128  GammasdEtaInSigCone.push_back(gamma->eta() - theTau.leadChargedHadrCand()->eta());
1129  GammasdPhiInSigCone.push_back(gamma->phi() - theTau.leadChargedHadrCand()->phi());
1130  }
1131  else {
1132  GammasdEtaInSigCone.push_back(gamma->eta() - theTau.eta());
1133  GammasdPhiInSigCone.push_back(gamma->phi() - theTau.phi());
1134  }
1135  GammasPtInSigCone.push_back(gamma->pt());
1136  pfGammaSum += gamma->p4();
1137  }
1138  // pfGammas outside the tau signal cone
1139  else {
1140  if ( theTau.leadChargedHadrCand().isNonnull() ) {
1141  GammasdEtaOutSigCone.push_back(gamma->eta() - theTau.leadChargedHadrCand()->eta());
1142  GammasdPhiOutSigCone.push_back(gamma->phi() - theTau.leadChargedHadrCand()->phi());
1143  }
1144  else {
1145  GammasdEtaOutSigCone.push_back(gamma->eta() - theTau.eta());
1146  GammasdPhiOutSigCone.push_back(gamma->phi() - theTau.phi());
1147  }
1148  GammasPtOutSigCone.push_back(gamma->pt());
1149  }
1150  }
1151 
1152  const reco::CandidatePtrVector signalChargedCands = theTau.signalChargedHadrCands();
1153  for ( const auto & charged : signalChargedCands ) {
1154  float dR = deltaR(charged->p4(), theTau.leadChargedHadrCand()->p4());
1155  float signalrad = std::max(0.05, std::min(0.10, 3.0/std::max(1.0, theTau.pt())));
1156 
1157  // charged particles inside the tau signal cone
1158  if (dR < signalrad) {
1159  pfChargedSum += charged->p4();
1160  }
1161  }
1162 
1163  Int_t TauSignalPFGammaCandsIn = GammasPtInSigCone.size();
1164  Int_t TauSignalPFGammaCandsOut = GammasPtOutSigCone.size();
1165  Float_t TauVisMassIn = (pfGammaSum + pfChargedSum).mass();
1166  Float_t TauPhi = -99.;
1168  float sumPhiTimesEnergy = 0.;
1169  float sumEnergy = 0.;
1170  const reco::CandidatePtrVector signalCands = theTau.signalCands();
1171  for ( const auto & signalCandPtr : signalCands ) {
1172  reco::Candidate const* signalCand = signalCandPtr.get();
1173  float phi = theTau.phi();
1174  math::XYZPoint aPos;
1175  if ( atECalEntrance(signalCand, aPos) == true ) phi = aPos.Phi();
1176  sumPhiTimesEnergy += phi*signalCand->energy();
1177  sumEnergy += signalCand->energy();
1178  }
1179  if ( sumEnergy > 0. ) {
1180  TauPhi = sumPhiTimesEnergy/sumEnergy;
1181  }
1182  }
1183  else {
1184  TauPhi = theTau.phiAtEcalEntrance();
1185  }
1186 
1187  Float_t TaudCrackPhi = dCrackPhi(TauPhi, TauEtaAtEcalEntrance);
1188  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance);
1189 
1190  Float_t TauHasGsf = 0;
1191  pat::PackedCandidate const* packedLeadTauCand = dynamic_cast<pat::PackedCandidate const*>(theTau.leadChargedHadrCand().get());
1192  //const reco::Track & pseudoTrack = packedLeadTauCand->pseudoTrack();
1193  if( abs(packedLeadTauCand->pdgId()) == 11 ) TauHasGsf = 1;
1194 
1195  // === electron variables ===
1196  Float_t dummyElecEta = 9.9;
1197 
1198  return MVAValue(TauPt,
1199  TauEtaAtEcalEntrance,
1200  TauPhi,
1201  TauLeadChargedPFCandPt,
1202  TauLeadChargedPFCandEtaAtEcalEntrance,
1203  TauEmFraction,
1204  TauLeadPFChargedHadrHoP,
1205  TauLeadPFChargedHadrEoP,
1206  TauVisMassIn,
1207  TaudCrackEta,
1208  TaudCrackPhi,
1209  TauHasGsf,
1210  TauSignalPFGammaCandsIn,
1211  TauSignalPFGammaCandsOut,
1212  GammasdEtaInSigCone,
1213  GammasdPhiInSigCone,
1214  GammasPtInSigCone,
1215  GammasdEtaOutSigCone,
1216  GammasdPhiOutSigCone,
1217  GammasPtOutSigCone,
1218  dummyElecEta,
1219  0.,
1220  0.,
1221  0.,
1222  0.,
1223  0.,
1224  0.,
1225  0.,
1226  0.,
1227  0.,
1228  0.,
1229  0.,
1230  0.,
1231  0.,
1232  0.,
1233  0.,
1234  0.);
1235 }
bool atECalEntrance(const reco::Candidate *part, math::XYZPoint &pos)
double eta() const final
momentum pseudorapidity
int pdgId() const override
PDG identifier.
float hcalEnergyLeadChargedHadrCand() const
return hcal energy from LeadChargedHadrCand
Definition: Tau.h:346
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:159
double dCrackPhi(double phi, double eta)
double pt() const final
transverse momentum
reco::CandidatePtrVector signalCands() const
reco::CandidatePtrVector signalGammaCands() const
virtual double energy() const =0
energy
float ecalEnergyLeadChargedHadrCand() const
Definition: Tau.h:344
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
float phiAtEcalEntrance() const
return phiAtEcalEntrance
Definition: Tau.h:348
const reco::CandidatePtr leadChargedHadrCand() const
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
float ptLeadChargedCand() const
return pt from LeadChargedCand
Definition: Tau.h:354
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)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
float emFraction_MVA() const
return emFraction_MVA
Definition: Tau.h:356
T get() const
get a component
Definition: Candidate.h:217
reco::CandidatePtrVector signalChargedHadrCands() const
float etaAtEcalEntrance() const
return etaAtEcalEntrance
Definition: Tau.h:350
float etaAtEcalEntranceLeadChargedCand() const
return etaAtEcalEntrance from LeadChargedCand
Definition: Tau.h:352
double dCrackEta(double eta)
double phi() const final
momentum azimuthal angle

Member Data Documentation

double AntiElectronIDMVA6::bField_
private

Definition at line 178 of file AntiElectronIDMVA6.h.

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

edm::FileInPath AntiElectronIDMVA6::inputFileName_
private

Definition at line 145 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

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

Definition at line 176 of file AntiElectronIDMVA6.h.

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

bool AntiElectronIDMVA6::isInitialized_
private

Definition at line 143 of file AntiElectronIDMVA6.h.

Referenced by beginEvent(), and MVAValue().

bool AntiElectronIDMVA6::loadMVAfromDB_
private

Definition at line 144 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_wGwoGSF_BL_
private

Definition at line 168 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_wGwoGSF_EC_
private

Definition at line 172 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_woGwoGSF_BL_
private

Definition at line 167 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_NoEleMatch_woGwoGSF_EC_
private

Definition at line 171 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_wGwGSF_BL_
private

Definition at line 170 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_wGwGSF_EC_
private

Definition at line 174 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_woGwGSF_BL_
private

Definition at line 169 of file AntiElectronIDMVA6.h.

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

const GBRForest* AntiElectronIDMVA6::mva_woGwGSF_EC_
private

Definition at line 173 of file AntiElectronIDMVA6.h.

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

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_wGwoGSF_BL_
private

Definition at line 148 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_wGwoGSF_EC_
private

Definition at line 152 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_woGwoGSF_BL_
private

Definition at line 147 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_NoEleMatch_woGwoGSF_EC_
private

Definition at line 151 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_wGwGSF_BL_
private

Definition at line 150 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_wGwGSF_EC_
private

Definition at line 154 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_woGwGSF_BL_
private

Definition at line 149 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

std::string AntiElectronIDMVA6::mvaName_woGwGSF_EC_
private

Definition at line 153 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and beginEvent().

bool AntiElectronIDMVA6::usePhiAtEcalEntranceExtrapolation_
private

Definition at line 156 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6(), and MVAValue().

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_wGwoGSF_Barrel_
private

Definition at line 159 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_wGwoGSF_Endcap_
private

Definition at line 163 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_woGwoGSF_Barrel_
private

Definition at line 158 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_NoEleMatch_woGwoGSF_Endcap_
private

Definition at line 162 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_wGwGSF_Barrel_
private

Definition at line 161 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_wGwGSF_Endcap_
private

Definition at line 165 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_woGwGSF_Barrel_
private

Definition at line 160 of file AntiElectronIDMVA6.h.

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

Float_t* AntiElectronIDMVA6::Var_woGwGSF_Endcap_
private

Definition at line 164 of file AntiElectronIDMVA6.h.

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

int AntiElectronIDMVA6::verbosity_
private

Definition at line 179 of file AntiElectronIDMVA6.h.

Referenced by AntiElectronIDMVA6().