test
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 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 ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- 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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

PFIsolationEstimator isolator
 
std::string nameIsoCh_
 
std::string nameIsoNh_
 
std::string nameIsoPh_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
particleFlowToken_
 
edm::EDGetTokenT
< reco::PhotonCollection
photonToken_
 
bool verbose_
 
edm::EDGetTokenT
< reco::VertexCollection
vertexToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::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 27 of file PhotonIsoProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 57 of file PhotonIsoProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 78 of file PhotonIsoProducer.cc.

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

Member Function Documentation

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

Implements edm::EDFilter.

Definition at line 92 of file PhotonIsoProducer.cc.

References gather_cfg::cout, edm::EventID::event(), edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), edm::EventBase::id(), edm::helper::Filler< Map >::insert(), edm::EventID::luminosityBlock(), edm::Event::put(), edm::EventID::run(), and GoodVertex_cfg::vertexCollection.

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().

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

Member Data Documentation

PFIsolationEstimator PhotonIsoProducer::isolator
private

Definition at line 43 of file PhotonIsoProducer.cc.

std::string PhotonIsoProducer::nameIsoCh_
private

Definition at line 39 of file PhotonIsoProducer.cc.

std::string PhotonIsoProducer::nameIsoNh_
private

Definition at line 41 of file PhotonIsoProducer.cc.

std::string PhotonIsoProducer::nameIsoPh_
private

Definition at line 40 of file PhotonIsoProducer.cc.

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

Definition at line 38 of file PhotonIsoProducer.cc.

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

Definition at line 37 of file PhotonIsoProducer.cc.

bool PhotonIsoProducer::verbose_
private

Definition at line 35 of file PhotonIsoProducer.cc.

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

Definition at line 36 of file PhotonIsoProducer.cc.