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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CaloRecHitsBeamHaloCleaned (const edm::ParameterSet &)
 
 ~CaloRecHitsBeamHaloCleaned ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual 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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 ( )

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 
)
overrideprivatevirtual

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  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  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  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:122
const DetId & detid() const
Definition: CaloRecHit.h:21
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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.