CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CaloRecHitsBeamHaloCleaned Class Reference

#include <RecoMET/METProducers/plugins/CaloRecHitsBeamHaloCleaned.cc>

Inheritance diagram for CaloRecHitsBeamHaloCleaned:
edm::stream::EDProducer<>

Public Member Functions

 CaloRecHitsBeamHaloCleaned (const edm::ParameterSet &)
 
 ~CaloRecHitsBeamHaloCleaned () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< EcalRecHitCollectionecalebhits_token
 
edm::EDGetTokenT< EcalRecHitCollectionecaleehits_token
 
edm::EDGetTokenT< GlobalHaloDataglobalhalo_token
 
edm::EDGetTokenT< HBHERecHitCollectionhbhehits_token
 
bool ishlt
 
edm::InputTag it_EBRecHits
 
edm::InputTag it_EERecHits
 
edm::InputTag it_GlobalHaloData
 
edm::InputTag it_HBHERecHits
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 48 of file CaloRecHitsBeamHaloCleaned.cc.

Constructor & Destructor Documentation

◆ CaloRecHitsBeamHaloCleaned()

CaloRecHitsBeamHaloCleaned::CaloRecHitsBeamHaloCleaned ( const edm::ParameterSet iConfig)
explicit

Definition at line 75 of file CaloRecHitsBeamHaloCleaned.cc.

References edm::ParameterSet::getParameter().

75  {
76  ishlt = iConfig.getParameter<bool>("IsHLT");
77 
78  produces<EcalRecHitCollection>("EcalRecHitsEB");
79  produces<EcalRecHitCollection>("EcalRecHitsEE");
80  produces<HBHERecHitCollection>();
81 
82  it_EBRecHits = iConfig.getParameter<edm::InputTag>("EBRecHitsLabel");
83  it_EERecHits = iConfig.getParameter<edm::InputTag>("EERecHitsLabel");
84  it_HBHERecHits = iConfig.getParameter<edm::InputTag>("HBHERecHitsLabel");
85  it_GlobalHaloData = iConfig.getParameter<edm::InputTag>("GlobalHaloDataLabel");
86 
87  ecalebhits_token = consumes<EcalRecHitCollection>(it_EBRecHits);
88  ecaleehits_token = consumes<EcalRecHitCollection>(it_EERecHits);
89  hbhehits_token = consumes<HBHERecHitCollection>(it_HBHERecHits);
90 
91  globalhalo_token = consumes<GlobalHaloData>(it_GlobalHaloData);
92 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< GlobalHaloData > globalhalo_token
edm::EDGetTokenT< EcalRecHitCollection > ecalebhits_token
edm::EDGetTokenT< HBHERecHitCollection > hbhehits_token
edm::EDGetTokenT< EcalRecHitCollection > ecaleehits_token

◆ ~CaloRecHitsBeamHaloCleaned()

CaloRecHitsBeamHaloCleaned::~CaloRecHitsBeamHaloCleaned ( )
override

Definition at line 94 of file CaloRecHitsBeamHaloCleaned.cc.

94  {
95  // do anything here that needs to be done at destruction time
96  // (e.g. close files, deallocate resources etc.)
97 }

Member Function Documentation

◆ fillDescriptions()

void CaloRecHitsBeamHaloCleaned::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 183 of file CaloRecHitsBeamHaloCleaned.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_2022v12_cff::InputTag.

183  {
185  desc.add<edm::InputTag>("EBRecHitsLabel", edm::InputTag("EcalRecHit", "EcalRecHitsEB"));
186  desc.add<edm::InputTag>("EERecHitsLabel", edm::InputTag("EcalRecHit", "EcalRecHitsEE"));
187  desc.add<edm::InputTag>("HBHERecHitsLabel", edm::InputTag("hbhereco"));
188  desc.add<edm::InputTag>("GlobalHaloDataLabel", edm::InputTag("GlobalHaloData"));
189  desc.add<bool>("IsHLT", false);
190  descriptions.add("caloRecHitsBeamHaloCleaned", desc);
191 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void CaloRecHitsBeamHaloCleaned::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 104 of file CaloRecHitsBeamHaloCleaned.cc.

References CaloRecHit::detid(), EcalRecHit::detid(), reco::GlobalHaloData::GetEBRechits(), reco::GlobalHaloData::GetEERechits(), reco::GlobalHaloData::GetHBHERechits(), mps_fire::i, iEvent, dqmiolumiharvest::j, eostools::move(), edm::RefVector< C, T, F >::size(), and edm::SortedCollection< T, SORT >::size().

104  {
105  using namespace edm;
106  using namespace reco;
107  using namespace std;
108 
109  Handle<EcalRecHitCollection> ebrhitsuncleaned;
110  iEvent.getByToken(ecalebhits_token, ebrhitsuncleaned);
111 
112  Handle<EcalRecHitCollection> eerhitsuncleaned;
113  iEvent.getByToken(ecaleehits_token, eerhitsuncleaned);
114 
115  Handle<HBHERecHitCollection> hbherhitsuncleaned;
116  iEvent.getByToken(hbhehits_token, hbherhitsuncleaned);
117 
118  // Get GlobalHaloData
119  edm::Handle<reco::GlobalHaloData> TheGlobalHaloData;
120  iEvent.getByToken(globalhalo_token, TheGlobalHaloData);
121 
122  const GlobalHaloData TheSummaryHalo = (*TheGlobalHaloData);
123 
124  //Cleaning of the various rechits collections:
125 
126  // EcalRecHit EB
127  auto ebrhitscleaned = std::make_unique<EcalRecHitCollection>();
128  for (unsigned int i = 0; i < ebrhitsuncleaned->size(); i++) {
129  const EcalRecHit& rhit = (*ebrhitsuncleaned)[i];
130  bool isclean(true);
131  const edm::RefVector<EcalRecHitCollection>& refbeamhalorechits = TheSummaryHalo.GetEBRechits();
132  for (unsigned int j = 0; j < refbeamhalorechits.size(); j++) {
133  const EcalRecHit& rhitbeamhalo = *(refbeamhalorechits)[j];
134  if (rhit.detid() == rhitbeamhalo.detid()) {
135  isclean = false;
136  break;
137  }
138  }
139  if (isclean)
140  ebrhitscleaned->push_back(rhit);
141  }
142 
143  // EcalRecHit EE
144  auto eerhitscleaned = std::make_unique<EcalRecHitCollection>();
145  for (unsigned int i = 0; i < eerhitsuncleaned->size(); i++) {
146  const EcalRecHit& rhit = (*eerhitsuncleaned)[i];
147  bool isclean(true);
148  const edm::RefVector<EcalRecHitCollection>& refbeamhalorechits = TheSummaryHalo.GetEERechits();
149  for (unsigned int j = 0; j < refbeamhalorechits.size(); j++) {
150  const EcalRecHit& rhitbeamhalo = *(refbeamhalorechits)[j];
151  if (rhit.detid() == rhitbeamhalo.detid()) {
152  isclean = false;
153  break;
154  }
155  }
156  if (isclean)
157  eerhitscleaned->push_back(rhit);
158  }
159 
160  // HBHERecHit
161  auto hbherhitscleaned = std::make_unique<HBHERecHitCollection>();
162  for (unsigned int i = 0; i < hbherhitsuncleaned->size(); i++) {
163  const HBHERecHit& rhit = (*hbherhitsuncleaned)[i];
164  bool isclean(true);
165  const edm::RefVector<HBHERecHitCollection>& refbeamhalorechits = TheSummaryHalo.GetHBHERechits();
166  for (unsigned int j = 0; j < refbeamhalorechits.size(); j++) {
167  const HBHERecHit& rhitbeamhalo = *(refbeamhalorechits)[j];
168  if (rhit.detid() == rhitbeamhalo.detid()) {
169  isclean = false;
170  break;
171  }
172  }
173  if (isclean)
174  hbherhitscleaned->push_back(rhit);
175  }
176 
177  iEvent.put(std::move(ebrhitscleaned), "EcalRecHitsEB");
178  iEvent.put(std::move(eerhitscleaned), "EcalRecHitsEE");
179  iEvent.put(std::move(hbherhitscleaned));
180 }
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
size_type size() const
int iEvent
Definition: GenABIO.cc:224
edm::RefVector< HBHERecHitCollection > & GetHBHERechits()
edm::EDGetTokenT< GlobalHaloData > globalhalo_token
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
edm::EDGetTokenT< EcalRecHitCollection > ecalebhits_token
const DetId & detid() const
Definition: EcalRecHit.h:72
fixed size matrix
HLT enums.
edm::RefVector< EcalRecHitCollection > & GetEBRechits()
edm::EDGetTokenT< HBHERecHitCollection > hbhehits_token
edm::RefVector< EcalRecHitCollection > & GetEERechits()
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< EcalRecHitCollection > ecaleehits_token

Member Data Documentation

◆ ecalebhits_token

edm::EDGetTokenT<EcalRecHitCollection> CaloRecHitsBeamHaloCleaned::ecalebhits_token
private

Definition at line 58 of file CaloRecHitsBeamHaloCleaned.cc.

◆ ecaleehits_token

edm::EDGetTokenT<EcalRecHitCollection> CaloRecHitsBeamHaloCleaned::ecaleehits_token
private

Definition at line 59 of file CaloRecHitsBeamHaloCleaned.cc.

◆ globalhalo_token

edm::EDGetTokenT<GlobalHaloData> CaloRecHitsBeamHaloCleaned::globalhalo_token
private

Definition at line 61 of file CaloRecHitsBeamHaloCleaned.cc.

◆ hbhehits_token

edm::EDGetTokenT<HBHERecHitCollection> CaloRecHitsBeamHaloCleaned::hbhehits_token
private

Definition at line 60 of file CaloRecHitsBeamHaloCleaned.cc.

◆ ishlt

bool CaloRecHitsBeamHaloCleaned::ishlt
private

Definition at line 69 of file CaloRecHitsBeamHaloCleaned.cc.

◆ it_EBRecHits

edm::InputTag CaloRecHitsBeamHaloCleaned::it_EBRecHits
private

Definition at line 64 of file CaloRecHitsBeamHaloCleaned.cc.

◆ it_EERecHits

edm::InputTag CaloRecHitsBeamHaloCleaned::it_EERecHits
private

Definition at line 65 of file CaloRecHitsBeamHaloCleaned.cc.

◆ it_GlobalHaloData

edm::InputTag CaloRecHitsBeamHaloCleaned::it_GlobalHaloData
private

Definition at line 67 of file CaloRecHitsBeamHaloCleaned.cc.

◆ it_HBHERecHits

edm::InputTag CaloRecHitsBeamHaloCleaned::it_HBHERecHits
private

Definition at line 66 of file CaloRecHitsBeamHaloCleaned.cc.