CMS 3D CMS Logo

EgammaHcalPFClusterIsolationProducer.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaHcalPFClusterIsolationProducer.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matteo Sani
5 // Institute: UCSD
6 //*****************************************************************************
7 
24 
25 #include <typeinfo>
26 
27 template <typename T1>
29 public:
30  typedef std::vector<T1> T1Collection;
33  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
34 
35  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
36 
37 private:
42 
43  const bool useHF_;
44  const double drMax_;
45  const double drVetoBarrel_;
46  const double drVetoEndcap_;
47  const double etaStripBarrel_;
48  const double etaStripEndcap_;
49  const double energyBarrel_;
50  const double energyEndcap_;
51  const double useEt_;
52 };
53 
54 template <typename T1>
56  :
57 
58  emObjectProducer_(consumes(config.getParameter<edm::InputTag>("candidateProducer"))),
59  pfClusterProducerHCAL_(consumes(config.getParameter<edm::InputTag>("pfClusterProducerHCAL"))),
60  pfClusterProducerHFEM_(consumes(config.getParameter<edm::InputTag>("pfClusterProducerHFEM"))),
61  pfClusterProducerHFHAD_(consumes(config.getParameter<edm::InputTag>("pfClusterProducerHFHAD"))),
62  useHF_(config.getParameter<bool>("useHF")),
63  drMax_(config.getParameter<double>("drMax")),
64  drVetoBarrel_(config.getParameter<double>("drVetoBarrel")),
65  drVetoEndcap_(config.getParameter<double>("drVetoEndcap")),
66  etaStripBarrel_(config.getParameter<double>("etaStripBarrel")),
67  etaStripEndcap_(config.getParameter<double>("etaStripEndcap")),
68  energyBarrel_(config.getParameter<double>("energyBarrel")),
69  energyEndcap_(config.getParameter<double>("energyEndcap")),
70  useEt_(config.getParameter<bool>("useEt")) {
71  produces<edm::ValueMap<float>>();
72 }
73 
74 template <typename T1>
77  desc.add<edm::InputTag>("candidateProducer", edm::InputTag("gedGsfElectrons"));
78  desc.add<edm::InputTag>("pfClusterProducerHCAL", edm::InputTag("particleFlowClusterHCAL"));
79  desc.ifValue(edm::ParameterDescription<bool>("useHF", false, true),
81  "pfClusterProducerHFEM", {"hltParticleFlowClusterHFEM"}, true) and
83  "pfClusterProducerHFHAD", {"hltParticleFlowClusterHFHAD"}, true)) or
84  false >> (edm::ParameterDescription<edm::InputTag>("pfClusterProducerHFEM", {""}, true) and
85  edm::ParameterDescription<edm::InputTag>("pfClusterProducerHFHAD", {""}, true)));
86  desc.add<double>("drMax", 0.3);
87  desc.add<double>("drVetoBarrel", 0.0);
88  desc.add<double>("drVetoEndcap", 0.0);
89  desc.add<double>("etaStripBarrel", 0.0);
90  desc.add<double>("etaStripEndcap", 0.0);
91  desc.add<double>("energyBarrel", 0.0);
92  desc.add<double>("energyEndcap", 0.0);
93  desc.add<bool>("useEt", true);
95 }
96 
97 template <typename T1>
100  const edm::EventSetup&) const {
101  auto emObjectHandle = iEvent.getHandle(emObjectProducer_);
102 
103  auto isoMap = std::make_unique<edm::ValueMap<float>>();
105  std::vector<float> retV(emObjectHandle->size(), 0);
106 
107  std::vector<edm::Handle<reco::PFClusterCollection>> clusterHandles{iEvent.getHandle(pfClusterProducerHCAL_)};
108 
109  if (useHF_) {
110  clusterHandles.push_back(iEvent.getHandle(pfClusterProducerHFEM_));
111  clusterHandles.push_back(iEvent.getHandle(pfClusterProducerHFHAD_));
112  }
113 
115  drMax_, drVetoBarrel_, drVetoEndcap_, etaStripBarrel_, etaStripEndcap_, energyBarrel_, energyEndcap_, useEt_);
116 
117  for (unsigned int iReco = 0; iReco < emObjectHandle->size(); iReco++) {
118  T1Ref candRef(emObjectHandle, iReco);
119  retV[iReco] = isoAlgo.getSum(candRef, clusterHandles);
120  }
121 
122  filler.insert(emObjectHandle, retV.begin(), retV.end());
123  filler.fill();
124 
125  iEvent.put(std::move(isoMap));
126 }
127 
130 
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Definition: config.py:1
std::string defaultModuleLabel()
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducerHFEM_
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
EgammaHcalPFClusterIsolationProducer< reco::GsfElectron > ElectronHcalPFClusterIsolationProducer
double getSum(const T1Ref candRef, const std::vector< edm::Handle< reco::PFClusterCollection >> &clusterHandles)
const edm::EDGetTokenT< T1Collection > emObjectProducer_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
EgammaHcalPFClusterIsolationProducer< reco::Photon > PhotonHcalPFClusterIsolationProducer
HLT enums.
const edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducerHFHAD_
const edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducerHCAL_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
def move(src, dest)
Definition: eostools.py:511