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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 49 of file CaloRecHitsBeamHaloCleaned.cc.

Constructor & Destructor Documentation

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

Definition at line 78 of file CaloRecHitsBeamHaloCleaned.cc.

References edm::ParameterSet::getParameter().

79 {
80 
81  ishlt = iConfig.getParameter< bool> ("IsHLT");
82 
83 
84 
85  produces<EcalRecHitCollection>("EcalRecHitsEB");
86  produces<EcalRecHitCollection>("EcalRecHitsEE");
87  produces<HBHERecHitCollection>();
88 
89 
90  it_EBRecHits = iConfig.getParameter<edm::InputTag>("EBRecHitsLabel");
91  it_EERecHits = iConfig.getParameter<edm::InputTag>("EERecHitsLabel");
92  it_HBHERecHits = iConfig.getParameter<edm::InputTag>("HBHERecHitsLabel");
93  it_GlobalHaloData = iConfig.getParameter<edm::InputTag>("GlobalHaloDataLabel");
94 
95 
96  ecalebhits_token= consumes<EcalRecHitCollection>(it_EBRecHits);
97  ecaleehits_token= consumes<EcalRecHitCollection>(it_EERecHits);
98  hbhehits_token= consumes<HBHERecHitCollection>(it_HBHERecHits);
99 
100  globalhalo_token=consumes<GlobalHaloData>(it_GlobalHaloData);
101 }
T getParameter(std::string const &) const
edm::EDGetTokenT< GlobalHaloData > globalhalo_token
edm::EDGetTokenT< EcalRecHitCollection > ecalebhits_token
edm::EDGetTokenT< HBHERecHitCollection > hbhehits_token
edm::EDGetTokenT< EcalRecHitCollection > ecaleehits_token
CaloRecHitsBeamHaloCleaned::~CaloRecHitsBeamHaloCleaned ( )
override

Definition at line 104 of file CaloRecHitsBeamHaloCleaned.cc.

105 {
106 
107  // do anything here that needs to be done at destruction time
108  // (e.g. close files, deallocate resources etc.)
109 
110 }

Member Function Documentation

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

Definition at line 205 of file CaloRecHitsBeamHaloCleaned.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

205  {
207  desc.add<edm::InputTag>("EBRecHitsLabel", edm::InputTag("EcalRecHit","EcalRecHitsEB"));
208  desc.add<edm::InputTag>("EERecHitsLabel", edm::InputTag("EcalRecHit","EcalRecHitsEE"));
209  desc.add<edm::InputTag>("HBHERecHitsLabel", edm::InputTag("hbhereco"));
210  desc.add<edm::InputTag>("GlobalHaloDataLabel", edm::InputTag("GlobalHaloData"));
211  desc.add<bool>("IsHLT",false);
212  descriptions.add("caloRecHitsBeamHaloCleaned",desc);
213 
214 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void CaloRecHitsBeamHaloCleaned::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 119 of file CaloRecHitsBeamHaloCleaned.cc.

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

120 {
121  using namespace edm;
122  using namespace reco;
123  using namespace std;
124 
125 
126  Handle<EcalRecHitCollection> ebrhitsuncleaned;
127  iEvent.getByToken(ecalebhits_token, ebrhitsuncleaned );
128 
129  Handle<EcalRecHitCollection> eerhitsuncleaned;
130  iEvent.getByToken(ecaleehits_token, eerhitsuncleaned );
131 
132  Handle<HBHERecHitCollection> hbherhitsuncleaned;
133  iEvent.getByToken(hbhehits_token, hbherhitsuncleaned );
134 
135  // Get GlobalHaloData
136  edm::Handle<reco::GlobalHaloData> TheGlobalHaloData;
137  iEvent.getByToken(globalhalo_token, TheGlobalHaloData);
138 
139 
140 
141  const GlobalHaloData TheSummaryHalo = (*TheGlobalHaloData );
142 
143 
144  //Cleaning of the various rechits collections:
145 
146  // EcalRecHit EB
147  auto ebrhitscleaned = std::make_unique<EcalRecHitCollection>();
148  for(unsigned int i = 0; i < ebrhitsuncleaned->size(); i++){
149  const EcalRecHit & rhit = (*ebrhitsuncleaned)[i];
150  bool isclean(true);
151  const edm::RefVector<EcalRecHitCollection>& refbeamhalorechits = TheSummaryHalo.GetEBRechits();
152  for(unsigned int j = 0; j <refbeamhalorechits.size() ; j++){
153  const EcalRecHit &rhitbeamhalo = *(refbeamhalorechits)[j];
154  if( rhit.detid() == rhitbeamhalo.detid() ) {
155  isclean = false;
156  break;
157  }
158  }
159  if(isclean) ebrhitscleaned->push_back(rhit);
160  }
161 
162  // EcalRecHit EE
163  auto eerhitscleaned = std::make_unique<EcalRecHitCollection>();
164  for(unsigned int i = 0; i < eerhitsuncleaned->size(); i++){
165  const EcalRecHit & rhit = (*eerhitsuncleaned)[i];
166  bool isclean(true);
167  const edm::RefVector<EcalRecHitCollection>& refbeamhalorechits = TheSummaryHalo.GetEERechits();
168  for(unsigned int j = 0; j <refbeamhalorechits.size() ; j++){
169  const EcalRecHit &rhitbeamhalo = *(refbeamhalorechits)[j];
170  if( rhit.detid() == rhitbeamhalo.detid() ) {
171  isclean = false;
172  break;
173  }
174  }
175  if(isclean) eerhitscleaned->push_back(rhit);
176  }
177 
178  // HBHERecHit
179  auto hbherhitscleaned = std::make_unique<HBHERecHitCollection>();
180  for(unsigned int i = 0; i < hbherhitsuncleaned->size(); i++){
181  const HBHERecHit & rhit = (*hbherhitsuncleaned)[i];
182  bool isclean(true);
183  const edm::RefVector<HBHERecHitCollection>& refbeamhalorechits = TheSummaryHalo.GetHBHERechits();
184  for(unsigned int j = 0; j <refbeamhalorechits.size() ; j++){
185  const HBHERecHit &rhitbeamhalo = *(refbeamhalorechits)[j];
186  if( rhit.detid() == rhitbeamhalo.detid() ) {
187  isclean = false;
188  break;
189  }
190  }
191  if(isclean) hbherhitscleaned->push_back(rhit);
192  }
193 
194 
195 
196  iEvent.put(std::move(ebrhitscleaned),"EcalRecHitsEB");
197  iEvent.put(std::move(eerhitscleaned),"EcalRecHitsEE");
198  iEvent.put(std::move(hbherhitscleaned));
199 
200 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
const DetId & detid() const
Definition: CaloRecHit.h:21
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
const DetId & detid() const
Definition: EcalRecHit.h:72
edm::RefVector< HBHERecHitCollection > & GetHBHERechits()
edm::EDGetTokenT< GlobalHaloData > globalhalo_token
edm::EDGetTokenT< EcalRecHitCollection > ecalebhits_token
fixed size matrix
HLT enums.
size_type size() const
size_type size() const
Size of the RefVector.
Definition: RefVector.h:107
edm::RefVector< EcalRecHitCollection > & GetEBRechits()
edm::EDGetTokenT< HBHERecHitCollection > hbhehits_token
edm::RefVector< EcalRecHitCollection > & GetEERechits()
def move(src, dest)
Definition: eostools.py:510
edm::EDGetTokenT< EcalRecHitCollection > ecaleehits_token

Member Data Documentation

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

Definition at line 60 of file CaloRecHitsBeamHaloCleaned.cc.

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

Definition at line 61 of file CaloRecHitsBeamHaloCleaned.cc.

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

Definition at line 63 of file CaloRecHitsBeamHaloCleaned.cc.

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

Definition at line 62 of file CaloRecHitsBeamHaloCleaned.cc.

bool CaloRecHitsBeamHaloCleaned::ishlt
private

Definition at line 72 of file CaloRecHitsBeamHaloCleaned.cc.

edm::InputTag CaloRecHitsBeamHaloCleaned::it_EBRecHits
private

Definition at line 66 of file CaloRecHitsBeamHaloCleaned.cc.

edm::InputTag CaloRecHitsBeamHaloCleaned::it_EERecHits
private

Definition at line 67 of file CaloRecHitsBeamHaloCleaned.cc.

edm::InputTag CaloRecHitsBeamHaloCleaned::it_GlobalHaloData
private

Definition at line 69 of file CaloRecHitsBeamHaloCleaned.cc.

edm::InputTag CaloRecHitsBeamHaloCleaned::it_HBHERecHits
private

Definition at line 68 of file CaloRecHitsBeamHaloCleaned.cc.