11 #include "TMVA/MethodBDT.h" 15 tag_(conf.getParameter<
std::
string>(
"mvaTag")),
16 MethodName_(
"BDTG method"),
17 beamSpotLabel_(conf.getParameter<
edm::InputTag>(
"beamSpot")),
18 conversionsLabelAOD_(conf.getParameter<
edm::InputTag>(
"conversionsAOD")),
19 conversionsLabelMiniAOD_(conf.getParameter<
edm::InputTag>(
"conversionsMiniAOD")) {
22 = conf.
getParameter<std::vector<std::string> >(
"weightFileNames");
23 init(weightFileNames);
29 <<
"wrong number of weightfiles" << std::endl;
98 mvaValue(
const int iCategory,
const std::vector<float> & vars)
const {
101 const bool debug =
false;
105 <<
" fbrem " << vars[11]
106 <<
" kfchi2 " << vars[9]
107 <<
" mykfhits " << vars[8]
108 <<
" gsfchi2 " << vars[10]
109 <<
" deta " << vars[18]
110 <<
" dphi " << vars[19]
111 <<
" detacalo " << vars[20]
112 <<
" see " << vars[0]
113 <<
" spp " << vars[1]
114 <<
" etawidth " << vars[4]
115 <<
" phiwidth " << vars[5]
116 <<
" OneMinusE1x5E5x5 " << vars[2]
118 <<
" HoE " << vars[6]
119 <<
" EoP " << vars[15]
120 <<
" IoEmIoP " << vars[17]
121 <<
" eleEoPout " << vars[16]
122 <<
" eta " << vars[24]
123 <<
" pt " << vars[21] << std::endl;
124 std::cout <<
" ### MVA " << result << std::endl;
137 <<
" given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
138 <<
" but appears to be neither" << std::endl;
149 const float ebSplit = 0.800;
150 const float ebeeSplit = 1.479;
182 TMVA::Reader tmpTMVAReader(
"!Color:Silent:!Error" );
190 tmpTMVAReader.AddVariable(
"ele_oldsigmaietaieta", &
allMVAVars_.
see);
191 tmpTMVAReader.AddVariable(
"ele_oldsigmaiphiiphi", &
allMVAVars_.
spp);
231 return std::unique_ptr<const GBRForest> (
new GBRForest( dynamic_cast<TMVA::MethodBDT*>( tmpTMVAReader.FindMVA(
MethodName_) ) ) );
259 <<
"Failed to retrieve event content needed for this MVA" 261 <<
"Check python MVA configuration file." 269 <<
" given particle is expected to be reco::GsfElectron or pat::Electron," << std::endl
270 <<
" but appears to be neither" << std::endl;
291 allMVAVars.
etawidth = superCluster->etaWidth();
292 allMVAVars.
phiwidth = superCluster->phiWidth();
295 allMVAVars.
PreShowerOverRaw = superCluster->preshowerEnergy() / superCluster->rawEnergy();
305 if( elePatPtr !=
NULL )
310 allMVAVars.
kfhits = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ;
311 allMVAVars.
kfchi2 = (validKF) ? myTrackRef->normalizedChi2() : 0;
317 allMVAVars.
gsfhits = eleRecoPtr->
gsfTrack()->hitPattern().trackerLayersWithMeasurement();
324 double vertexFitProbability = -1.;
327 vertexFitProbability = TMath::Prob( vtx.
chi2(), vtx.
ndof());
343 allMVAVars.
pt = eleRecoPtr->
pt();
344 float scEta = superCluster->eta();
348 allMVAVars.
SCeta = scEta;
349 allMVAVars.
pt = eleRecoPtr->
pt();
353 std::vector<float> vars;
420 if(allMVAVars.
fbrem < -1.)
421 allMVAVars.
fbrem = -1.;
423 allMVAVars.
deta = fabs(allMVAVars.
deta);
424 if(allMVAVars.
deta > 0.06)
425 allMVAVars.
deta = 0.06;
428 allMVAVars.
dphi = fabs(allMVAVars.
dphi);
429 if(allMVAVars.
dphi > 0.6)
430 allMVAVars.
dphi = 0.6;
433 if(allMVAVars.
EoP > 20.)
434 allMVAVars.
EoP = 20.;
451 if(allMVAVars.
R9 > 5)
458 if(allMVAVars.
kfchi2 > 10.)
~ElectronMVAEstimatorRun2Spring16GeneralPurpose()
const edm::InputTag conversionsLabelMiniAOD_
T getParameter(std::string const &) const
virtual double pt() const final
transverse momentum
void init(const std::vector< std::string > weightFileNames)
bool isNonnull() const
Checks for non-null.
float eSuperClusterOverP() const
float full5x5_e5x5() const
float full5x5_e1x5() const
T const * get() const
Returns C++ pointer to the item.
bool isValid() const
Tells whether the vertex is valid.
math::XYZVectorF trackMomentumAtVtx() const
float full5x5_sigmaIphiIphi() const
std::vector< std::unique_ptr< const GBRForest > > gbrForest_s
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
TrackRef closestCtfTrackRef() const
float full5x5_sigmaIetaIeta() const
std::vector< float > packMVAVariables(const Args...args) const
float deltaEtaSuperClusterTrackAtVtx() const
reco::TrackRef closestCtfTrackRef() const
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
void setConsumes(edm::ConsumesCollector &&) const override final
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
const edm::InputTag conversionsLabelAOD_
float deltaPhiSuperClusterTrackAtVtx() const
float mvaValue(const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const override
Abs< T >::type abs(const T &t)
double chi2() const
chi-squares
ElectronMVAEstimatorRun2Spring16GeneralPurpose()
float eEleClusterOverPout() const
T const * get() const
Returns C++ pointer to the item.
std::vector< float > fillMVAVariables(const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const override
int findCategory(const edm::Ptr< reco::Candidate > &particle) const override
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
bool isEndcap(GeomDetEnumerators::SubDetector m)
bool isNull() const
Checks for null.
const std::string MethodName_
void constrainMVAVariables(AllVariables &) const
T const * product() const
float full5x5_hcalOverEcal() const
Analysis-level electron class.
float convVtxFitProbability
const edm::InputTag beamSpotLabel_
float deltaEtaSeedClusterTrackAtCalo() const
bool getByLabel(InputTag const &, Handle< T > &) const
bool isEndcapCategory(int category) const
float expectedMissingInnerHits
std::string fullPath() const
const Point & position() const
position
std::unique_ptr< const GBRForest > createSingleReader(const int iCategory, const edm::FileInPath &weightFile)
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack