CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PhotonIsoProducer Class Reference
Inheritance diagram for PhotonIsoProducer:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PhotonIsoProducer (const edm::ParameterSet &)
 
 ~PhotonIsoProducer () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

PFIsolationEstimator isolator
 
std::string nameIsoCh_
 
std::string nameIsoNh_
 
std::string nameIsoPh_
 
edm::EDGetTokenT< reco::PFCandidateCollectionparticleFlowToken_
 
edm::EDGetTokenT< reco::PhotonCollectionphotonToken_
 
bool verbose_
 
edm::EDGetTokenT< reco::VertexCollectionvertexToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 25 of file PhotonIsoProducer.cc.

Constructor & Destructor Documentation

◆ PhotonIsoProducer()

PhotonIsoProducer::PhotonIsoProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 56 of file PhotonIsoProducer.cc.

56  {
57  verbose_ = iConfig.getUntrackedParameter<bool>("verbose", false);
58  vertexToken_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexTag"));
59  photonToken_ = consumes<reco::PhotonCollection>(iConfig.getParameter<edm::InputTag>("photonTag"));
60  particleFlowToken_ = consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("particleFlowTag"));
61 
62  nameIsoCh_ = iConfig.getParameter<std::string>("nameValueMapIsoCh");
63  nameIsoPh_ = iConfig.getParameter<std::string>("nameValueMapIsoPh");
64  nameIsoNh_ = iConfig.getParameter<std::string>("nameValueMapIsoNh");
65 
66  produces<edm::ValueMap<double> >(nameIsoCh_);
67  produces<edm::ValueMap<double> >(nameIsoPh_);
68  produces<edm::ValueMap<double> >(nameIsoNh_);
69 
70  isolator.initializePhotonIsolation(kTRUE); //NOTE: this automatically set all the correct defaul veto values
71  isolator.setConeSize(0.3);
72 }

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), PFIsolationEstimator::initializePhotonIsolation(), isolator, nameIsoCh_, nameIsoNh_, nameIsoPh_, particleFlowToken_, photonToken_, PFIsolationEstimator::setConeSize(), AlCaHLTBitMon_QueryRunRegistry::string, verbose_, and vertexToken_.

◆ ~PhotonIsoProducer()

PhotonIsoProducer::~PhotonIsoProducer ( )
override

Definition at line 74 of file PhotonIsoProducer.cc.

74  {
75  // do anything here that needs to be done at desctruction time
76  // (e.g. close files, deallocate resources etc.)
77 }

Member Function Documentation

◆ filter()

bool PhotonIsoProducer::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDFilter.

Definition at line 84 of file PhotonIsoProducer.cc.

84  {
85  std::unique_ptr<edm::ValueMap<double> > chIsoMap(new edm::ValueMap<double>());
86  edm::ValueMap<double>::Filler chFiller(*chIsoMap);
87 
88  std::unique_ptr<edm::ValueMap<double> > phIsoMap(new edm::ValueMap<double>());
89  edm::ValueMap<double>::Filler phFiller(*phIsoMap);
90 
91  std::unique_ptr<edm::ValueMap<double> > nhIsoMap(new edm::ValueMap<double>());
92  edm::ValueMap<double>::Filler nhFiller(*nhIsoMap);
93 
96 
98  iEvent.getByToken(photonToken_, phoCollection);
99  const reco::PhotonCollection* recoPho = phoCollection.product();
100 
101  // All PF Candidate for alternate isolation
103  iEvent.getByToken(particleFlowToken_, pfCandidatesH);
104  const reco::PFCandidateCollection thePfColl = *(pfCandidatesH.product());
105 
106  std::vector<double> chIsoValues;
107  std::vector<double> phIsoValues;
108  std::vector<double> nhIsoValues;
109  chIsoValues.reserve(phoCollection->size());
110  phIsoValues.reserve(phoCollection->size());
111  nhIsoValues.reserve(phoCollection->size());
112 
113  unsigned int ivtx = 0;
114  reco::VertexRef myVtxRef(vertexCollection, ivtx);
115 
116  for (reco::PhotonCollection::const_iterator aPho = recoPho->begin(); aPho != recoPho->end(); ++aPho) {
117  isolator.fGetIsolation(&*aPho, &thePfColl, myVtxRef, vertexCollection);
118 
119  if (verbose_) {
120  std::cout << " run " << iEvent.id().run() << " lumi " << iEvent.id().luminosityBlock() << " event "
121  << iEvent.id().event();
122  std::cout << " pt " << aPho->pt() << " eta " << aPho->eta() << " phi " << aPho->phi() << " charge "
123  << aPho->charge() << " : " << std::endl;
124  ;
125 
126  std::cout << " ChargedIso " << isolator.getIsolationCharged() << std::endl;
127  std::cout << " PhotonIso " << isolator.getIsolationPhoton() << std::endl;
128  std::cout << " NeutralHadron Iso " << isolator.getIsolationNeutral() << std::endl;
129  }
130 
131  chIsoValues.push_back(isolator.getIsolationCharged());
132  phIsoValues.push_back(isolator.getIsolationPhoton());
133  nhIsoValues.push_back(isolator.getIsolationNeutral());
134  }
135 
136  chFiller.insert(phoCollection, chIsoValues.begin(), chIsoValues.end());
137  chFiller.fill();
138 
139  phFiller.insert(phoCollection, phIsoValues.begin(), phIsoValues.end());
140  phFiller.fill();
141 
142  nhFiller.insert(phoCollection, nhIsoValues.begin(), nhIsoValues.end());
143  nhFiller.fill();
144 
145  iEvent.put(std::move(chIsoMap), nameIsoCh_);
146  iEvent.put(std::move(phIsoMap), nameIsoPh_);
147  iEvent.put(std::move(nhIsoMap), nameIsoNh_);
148 
149  return true;
150 }

References gather_cfg::cout, PFIsolationEstimator::fGetIsolation(), edm::helper::Filler< Map >::fill(), PFIsolationEstimator::getIsolationCharged(), PFIsolationEstimator::getIsolationNeutral(), PFIsolationEstimator::getIsolationPhoton(), iEvent, edm::helper::Filler< Map >::insert(), isolator, eostools::move(), nameIsoCh_, nameIsoNh_, nameIsoPh_, particleFlowToken_, photonToken_, edm::Handle< T >::product(), verbose_, spclusmultinvestigator_cfi::vertexCollection, and vertexToken_.

Member Data Documentation

◆ isolator

PFIsolationEstimator PhotonIsoProducer::isolator
private

Definition at line 42 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

◆ nameIsoCh_

std::string PhotonIsoProducer::nameIsoCh_
private

Definition at line 38 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

◆ nameIsoNh_

std::string PhotonIsoProducer::nameIsoNh_
private

Definition at line 40 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

◆ nameIsoPh_

std::string PhotonIsoProducer::nameIsoPh_
private

Definition at line 39 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

◆ particleFlowToken_

edm::EDGetTokenT<reco::PFCandidateCollection> PhotonIsoProducer::particleFlowToken_
private

Definition at line 37 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

◆ photonToken_

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

Definition at line 36 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

◆ verbose_

bool PhotonIsoProducer::verbose_
private

Definition at line 34 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

◆ vertexToken_

edm::EDGetTokenT<reco::VertexCollection> PhotonIsoProducer::vertexToken_
private

Definition at line 35 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

edm::Handle::product
T const * product() const
Definition: Handle.h:70
PFIsolationEstimator::initializePhotonIsolation
void initializePhotonIsolation(Bool_t bApplyVeto)
Definition: PFIsolationEstimator.cc:134
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PFIsolationEstimator::setConeSize
void setConeSize(float fValue=0.4)
Definition: PFIsolationEstimator.h:97
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
PhotonIsoProducer::nameIsoPh_
std::string nameIsoPh_
Definition: PhotonIsoProducer.cc:39
edm::Handle< reco::VertexCollection >
edm::Ref< VertexCollection >
PFIsolationEstimator::getIsolationPhoton
float getIsolationPhoton()
Definition: PFIsolationEstimator.h:144
PhotonIsoProducer::nameIsoNh_
std::string nameIsoNh_
Definition: PhotonIsoProducer.cc:40
PhotonIsoProducer::isolator
PFIsolationEstimator isolator
Definition: PhotonIsoProducer.cc:42
PFIsolationEstimator::getIsolationCharged
float getIsolationCharged()
Definition: PFIsolationEstimator.h:152
PhotonIsoProducer::photonToken_
edm::EDGetTokenT< reco::PhotonCollection > photonToken_
Definition: PhotonIsoProducer.cc:36
PhotonIsoProducer::vertexToken_
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
Definition: PhotonIsoProducer.cc:35
PFIsolationEstimator::fGetIsolation
float fGetIsolation(const reco::PFCandidate *pfCandidate, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
Definition: PFIsolationEstimator.cc:178
iEvent
int iEvent
Definition: GenABIO.cc:224
PFIsolationEstimator::getIsolationNeutral
float getIsolationNeutral()
Definition: PFIsolationEstimator.h:148
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
eostools.move
def move(src, dest)
Definition: eostools.py:511
PhotonIsoProducer::nameIsoCh_
std::string nameIsoCh_
Definition: PhotonIsoProducer.cc:38
spclusmultinvestigator_cfi.vertexCollection
vertexCollection
Definition: spclusmultinvestigator_cfi.py:4
edm::ValueMap
Definition: ValueMap.h:107
reco::PFCandidateCollection
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
Definition: PFCandidateFwd.h:12
PhotonIsoProducer::particleFlowToken_
edm::EDGetTokenT< reco::PFCandidateCollection > particleFlowToken_
Definition: PhotonIsoProducer.cc:37
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PhotonIsoProducer::verbose_
bool verbose_
Definition: PhotonIsoProducer.cc:34
reco::PhotonCollection
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
edm::helper::Filler
Definition: ValueMap.h:22
edm::InputTag
Definition: InputTag.h:15