CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaEcalPFClusterIsolationProducer.cc
Go to the documentation of this file.
3 
8 
12 
14 
17 
18 template<typename T1>
20 
21  emObjectProducer_ (consumes<T1Collection>(config.getParameter<edm::InputTag>("candidateProducer"))),
22  pfClusterProducer_ (consumes<reco::PFClusterCollection>(config.getParameter<edm::InputTag>("pfClusterProducer"))),
23  drMax_ (config.getParameter<double>("drMax")),
24  drVetoBarrel_ (config.getParameter<double>("drVetoBarrel")),
25  drVetoEndcap_ (config.getParameter<double>("drVetoEndcap")),
26  etaStripBarrel_ (config.getParameter<double>("etaStripBarrel")),
27  etaStripEndcap_ (config.getParameter<double>("etaStripEndcap")),
28  energyBarrel_ (config.getParameter<double>("energyBarrel")),
29  energyEndcap_ (config.getParameter<double>("energyEndcap")) {
30 
31  produces <edm::ValueMap<float>>();
32 }
33 
34 template<typename T1>
36 {}
37 
38 template<typename T1>
40 
42  desc.add<edm::InputTag>("candidateProducer", edm::InputTag("gedGsfElectrons"));
43  desc.add<edm::InputTag>("pfClusterProducer", edm::InputTag("particleFlowClusterECAL"));
44  desc.add<double>("drMax", 0.3);
45  desc.add<double>("drVetoBarrel", 0.0);
46  desc.add<double>("drVetoEndcap", 0.0);
47  desc.add<double>("etaStripBarrel", 0.0);
48  desc.add<double>("etaStripEndcap", 0.0);
49  desc.add<double>("energyBarrel", 0.0);
50  desc.add<double>("energyEndcap", 0.0);
52 }
53 
54 template<typename T1>
56 
57  edm::Handle<T1Collection> emObjectHandle;
58  iEvent.getByToken(emObjectProducer_, emObjectHandle);
59 
60  std::auto_ptr<edm::ValueMap<float> > isoMap(new edm::ValueMap<float>());
61  edm::ValueMap<float>::Filler filler(*isoMap);
62  std::vector<float> retV(emObjectHandle->size(),0);
63 
65  iEvent.getByToken(pfClusterProducer_, clusterHandle);
66 
67  EcalPFClusterIsolation<T1> isoAlgo(drMax_, drVetoBarrel_, drVetoEndcap_, etaStripBarrel_, etaStripEndcap_, energyBarrel_, energyEndcap_);
68 
69  for (unsigned int iReco = 0; iReco < emObjectHandle->size(); iReco++) {
70  T1Ref candRef(emObjectHandle, iReco);
71  retV[iReco] = isoAlgo.getSum(candRef, clusterHandle);
72  }
73 
74  filler.insert(emObjectHandle,retV.begin(),retV.end());
75  filler.fill();
76 
77  iEvent.put(isoMap);
78 }
79 
82 
std::string defaultModuleLabel()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
EgammaEcalPFClusterIsolationProducer< reco::GsfElectron > ElectronEcalPFClusterIsolationProducer
int iEvent
Definition: GenABIO.cc:230
EgammaEcalPFClusterIsolationProducer< reco::Photon > PhotonEcalPFClusterIsolationProducer
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
virtual void produce(edm::Event &, const edm::EventSetup &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double getSum(T1Ref, edm::Handle< std::vector< reco::PFCluster > >)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9