CMS 3D CMS Logo

EgammaIsoHcalDetIdCollectionProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaIsoHcalDetIdCollectionProducer
4 // Class: EgammaIsoHcalDetIdCollectionProducer
5 //
29 
31 public:
33  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
34 
35  void beginRun(edm::Run const&, const edm::EventSetup&) final;
36  void produce(edm::Event&, const edm::EventSetup&) override;
37 
38 private:
39  // ----------member data ---------------------------
44 
46 
47  float minSCEt_;
48  float minEleEt_;
49  float minPhoEt_;
50 
52 };
53 
56 
58  : recHitsToken_{consumes(iConfig.getParameter<edm::InputTag>("recHitsLabel"))},
59  superClustersToken_{consumes(iConfig.getParameter<edm::InputTag>("superClustersLabel"))},
60  elesToken_{consumes(iConfig.getParameter<edm::InputTag>("elesLabel"))},
61  phosToken_{consumes(iConfig.getParameter<edm::InputTag>("phosLabel"))},
62  hcalHitSelector_(iConfig.getParameter<edm::ParameterSet>("hitSelection"), consumesCollector()) {
63  minSCEt_ = iConfig.getParameter<double>("minSCEt");
64  minEleEt_ = iConfig.getParameter<double>("minEleEt");
65  minPhoEt_ = iConfig.getParameter<double>("minPhoEt");
66 
67  interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
68 
69  //register your products
70  produces<DetIdCollection>(interestingDetIdCollection_);
71 }
72 
75  desc.add<edm::InputTag>("recHitsLabel", edm::InputTag("hbhereco"));
76  desc.add<edm::InputTag>("elesLabel", edm::InputTag("gedGsfElectrons"));
77  desc.add<edm::InputTag>("phosLabel", edm::InputTag("gedPhotons"));
78  desc.add<edm::InputTag>("superClustersLabel", edm::InputTag("particleFlowEGamma"));
79  desc.add<double>("minSCEt", 20);
80  desc.add<double>("minEleEt", 20);
81  desc.add<double>("minPhoEt", 20);
82  desc.add<std::string>("interestingDetIdCollection", "");
84  descriptions.add(("interestingGedEgammaIsoHCALDetId"), desc);
85 }
86 
88  hcalHitSelector_.setup(iSetup);
89 }
90 
91 // ------------ method called to produce the data ------------
93  auto superClusters = iEvent.getHandle(superClustersToken_);
94  auto eles = iEvent.getHandle(elesToken_);
95  auto phos = iEvent.getHandle(phosToken_);
96  auto recHits = iEvent.getHandle(recHitsToken_);
97 
98  std::vector<DetId> indexToStore;
99  indexToStore.reserve(100);
100 
101  if (eles.isValid() && recHits.isValid()) {
102  for (auto& ele : *eles) {
103  float scEt = ele.superCluster()->energy() * std::sin(ele.superCluster()->position().theta());
104  if (scEt > minEleEt_ || ele.et() > minEleEt_) {
105  hcalHitSelector_.addDetIds(*ele.superCluster(), *recHits, indexToStore);
106  }
107  }
108  }
109  if (phos.isValid() && recHits.isValid()) {
110  for (auto& pho : *phos) {
111  float scEt = pho.superCluster()->energy() * std::sin(pho.superCluster()->position().theta());
112  if (scEt > minPhoEt_ || pho.et() > minPhoEt_) {
113  hcalHitSelector_.addDetIds(*pho.superCluster(), *recHits, indexToStore);
114  }
115  }
116  }
117  if (superClusters.isValid() && recHits.isValid()) {
118  for (auto& sc : *superClusters) {
119  float scEt = sc.energy() * std::sin(sc.position().theta());
120  if (scEt > minSCEt_) {
121  hcalHitSelector_.addDetIds(sc, *recHits, indexToStore);
122  }
123  }
124  }
125 
126  //unify the vector
127  std::sort(indexToStore.begin(), indexToStore.end());
128  std::unique(indexToStore.begin(), indexToStore.end());
129 
130  auto detIdCollection = std::make_unique<DetIdCollection>(indexToStore);
131 
132  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_);
133 }
EGHcalRecHitSelector::setup
void setup(const edm::EventSetup &iSetup)
Definition: EGHcalRecHitSelector.h:29
EgammaIsoHcalDetIdCollectionProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:73
ESHandle.h
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
EgammaIsoHcalDetIdCollectionProducer::minPhoEt_
float minPhoEt_
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:49
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EgammaIsoHcalDetIdCollectionProducer::minEleEt_
float minEleEt_
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:48
EDProducer.h
PhotonFwd.h
EGHcalRecHitSelector::addDetIds
void addDetIds(const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, CollType &detIdsToStore) const
Definition: EGHcalRecHitSelector.h:49
EgammaIsoHcalDetIdCollectionProducer::recHitsToken_
const edm::EDGetTokenT< HBHERecHitCollection > recHitsToken_
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:40
HLT_FULL_cff.superClusters
superClusters
Definition: HLT_FULL_cff.py:15191
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
EgammaIsoHcalDetIdCollectionProducer::minSCEt_
float minSCEt_
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:47
MakerMacros.h
Photon.h
EGHcalRecHitSelector::makePSetDescription
static edm::ParameterSetDescription makePSetDescription()
Definition: EGHcalRecHitSelector.cc:13
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EgammaIsoHcalDetIdCollectionProducer::interestingDetIdCollection_
std::string interestingDetIdCollection_
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:45
EgammaIsoHcalDetIdCollectionProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:92
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
GsfElectron.h
CaloGeometryRecord.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
EgammaIsoHcalDetIdCollectionProducer::phosToken_
const edm::EDGetTokenT< reco::PhotonCollection > phosToken_
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:43
GsfElectronFwd.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
EgammaIsoHcalDetIdCollectionProducer::EgammaIsoHcalDetIdCollectionProducer
EgammaIsoHcalDetIdCollectionProducer(const edm::ParameterSet &)
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:57
EgammaIsoHcalDetIdCollectionProducer::hcalHitSelector_
EGHcalRecHitSelector hcalHitSelector_
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:51
EGHcalRecHitSelector.h
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
EgammaIsoHcalDetIdCollectionProducer
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:30
iEvent
int iEvent
Definition: GenABIO.cc:224
EgammaIsoHcalDetIdCollectionProducer::superClustersToken_
const edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:41
edm::stream::EDProducer
Definition: EDProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EGHcalRecHitSelector
Definition: EGHcalRecHitSelector.h:19
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
EgammaIsoHcalDetIdCollectionProducer::elesToken_
const edm::EDGetTokenT< reco::GsfElectronCollection > elesToken_
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:42
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
SuperClusterFwd.h
SuperCluster.h
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HcalRecHitCollections.h
EgammaIsoHcalDetIdCollectionProducer::beginRun
void beginRun(edm::Run const &, const edm::EventSetup &) final
Definition: EgammaIsoHcalDetIdCollectionProducer.cc:87
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
DetIdCollection.h