CMS 3D CMS Logo

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

#include <EcalRecHitsMerger.h>

Inheritance diagram for EcalRecHitsMerger:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob (void) override
 
 EcalRecHitsMerger (const edm::ParameterSet &pset)
 
void endJob (void) override
 
void produce (edm::StreamID sid, edm::Event &e, const edm::EventSetup &c) const override
 
 ~EcalRecHitsMerger () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) 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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

bool debug_
 
edm::InputTag EgammaSourceEB_
 
edm::InputTag EgammaSourceEE_
 
std::string InputRecHitEB_
 
std::string InputRecHitEE_
 
edm::InputTag JetsSourceEB_
 
edm::InputTag JetsSourceEE_
 
edm::InputTag MuonsSourceEB_
 
edm::InputTag MuonsSourceEE_
 
std::string OutputLabelEB_
 
std::string OutputLabelEE_
 
edm::InputTag Pi0SourceEB_
 
edm::InputTag Pi0SourceEE_
 
edm::InputTag RestSourceEB_
 
edm::InputTag RestSourceEE_
 
edm::InputTag TausSourceEB_
 
edm::InputTag TausSourceEE_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
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

Definition at line 21 of file EcalRecHitsMerger.h.

Constructor & Destructor Documentation

EcalRecHitsMerger::EcalRecHitsMerger ( const edm::ParameterSet pset)

Definition at line 19 of file EcalRecHitsMerger.cc.

References edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

19  {
20 
21  debug_ = pset.getUntrackedParameter<bool>("debug");
22 
23  EgammaSourceEB_ = pset.getUntrackedParameter<edm::InputTag>("EgammaSource_EB");
24  MuonsSourceEB_ = pset.getUntrackedParameter<edm::InputTag>("MuonsSource_EB");
25  TausSourceEB_ = pset.getUntrackedParameter<edm::InputTag>("TausSource_EB");
26  JetsSourceEB_ = pset.getUntrackedParameter<edm::InputTag>("JetsSource_EB");
27  RestSourceEB_ = pset.getUntrackedParameter<edm::InputTag>("RestSource_EB");
28  Pi0SourceEB_ = pset.getUntrackedParameter<edm::InputTag>("Pi0Source_EB",edm::InputTag("dummyPi0"));
29 
30  EgammaSourceEE_ = pset.getUntrackedParameter<edm::InputTag>("EgammaSource_EE");
31  MuonsSourceEE_ = pset.getUntrackedParameter<edm::InputTag>("MuonsSource_EE");
32  TausSourceEE_ = pset.getUntrackedParameter<edm::InputTag>("TausSource_EE");
33  JetsSourceEE_ = pset.getUntrackedParameter<edm::InputTag>("JetsSource_EE");
34  RestSourceEE_ = pset.getUntrackedParameter<edm::InputTag>("RestSource_EE");
35  Pi0SourceEE_ = pset.getUntrackedParameter<edm::InputTag>("Pi0Source_EE",edm::InputTag("dummyPi0"));
36 
37  OutputLabelEB_ = pset.getUntrackedParameter<std::string>("OutputLabel_EB");
38  OutputLabelEE_ = pset.getUntrackedParameter<std::string>("OutputLabel_EE");
39 
40  InputRecHitEB_ = pset.getUntrackedParameter<std::string>("EcalRecHitCollectionEB");
41  InputRecHitEE_ = pset.getUntrackedParameter<std::string>("EcalRecHitCollectionEE");
42 
43  produces<EcalRecHitCollection>(OutputLabelEB_);
44  produces<EcalRecHitCollection>(OutputLabelEE_);
45 
46 }
edm::InputTag EgammaSourceEE_
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag JetsSourceEB_
edm::InputTag EgammaSourceEB_
edm::InputTag Pi0SourceEB_
std::string OutputLabelEB_
edm::InputTag TausSourceEE_
edm::InputTag RestSourceEE_
edm::InputTag MuonsSourceEE_
edm::InputTag JetsSourceEE_
std::string InputRecHitEE_
edm::InputTag MuonsSourceEB_
std::string OutputLabelEE_
edm::InputTag RestSourceEB_
edm::InputTag Pi0SourceEE_
std::string InputRecHitEB_
edm::InputTag TausSourceEB_
EcalRecHitsMerger::~EcalRecHitsMerger ( )
override

Definition at line 50 of file EcalRecHitsMerger.cc.

50  {
51 }

Member Function Documentation

void EcalRecHitsMerger::beginJob ( void  )
overridevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 76 of file EcalRecHitsMerger.cc.

76  {
77 }
void EcalRecHitsMerger::endJob ( void  )
overridevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 79 of file EcalRecHitsMerger.cc.

79  {
80 }
void EcalRecHitsMerger::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 53 of file EcalRecHitsMerger.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

53  {
54 
56  desc.add<bool>("debug", false);
57  desc.add<edm::InputTag>("EgammaSource_EB", edm::InputTag("ecalRegionalEgammaRecHitTmp","EcalRecHitsEB"));
58  desc.add<edm::InputTag>("MuonsSource_EB", edm::InputTag("ecalRegionalMuonsRecHitTmp","EcalRecHitsEB"));
59  desc.add<edm::InputTag>("TausSource_EB", edm::InputTag("ecalRegionalTausRecHitTmp","EcalRecHitsEB"));
60  desc.add<edm::InputTag>("JetsSource_EB", edm::InputTag("ecalRegionalJetsRecHitTmp","EcalRecHitsEB"));
61  desc.add<edm::InputTag>("RestSource_EB", edm::InputTag("ecalRegionalRestRecHitTmp","EcalRecHitsEB"));
62  desc.add<edm::InputTag>("Pi0Source_EB", edm::InputTag("dummyPi0"));
63  desc.add<edm::InputTag>("EgammaSource_EE", edm::InputTag("ecalRegionalEgammaRecHitTmp","EcalRecHitsEE"));
64  desc.add<edm::InputTag>("MuonsSource_EE", edm::InputTag("ecalRegionalMuonsRecHitTmp","EcalRecHitsEE"));
65  desc.add<edm::InputTag>("TausSource_EE", edm::InputTag("ecalRegionalTausRecHitTmp","EcalRecHitsEE"));
66  desc.add<edm::InputTag>("JetsSource_EE", edm::InputTag("ecalRegionalJetsRecHitTmp","EcalRecHitsEE"));
67  desc.add<edm::InputTag>("RestSource_EE", edm::InputTag("ecalRegionalRestRecHitTmp","EcalRecHitsEE"));
68  desc.add<edm::InputTag>("Pi0Source_EE", edm::InputTag("dummyPi0"));
69  desc.add<std::string>("OutputLabel_EB", "EcalRecHitsEB");
70  desc.add<std::string>("OutputLabel_EE", "EcalRecHitsEE");
71  desc.add<std::string>("EcalRecHitCollectionEB", "EcalRecHitsEB");
72  desc.add<std::string>("EcalRecHitCollectionEE", "EcalRecHitsEE");
73  descriptions.add("hltEcalRecHitsMerger", desc);
74 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EcalRecHitsMerger::produce ( edm::StreamID  sid,
edm::Event e,
const edm::EventSetup c 
) const
override

Definition at line 82 of file EcalRecHitsMerger.cc.

References begin, gather_cfg::cout, edm::EventID::event(), edm::Event::getManyByType(), mps_fire::i, edm::EventBase::id(), instance, eostools::move(), edm::Event::put(), edm::EventID::run(), findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

82  {
83 
84  if (debug_) std::cout << " EcalRecHitMerger : Run " << e.id().run() << " Event " << e.id().event() << std::endl;
85 
86  std::vector< edm::Handle<EcalRecHitCollection> > EcalRecHits_done;
87  e.getManyByType(EcalRecHits_done);
88 
89  auto EBMergedRecHits = std::make_unique<EcalRecHitCollection>();
90  auto EEMergedRecHits = std::make_unique<EcalRecHitCollection>();
91 
92  unsigned int nColl = EcalRecHits_done.size();
93 
94  int nEB = 0;
95  int nEE = 0;
96 
97 
98  for (unsigned int i=0; i < nColl; i++) {
99 
100  std::string instance = EcalRecHits_done[i].provenance()->productInstanceName();
101  std::string module_label = EcalRecHits_done[i].provenance()->moduleLabel();
102 
103  if ( module_label != EgammaSourceEB_.label() &&
104  module_label != MuonsSourceEB_.label() &&
105  module_label != JetsSourceEB_.label() &&
106  module_label != TausSourceEB_.label() &&
107  module_label != RestSourceEB_.label() &&
108  module_label != Pi0SourceEB_.label() ) continue;
109 
110  if (instance == InputRecHitEB_) {
111  nEB += EcalRecHits_done[i] -> size();
112  }
113  else if (instance == InputRecHitEE_) {
114  nEE += EcalRecHits_done[i] -> size();
115  }
116 
117  }
118 
119  EBMergedRecHits -> reserve(nEB);
120  EEMergedRecHits -> reserve(nEE);
121  if (debug_) std::cout << " Number of EB Rechits to merge = " << nEB << std::endl;
122  if (debug_) std::cout << " Number of EE Rechits to merge = " << nEE << std::endl;
123 
124  for (unsigned int i=0; i < nColl; i++) {
125  std::string instance = EcalRecHits_done[i].provenance()->productInstanceName();
126 
127  std::string module_label = EcalRecHits_done[i].provenance()->moduleLabel();
128  if ( module_label != EgammaSourceEB_.label() &&
129  module_label != MuonsSourceEB_.label() &&
130  module_label != JetsSourceEB_.label() &&
131  module_label != TausSourceEB_.label() &&
132  module_label != RestSourceEB_.label() &&
133  module_label != Pi0SourceEB_.label() ) continue;
134 
135  if (instance == InputRecHitEB_) {
136  for (EcalRecHitCollection::const_iterator it=EcalRecHits_done[i]->begin(); it !=EcalRecHits_done[i]->end(); it++) {
137  EBMergedRecHits -> push_back(*it);
138  }
139  }
140  else if (instance == InputRecHitEE_) {
141  for (EcalRecHitCollection::const_iterator it=EcalRecHits_done[i]->begin(); it !=EcalRecHits_done[i]->end(); it++) {
142  EEMergedRecHits -> push_back(*it);
143  }
144  }
145 
146  }
147 
148 
149  // std::cout << " avant le put " << std::endl;
150  e.put(std::move(EBMergedRecHits),OutputLabelEB_);
151  e.put(std::move(EEMergedRecHits),OutputLabelEE_);
152  // std::cout << " apres le put " << std::endl;
153 
154 }
RunNumber_t run() const
Definition: EventID.h:39
size
Write out results.
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:569
EventNumber_t event() const
Definition: EventID.h:41
edm::InputTag JetsSourceEB_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
edm::InputTag EgammaSourceEB_
static PFTauRenderPlugin instance
edm::InputTag Pi0SourceEB_
std::vector< EcalRecHit >::const_iterator const_iterator
std::string OutputLabelEB_
std::string InputRecHitEE_
edm::InputTag MuonsSourceEB_
std::string OutputLabelEE_
edm::InputTag RestSourceEB_
std::string const & label() const
Definition: InputTag.h:36
edm::EventID id() const
Definition: EventBase.h:60
#define begin
Definition: vmac.h:32
std::string InputRecHitEB_
edm::InputTag TausSourceEB_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

bool EcalRecHitsMerger::debug_
private

Definition at line 52 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::EgammaSourceEB_
private

Definition at line 32 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::EgammaSourceEE_
private

Definition at line 40 of file EcalRecHitsMerger.h.

std::string EcalRecHitsMerger::InputRecHitEB_
private

Definition at line 48 of file EcalRecHitsMerger.h.

std::string EcalRecHitsMerger::InputRecHitEE_
private

Definition at line 49 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::JetsSourceEB_
private

Definition at line 35 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::JetsSourceEE_
private

Definition at line 43 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::MuonsSourceEB_
private

Definition at line 33 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::MuonsSourceEE_
private

Definition at line 41 of file EcalRecHitsMerger.h.

std::string EcalRecHitsMerger::OutputLabelEB_
private

Definition at line 38 of file EcalRecHitsMerger.h.

std::string EcalRecHitsMerger::OutputLabelEE_
private

Definition at line 46 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::Pi0SourceEB_
private

Definition at line 37 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::Pi0SourceEE_
private

Definition at line 45 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::RestSourceEB_
private

Definition at line 36 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::RestSourceEE_
private

Definition at line 44 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::TausSourceEB_
private

Definition at line 34 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::TausSourceEE_
private

Definition at line 42 of file EcalRecHitsMerger.h.