CMS 3D CMS Logo

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  auto isoMap = std::make_unique<edm::ValueMap<double>>();
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(std::move(isoMap));
82 
83 }
84 
85 //define this as a plug-in
86 //DEFINE_FWK_MODULE(EgammaTowerIsolationProducer);
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
void produce(edm::Event &, const edm::EventSetup &) override
EgammaTowerIsolationProducer(const edm::ParameterSet &)
Definition: config.py:1
int iEvent
Definition: GenABIO.cc:230
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
T const * product() const
Definition: Handle.h:81
def move(src, dest)
Definition: eostools.py:510