CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PhotonIDProducer.cc
Go to the documentation of this file.
5 
6 
7 
9 
10  photonProducer_ = conf_.getParameter<std::string>("photonProducer");
11  photonLabel_ = conf_.getParameter<std::string>("photonLabel");
12 
13  photonCutBasedIDLooseLabel_ = conf.getParameter<std::string>("photonCutBasedIDLooseLabel");
14  photonCutBasedIDTightLabel_ = conf.getParameter<std::string>("photonCutBasedIDTightLabel");
15  photonCutBasedIDLooseEMLabel_ = conf.getParameter<std::string>("photonCutBasedIDLooseEMLabel");
16 
17  doCutBased_ = conf_.getParameter<bool>("doCutBased");
19  cutBasedAlgo_->setup(conf);
20  produces<edm::ValueMap<Bool_t> > (photonCutBasedIDLooseLabel_);
21  produces<edm::ValueMap<Bool_t> > (photonCutBasedIDTightLabel_);
22  produces<edm::ValueMap<Bool_t> > (photonCutBasedIDLooseEMLabel_);
23 
24 }
25 
27 
28  //if (doCutBased_)
29  delete cutBasedAlgo_;
30 
31 }
32 
34 
35  // Read in photons
38 
39 
40  // Loop over photons and calculate photon ID using specified technique(s)
41  reco::PhotonCollection::const_iterator photon;
42  std::vector <Bool_t> Loose;
43  std::vector <Bool_t> Tight;
44  std::vector <Bool_t> LooseEM;
45  for (photon = (*photons).begin();
46  photon != (*photons).end(); ++photon) {
47  bool LooseQual;
48  bool TightQual;
49  bool LooseEMQual;
50  if (photon->isEB())
51  cutBasedAlgo_->decideEB(&(*photon),LooseEMQual,LooseQual, TightQual);
52  else
53  cutBasedAlgo_->decideEE(&(*photon),LooseEMQual,LooseQual, TightQual);
54  LooseEM.push_back(LooseEMQual);
55  Loose.push_back(LooseQual);
56  Tight.push_back(TightQual);
57 
58  }
59 
60 
61  std::auto_ptr<edm::ValueMap<Bool_t> > outlooseEM(new edm::ValueMap<Bool_t>());
62  edm::ValueMap<Bool_t>::Filler fillerlooseEM(*outlooseEM);
63  fillerlooseEM.insert(photons, LooseEM.begin(), LooseEM.end());
64  fillerlooseEM.fill();
65  // and put it into the event
66  e.put(outlooseEM, photonCutBasedIDLooseEMLabel_);
67 
68  std::auto_ptr<edm::ValueMap<Bool_t> > outloose(new edm::ValueMap<Bool_t>());
69  edm::ValueMap<Bool_t>::Filler fillerloose(*outloose);
70  fillerloose.insert(photons, Loose.begin(), Loose.end());
71  fillerloose.fill();
72  // and put it into the event
73  e.put(outloose, photonCutBasedIDLooseLabel_);
74 
75  std::auto_ptr<edm::ValueMap<Bool_t> > outtight(new edm::ValueMap<Bool_t>());
76  edm::ValueMap<Bool_t>::Filler fillertight(*outtight);
77  fillertight.insert(photons, Tight.begin(), Tight.end());
78  fillertight.fill();
79  // and put it into the event
80  e.put(outtight, photonCutBasedIDTightLabel_);
81 
82 
83 }
T getParameter(std::string const &) const
void decideEE(const reco::Photon *pho, bool &LooseEM, bool &LoosePhoton, bool &TightPhoton)
PhotonIDProducer(const edm::ParameterSet &conf)
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
virtual void produce(edm::Event &e, const edm::EventSetup &c)
std::string photonProducer_
void decideEB(const reco::Photon *pho, bool &LooseEM, bool &LoosePhoton, bool &TightPhoton)
CutBasedPhotonIDAlgo * cutBasedAlgo_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
virtual ~PhotonIDProducer()
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple conf
Definition: dbtoconf.py:185
std::string photonLabel_
std::string photonCutBasedIDLooseLabel_
std::string photonCutBasedIDLooseEMLabel_
std::string photonCutBasedIDTightLabel_
edm::ParameterSet conf_