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<>

Public Member Functions

 PhotonIDProducer (const edm::ParameterSet &conf)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~PhotonIDProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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
 

Detailed Description

Definition at line 16 of file PhotonIDProducer.h.

Constructor & Destructor Documentation

◆ PhotonIDProducer()

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

Definition at line 5 of file PhotonIDProducer.cc.

5  : conf_(conf) {
6  photonToken_ = consumes<reco::PhotonCollection>(
7  edm::InputTag(conf_.getParameter<std::string>("photonProducer"), conf_.getParameter<std::string>("photonLabel")));
8 
9  photonCutBasedIDLooseLabel_ = conf.getParameter<std::string>("photonCutBasedIDLooseLabel");
10  photonCutBasedIDTightLabel_ = conf.getParameter<std::string>("photonCutBasedIDTightLabel");
11  photonCutBasedIDLooseEMLabel_ = conf.getParameter<std::string>("photonCutBasedIDLooseEMLabel");
12 
13  doCutBased_ = conf_.getParameter<bool>("doCutBased");
15  cutBasedAlgo_->setup(conf);
16  produces<edm::ValueMap<Bool_t>>(photonCutBasedIDLooseLabel_);
17  produces<edm::ValueMap<Bool_t>>(photonCutBasedIDTightLabel_);
18  produces<edm::ValueMap<Bool_t>>(photonCutBasedIDLooseEMLabel_);
19 }

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

◆ ~PhotonIDProducer()

PhotonIDProducer::~PhotonIDProducer ( )
override

Definition at line 21 of file PhotonIDProducer.cc.

21  {
22  //if (doCutBased_)
23  delete cutBasedAlgo_;
24 }

References cutBasedAlgo_.

Member Function Documentation

◆ produce()

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

Definition at line 26 of file PhotonIDProducer.cc.

26  {
27  // Read in photons
29  e.getByToken(photonToken_, photons);
30 
31  // Loop over photons and calculate photon ID using specified technique(s)
32  reco::PhotonCollection::const_iterator photon;
33  std::vector<Bool_t> Loose;
34  std::vector<Bool_t> Tight;
35  std::vector<Bool_t> LooseEM;
36  for (photon = (*photons).begin(); photon != (*photons).end(); ++photon) {
37  bool LooseQual;
38  bool TightQual;
39  bool LooseEMQual;
40  if (photon->isEB())
41  cutBasedAlgo_->decideEB(&(*photon), LooseEMQual, LooseQual, TightQual);
42  else
43  cutBasedAlgo_->decideEE(&(*photon), LooseEMQual, LooseQual, TightQual);
44  LooseEM.push_back(LooseEMQual);
45  Loose.push_back(LooseQual);
46  Tight.push_back(TightQual);
47  }
48 
49  auto outlooseEM = std::make_unique<edm::ValueMap<Bool_t>>();
50  edm::ValueMap<Bool_t>::Filler fillerlooseEM(*outlooseEM);
51  fillerlooseEM.insert(photons, LooseEM.begin(), LooseEM.end());
52  fillerlooseEM.fill();
53  // and put it into the event
54  e.put(std::move(outlooseEM), photonCutBasedIDLooseEMLabel_);
55 
56  auto outloose = std::make_unique<edm::ValueMap<Bool_t>>();
57  edm::ValueMap<Bool_t>::Filler fillerloose(*outloose);
58  fillerloose.insert(photons, Loose.begin(), Loose.end());
59  fillerloose.fill();
60  // and put it into the event
61  e.put(std::move(outloose), photonCutBasedIDLooseLabel_);
62 
63  auto outtight = std::make_unique<edm::ValueMap<Bool_t>>();
64  edm::ValueMap<Bool_t>::Filler fillertight(*outtight);
65  fillertight.insert(photons, Tight.begin(), Tight.end());
66  fillertight.fill();
67  // and put it into the event
68  e.put(std::move(outtight), photonCutBasedIDTightLabel_);
69 }

References cutBasedAlgo_, CutBasedPhotonIDAlgo::decideEB(), CutBasedPhotonIDAlgo::decideEE(), MillePedeFileConverter_cfg::e, muon::Loose, eostools::move(), muons2muons_cfi::photon, photonCutBasedIDLooseEMLabel_, photonCutBasedIDLooseLabel_, photonCutBasedIDTightLabel_, BPHMonitor_cfi::photons, photonToken_, and muon::Tight.

Member Data Documentation

◆ conf_

edm::ParameterSet PhotonIDProducer::conf_
private

Definition at line 26 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer().

◆ cutBasedAlgo_

CutBasedPhotonIDAlgo* PhotonIDProducer::cutBasedAlgo_
private

Definition at line 24 of file PhotonIDProducer.h.

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

◆ doCutBased_

bool PhotonIDProducer::doCutBased_
private

Definition at line 33 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer().

◆ photonCutBasedIDLooseEMLabel_

std::string PhotonIDProducer::photonCutBasedIDLooseEMLabel_
private

Definition at line 29 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

◆ photonCutBasedIDLooseLabel_

std::string PhotonIDProducer::photonCutBasedIDLooseLabel_
private

Definition at line 30 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

◆ photonCutBasedIDTightLabel_

std::string PhotonIDProducer::photonCutBasedIDTightLabel_
private

Definition at line 31 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

◆ photonToken_

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

Definition at line 27 of file PhotonIDProducer.h.

Referenced by PhotonIDProducer(), and produce().

muons2muons_cfi.photon
photon
Definition: muons2muons_cfi.py:28
PhotonIDProducer::photonCutBasedIDLooseLabel_
std::string photonCutBasedIDLooseLabel_
Definition: PhotonIDProducer.h:30
CutBasedPhotonIDAlgo
Definition: CutBasedPhotonIDAlgo.h:9
PhotonIDProducer::doCutBased_
bool doCutBased_
Definition: PhotonIDProducer.h:33
PhotonIDProducer::conf_
edm::ParameterSet conf_
Definition: PhotonIDProducer.h:26
edm::Handle< reco::PhotonCollection >
CutBasedPhotonIDAlgo::decideEE
void decideEE(const reco::Photon *pho, bool &LooseEM, bool &LoosePhoton, bool &TightPhoton)
Definition: CutBasedPhotonIDAlgo.cc:435
CutBasedPhotonIDAlgo::decideEB
void decideEB(const reco::Photon *pho, bool &LooseEM, bool &LoosePhoton, bool &TightPhoton)
Definition: CutBasedPhotonIDAlgo.cc:109
CutBasedPhotonIDAlgo::setup
void setup(const edm::ParameterSet &conf)
Definition: CutBasedPhotonIDAlgo.cc:5
PhotonIDProducer::photonToken_
edm::EDGetTokenT< reco::PhotonCollection > photonToken_
Definition: PhotonIDProducer.h:27
PhotonIDProducer::photonCutBasedIDLooseEMLabel_
std::string photonCutBasedIDLooseEMLabel_
Definition: PhotonIDProducer.h:29
PhotonIDProducer::photonCutBasedIDTightLabel_
std::string photonCutBasedIDTightLabel_
Definition: PhotonIDProducer.h:31
muon::Tight
Definition: ME0MuonSelector.h:17
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
muon::Loose
Definition: ME0MuonSelector.h:16
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::helper::Filler
Definition: ValueMap.h:22
PhotonIDProducer::cutBasedAlgo_
CutBasedPhotonIDAlgo * cutBasedAlgo_
Definition: PhotonIDProducer.h:24
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37