CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
EgammaPhotonTkNumIsolationProducer.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaPhotonTkNumIsolationProducer.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 
18 
20 public:
22 
23  void produce(edm::StreamID sid, edm::Event&, const edm::EventSetup&) const override;
24 
25 private:
29 
30  const double ptMin_;
31  const double intRadiusBarrel_;
32  const double intRadiusEndcap_;
33  const double stripBarrel_;
34  const double stripEndcap_;
35  const double extRadius_;
36  const double maxVtxDist_;
37  const double drb_;
38 };
39 
42 
44  :
45 
46  photonProducer_{consumes(config.getParameter<edm::InputTag>("photonProducer"))},
47 
48  trackProducer_{consumes(config.getParameter<edm::InputTag>("trackProducer"))},
49  beamspotProducer_{consumes(config.getParameter<edm::InputTag>("BeamspotProducer"))},
50 
51  ptMin_(config.getParameter<double>("ptMin")),
52  intRadiusBarrel_(config.getParameter<double>("intRadiusBarrel")),
53  intRadiusEndcap_(config.getParameter<double>("intRadiusEndcap")),
54  stripBarrel_(config.getParameter<double>("stripBarrel")),
55  stripEndcap_(config.getParameter<double>("stripEndcap")),
56  extRadius_(config.getParameter<double>("extRadius")),
57  maxVtxDist_(config.getParameter<double>("maxVtxDist")),
58  drb_(config.getParameter<double>("maxVtxDistXY"))
59 
60 {
61  //register your products
62  produces<edm::ValueMap<int>>();
63 }
64 
65 // ------------ method called to produce the data ------------
68  const edm::EventSetup& iSetup) const {
69  // Get the filtered objects
70  auto photonHandle = iEvent.getHandle(photonProducer_);
71 
72  //prepare product
73  auto isoMap = std::make_unique<edm::ValueMap<int>>();
75  std::vector<int> retV(photonHandle->size(), 0);
76 
77  PhotonTkIsolation myTkIsolation(extRadius_,
82  ptMin_,
84  drb_,
85  &iEvent.get(trackProducer_),
86  iEvent.get(beamspotProducer_).position());
87 
88  for (unsigned int i = 0; i < photonHandle->size(); ++i) {
89  int isoValue = myTkIsolation.getIso(&(photonHandle->at(i))).first;
90  retV[i] = isoValue;
91  }
92 
93  //fill and insert valuemap
94  filler.insert(photonHandle, retV.begin(), retV.end());
95  filler.fill();
96  iEvent.put(std::move(isoMap));
97 }
Definition: config.py:1
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< reco::BeamSpot > beamspotProducer_
int iEvent
Definition: GenABIO.cc:224
std::pair< int, float > getIso(const reco::Candidate *) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
const edm::EDGetTokenT< reco::TrackCollection > trackProducer_
def move(src, dest)
Definition: eostools.py:511
const edm::EDGetTokenT< edm::View< reco::Candidate > > photonProducer_