CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
EcalRecHitsMerger Class Reference

#include <EcalRecHitsMerger.h>

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

Public Member Functions

void beginJob (void)
 
 EcalRecHitsMerger (const edm::ParameterSet &pset)
 
void endJob (void)
 
void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~EcalRecHitsMerger ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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)
 

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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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 ( )
virtual

Definition at line 50 of file EcalRecHitsMerger.cc.

50  {
51 }

Member Function Documentation

void EcalRecHitsMerger::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 76 of file EcalRecHitsMerger.cc.

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

Reimplemented from edm::EDProducer.

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::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 82 of file EcalRecHitsMerger.cc.

References begin, gather_cfg::cout, edm::EventID::event(), edm::Event::getManyByType(), i, edm::EventBase::id(), instance, 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  std::auto_ptr<EcalRecHitCollection> EBMergedRecHits(new EcalRecHitCollection);
90  std::auto_ptr<EcalRecHitCollection> EEMergedRecHits(new 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(EBMergedRecHits,OutputLabelEB_);
151  e.put(EEMergedRecHits,OutputLabelEE_);
152  // std::cout << " apres le put " << std::endl;
153 
154 }
RunNumber_t run() const
Definition: EventID.h:39
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:436
EventNumber_t event() const
Definition: EventID.h:41
int i
Definition: DBlmapReader.cc:9
edm::InputTag JetsSourceEB_
edm::InputTag EgammaSourceEB_
static PFTauRenderPlugin instance
edm::InputTag Pi0SourceEB_
std::vector< EcalRecHit >::const_iterator const_iterator
std::string OutputLabelEB_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::string InputRecHitEE_
edm::InputTag MuonsSourceEB_
std::string OutputLabelEE_
edm::InputTag RestSourceEB_
std::string const & label() const
Definition: InputTag.h:42
edm::EventID id() const
Definition: EventBase.h:56
#define begin
Definition: vmac.h:30
std::string InputRecHitEB_
tuple cout
Definition: gather_cfg.py:121
edm::InputTag TausSourceEB_
tuple size
Write out results.

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.