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 ()
 
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
 
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)
 
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 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 &)
 
- 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 25 of file PhotonIsoProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 55 of file PhotonIsoProducer.cc.

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

55  {
56  verbose_ = iConfig.getUntrackedParameter<bool>("verbose", false);
57  vertexToken_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexTag"));
58  photonToken_ = consumes<reco::PhotonCollection>(iConfig.getParameter<edm::InputTag>("photonTag"));
59  particleFlowToken_ = consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("particleFlowTag"));
60 
61  nameIsoCh_ = iConfig.getParameter<std::string>("nameValueMapIsoCh");
62  nameIsoPh_ = iConfig.getParameter<std::string>("nameValueMapIsoPh");
63  nameIsoNh_ = iConfig.getParameter<std::string>("nameValueMapIsoNh");
64 
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 
73 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::PhotonCollection > photonToken_
PFIsolationEstimator isolator
edm::EDGetTokenT< reco::PFCandidateCollection > particleFlowToken_
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
void initializePhotonIsolation(Bool_t bApplyVeto)
void setConeSize(float fValue=0.4)
PhotonIsoProducer::~PhotonIsoProducer ( )
override

Definition at line 76 of file PhotonIsoProducer.cc.

77 {
78 
79  // do anything here that needs to be done at desctruction time
80  // (e.g. close files, deallocate resources etc.)
81 
82 }

Member Function Documentation

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

Definition at line 90 of file PhotonIsoProducer.cc.

References gather_cfg::cout, DEFINE_FWK_MODULE, edm::EventID::event(), PFIsolationEstimator::fGetIsolation(), edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), PFIsolationEstimator::getIsolationCharged(), PFIsolationEstimator::getIsolationNeutral(), PFIsolationEstimator::getIsolationPhoton(), edm::EventBase::id(), edm::helper::Filler< Map >::insert(), isolator, edm::EventID::luminosityBlock(), eostools::move(), nameIsoCh_, nameIsoNh_, nameIsoPh_, particleFlowToken_, photonToken_, edm::Handle< T >::product(), edm::Event::put(), edm::EventID::run(), verbose_, particleFlowSuperClusterECAL_cfi::vertexCollection, and vertexToken_.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

90  {
91 
92  std::unique_ptr<edm::ValueMap<double> > chIsoMap(new edm::ValueMap<double>() );
93  edm::ValueMap<double>::Filler chFiller(*chIsoMap);
94 
95  std::unique_ptr<edm::ValueMap<double> > phIsoMap(new edm::ValueMap<double>() );
96  edm::ValueMap<double>::Filler phFiller(*phIsoMap);
97 
98  std::unique_ptr<edm::ValueMap<double> > nhIsoMap(new edm::ValueMap<double>() );
99  edm::ValueMap<double>::Filler nhFiller(*nhIsoMap);
100 
102  iEvent.getByToken(vertexToken_, vertexCollection);
103 
105  iEvent.getByToken(photonToken_, phoCollection);
106  const reco::PhotonCollection *recoPho = phoCollection.product();
107 
108  // All PF Candidate for alternate isolation
110  iEvent.getByToken(particleFlowToken_, pfCandidatesH);
111  const reco::PFCandidateCollection thePfColl = *(pfCandidatesH.product());
112 
113  std::vector<double> chIsoValues;
114  std::vector<double> phIsoValues;
115  std::vector<double> nhIsoValues;
116  chIsoValues.reserve(phoCollection->size());
117  phIsoValues.reserve(phoCollection->size());
118  nhIsoValues.reserve(phoCollection->size());
119 
120  unsigned int ivtx = 0;
121  reco::VertexRef myVtxRef(vertexCollection, ivtx);
122 
123 
124  for (reco::PhotonCollection::const_iterator aPho = recoPho->begin(); aPho != recoPho->end(); ++aPho) {
125 
126  isolator.fGetIsolation(&*aPho,
127  &thePfColl,
128  myVtxRef,
129  vertexCollection);
130 
131  if(verbose_) {
132  std::cout << " run " << iEvent.id().run() << " lumi " << iEvent.id().luminosityBlock() << " event " << iEvent.id().event();
133  std::cout << " pt " << aPho->pt() << " eta " << aPho->eta() << " phi " << aPho->phi()
134  << " charge " << aPho->charge()<< " : " << std::endl;;
135 
136  std::cout << " ChargedIso " << isolator.getIsolationCharged() << std::endl;
137  std::cout << " PhotonIso " << isolator.getIsolationPhoton() << std::endl;
138  std::cout << " NeutralHadron Iso " << isolator.getIsolationNeutral() << std::endl;
139  }
140 
141  chIsoValues.push_back(isolator.getIsolationCharged());
142  phIsoValues.push_back(isolator.getIsolationPhoton());
143  nhIsoValues.push_back(isolator.getIsolationNeutral());
144 
145  }
146 
147  chFiller.insert(phoCollection, chIsoValues.begin(), chIsoValues.end() );
148  chFiller.fill();
149 
150  phFiller.insert(phoCollection, phIsoValues.begin(), phIsoValues.end() );
151  phFiller.fill();
152 
153  nhFiller.insert(phoCollection, nhIsoValues.begin(), nhIsoValues.end() );
154  nhFiller.fill();
155 
156 
157  iEvent.put(std::move(chIsoMap),nameIsoCh_);
158  iEvent.put(std::move(phIsoMap),nameIsoPh_);
159  iEvent.put(std::move(nhIsoMap),nameIsoNh_);
160 
161 
162  return true;
163 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
edm::EDGetTokenT< reco::PhotonCollection > photonToken_
PFIsolationEstimator isolator
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
edm::EDGetTokenT< reco::PFCandidateCollection > particleFlowToken_
T const * product() const
Definition: Handle.h:81
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
edm::EventID id() const
Definition: EventBase.h:60
float fGetIsolation(const reco::PFCandidate *pfCandidate, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

PFIsolationEstimator PhotonIsoProducer::isolator
private

Definition at line 41 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

std::string PhotonIsoProducer::nameIsoCh_
private

Definition at line 37 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

std::string PhotonIsoProducer::nameIsoNh_
private

Definition at line 39 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

std::string PhotonIsoProducer::nameIsoPh_
private

Definition at line 38 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

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

Definition at line 36 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

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

Definition at line 35 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

bool PhotonIsoProducer::verbose_
private

Definition at line 33 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().

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

Definition at line 34 of file PhotonIsoProducer.cc.

Referenced by filter(), and PhotonIsoProducer().