CMS 3D CMS Logo

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

#include <ESRecHitsMerger.h>

Inheritance diagram for ESRecHitsMerger:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob (void) override
 
void endJob (void) override
 
 ESRecHitsMerger (const edm::ParameterSet &pset)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~ESRecHitsMerger () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Private Attributes

bool debug_
 
edm::InputTag EgammaSourceES_
 
edm::InputTag EtaSourceES_
 
std::string InputRecHitES_
 
edm::InputTag JetsSourceES_
 
edm::InputTag MuonsSourceES_
 
std::string OutputLabelES_
 
edm::InputTag Pi0SourceES_
 
edm::InputTag RestSourceES_
 
edm::InputTag TausSourceES_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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 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 ESRecHitsMerger.h.

Constructor & Destructor Documentation

ESRecHitsMerger::ESRecHitsMerger ( const edm::ParameterSet pset)

Definition at line 19 of file ESRecHitsMerger.cc.

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

19  {
20 
21  debug_ = pset.getUntrackedParameter<bool>("debug");
22 
23  EgammaSourceES_ = pset.getUntrackedParameter<edm::InputTag>("EgammaSource_ES",edm::InputTag("dummyEgamma"));
24  MuonsSourceES_ = pset.getUntrackedParameter<edm::InputTag>("MuonsSource_ES",edm::InputTag("dummyMuons"));
25  TausSourceES_ = pset.getUntrackedParameter<edm::InputTag>("TausSource_ES",edm::InputTag("dummyTaus"));
26  JetsSourceES_ = pset.getUntrackedParameter<edm::InputTag>("JetsSource_ES",edm::InputTag("dummyJets"));
27  RestSourceES_ = pset.getUntrackedParameter<edm::InputTag>("RestSource_ES",edm::InputTag("dummyRest"));
28  Pi0SourceES_ = pset.getUntrackedParameter<edm::InputTag>("Pi0Source_ES",edm::InputTag("dummyPi0"));
29  EtaSourceES_ = pset.getUntrackedParameter<edm::InputTag>("EtaSource_ES",edm::InputTag("dummyEta"));
30 
31  OutputLabelES_ = pset.getUntrackedParameter<std::string>("OutputLabel_ES");
32  InputRecHitES_ = pset.getUntrackedParameter<std::string>("EcalRecHitCollectionES");
33 
34  consumesMany<ESRecHitCollection>();
35  produces<EcalRecHitCollection>(OutputLabelES_);
36 
37 }
T getUntrackedParameter(std::string const &, T const &) const
std::string InputRecHitES_
edm::InputTag MuonsSourceES_
edm::InputTag TausSourceES_
edm::InputTag RestSourceES_
std::string OutputLabelES_
edm::InputTag Pi0SourceES_
edm::InputTag EgammaSourceES_
edm::InputTag EtaSourceES_
edm::InputTag JetsSourceES_
ESRecHitsMerger::~ESRecHitsMerger ( )
override

Definition at line 57 of file ESRecHitsMerger.cc.

57  {
58 }

Member Function Documentation

void ESRecHitsMerger::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 61 of file ESRecHitsMerger.cc.

61  {
62 }
void ESRecHitsMerger::endJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 64 of file ESRecHitsMerger.cc.

64  {
65 }
void ESRecHitsMerger::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 39 of file ESRecHitsMerger.cc.

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

39  {
40 
42  desc.add<bool>("debug", false);
43  desc.add<edm::InputTag>("EgammaSource_ES", edm::InputTag("dummyEgamma"));
44  desc.add<edm::InputTag>("MuonsSource_ES",edm::InputTag("dummyMuons"));
45  desc.add<edm::InputTag>("TausSource_ES",edm::InputTag("dummyTaus"));
46  desc.add<edm::InputTag>("JetsSource_ES",edm::InputTag("dummyJets"));
47  desc.add<edm::InputTag>("RestSource_ES",edm::InputTag("dummyRest"));
48  desc.add<edm::InputTag>("Pi0Source_ES",edm::InputTag("dummyPi0"));
49  desc.add<edm::InputTag>("EtaSource_ES",edm::InputTag("dummyEta"));
50  desc.add<std::string>("OutputLabel_ES", "EcalRecHitsES");
51  desc.add<std::string>("EcalRecHitCollectionES", "EcalRecHitsES");
52  descriptions.add("hltESRecHitsMerger", desc);
53 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void ESRecHitsMerger::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 67 of file ESRecHitsMerger.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.

67  {
68 
69  if (debug_) std::cout << " ESRecHitMerger : Run " << e.id().run() << " Event " << e.id().event() << std::endl;
70 
71 
72  std::vector< edm::Handle<ESRecHitCollection> > EcalRecHits_done;
73  e.getManyByType(EcalRecHits_done);
74 
75  auto ESMergedRecHits = std::make_unique<EcalRecHitCollection>();
76 
77 
78  unsigned int nColl = EcalRecHits_done.size();
79 
80  int nES = 0;
81 
82 
83  for (unsigned int i=0; i < nColl; i++) {
84 
85  std::string instance = EcalRecHits_done[i].provenance()->productInstanceName();
86  std::string module_label = EcalRecHits_done[i].provenance()->moduleLabel();
87 
88 
89  if (debug_){
90  std::cout<<"ESrechit to be merged from "<<module_label.c_str()<<" "<<instance.c_str()<<std::endl;
91  }
92 
93  if ( module_label != EgammaSourceES_.label() &&
94  module_label != MuonsSourceES_.label() &&
95  module_label != JetsSourceES_.label() &&
96  module_label != TausSourceES_.label() &&
97  module_label != RestSourceES_.label() &&
98  module_label != Pi0SourceES_.label() &&
99  module_label != EtaSourceES_.label()) continue;
100 
101  if (instance == InputRecHitES_) {
102  nES += EcalRecHits_done[i] -> size();
103  }
104 
105  }
106 
107 
108  ESMergedRecHits -> reserve(nES);
109 
110  if (debug_) std::cout << " Number of ES Rechits to merge = " << nES << std::endl;
111 
112  for (unsigned int i=0; i < nColl; i++) {
113  std::string instance = EcalRecHits_done[i].provenance()->productInstanceName();
114 
115  std::string module_label = EcalRecHits_done[i].provenance()->moduleLabel();
116  if ( module_label != EgammaSourceES_.label() &&
117  module_label != MuonsSourceES_.label() &&
118  module_label != JetsSourceES_.label() &&
119  module_label != TausSourceES_.label() &&
120  module_label != RestSourceES_.label() &&
121  module_label != Pi0SourceES_.label() &&
122  module_label != EtaSourceES_.label() ) continue;
123 
124  if (instance == InputRecHitES_) {
125  for (EcalRecHitCollection::const_iterator it=EcalRecHits_done[i]->begin(); it !=EcalRecHits_done[i]->end(); it++) {
126  ESMergedRecHits -> push_back(*it);
127  }
128  }
129 
130  }
131 
132 
133  // std::cout << " avant le put " << std::endl;
134  e.put(std::move(ESMergedRecHits),OutputLabelES_);
135  // std::cout << " apres le put " << std::endl;
136 
137 }
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
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::string InputRecHitES_
static PFTauRenderPlugin instance
edm::InputTag MuonsSourceES_
std::vector< EcalRecHit >::const_iterator const_iterator
edm::InputTag TausSourceES_
edm::InputTag RestSourceES_
std::string OutputLabelES_
edm::InputTag Pi0SourceES_
std::string const & label() const
Definition: InputTag.h:36
edm::EventID id() const
Definition: EventBase.h:60
#define begin
Definition: vmac.h:32
edm::InputTag EgammaSourceES_
edm::InputTag EtaSourceES_
def move(src, dest)
Definition: eostools.py:510
edm::InputTag JetsSourceES_

Member Data Documentation

bool ESRecHitsMerger::debug_
private

Definition at line 44 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::EgammaSourceES_
private

Definition at line 32 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::EtaSourceES_
private

Definition at line 38 of file ESRecHitsMerger.h.

std::string ESRecHitsMerger::InputRecHitES_
private

Definition at line 41 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::JetsSourceES_
private

Definition at line 35 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::MuonsSourceES_
private

Definition at line 33 of file ESRecHitsMerger.h.

std::string ESRecHitsMerger::OutputLabelES_
private

Definition at line 39 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::Pi0SourceES_
private

Definition at line 37 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::RestSourceES_
private

Definition at line 36 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::TausSourceES_
private

Definition at line 34 of file ESRecHitsMerger.h.