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

Public Member Functions

 PhotonIsoProducer (const edm::ParameterSet &)
 
 ~PhotonIsoProducer ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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::InputTag particleFlowTag_
 
edm::InputTag photonTag_
 
bool verbose_
 
edm::InputTag vertexTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- 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::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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(), and edm::ParameterSet::getUntrackedParameter().

57  {
58  verbose_ = iConfig.getUntrackedParameter<bool>("verbose", false);
59  vertexTag_ = iConfig.getParameter<edm::InputTag>("vertexTag");
60  photonTag_ = iConfig.getParameter<edm::InputTag>("photonTag");
61  particleFlowTag_ = 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::InputTag particleFlowTag_
edm::InputTag photonTag_
PFIsolationEstimator isolator
edm::InputTag vertexTag_
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::getByLabel(), 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.getByLabel(photonTag_, phoCollection);
109  const reco::PhotonCollection *recoPho = phoCollection.product();
110 
111  // All PF Candidate for alternate isolation
113  iEvent.getByLabel(particleFlowTag_, 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
edm::InputTag particleFlowTag_
edm::InputTag photonTag_
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
tuple vertexCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
PFIsolationEstimator isolator
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
edm::EventID id() const
Definition: EventBase.h:56
edm::InputTag vertexTag_
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::InputTag PhotonIsoProducer::particleFlowTag_
private

Definition at line 38 of file PhotonIsoProducer.cc.

edm::InputTag PhotonIsoProducer::photonTag_
private

Definition at line 37 of file PhotonIsoProducer.cc.

bool PhotonIsoProducer::verbose_
private

Definition at line 35 of file PhotonIsoProducer.cc.

edm::InputTag PhotonIsoProducer::vertexTag_
private

Definition at line 36 of file PhotonIsoProducer.cc.