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
ESRecHitsMerger Class Reference

#include <ESRecHitsMerger.h>

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

Public Member Functions

void beginJob (void)
 
void endJob (void)
 
 ESRecHitsMerger (const edm::ParameterSet &pset)
 
void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~ESRecHitsMerger ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
 
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)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 17 of file ESRecHitsMerger.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file ESRecHitsMerger.cc.

References edm::ParameterSet::getUntrackedParameter().

17  {
18 
19  debug_ = pset.getUntrackedParameter<bool>("debug");
20 
21  EgammaSourceES_ = pset.getUntrackedParameter<edm::InputTag>("EgammaSource_ES",edm::InputTag("dummyEgamma"));
22  MuonsSourceES_ = pset.getUntrackedParameter<edm::InputTag>("MuonsSource_ES",edm::InputTag("dummyMuons"));
23  TausSourceES_ = pset.getUntrackedParameter<edm::InputTag>("TausSource_ES",edm::InputTag("dummyTaus"));
24  JetsSourceES_ = pset.getUntrackedParameter<edm::InputTag>("JetsSource_ES",edm::InputTag("dummyJets"));
25  RestSourceES_ = pset.getUntrackedParameter<edm::InputTag>("RestSource_ES",edm::InputTag("dummyRest"));
26  Pi0SourceES_ = pset.getUntrackedParameter<edm::InputTag>("Pi0Source_ES",edm::InputTag("dummyPi0"));
27  EtaSourceES_ = pset.getUntrackedParameter<edm::InputTag>("EtaSource_ES",edm::InputTag("dummyEta"));
28 
29 
30  OutputLabelES_ = pset.getUntrackedParameter<std::string>("OutputLabel_ES");
31 
32  InputRecHitES_ = pset.getUntrackedParameter<std::string>("EcalRecHitCollectionES");
33 
34  produces<EcalRecHitCollection>(OutputLabelES_);
35 
36 }
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 ( )
virtual

Definition at line 40 of file ESRecHitsMerger.cc.

40  {
41 }

Member Function Documentation

void ESRecHitsMerger::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 44 of file ESRecHitsMerger.cc.

44  {
45 }
void ESRecHitsMerger::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 47 of file ESRecHitsMerger.cc.

47  {
48 }
void ESRecHitsMerger::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 50 of file ESRecHitsMerger.cc.

References begin, gather_cfg::cout, edm::EventID::event(), edm::Event::getManyByType(), i, edm::EventBase::id(), edm::Event::put(), edm::EventID::run(), and findQualityFiles::size.

50  {
51 
52  if (debug_) std::cout << " ESRecHitMerger : Run " << e.id().run() << " Event " << e.id().event() << std::endl;
53 
54 
55  std::vector< edm::Handle<ESRecHitCollection> > EcalRecHits_done;
56  e.getManyByType(EcalRecHits_done);
57 
58  std::auto_ptr<EcalRecHitCollection> ESMergedRecHits(new EcalRecHitCollection);
59 
60 
61  unsigned int nColl = EcalRecHits_done.size();
62 
63  int nES = 0;
64 
65 
66  for (unsigned int i=0; i < nColl; i++) {
67 
68  std::string instance = EcalRecHits_done[i].provenance()->productInstanceName();
69  std::string module_label = EcalRecHits_done[i].provenance()->moduleLabel();
70 
71 
72  if (debug_){
73  std::cout<<"ESrechit to be merged from "<<module_label.c_str()<<" "<<instance.c_str()<<std::endl;
74  }
75 
76  if ( module_label != EgammaSourceES_.label() &&
77  module_label != MuonsSourceES_.label() &&
78  module_label != JetsSourceES_.label() &&
79  module_label != TausSourceES_.label() &&
80  module_label != RestSourceES_.label() &&
81  module_label != Pi0SourceES_.label() &&
82  module_label != EtaSourceES_.label()) continue;
83 
84  if (instance == InputRecHitES_) {
85  nES += EcalRecHits_done[i] -> size();
86  }
87 
88  }
89 
90 
91  ESMergedRecHits -> reserve(nES);
92 
93  if (debug_) std::cout << " Number of ES Rechits to merge = " << nES << std::endl;
94 
95  for (unsigned int i=0; i < nColl; i++) {
96  std::string instance = EcalRecHits_done[i].provenance()->productInstanceName();
97 
98  std::string module_label = EcalRecHits_done[i].provenance()->moduleLabel();
99  if ( module_label != EgammaSourceES_.label() &&
100  module_label != MuonsSourceES_.label() &&
101  module_label != JetsSourceES_.label() &&
102  module_label != TausSourceES_.label() &&
103  module_label != RestSourceES_.label() &&
104  module_label != Pi0SourceES_.label() &&
105  module_label != EtaSourceES_.label() ) continue;
106 
107  if (instance == InputRecHitES_) {
108  for (EcalRecHitCollection::const_iterator it=EcalRecHits_done[i]->begin(); it !=EcalRecHits_done[i]->end(); it++) {
109  ESMergedRecHits -> push_back(*it);
110  }
111  }
112 
113  }
114 
115 
116  // std::cout << " avant le put " << std::endl;
117  e.put(ESMergedRecHits,OutputLabelES_);
118  // std::cout << " apres le put " << std::endl;
119 
120 }
RunNumber_t run() const
Definition: EventID.h:42
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:407
EventNumber_t event() const
Definition: EventID.h:44
int i
Definition: DBlmapReader.cc:9
std::string InputRecHitES_
edm::InputTag MuonsSourceES_
std::vector< T >::const_iterator const_iterator
edm::InputTag TausSourceES_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
edm::InputTag RestSourceES_
std::string OutputLabelES_
edm::InputTag Pi0SourceES_
std::string const & label() const
Definition: InputTag.h:25
edm::EventID id() const
Definition: EventBase.h:56
#define begin
Definition: vmac.h:31
edm::InputTag EgammaSourceES_
tuple cout
Definition: gather_cfg.py:41
edm::InputTag EtaSourceES_
tuple size
Write out results.
edm::InputTag JetsSourceES_

Member Data Documentation

bool ESRecHitsMerger::debug_
private

Definition at line 39 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::EgammaSourceES_
private

Definition at line 27 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::EtaSourceES_
private

Definition at line 33 of file ESRecHitsMerger.h.

std::string ESRecHitsMerger::InputRecHitES_
private

Definition at line 36 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::JetsSourceES_
private

Definition at line 30 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::MuonsSourceES_
private

Definition at line 28 of file ESRecHitsMerger.h.

std::string ESRecHitsMerger::OutputLabelES_
private

Definition at line 34 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::Pi0SourceES_
private

Definition at line 32 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::RestSourceES_
private

Definition at line 31 of file ESRecHitsMerger.h.

edm::InputTag ESRecHitsMerger::TausSourceES_
private

Definition at line 29 of file ESRecHitsMerger.h.