CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHcalPFClusterIsolationProducer.cc
Go to the documentation of this file.
3 
5 
10 
14 
16 
19 
20 #include <typeinfo>
21 
22 template<typename T1>
24 
25  emObjectProducer_ (consumes<T1Collection>(config.getParameter<edm::InputTag>("candidateProducer"))),
26  pfClusterProducerHCAL_ (consumes<reco::PFClusterCollection>(config.getParameter<edm::InputTag>("pfClusterProducerHCAL"))),
27  pfClusterProducerHFEM_ (consumes<reco::PFClusterCollection>(config.getParameter<edm::InputTag>("pfClusterProducerHFEM"))),
28  pfClusterProducerHFHAD_ (consumes<reco::PFClusterCollection>(config.getParameter<edm::InputTag>("pfClusterProducerHFHAD"))),
29  useHF_ (config.getParameter<bool>("useHF")),
30  drMax_ (config.getParameter<double>("drMax")),
31  drVetoBarrel_ (config.getParameter<double>("drVetoBarrel")),
32  drVetoEndcap_ (config.getParameter<double>("drVetoEndcap")),
33  etaStripBarrel_ (config.getParameter<double>("etaStripBarrel")),
34  etaStripEndcap_ (config.getParameter<double>("etaStripEndcap")),
35  energyBarrel_ (config.getParameter<double>("energyBarrel")),
36  energyEndcap_ (config.getParameter<double>("energyEndcap")),
37  useEt_ (config.getParameter<bool>("useEt")) {
38 
39  produces <edm::ValueMap<float>>();
40 }
41 
42 template<typename T1>
44 {}
45 
46 template<typename T1>
48 
50  desc.add<edm::InputTag>("candidateProducer", edm::InputTag("gedGsfElectrons"));
51  desc.add<edm::InputTag>("pfClusterProducerHCAL", edm::InputTag("particleFlowClusterHCAL"));
52  desc.ifValue(edm::ParameterDescription<bool>("useHF", false, true),
53  true >> (edm::ParameterDescription<edm::InputTag>("pfClusterProducerHFEM", edm::InputTag("hltParticleFlowClusterHFEM"), true) and
54  edm::ParameterDescription<edm::InputTag>("pfClusterProducerHFHAD", edm::InputTag("hltParticleFlowClusterHFHAD"), true)) or
55  false >> (edm::ParameterDescription<edm::InputTag>("pfClusterProducerHFEM", edm::InputTag(""), true) and
56  edm::ParameterDescription<edm::InputTag>("pfClusterProducerHFHAD", edm::InputTag(""), true)));
57  desc.add<double>("drMax", 0.3);
58  desc.add<double>("drVetoBarrel", 0.0);
59  desc.add<double>("drVetoEndcap", 0.0);
60  desc.add<double>("etaStripBarrel", 0.0);
61  desc.add<double>("etaStripEndcap", 0.0);
62  desc.add<double>("energyBarrel", 0.0);
63  desc.add<double>("energyEndcap", 0.0);
64  desc.add<bool>("useEt", true);
66 }
67 
68 template<typename T1>
70 
71  edm::Handle<T1Collection> emObjectHandle;
72  iEvent.getByToken(emObjectProducer_, emObjectHandle);
73 
74  std::auto_ptr<edm::ValueMap<float> > isoMap(new edm::ValueMap<float>());
75  edm::ValueMap<float>::Filler filler(*isoMap);
76  std::vector<float> retV(emObjectHandle->size(),0);
77 
78  std::vector<edm::Handle<reco::PFClusterCollection>> clusterHandles;
80  iEvent.getByToken(pfClusterProducerHCAL_, clusterHandle);
81  clusterHandles.push_back(clusterHandle);
82 
83  if (useHF_) {
85  iEvent.getByToken(pfClusterProducerHFEM_, clusterHandle);
86  clusterHandles.push_back(clusterHandle);
87 
88  iEvent.getByToken(pfClusterProducerHFHAD_, clusterHandle);
89  clusterHandles.push_back(clusterHandle);
90  }
91 
92  HcalPFClusterIsolation<T1> isoAlgo(drMax_, drVetoBarrel_, drVetoEndcap_, etaStripBarrel_, etaStripEndcap_, energyBarrel_, energyEndcap_, useEt_);
93 
94  for (unsigned int iReco = 0; iReco < emObjectHandle->size(); iReco++) {
95  T1Ref candRef(emObjectHandle, iReco);
96  retV[iReco] = isoAlgo.getSum(candRef, clusterHandles);
97  }
98 
99  filler.insert(emObjectHandle,retV.begin(),retV.end());
100  filler.fill();
101 
102  iEvent.put(isoMap);
103 }
104 
107 
std::string defaultModuleLabel()
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
EgammaHcalPFClusterIsolationProducer< reco::GsfElectron > ElectronHcalPFClusterIsolationProducer
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double getSum(const T1Ref candRef, const std::vector< edm::Handle< reco::PFClusterCollection >> &clusterHandles)
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::auto_ptr< ParameterDescriptionCases< T > > cases)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
EgammaHcalPFClusterIsolationProducer< reco::Photon > PhotonHcalPFClusterIsolationProducer
virtual void produce(edm::Event &, const edm::EventSetup &)
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)