15 const std::vector <std::string> weightFileNames
16 = conf.
getParameter<std::vector<std::string> >(
"weightFileNames");
20 <<
"wrong number of weightfiles" << std::endl;
45 const std::vector<float> vars = std::move(
fillMVAVariables( particle, evt ) );
52 <<
" fbrem " << vars[11]
53 <<
" kfchi2 " << vars[9]
54 <<
" mykfhits " << vars[0]
55 <<
" gsfchi2 " << vars[10]
56 <<
" deta " << vars[15]
57 <<
" dphi " << vars[16]
58 <<
" detacalo " << vars[17]
61 <<
" etawidth " << vars[5]
62 <<
" phiwidth " << vars[6]
63 <<
" OneMinusE1x5E5x5 " << vars[3]
66 <<
" EoP " << vars[12]
67 <<
" IoEmIoP " << vars[14]
68 <<
" eleEoPout " << vars[13]
71 <<
" eta " << vars[21]
72 <<
" isBarrel " << vars[19]
73 <<
" isEndcap " << vars[20]
76 std::cout <<
" ### MVA " << result << std::endl;
89 <<
" given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
90 <<
" but appears to be neither" << std::endl;
92 const float pt = eleRecoPtr->pt();
93 const float eta = eleRecoPtr->superCluster()->eta();
103 if (pt < ptSplit &&
std::abs(eta) < ebSplit)
109 if (pt < ptSplit &&
std::abs(eta) >= ebeeSplit)
112 if (pt >= ptSplit &&
std::abs(eta) < ebSplit)
118 if (pt >= ptSplit &&
std::abs(eta) >= ebeeSplit)
135 std::unique_ptr<const GBRForest>
142 TMVA::Reader tmpTMVAReader(
"!Color:Silent:Error" );
152 tmpTMVAReader.AddVariable(
"ele_oldsigmaietaieta", &
_allMVAVars.
see);
153 tmpTMVAReader.AddVariable(
"ele_oldsigmaiphiiphi", &
_allMVAVars.
spp);
189 return std::unique_ptr<const GBRForest> (
new GBRForest( dynamic_cast<TMVA::MethodBDT*>( tmpTMVAReader.FindMVA(
_MethodName) ) ) );
202 <<
" given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
203 <<
" but appears to be neither" << std::endl;
210 auto superCluster = eleRecoPtr->superCluster();
221 myTrackRef = elePatPtr->closestCtfTrackRef();
224 allMVAVars.
kfhits = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ;
226 allMVAVars.
see = eleRecoPtr->full5x5_sigmaIetaIeta();
227 allMVAVars.
spp = eleRecoPtr->full5x5_sigmaIphiIphi();
228 allMVAVars.
OneMinusE1x5E5x5 = 1. - eleRecoPtr->full5x5_e1x5() / eleRecoPtr->full5x5_e5x5();
229 allMVAVars.
R9 = eleRecoPtr->full5x5_r9();
230 allMVAVars.
etawidth = superCluster->etaWidth();
231 allMVAVars.
phiwidth = superCluster->phiWidth();
232 allMVAVars.
HoE = eleRecoPtr->hadronicOverEm();
234 allMVAVars.
PreShowerOverRaw = superCluster->preshowerEnergy() / superCluster->rawEnergy();
236 allMVAVars.
kfchi2 = (validKF) ? myTrackRef->normalizedChi2() : 0;
237 allMVAVars.
gsfchi2 = eleRecoPtr->gsfTrack()->normalizedChi2();
239 allMVAVars.
fbrem = eleRecoPtr->fbrem();
240 allMVAVars.
EoP = eleRecoPtr->eSuperClusterOverP();
241 allMVAVars.
eleEoPout = eleRecoPtr->eEleClusterOverPout();
242 allMVAVars.
IoEmIoP = (1.0/eleRecoPtr->ecalEnergy()) - (1.0 / eleRecoPtr->p());
244 allMVAVars.
deta = eleRecoPtr->deltaEtaSuperClusterTrackAtVtx();
245 allMVAVars.
dphi = eleRecoPtr->deltaPhiSuperClusterTrackAtVtx();
246 allMVAVars.
detacalo = eleRecoPtr->deltaEtaSeedClusterTrackAtCalo();
248 allMVAVars.
pt = eleRecoPtr->pt();
249 const float scEta = superCluster->eta();
253 allMVAVars.
SCeta = scEta;
257 std::vector<float> vars;
T getParameter(std::string const &) const
bool isNonnull() const
Checks for non-null.
T const * get() const
Returns C++ pointer to the item.
std::vector< float > fillMVAVariables(const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const
std::vector< float > packMVAVariables(const Args...args) const
int findCategory(const edm::Ptr< reco::Candidate > &particle) const
std::vector< std::unique_ptr< const GBRForest > > _gbrForests
std::unique_ptr< const GBRForest > createSingleReader(const int iCategory, const edm::FileInPath &weightFile)
ElectronMVAEstimatorRun2Phys14NonTrig(const edm::ParameterSet &conf)
Abs< T >::type abs(const T &t)
~ElectronMVAEstimatorRun2Phys14NonTrig()
bool isEndcap(GeomDetEnumerators::SubDetector m)
float mvaValue(const edm::Ptr< reco::Candidate > &particle, const edm::Event &evt) const
void constrainMVAVariables(AllVariables &vars) const
bool isEndcapCategory(int category) const
std::string fullPath() const