CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaTowerIsolationProducer.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaTowerIsolationProducer.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 
9 
11 
12 // Framework
14 
20 
22 
23 
25 {
26  // use configuration file to setup input/output collection names
27  emObjectProducer_ = conf_.getParameter<edm::InputTag>("emObjectProducer");
28 
29  towerProducer_ = conf_.getParameter<edm::InputTag>("towerProducer");
30 
31  egHcalIsoPtMin_ = conf_.getParameter<double>("etMin");
32  egHcalIsoConeSizeIn_ = conf_.getParameter<double>("intRadius");
33  egHcalIsoConeSizeOut_ = conf_.getParameter<double>("extRadius");
34  egHcalDepth_ = conf_.getParameter<int>("Depth");
35 
36 
37  //register your products
38  produces < edm::ValueMap<double> >();
39 }
40 
41 
43 
44 
45 //
46 // member functions
47 //
48 
49 // ------------ method called to produce the data ------------
50 void
52 {
53 
54  // Get the filtered objects
56  iEvent.getByLabel(emObjectProducer_,emObjectHandle);
57 
58  // Get the barrel hcal hits
60  iEvent.getByLabel(towerProducer_, towerHandle);
61  const CaloTowerCollection* towers = towerHandle.product();
62 
63  std::auto_ptr<edm::ValueMap<double> > isoMap(new edm::ValueMap<double>());
64  edm::ValueMap<double>::Filler filler(*isoMap);
65  std::vector<double> retV(emObjectHandle->size(),0);
66 
70  egHcalDepth_,
71  towers) ;
72 
73 
74  for( size_t i = 0 ; i < emObjectHandle->size(); ++i) {
75  double isoValue = myHadIsolation.getTowerEtSum(&(emObjectHandle->at(i)));
76  retV[i]=isoValue;
77  }
78 
79  filler.insert(emObjectHandle,retV.begin(),retV.end());
80  filler.fill();
81  iEvent.put(isoMap);
82 
83 }
84 
85 //define this as a plug-in
86 //DEFINE_FWK_MODULE(EgammaTowerIsolationProducer);
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
EgammaTowerIsolationProducer(const edm::ParameterSet &)
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual void produce(edm::Event &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
T const * product() const
Definition: Handle.h:81