CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 
17 
19 public:
21 
22  void produce(edm::Event&, const edm::EventSetup&) override;
23 
24 private:
25  // ----------member data ---------------------------
26 
29 
31 
32  const double egHcalIsoPtMin_;
33  const double egHcalIsoConeSizeOut_;
34  const double egHcalIsoConeSizeIn_;
35  const signed int egHcalDepth_;
36 };
37 
40 
42  : emObjectProducer_{consumes(config.getParameter<edm::InputTag>("emObjectProducer"))},
43  towerProducer_{consumes(config.getParameter<edm::InputTag>("towerProducer"))},
44  putToken_{produces<edm::ValueMap<double>>()},
45  egHcalIsoPtMin_{config.getParameter<double>("etMin")},
46  egHcalIsoConeSizeOut_{config.getParameter<double>("extRadius")},
47  egHcalIsoConeSizeIn_{config.getParameter<double>("intRadius")},
48  egHcalDepth_{config.getParameter<int>("Depth")} {}
49 
51  // Get the filtered objects
52  auto emObjectHandle = iEvent.getHandle(emObjectProducer_);
53 
54  // Get the barrel hcal hits
55  auto const& towers = iEvent.get(towerProducer_);
56 
57  edm::ValueMap<double> isoMap;
58  edm::ValueMap<double>::Filler filler(isoMap);
59  std::vector<double> retV(emObjectHandle->size(), 0);
60 
61  EgammaTowerIsolation myHadIsolation(
63 
64  for (size_t i = 0; i < emObjectHandle->size(); ++i) {
65  double isoValue = myHadIsolation.getTowerEtSum(&(emObjectHandle->at(i)));
66  retV[i] = isoValue;
67  }
68 
69  filler.insert(emObjectHandle, retV.begin(), retV.end());
70  filler.fill();
71  iEvent.emplace(putToken_, std::move(isoMap));
72 }
void produce(edm::Event &, const edm::EventSetup &) override
EgammaTowerIsolationProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
const edm::EDGetTokenT< edm::View< reco::Candidate > > emObjectProducer_
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:433
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
tuple config
parse the configuration file
const edm::EDPutTokenT< edm::ValueMap< double > > putToken_
const edm::EDGetTokenT< CaloTowerCollection > towerProducer_