CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
PhotonIDProducer Class Reference

#include <PhotonIDProducer.h>

Inheritance diagram for PhotonIDProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PhotonIDProducer (const edm::ParameterSet &conf)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~PhotonIDProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::ParameterSet conf_
 
CutBasedPhotonIDAlgocutBasedAlgo_
 
bool doCutBased_
 
std::string photonCutBasedIDLooseEMLabel_
 
std::string photonCutBasedIDLooseLabel_
 
std::string photonCutBasedIDTightLabel_
 
std::string photonLabel_
 
std::string photonProducer_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 15 of file PhotonIDProducer.h.

Constructor & Destructor Documentation

PhotonIDProducer::PhotonIDProducer ( const edm::ParameterSet conf)
explicit

Definition at line 8 of file PhotonIDProducer.cc.

References conf_, cutBasedAlgo_, doCutBased_, edm::ParameterSet::getParameter(), photonCutBasedIDLooseEMLabel_, photonCutBasedIDLooseLabel_, photonCutBasedIDTightLabel_, photonLabel_, photonProducer_, and AlCaHLTBitMon_QueryRunRegistry::string.

8  : conf_(conf) {
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 }
T getParameter(std::string const &) const
std::string photonProducer_
CutBasedPhotonIDAlgo * cutBasedAlgo_
std::string photonLabel_
std::string photonCutBasedIDLooseLabel_
std::string photonCutBasedIDLooseEMLabel_
std::string photonCutBasedIDTightLabel_
edm::ParameterSet conf_
PhotonIDProducer::~PhotonIDProducer ( )
virtual

Definition at line 26 of file PhotonIDProducer.cc.

References cutBasedAlgo_.

26  {
27 
28  //if (doCutBased_)
29  delete cutBasedAlgo_;
30 
31 }
CutBasedPhotonIDAlgo * cutBasedAlgo_

Member Function Documentation

void PhotonIDProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 33 of file PhotonIDProducer.cc.

References cutBasedAlgo_, CutBasedPhotonIDAlgo::decideEB(), CutBasedPhotonIDAlgo::decideEE(), edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), edm::helper::Filler< Map >::insert(), photonCutBasedIDLooseEMLabel_, photonCutBasedIDLooseLabel_, photonCutBasedIDTightLabel_, photonLabel_, photonProducer_, interactiveExample::photons, and edm::Event::put().

33  {
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 }
void decideEE(const reco::Photon *pho, bool &LooseEM, bool &LoosePhoton, bool &TightPhoton)
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:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
std::string photonLabel_
std::string photonCutBasedIDLooseLabel_
std::string photonCutBasedIDLooseEMLabel_
std::string photonCutBasedIDTightLabel_

Member Data Documentation

edm::ParameterSet PhotonIDProducer::conf_
private

Definition at line 28 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer().

CutBasedPhotonIDAlgo* PhotonIDProducer::cutBasedAlgo_
private

Definition at line 26 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), produce(), and ~PhotonIDProducer().

bool PhotonIDProducer::doCutBased_
private

Definition at line 36 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer().

std::string PhotonIDProducer::photonCutBasedIDLooseEMLabel_
private

Definition at line 32 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

std::string PhotonIDProducer::photonCutBasedIDLooseLabel_
private

Definition at line 33 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

std::string PhotonIDProducer::photonCutBasedIDTightLabel_
private

Definition at line 34 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

std::string PhotonIDProducer::photonLabel_
private

Definition at line 31 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

std::string PhotonIDProducer::photonProducer_
private

Definition at line 30 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().