CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 17 of file EcalRecHitsMerger.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file EcalRecHitsMerger.cc.

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

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

48  {
49 }

Member Function Documentation

void EcalRecHitsMerger::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 52 of file EcalRecHitsMerger.cc.

52  {
53 }
void EcalRecHitsMerger::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 55 of file EcalRecHitsMerger.cc.

55  {
56 }
void EcalRecHitsMerger::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 58 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.

58  {
59 
60  if (debug_) std::cout << " EcalRecHitMerger : Run " << e.id().run() << " Event " << e.id().event() << std::endl;
61 
62  std::vector< edm::Handle<EcalRecHitCollection> > EcalRecHits_done;
63  e.getManyByType(EcalRecHits_done);
64 
65  std::auto_ptr<EcalRecHitCollection> EBMergedRecHits(new EcalRecHitCollection);
66  std::auto_ptr<EcalRecHitCollection> EEMergedRecHits(new EcalRecHitCollection);
67 
68  unsigned int nColl = EcalRecHits_done.size();
69 
70  int nEB = 0;
71  int nEE = 0;
72 
73 
74  for (unsigned int i=0; i < nColl; i++) {
75 
76  std::string instance = EcalRecHits_done[i].provenance()->productInstanceName();
77  std::string module_label = EcalRecHits_done[i].provenance()->moduleLabel();
78 
79  if ( module_label != EgammaSourceEB_.label() &&
80  module_label != MuonsSourceEB_.label() &&
81  module_label != JetsSourceEB_.label() &&
82  module_label != TausSourceEB_.label() &&
83  module_label != RestSourceEB_.label() &&
84  module_label != Pi0SourceEB_.label() ) continue;
85 
86  if (instance == InputRecHitEB_) {
87  nEB += EcalRecHits_done[i] -> size();
88  }
89  else if (instance == InputRecHitEE_) {
90  nEE += EcalRecHits_done[i] -> size();
91  }
92 
93  }
94 
95  EBMergedRecHits -> reserve(nEB);
96  EEMergedRecHits -> reserve(nEE);
97  if (debug_) std::cout << " Number of EB Rechits to merge = " << nEB << std::endl;
98  if (debug_) std::cout << " Number of EE Rechits to merge = " << nEE << std::endl;
99 
100  for (unsigned int i=0; i < nColl; i++) {
101  std::string instance = EcalRecHits_done[i].provenance()->productInstanceName();
102 
103  std::string module_label = EcalRecHits_done[i].provenance()->moduleLabel();
104  if ( module_label != EgammaSourceEB_.label() &&
105  module_label != MuonsSourceEB_.label() &&
106  module_label != JetsSourceEB_.label() &&
107  module_label != TausSourceEB_.label() &&
108  module_label != RestSourceEB_.label() &&
109  module_label != Pi0SourceEB_.label() ) continue;
110 
111  if (instance == InputRecHitEB_) {
112  for (EcalRecHitCollection::const_iterator it=EcalRecHits_done[i]->begin(); it !=EcalRecHits_done[i]->end(); it++) {
113  EBMergedRecHits -> push_back(*it);
114  }
115  }
116  else if (instance == InputRecHitEE_) {
117  for (EcalRecHitCollection::const_iterator it=EcalRecHits_done[i]->begin(); it !=EcalRecHits_done[i]->end(); it++) {
118  EEMergedRecHits -> push_back(*it);
119  }
120  }
121 
122  }
123 
124 
125  // std::cout << " avant le put " << std::endl;
126  e.put(EBMergedRecHits,OutputLabelEB_);
127  e.put(EEMergedRecHits,OutputLabelEE_);
128  // std::cout << " apres le put " << std::endl;
129 
130 }
RunNumber_t run() const
Definition: EventID.h:42
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:395
EventNumber_t event() const
Definition: EventID.h:44
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:94
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:31
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 47 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::EgammaSourceEB_
private

Definition at line 27 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::EgammaSourceEE_
private

Definition at line 35 of file EcalRecHitsMerger.h.

std::string EcalRecHitsMerger::InputRecHitEB_
private

Definition at line 43 of file EcalRecHitsMerger.h.

std::string EcalRecHitsMerger::InputRecHitEE_
private

Definition at line 44 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::JetsSourceEB_
private

Definition at line 30 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::JetsSourceEE_
private

Definition at line 38 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::MuonsSourceEB_
private

Definition at line 28 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::MuonsSourceEE_
private

Definition at line 36 of file EcalRecHitsMerger.h.

std::string EcalRecHitsMerger::OutputLabelEB_
private

Definition at line 33 of file EcalRecHitsMerger.h.

std::string EcalRecHitsMerger::OutputLabelEE_
private

Definition at line 41 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::Pi0SourceEB_
private

Definition at line 32 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::Pi0SourceEE_
private

Definition at line 40 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::RestSourceEB_
private

Definition at line 31 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::RestSourceEE_
private

Definition at line 39 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::TausSourceEB_
private

Definition at line 29 of file EcalRecHitsMerger.h.

edm::InputTag EcalRecHitsMerger::TausSourceEE_
private

Definition at line 37 of file EcalRecHitsMerger.h.