3 #include "TMVA/MethodBDT.h" 8 methodName_(
"BDTG method"),
9 phoChargedIsolationLabel_(conf.getParameter<
edm::InputTag>(
"phoChargedIsolation")),
10 phoPhotonIsolationLabel_(conf.getParameter<
edm::InputTag>(
"phoPhotonIsolation")),
11 phoWorstChargedIsolationLabel_(conf.getParameter<
edm::InputTag>(
"phoWorstChargedIsolation")),
12 rhoLabel_(conf.getParameter<
edm::InputTag>(
"rho")),
13 effectiveAreas_( (conf.getParameter<
edm::FileInPath>(
"effAreasConfigFile")).fullPath()),
14 phoIsoPtScalingCoeff_(conf.getParameter<
std::vector<double >>(
"phoIsoPtScalingCoeff"))
24 = conf.
getParameter<std::vector<std::string> >(
"weightFileNames");
28 <<
"wrong number of weightfiles" << std::endl;
61 const bool debug =
false;
65 printf(
"Printout of the photon variable inputs for MVA:\n");
66 printf(
" varRawE_ %f\n", vars[0] );
67 printf(
" varR9_ %f\n", vars[1] );
68 printf(
" varSieie_ %f\n", vars[2] );
69 printf(
" varSCEtaWidth_ %f\n", vars[3] );
70 printf(
" varSCPhiWidth_ %f\n", vars[4] );
71 printf(
" varSieip_ %f\n", vars[5] );
72 printf(
" varE2x2overE5x5_ %f\n", vars[6] );
73 printf(
" varPhoIsoRaw_ %f\n", vars[7] );
74 printf(
" varChIsoRaw_ %f\n", vars[8] );
75 printf(
" varWorstChRaw_ %f\n", vars[9] );
76 printf(
" varSCEta_ %f\n", vars[10] );
77 printf(
" varRho_ %f\n", vars[11] );
79 printf(
" varESEffSigmaRR_ %f\n", vars[12] );
80 printf(
" varESEnOverRawE_ %f\n", vars[13] );
94 <<
" given particle is expected to be reco::Photon or pat::Photon," << std::endl
95 <<
" but appears to be neither" << std::endl;
132 TMVA::Reader tmpTMVAReader(
"!Color:Silent:Error" );
163 return std::unique_ptr<const GBRForest>(
new GBRForest( dynamic_cast<TMVA::MethodBDT*>( tmpTMVAReader.FindMVA(
methodName_) ) ) );
195 if(! ( phoChargedIsolationMap.
isValid()
196 && phoPhotonIsolationMap.
isValid()
197 && phoWorstChargedIsolationMap.
isValid()
200 <<
"Failed to retrieve event content needed for this MVA" 202 <<
"Check python MVA configuration file and make sure all needed" 204 <<
"producers are running upstream" << std::endl;
211 <<
" given particle is expected to be reco::Photon or pat::Photon," << std::endl
212 <<
" but appears to be neither" << std::endl;
227 e2x2 = full5x5_pss.
e2x2;
228 e5x5 = full5x5_pss.e5x5;
229 full5x5_sigmaIetaIeta = full5x5_pss.sigmaIetaIeta;
230 full5x5_sigmaIetaIphi = full5x5_pss.sigmaIetaIphi;
231 effSigmaRR = full5x5_pss.effSigmaRR;
233 allMVAVars.
varRawE = superCluster->rawEnergy();
234 allMVAVars.
varR9 = phoRecoPtr->
r9() ;
235 allMVAVars.
varSieie = full5x5_sigmaIetaIeta;
238 allMVAVars.
varSieip = full5x5_sigmaIetaIphi;
240 allMVAVars.
varPhoIsoRaw = (*phoPhotonIsolationMap)[phoRecoPtr];
241 allMVAVars.
varChIsoRaw = (*phoChargedIsolationMap)[phoRecoPtr];
242 allMVAVars.
varWorstChRaw = (*phoWorstChargedIsolationMap)[phoRecoPtr];
243 allMVAVars.
varSCEta = superCluster->eta();
246 allMVAVars.
varESEnOverRawE = superCluster->preshowerEnergy() / superCluster->rawEnergy();
253 std::vector<float> vars;
310 "PhotonMVAEstimatorRunIIFall17");
T getParameter(std::string const &) const
const edm::InputTag phoChargedIsolationLabel_
const edm::InputTag rhoLabel_
std::vector< std::unique_ptr< const GBRForest > > gbrForests_
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
bool isEndcapCategory(int category) const
const edm::InputTag phoWorstChargedIsolationLabel_
std::vector< float > packMVAVariables(const Args...args) const
void constrainMVAVariables(AllVariables &) const
std::vector< float > fillMVAVariables(const edm::Ptr< reco::Candidate > &particle, const edm::Event &iEvent) const override
const std::string methodName_
bool isNull() const
Checks for null.
Abs< T >::type abs(const T &t)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
bool isEndcap(GeomDetEnumerators::SubDetector m)
float mvaValue(const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const
const edm::InputTag phoPhotonIsolationLabel_
~PhotonMVAEstimatorRunIIFall17()
PhotonMVAEstimatorRunIIFall17(const edm::ParameterSet &conf)
const ShowerShape & full5x5_showerShapeVariables() const
std::unique_ptr< const GBRForest > createSingleReader(const int iCategory, const edm::FileInPath &weightFile)
std::string fullPath() const
#define DEFINE_EDM_PLUGIN(factory, type, name)
void setConsumes(edm::ConsumesCollector &&) const override
int findCategory(const edm::Ptr< reco::Candidate > &particle) const override