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 
defaultModuleLabel.h
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
Handle.h
electrons_cff.bool
bool
Definition: electrons_cff.py:366
HcalPFClusterIsolation::getSum
double getSum(const T1Ref candRef, const std::vector< edm::Handle< reco::PFClusterCollection >> &clusterHandles)
Definition: HcalPFClusterIsolation.cc:32
edm::EDGetTokenT< T1Collection >
EgammaHcalPFClusterIsolationProducer::pfClusterProducerHFEM_
const edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducerHFEM_
Definition: EgammaHcalPFClusterIsolationProducer.cc:40
edm
HLT enums.
Definition: AlignableModifier.h:19
EgammaHcalPFClusterIsolationProducer::T1Collection
std::vector< T1 > T1Collection
Definition: EgammaHcalPFClusterIsolationProducer.cc:30
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TypeID.h
edm::Ref
Definition: AssociativeIterator.h:58
EgammaHcalPFClusterIsolationProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EgammaHcalPFClusterIsolationProducer.cc:75
config
Definition: config.py:1
MakerMacros.h
Photon.h
EgammaHcalPFClusterIsolationProducer::drVetoEndcap_
const double drVetoEndcap_
Definition: EgammaHcalPFClusterIsolationProducer.cc:46
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
EgammaHcalPFClusterIsolationProducer::energyEndcap_
const double energyEndcap_
Definition: EgammaHcalPFClusterIsolationProducer.cc:50
EgammaHcalPFClusterIsolationProducer::EgammaHcalPFClusterIsolationProducer
EgammaHcalPFClusterIsolationProducer(const edm::ParameterSet &)
Definition: EgammaHcalPFClusterIsolationProducer.cc:55
EgammaHcalPFClusterIsolationProducer
Definition: EgammaHcalPFClusterIsolationProducer.cc:28
PFCluster.h
ParameterSetDescription.h
GsfElectron.h
EgammaHcalPFClusterIsolationProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: EgammaHcalPFClusterIsolationProducer.cc:98
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
EgammaHcalPFClusterIsolationProducer::drVetoBarrel_
const double drVetoBarrel_
Definition: EgammaHcalPFClusterIsolationProducer.cc:45
edm::ParameterSet
Definition: ParameterSet.h:47
defaultModuleLabel
std::string defaultModuleLabel()
Definition: defaultModuleLabel.h:16
CandAssociation.h
Event.h
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
PFClusterFwd.h
EgammaHcalPFClusterIsolationProducer::T1Ref
edm::Ref< T1Collection > T1Ref
Definition: EgammaHcalPFClusterIsolationProducer.cc:31
EgammaHcalPFClusterIsolationProducer::etaStripBarrel_
const double etaStripBarrel_
Definition: EgammaHcalPFClusterIsolationProducer.cc:47
edm::EventSetup
Definition: EventSetup.h:58
EgammaHcalPFClusterIsolationProducer::useEt_
const double useEt_
Definition: EgammaHcalPFClusterIsolationProducer.cc:51
EgammaHcalPFClusterIsolationProducer::emObjectProducer_
const edm::EDGetTokenT< T1Collection > emObjectProducer_
Definition: EgammaHcalPFClusterIsolationProducer.cc:38
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
ElectronHcalPFClusterIsolationProducer
EgammaHcalPFClusterIsolationProducer< reco::GsfElectron > ElectronHcalPFClusterIsolationProducer
Definition: EgammaHcalPFClusterIsolationProducer.cc:128
EgammaHcalPFClusterIsolationProducer::energyBarrel_
const double energyBarrel_
Definition: EgammaHcalPFClusterIsolationProducer.cc:49
EventSetup.h
or
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::pfClusterProducerHCAL_
const edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducerHCAL_
Definition: EgammaHcalPFClusterIsolationProducer.cc:39
PhotonHcalPFClusterIsolationProducer
EgammaHcalPFClusterIsolationProducer< reco::Photon > PhotonHcalPFClusterIsolationProducer
Definition: EgammaHcalPFClusterIsolationProducer.cc:129
edm::helper::Filler
Definition: ValueMap.h:22
EgammaHcalPFClusterIsolationProducer::etaStripEndcap_
const double etaStripEndcap_
Definition: EgammaHcalPFClusterIsolationProducer.cc:48
ParameterSet.h
HcalPFClusterIsolation.h
EDProducer.h
EgammaHcalPFClusterIsolationProducer::drMax_
const double drMax_
Definition: EgammaHcalPFClusterIsolationProducer.cc:44
edm::Event
Definition: Event.h:73
HcalPFClusterIsolation
Definition: HcalPFClusterIsolation.h:17
EgammaHcalPFClusterIsolationProducer::pfClusterProducerHFHAD_
const edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducerHFHAD_
Definition: EgammaHcalPFClusterIsolationProducer.cc:41
edm::ParameterDescription
Definition: ParameterDescription.h:110
edm::InputTag
Definition: InputTag.h:15
EgammaHcalPFClusterIsolationProducer::useHF_
const bool useHF_
Definition: EgammaHcalPFClusterIsolationProducer.cc:43