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")),
15 phoIsoCutoff_(conf.getParameter<double>(
"phoIsoCutoff"))
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(
" varSCPhi_ %f\n", vars[0] );
67 printf(
" varR9_ %f\n", vars[1] );
68 printf(
" varSieie_ %f\n", vars[2] );
69 printf(
" varSieip_ %f\n", vars[3] );
70 printf(
" varE2x2overE5x5_ %f\n", vars[4] );
71 printf(
" varSCEta_ %f\n", vars[5] );
72 printf(
" varRawE_ %f\n", vars[6] );
73 printf(
" varSCEtaWidth_ %f\n", vars[7] );
74 printf(
" varSCPhiWidth_ %f\n", vars[8] );
75 printf(
" varRho_ %f\n", vars[9] );
77 printf(
" varPhoIsoRaw_ %f\n", vars[10] );
79 printf(
" varPhoIsoRawCorr_ %f\n", vars[10] );
81 printf(
" varChIsoRaw_ %f\n", vars[11] );
82 printf(
" varWorstChRaw_ %f\n", vars[12] );
84 printf(
" varESEnOverRawE_ %f\n", vars[13] );
85 printf(
" varESEffSigmaRR_ %f\n", vars[14] );
99 <<
" given particle is expected to be reco::Photon or pat::Photon," << std::endl
100 <<
" but appears to be neither" << std::endl;
108 const float ebeeSplit = 1.479;
137 TMVA::Reader tmpTMVAReader(
"!Color:Silent:Error" );
177 return std::unique_ptr<const GBRForest>(
new GBRForest( dynamic_cast<TMVA::MethodBDT*>( tmpTMVAReader.FindMVA(
MethodName_) ) ) );
209 if(! ( phoChargedIsolationMap.
isValid()
210 && phoPhotonIsolationMap.
isValid()
211 && phoWorstChargedIsolationMap.
isValid()
214 <<
"Failed to retrieve event content needed for this MVA" 216 <<
"Check python MVA configuration file and make sure all needed" 218 <<
"producers are running upstream" << std::endl;
225 <<
" given particle is expected to be reco::Photon or pat::Photon," << std::endl
226 <<
" but appears to be neither" << std::endl;
241 e2x2 = full5x5_pss.
e2x2;
242 e5x5 = full5x5_pss.e5x5;
243 full5x5_sigmaIetaIeta = full5x5_pss.sigmaIetaIeta;
244 full5x5_sigmaIetaIphi = full5x5_pss.sigmaIetaIphi;
245 effSigmaRR = full5x5_pss.effSigmaRR;
247 allMVAVars.
scPhi = superCluster->phi();
248 allMVAVars.
varR9 = phoRecoPtr->
r9() ;
249 allMVAVars.
varSieie = full5x5_sigmaIetaIeta;
250 allMVAVars.
varSieip = full5x5_sigmaIetaIphi;
252 allMVAVars.
varSCEta = superCluster->eta();
253 allMVAVars.
varRawE = superCluster->rawEnergy();
256 allMVAVars.
varESEnOverRawE = superCluster->preshowerEnergy() / superCluster->rawEnergy();
259 allMVAVars.
varPhoIsoRaw = (*phoPhotonIsolationMap)[phoRecoPtr];
260 allMVAVars.
varChIsoRaw = (*phoChargedIsolationMap)[phoRecoPtr];
261 allMVAVars.
varWorstChRaw = (*phoWorstChargedIsolationMap)[phoRecoPtr];
266 double phoIsoPtScalingCoeffVal = 0;
271 double phoIsoCorr = (*phoPhotonIsolationMap)[phoRecoPtr] - eA*(*rho) - phoIsoPtScalingCoeffVal*phoRecoPtr->
pt();
280 std::vector<float> vars;
340 "PhotonMVAEstimatorRun2Spring16NonTrig");
T getParameter(std::string const &) const
virtual double pt() const final
transverse momentum
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
~PhotonMVAEstimatorRun2Spring16NonTrig()
std::unique_ptr< const GBRForest > createSingleReader(const int iCategory, const edm::FileInPath &weightFile)
const edm::InputTag rhoLabel_
PhotonMVAEstimatorRun2Spring16NonTrig(const edm::ParameterSet &conf)
const float getEffectiveArea(float eta) const
int findCategory(const edm::Ptr< reco::Candidate > &particle) const override
std::vector< float > packMVAVariables(const Args...args) const
std::vector< float > fillMVAVariables(const edm::Ptr< reco::Candidate > &particle, const edm::Event &iEvent) const override
void constrainMVAVariables(AllVariables &) const
bool isEndcapCategory(int category) const
bool isNull() const
Checks for null.
Abs< T >::type abs(const T &t)
std::vector< std::unique_ptr< const GBRForest > > gbrForests_
const std::string MethodName_
const edm::InputTag phoPhotonIsolationLabel_
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 phoChargedIsolationLabel_
EffectiveAreas effectiveAreas_
void setConsumes(edm::ConsumesCollector &&) const override
const ShowerShape & full5x5_showerShapeVariables() const
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::string fullPath() const
const edm::InputTag phoWorstChargedIsolationLabel_
std::vector< double > phoIsoPtScalingCoeff_