CMS 3D CMS Logo

EgammaEcalPFClusterIsolationProducer.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaEcalPFClusterIsolationProducer.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matteo Sani
5 // Institute: UCSD
6 //*****************************************************************************
7 
22 
23 template <typename T1>
25 public:
26  typedef std::vector<T1> T1Collection;
29  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
30 
31  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
32 
33 private:
36 
37  const double drMax_;
38  const double drVetoBarrel_;
39  const double drVetoEndcap_;
40  const double etaStripBarrel_;
41  const double etaStripEndcap_;
42  const double energyBarrel_;
43  const double energyEndcap_;
44 };
45 
46 template <typename T1>
48  :
49 
50  emObjectProducer_(consumes<T1Collection>(config.getParameter<edm::InputTag>("candidateProducer"))),
51  pfClusterProducer_(consumes<reco::PFClusterCollection>(config.getParameter<edm::InputTag>("pfClusterProducer"))),
52  drMax_(config.getParameter<double>("drMax")),
53  drVetoBarrel_(config.getParameter<double>("drVetoBarrel")),
54  drVetoEndcap_(config.getParameter<double>("drVetoEndcap")),
55  etaStripBarrel_(config.getParameter<double>("etaStripBarrel")),
56  etaStripEndcap_(config.getParameter<double>("etaStripEndcap")),
57  energyBarrel_(config.getParameter<double>("energyBarrel")),
58  energyEndcap_(config.getParameter<double>("energyEndcap")) {
59  produces<edm::ValueMap<float>>();
60 }
61 
62 template <typename T1>
65  desc.add<edm::InputTag>("candidateProducer", edm::InputTag("gedGsfElectrons"));
66  desc.add<edm::InputTag>("pfClusterProducer", edm::InputTag("particleFlowClusterECAL"));
67  desc.add<double>("drMax", 0.3);
68  desc.add<double>("drVetoBarrel", 0.0);
69  desc.add<double>("drVetoEndcap", 0.0);
70  desc.add<double>("etaStripBarrel", 0.0);
71  desc.add<double>("etaStripEndcap", 0.0);
72  desc.add<double>("energyBarrel", 0.0);
73  desc.add<double>("energyEndcap", 0.0);
75 }
76 
77 template <typename T1>
80  const edm::EventSetup&) const {
81  auto emObjectHandle = iEvent.getHandle(emObjectProducer_);
82 
83  auto isoMap = std::make_unique<edm::ValueMap<float>>();
85  std::vector<float> retV(emObjectHandle->size(), 0);
86 
87  auto clusterHandle = iEvent.getHandle(pfClusterProducer_);
88 
90  drMax_, drVetoBarrel_, drVetoEndcap_, etaStripBarrel_, etaStripEndcap_, energyBarrel_, energyEndcap_);
91 
92  for (unsigned int iReco = 0; iReco < emObjectHandle->size(); iReco++) {
93  T1Ref candRef(emObjectHandle, iReco);
94  retV[iReco] = isoAlgo.getSum(candRef, clusterHandle);
95  }
96 
97  filler.insert(emObjectHandle, retV.begin(), retV.end());
98  filler.fill();
99 
100  iEvent.put(std::move(isoMap));
101 }
102 
105 
double getSum(T1, edm::Handle< std::vector< reco::PFCluster > >)
const edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducer_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: config.py:1
std::string defaultModuleLabel()
EgammaEcalPFClusterIsolationProducer< reco::GsfElectron > ElectronEcalPFClusterIsolationProducer
int iEvent
Definition: GenABIO.cc:224
EgammaEcalPFClusterIsolationProducer< reco::Photon > PhotonEcalPFClusterIsolationProducer
std::vector< l1t::PFCluster > PFClusterCollection
Definition: PFCluster.h:73
const edm::EDGetTokenT< T1Collection > emObjectProducer_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511