5 #include "TMVA/MethodBDT.h" 12 _MethodName(
"BDTG method"),
13 _useValueMaps(conf.getParameter<bool>(
"useValueMaps")),
14 _full5x5SigmaIEtaIEtaMapLabel(conf.getParameter<
edm::InputTag>(
"full5x5SigmaIEtaIEtaMap")),
15 _full5x5SigmaIEtaIPhiMapLabel(conf.getParameter<
edm::InputTag>(
"full5x5SigmaIEtaIPhiMap")),
16 _full5x5E1x3MapLabel(conf.getParameter<
edm::InputTag>(
"full5x5E1x3Map")),
17 _full5x5E2x2MapLabel(conf.getParameter<
edm::InputTag>(
"full5x5E2x2Map")),
18 _full5x5E2x5MaxMapLabel(conf.getParameter<
edm::InputTag>(
"full5x5E2x5MaxMap")),
19 _full5x5E5x5MapLabel(conf.getParameter<
edm::InputTag>(
"full5x5E5x5Map")),
20 _esEffSigmaRRMapLabel(conf.getParameter<
edm::InputTag>(
"esEffSigmaRRMap")),
21 _phoChargedIsolationLabel(conf.getParameter<
edm::InputTag>(
"phoChargedIsolation")),
22 _phoPhotonIsolationLabel(conf.getParameter<
edm::InputTag>(
"phoPhotonIsolation")),
23 _phoWorstChargedIsolationLabel(conf.getParameter<
edm::InputTag>(
"phoWorstChargedIsolation")),
24 _rhoLabel(conf.getParameter<
edm::InputTag>(
"rho"))
32 = conf.
getParameter<std::vector<std::string> >(
"weightFileNames");
36 <<
"wrong number of weightfiles" << std::endl;
61 printf(
"Printout of the photon variable inputs for MVA:\n");
62 printf(
" varPhi_ %f\n", vars[0] );
63 printf(
" varR9_ %f\n", vars[1] );
64 printf(
" varSieie_ %f\n", vars[2] );
65 printf(
" varSieip_ %f\n", vars[3] );
66 printf(
" varE1x3overE5x5_ %f\n", vars[4] );
67 printf(
" varE2x2overE5x5_ %f\n", vars[5] );
68 printf(
" varE2x5overE5x5_ %f\n", vars[6] );
69 printf(
" varSCEta_ %f\n", vars[7] );
70 printf(
" varRawE_ %f\n", vars[8] );
71 printf(
" varSCEtaWidth_ %f\n", vars[9] );
72 printf(
" varSCPhiWidth_ %f\n", vars[10] );
73 printf(
" varRho_ %f\n", vars[11] );
74 printf(
" varPhoIsoRaw_ %f\n", vars[12] );
75 printf(
" varChIsoRaw_ %f\n", vars[13] );
76 printf(
" varWorstChRaw_ %f\n", vars[14] );
78 printf(
" varESEnOverRawE_ %f\n", vars[15] );
79 printf(
" varESEffSigmaRR_ %f\n", vars[16] );
81 printf(
" varPt_ %f\n", vars[17] );
82 printf(
" varEta_ %f\n", vars[18] );
85 printf(
" varPt_ %f\n", vars[15] );
86 printf(
" varEta_ %f\n", vars[16] );
100 <<
" given particle is expected to be reco::Photon or pat::Photon," << std::endl
101 <<
" but appears to be neither" << std::endl;
139 TMVA::Reader tmpTMVAReader(
"!Color:Silent:Error" );
180 return std::make_unique<const GBRForest>(
dynamic_cast<TMVA::MethodBDT*
>( tmpTMVAReader.FindMVA(
_MethodName) ) );
224 && full5x5SigmaIEtaIPhiMap.
isValid()
229 && esEffSigmaRRMap.
isValid() ) )
230 && phoChargedIsolationMap.
isValid()
231 && phoPhotonIsolationMap.
isValid()
232 && phoWorstChargedIsolationMap.
isValid()
235 <<
"Failed to retrieve event content needed for this MVA" 237 <<
"Check python MVA configuration file and make sure all needed" 239 <<
"producers are running upstream" << std::endl;
247 <<
" given particle is expected to be reco::Photon or pat::Photon," << std::endl
248 <<
" but appears to be neither" << std::endl;
265 e1x3 = (*full5x5E1x3Map )[ phoRecoPtr ];
266 e2x2 = (*full5x5E2x2Map )[ phoRecoPtr ];
267 e2x5 = (*full5x5E2x5MaxMap)[ phoRecoPtr ];
268 e5x5 = (*full5x5E5x5Map )[ phoRecoPtr ];
269 full5x5_sigmaIetaIeta = (*full5x5SigmaIEtaIEtaMap)[ phoRecoPtr ];
270 full5x5_sigmaIetaIphi = (*full5x5SigmaIEtaIPhiMap)[ phoRecoPtr ];
271 effSigmaRR = (*esEffSigmaRRMap)[ phoRecoPtr ];
275 e1x3 = full5x5_pss.
e1x3;
276 e2x2 = full5x5_pss.e2x2;
277 e2x5 = full5x5_pss.e2x5Max;
278 e5x5 = full5x5_pss.e5x5;
279 full5x5_sigmaIetaIeta = full5x5_pss.sigmaIetaIeta;
280 full5x5_sigmaIetaIphi = full5x5_pss.sigmaIetaIphi;
281 effSigmaRR = full5x5_pss.effSigmaRR;
285 allMVAVars.
varR9 = phoRecoPtr->
r9() ;
286 allMVAVars.
varSieie = full5x5_sigmaIetaIeta;
287 allMVAVars.
varSieip = full5x5_sigmaIetaIphi;
291 allMVAVars.
varSCEta = superCluster->eta();
292 allMVAVars.
varRawE = superCluster->rawEnergy();
295 allMVAVars.
varESEnOverRawE = superCluster->preshowerEnergy() / superCluster->rawEnergy();
298 allMVAVars.
varPhoIsoRaw = (*phoPhotonIsolationMap)[phoRecoPtr];
299 allMVAVars.
varChIsoRaw = (*phoChargedIsolationMap)[phoRecoPtr];
300 allMVAVars.
varWorstChRaw = (*phoWorstChargedIsolationMap)[phoRecoPtr];
302 allMVAVars.
varPt = phoRecoPtr->
pt();
307 std::vector<float> vars;
383 "PhotonMVAEstimatorRun2Phys14NonTrig");
T getParameter(std::string const &) const
virtual double pt() const final
transverse momentum
std::unique_ptr< const GBRForest > createSingleReader(const int iCategory, const edm::FileInPath &weightFile)
const edm::InputTag _esEffSigmaRRMapLabel
const edm::InputTag _full5x5E2x5MaxMapLabel
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
void setConsumes(edm::ConsumesCollector &&) const override
virtual double eta() const final
momentum pseudorapidity
const edm::InputTag _rhoLabel
const edm::InputTag _full5x5E2x2MapLabel
const std::string _MethodName
const edm::InputTag _phoPhotonIsolationLabel
std::vector< float > packMVAVariables(const Args...args) const
virtual double phi() const final
momentum azimuthal angle
float mvaValue(const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const override
const edm::InputTag _phoWorstChargedIsolationLabel
int findCategory(const edm::Ptr< reco::Candidate > &particle) const override
const edm::InputTag _full5x5SigmaIEtaIPhiMapLabel
bool isEndcapCategory(int category) const
bool isNull() const
Checks for null.
Abs< T >::type abs(const T &t)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const edm::InputTag _full5x5E5x5MapLabel
bool isEndcap(GeomDetEnumerators::SubDetector m)
const edm::InputTag _full5x5E1x3MapLabel
PhotonMVAEstimatorRun2Phys14NonTrig(const edm::ParameterSet &conf)
void constrainMVAVariables(AllVariables &vars) const
const edm::InputTag _full5x5SigmaIEtaIEtaMapLabel
const ShowerShape & full5x5_showerShapeVariables() const
~PhotonMVAEstimatorRun2Phys14NonTrig()
std::string fullPath() const
const edm::InputTag _phoChargedIsolationLabel
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< std::unique_ptr< const GBRForest > > _gbrForests
std::vector< float > fillMVAVariables(const edm::Ptr< reco::Candidate > &particle, const edm::Event &) const override