CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PhotonIDProducer Class Reference

#include <PhotonIDProducer.h>

Inheritance diagram for PhotonIDProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase 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::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::ParameterSet conf_
 
CutBasedPhotonIDAlgocutBasedAlgo_
 
bool doCutBased_
 
std::string photonCutBasedIDLooseEMLabel_
 
std::string photonCutBasedIDLooseLabel_
 
std::string photonCutBasedIDTightLabel_
 
edm::EDGetTokenT< reco::PhotonCollectionphotonToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 16 of file PhotonIDProducer.h.

Constructor & Destructor Documentation

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

Definition at line 7 of file PhotonIDProducer.cc.

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

7  : conf_(conf) {
8  photonToken_ = consumes<reco::PhotonCollection>(edm::InputTag(conf_.getParameter<std::string>("photonProducer"),
9  conf_.getParameter<std::string>("photonLabel")));
10 
11  photonCutBasedIDLooseLabel_ = conf.getParameter<std::string>("photonCutBasedIDLooseLabel");
12  photonCutBasedIDTightLabel_ = conf.getParameter<std::string>("photonCutBasedIDTightLabel");
13  photonCutBasedIDLooseEMLabel_ = conf.getParameter<std::string>("photonCutBasedIDLooseEMLabel");
14 
15  doCutBased_ = conf_.getParameter<bool>("doCutBased");
17  cutBasedAlgo_->setup(conf);
18  produces<edm::ValueMap<Bool_t> > (photonCutBasedIDLooseLabel_);
19  produces<edm::ValueMap<Bool_t> > (photonCutBasedIDTightLabel_);
20  produces<edm::ValueMap<Bool_t> > (photonCutBasedIDLooseEMLabel_);
21 
22 }
T getParameter(std::string const &) const
CutBasedPhotonIDAlgo * cutBasedAlgo_
std::string photonCutBasedIDLooseLabel_
std::string photonCutBasedIDLooseEMLabel_
std::string photonCutBasedIDTightLabel_
edm::ParameterSet conf_
edm::EDGetTokenT< reco::PhotonCollection > photonToken_
PhotonIDProducer::~PhotonIDProducer ( )
virtual

Definition at line 24 of file PhotonIDProducer.cc.

References cutBasedAlgo_.

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

Member Function Documentation

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

Definition at line 31 of file PhotonIDProducer.cc.

References cutBasedAlgo_, CutBasedPhotonIDAlgo::decideEB(), CutBasedPhotonIDAlgo::decideEE(), edm::Event::getByToken(), muon::Loose, eostools::move(), muons2muons_cfi::photon, photonCutBasedIDLooseEMLabel_, photonCutBasedIDLooseLabel_, photonCutBasedIDTightLabel_, jetCleaner_cfi::photons, photonToken_, edm::Event::put(), and muon::Tight.

31  {
32 
33  // Read in photons
35  e.getByToken(photonToken_,photons);
36 
37 
38  // Loop over photons and calculate photon ID using specified technique(s)
39  reco::PhotonCollection::const_iterator photon;
40  std::vector <Bool_t> Loose;
41  std::vector <Bool_t> Tight;
42  std::vector <Bool_t> LooseEM;
43  for (photon = (*photons).begin();
44  photon != (*photons).end(); ++photon) {
45  bool LooseQual;
46  bool TightQual;
47  bool LooseEMQual;
48  if (photon->isEB())
49  cutBasedAlgo_->decideEB(&(*photon),LooseEMQual,LooseQual, TightQual);
50  else
51  cutBasedAlgo_->decideEE(&(*photon),LooseEMQual,LooseQual, TightQual);
52  LooseEM.push_back(LooseEMQual);
53  Loose.push_back(LooseQual);
54  Tight.push_back(TightQual);
55 
56  }
57 
58 
59  auto outlooseEM = std::make_unique<edm::ValueMap<Bool_t>>();
60  edm::ValueMap<Bool_t>::Filler fillerlooseEM(*outlooseEM);
61  fillerlooseEM.insert(photons, LooseEM.begin(), LooseEM.end());
62  fillerlooseEM.fill();
63  // and put it into the event
65 
66  auto outloose = std::make_unique<edm::ValueMap<Bool_t>>();
67  edm::ValueMap<Bool_t>::Filler fillerloose(*outloose);
68  fillerloose.insert(photons, Loose.begin(), Loose.end());
69  fillerloose.fill();
70  // and put it into the event
72 
73  auto outtight = std::make_unique<edm::ValueMap<Bool_t>>();
74  edm::ValueMap<Bool_t>::Filler fillertight(*outtight);
75  fillertight.insert(photons, Tight.begin(), Tight.end());
76  fillertight.fill();
77  // and put it into the event
79 
80 
81 }
void decideEE(const reco::Photon *pho, bool &LooseEM, bool &LoosePhoton, bool &TightPhoton)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void decideEB(const reco::Photon *pho, bool &LooseEM, bool &LoosePhoton, bool &TightPhoton)
CutBasedPhotonIDAlgo * cutBasedAlgo_
std::string photonCutBasedIDLooseLabel_
std::string photonCutBasedIDLooseEMLabel_
std::string photonCutBasedIDTightLabel_
edm::EDGetTokenT< reco::PhotonCollection > photonToken_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::ParameterSet PhotonIDProducer::conf_
private

Definition at line 29 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer().

CutBasedPhotonIDAlgo* PhotonIDProducer::cutBasedAlgo_
private

Definition at line 27 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().

edm::EDGetTokenT<reco::PhotonCollection> PhotonIDProducer::photonToken_
private

Definition at line 30 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().