7 #include "TMVA/Reader.h" 8 #include "TMVA/MethodBDT.h" 11 std::vector<std::string> weightsfiles;
15 weightsfiles.push_back(path_mvaWeightFileEleID);
23 std::cout <<
"Error: Expected Number of bins = " <<
ExpectedNBins <<
" does not equal to weightsfiles.size() = " 31 TMVA::Reader tmvaReader(
"!Color:Silent");
32 tmvaReader.AddVariable(
"fbrem", &
fbrem);
33 tmvaReader.AddVariable(
"EtotOvePin", &
EtotOvePin);
34 tmvaReader.AddVariable(
"EClusOverPout", &
eleEoPout);
38 tmvaReader.AddVariable(
"HoE", &
HoE);
39 tmvaReader.AddVariable(
"gsfchi2", &
gsfchi2);
40 tmvaReader.AddVariable(
"kfchi2", &
kfchi2);
41 tmvaReader.AddVariable(
"kfhits", &
kfhits);
43 tmvaReader.AddVariable(
"deta", &
deta);
44 tmvaReader.AddVariable(
"dphi", &
dphi);
45 tmvaReader.AddVariable(
"detacalo", &
detacalo);
46 tmvaReader.AddVariable(
"see", &
see);
47 tmvaReader.AddVariable(
"spp", &
spp);
48 tmvaReader.AddVariable(
"R9", &
R9);
49 tmvaReader.AddVariable(
"etawidth", &
etawidth);
50 tmvaReader.AddVariable(
"phiwidth", &
phiwidth);
52 tmvaReader.AddVariable(
"IoEmIoP", &
IoEmIoP);
54 tmvaReader.AddVariable(
"nPV", &
nPV);
56 tmvaReader.AddVariable(
"pt", &
pt);
57 tmvaReader.AddVariable(
"eta", &
eta);
59 tmvaReader.AddSpectator(
"pt", &
pt);
60 tmvaReader.AddSpectator(
"eta", &
eta);
64 tmvaReader.BookMVA(
"BDT",weightsfiles[
i]);
65 gbr[
i].reset(
new GBRForest( dynamic_cast<TMVA::MethodBDT*>( tmvaReader.FindMVA(
"BDT") ) ) );
79 bool ptrange[3],etarange[3],purange[2];
80 ptrange[0]=pt > 2 && pt < 5;
81 ptrange[1]=pt > 5 && pt < 10;
83 etarange[0]=fabs(eta) < 0.8;
84 etarange[1]=fabs(eta) > 0.8 && fabs(eta) <1.4;
85 etarange[2]=fabs(eta) > 1.4;
90 for(
int kPU=0;kPU<2;kPU++)
91 for(
int kETA=0;kETA<3;kETA++)
92 for(
int kPT=0;kPT<3;kPT++){
93 if (purange[kPU] && ptrange[kPT] && etarange[kETA]) bin=
index;
105 vars[0] = myElectron.
fbrem();
112 vars[3] = (etot-eEcal)/dP;
120 vars[7] = myElectron.
gsfTrack()->normalizedChi2();
121 vars[8] = (validKF) ? myTrackRef->normalizedChi2() : 0 ;
122 vars[9] = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ;
130 vars[16] = myElectron.
r9();
133 vars[19] = (myElectron.
e5x5()) !=0. ? 1.-(myElectron.
e1x5()/myElectron.
e5x5()) : -1. ;
134 vars[20] = (1.0/myElectron.
ecalEnergy()) - (1.0 / myElectron.
p());
136 vars[22] = pvc.size();
137 vars[23] = myElectron.
pt();
138 vars[24] = myElectron.
eta();
166 double result=
gbr[0]->GetClassifier(vars);
float sigmaIphiIphi() const
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
virtual TrackRef closestCtfTrackRef() const
bool isNonnull() const
Checks for non-null.
double eta() const final
momentum pseudorapidity
~SoftElectronMVAEstimator()
float eSuperClusterOverP() const
SoftElectronMVAEstimator(const Configuration &)
math::XYZVectorF trackMomentumAtVtx() const
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
std::vector< std::string > vweightsfiles
static unsigned int ExpectedNBins
float deltaEtaSuperClusterTrackAtVtx() const
float sigmaIetaIeta() const
UInt_t GetMVABin(int pu, double eta, double pt) const
float deltaPhiSuperClusterTrackAtVtx() const
Abs< T >::type abs(const T &t)
float eEleClusterOverPout() const
T const * get() const
Returns C++ pointer to the item.
Float_t DeltaEtaTrackEcalSeed
float hcalOverEcalBc() const
double mva(const reco::GsfElectron &myElectron, const reco::VertexCollection &) const
bin
set the eta bin as selection string.
double p() const final
magnitude of momentum vector
float deltaEtaEleClusterTrackAtCalo() const
void bindVariables(float vars[25]) const
math::XYZVectorF trackMomentumAtEleClus() const
std::array< std::unique_ptr< const GBRForest >, ExpectedNBins > gbr
float deltaEtaSeedClusterTrackAtCalo() const
SuperClusterRef superCluster() const override
reference to a SuperCluster
float sigmaEtaEta() const