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

#include <CaloRecHitsProducer.h>

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

Public Member Functions

virtual void beginRun (edm::Run &run, const edm::EventSetup &es)
 
 CaloRecHitsProducer (edm::ParameterSet const &p)
 
virtual void endJob ()
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~CaloRecHitsProducer ()
 
- 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 doDigis_
 
bool doMiscalib_
 
EcalBarrelRecHitsMakerEcalBarrelRecHitsMaker_
 
EcalEndcapRecHitsMakerEcalEndcapRecHitsMaker_
 
EcalPreshowerRecHitsMakerEcalPreshowerRecHitsMaker_
 
HcalRecHitsMakerHcalRecHitsMaker_
 
const RandomEnginerandom
 
std::vector< unsigned int > theInputRecHitCollectionTypes
 
std::vector< std::string > theOutputRecHitCollections
 

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
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 23 of file CaloRecHitsProducer.h.

Constructor & Destructor Documentation

CaloRecHitsProducer::CaloRecHitsProducer ( edm::ParameterSet const &  p)
explicit

Definition at line 21 of file CaloRecHitsProducer.cc.

References gather_cfg::cout, doDigis_, doMiscalib_, EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, edm::hlt::Exception, edm::ParameterSet::getParameter(), HcalRecHitsMaker_, LaserDQM_cfg::input, edm::Service< T >::isAvailable(), random, theInputRecHitCollectionTypes, and theOutputRecHitCollections.

23 {
24 
25  // Initialize the random number generator service
27  if ( ! rng.isAvailable() ) {
28  throw cms::Exception("Configuration")
29  << "CaloRecHitsProducer requires the RandomGeneratorService\n"
30  "which is not present in the configuration file.\n"
31  "You must add the service in the configuration file\n"
32  "or remove the module that requires it";
33  }
34  random = new RandomEngine(&(*rng));
35  theInputRecHitCollectionTypes = p.getParameter<std::vector<unsigned> >("InputRecHitCollectionTypes");
36  theOutputRecHitCollections = p.getParameter<std::vector<std::string> >("OutputRecHitCollections");
37  doDigis_ = p.getParameter<bool>("doDigis");
38  doMiscalib_ = p.getParameter<bool>("doMiscalib");
39  edm::ParameterSet RecHitsParameters = p.getParameter<edm::ParameterSet>("RecHitsFactory");
40 
41  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
42 
44 
45  case 1:
46  {
47  //Preshower
48  if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size())
49  produces<ESRecHitCollection>(theOutputRecHitCollections[input]);
50  else
51  produces<ESRecHitCollection>();
52 
53  if (doDigis_)
54  std::cout << " The digitization of the preshower is not implemented " << std::endl;
55 
57  }
58  break;
59 
60  case 2:
61  {
62  //Ecal Barrel
63  if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size())
64  produces<EBRecHitCollection>(theOutputRecHitCollections[input]);
65  else
66  produces<EBRecHitCollection>();
67 
68  if (doDigis_) produces<EBDigiCollection>();
69  EcalBarrelRecHitsMaker_ = new EcalBarrelRecHitsMaker(RecHitsParameters,random);
70  }
71  break;
72 
73  case 3:
74  {
75  //EcalEndcap
76  if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size())
77  produces<EERecHitCollection>(theOutputRecHitCollections[input]);
78  else
79  produces<EERecHitCollection>();
80  if (doDigis_) produces<EEDigiCollection>();
81  EcalEndcapRecHitsMaker_ = new EcalEndcapRecHitsMaker(RecHitsParameters,random);
82  }
83  break;
84 
85  case 4:
86  {
87  //HBHE
88  if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size())
89  produces<HBHERecHitCollection>(theOutputRecHitCollections[input]);
90  else
91  produces<HBHERecHitCollection>();
92 
93  if (doDigis_) produces<HBHEDigiCollection>();
94  HcalRecHitsMaker_ = new HcalRecHitsMaker(RecHitsParameters,4,random);
95  }
96  break;
97 
98  case 5:
99  {
100  //HO
101  if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size())
102  produces<HORecHitCollection>(theOutputRecHitCollections[input]);
103  else
104  produces<HORecHitCollection>();
105 
106  if (doDigis_) produces<HODigiCollection>();
107 
108  HcalRecHitsMaker_ = new HcalRecHitsMaker(RecHitsParameters,5,random);
109  }
110  break;
111 
112  case 6:
113  {
114  //HF
115  if (theOutputRecHitCollections.size()&&theOutputRecHitCollections[input].size())
116  produces<HFRecHitCollection>(theOutputRecHitCollections[input]);
117  else
118  produces<HFRecHitCollection>();
119  if(doDigis_) produces<HFDigiCollection>();
120 
121  HcalRecHitsMaker_ = new HcalRecHitsMaker(RecHitsParameters,6,random);
122  }
123  break;
124 
125  default:
126  // Should not happen
127  break;
128 
129  }
130 
131  }
132 
133 }
EcalEndcapRecHitsMaker * EcalEndcapRecHitsMaker_
#define NULL
Definition: scimark2.h:8
EcalPreshowerRecHitsMaker * EcalPreshowerRecHitsMaker_
HcalRecHitsMaker * HcalRecHitsMaker_
std::vector< std::string > theOutputRecHitCollections
bool isAvailable() const
Definition: Service.h:47
std::vector< unsigned int > theInputRecHitCollectionTypes
EcalBarrelRecHitsMaker * EcalBarrelRecHitsMaker_
const RandomEngine * random
tuple cout
Definition: gather_cfg.py:121
CaloRecHitsProducer::~CaloRecHitsProducer ( )
virtual

Definition at line 135 of file CaloRecHitsProducer.cc.

References random.

136 {
137  if ( random ) {
138  delete random;
139  }
140 }
const RandomEngine * random

Member Function Documentation

void CaloRecHitsProducer::beginRun ( edm::Run run,
const edm::EventSetup es 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 143 of file CaloRecHitsProducer.cc.

References doDigis_, doMiscalib_, EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, HcalRecHitsMaker_, EcalBarrelRecHitsMaker::init(), EcalEndcapRecHitsMaker::init(), EcalPreshowerRecHitsMaker::init(), HcalRecHitsMaker::init(), LaserDQM_cfg::input, and theInputRecHitCollectionTypes.

143  {
144 
145  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
146  switch ( theInputRecHitCollectionTypes[input] ) {
147  case 1:
148  {
149  // preshower
151  }
152  break;
153  case 2:
154  {
155  // ecal barrel
157  }
158  break;
159  case 3:
160  {
161  // ecal endcap
163  }
164  break;
165  case 4:
166  case 5:
167  case 6:
168  {
170  }
171  break;
172  default:
173  break;
174  }
175  }
176 }
EcalEndcapRecHitsMaker * EcalEndcapRecHitsMaker_
EcalPreshowerRecHitsMaker * EcalPreshowerRecHitsMaker_
HcalRecHitsMaker * HcalRecHitsMaker_
std::vector< unsigned int > theInputRecHitCollectionTypes
void init(const edm::EventSetup &es, bool dodigis, bool domiscalib)
EcalBarrelRecHitsMaker * EcalBarrelRecHitsMaker_
void init(const edm::EventSetup &es)
void init(const edm::EventSetup &es, bool dodigis, bool domiscalib)
void init(const edm::EventSetup &es, bool dodigis, bool doMiscalib)
void CaloRecHitsProducer::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 178 of file CaloRecHitsProducer.cc.

References EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, and HcalRecHitsMaker_.

179 {
180  //std::cout << " (Fast)RecHitsProducer terminating " << std::endl;
185 }
EcalEndcapRecHitsMaker * EcalEndcapRecHitsMaker_
EcalPreshowerRecHitsMaker * EcalPreshowerRecHitsMaker_
HcalRecHitsMaker * HcalRecHitsMaker_
EcalBarrelRecHitsMaker * EcalBarrelRecHitsMaker_
void CaloRecHitsProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 187 of file CaloRecHitsProducer.cc.

References doDigis_, EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, HcalRecHitsMaker_, LaserDQM_cfg::input, EcalBarrelRecHitsMaker::loadEcalBarrelRecHits(), EcalEndcapRecHitsMaker::loadEcalEndcapRecHits(), EcalPreshowerRecHitsMaker::loadEcalPreshowerRecHits(), HcalRecHitsMaker::loadHcalRecHits(), edm::Event::put(), theInputRecHitCollectionTypes, and theOutputRecHitCollections.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

188 {
189 
190  // create empty outputs for HCAL
191  // see RecoLocalCalo/HcalRecProducers/src/HcalSimpleReconstructor.cc
192  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
193  switch ( theInputRecHitCollectionTypes[input] ) {
194  case 1:
195  {
196  // preshower
197  std::auto_ptr<ESRecHitCollection> reces(new ESRecHitCollection); // ECAL pre-shower
200  iEvent.put(reces,theOutputRecHitCollections[input]);
201  else
202  iEvent.put(reces);
203  break;
204  }
205 
206  case 2:
207  {
208  // ecal barrel
209  std::auto_ptr<EBRecHitCollection> receb(new EBRecHitCollection); // ECAL Barrel
210  std::auto_ptr<EBDigiCollection> digieb(new EBDigiCollection(1));
212  // std::cout << " ECALBarrel " << receb->size() << std::endl;
214  iEvent.put(receb,theOutputRecHitCollections[input]);
215  else
216  iEvent.put(receb);
217 
218  if(doDigis_)
219  iEvent.put(digieb);
220  }
221  break;
222  case 3:
223  {
224  // ecal endcap
225  std::auto_ptr<EERecHitCollection> recee(new EERecHitCollection); // ECAL Endcap
226  std::auto_ptr<EEDigiCollection> digiee(new EEDigiCollection(1));
228  // std::cout << " ECALEndcap " << recee->size() << std::endl;
230  iEvent.put(recee,theOutputRecHitCollections[input]);
231  else
232  iEvent.put(recee);
233 
234  if(doDigis_)
235  iEvent.put(digiee);
236  }
237  break;
238  case 4:
239  {
240  // hbhe
241  std::auto_ptr<HBHERecHitCollection> rec1(new HBHERecHitCollection); // Barrel+Endcap
242  std::auto_ptr<HBHEDigiCollection> digihbhe(new HBHEDigiCollection);
243  HcalRecHitsMaker_->loadHcalRecHits(iEvent,*rec1,*digihbhe);
245  iEvent.put(rec1,theOutputRecHitCollections[input]);
246  else
247  iEvent.put(rec1);
248 
249  if(doDigis_)
250  iEvent.put(digihbhe);
251  }
252  break;
253  case 5:
254  {
255  //ho
256  std::auto_ptr<HORecHitCollection> rec2(new HORecHitCollection); // Outer
257  std::auto_ptr<HODigiCollection> digiho(new HODigiCollection);
258 
259  HcalRecHitsMaker_->loadHcalRecHits(iEvent,*rec2,*digiho);
261  iEvent.put(rec2,theOutputRecHitCollections[input]);
262  else
263  iEvent.put(rec2);
264  if(doDigis_)
265  iEvent.put(digiho);
266  }
267  break;
268  case 6:
269  {
270  //hf
271  std::auto_ptr<HFRecHitCollection> rec3(new HFRecHitCollection); // Forward
272  std::auto_ptr<HFDigiCollection> digihf(new HFDigiCollection);
273  HcalRecHitsMaker_->loadHcalRecHits(iEvent,*rec3,*digihf);
275  iEvent.put(rec3,theOutputRecHitCollections[input]);
276  else
277  iEvent.put(rec3);
278  if(doDigis_)
279  iEvent.put(digihf);
280  }
281  break;
282  default:
283  break;
284  }
285  }
286 }
EcalEndcapRecHitsMaker * EcalEndcapRecHitsMaker_
void loadEcalEndcapRecHits(edm::Event &iEvent, EERecHitCollection &ecalHits, EEDigiCollection &ecalDigis)
void loadEcalBarrelRecHits(edm::Event &iEvent, EBRecHitCollection &ecalHits, EBDigiCollection &ecaldigis)
EcalPreshowerRecHitsMaker * EcalPreshowerRecHitsMaker_
HcalRecHitsMaker * HcalRecHitsMaker_
int iEvent
Definition: GenABIO.cc:243
std::vector< std::string > theOutputRecHitCollections
std::vector< unsigned int > theInputRecHitCollectionTypes
void loadEcalPreshowerRecHits(edm::Event &iEvent, ESRecHitCollection &esRecHits)
EcalBarrelRecHitsMaker * EcalBarrelRecHitsMaker_
void loadHcalRecHits(edm::Event &iEvent, HBHERecHitCollection &hbheHits, HBHEDigiCollection &hbheDigis)

Member Data Documentation

bool CaloRecHitsProducer::doDigis_
private

Definition at line 35 of file CaloRecHitsProducer.h.

Referenced by beginRun(), CaloRecHitsProducer(), and produce().

bool CaloRecHitsProducer::doMiscalib_
private

Definition at line 36 of file CaloRecHitsProducer.h.

Referenced by beginRun(), and CaloRecHitsProducer().

EcalBarrelRecHitsMaker* CaloRecHitsProducer::EcalBarrelRecHitsMaker_
private

Definition at line 39 of file CaloRecHitsProducer.h.

Referenced by beginRun(), CaloRecHitsProducer(), endJob(), and produce().

EcalEndcapRecHitsMaker* CaloRecHitsProducer::EcalEndcapRecHitsMaker_
private

Definition at line 40 of file CaloRecHitsProducer.h.

Referenced by beginRun(), CaloRecHitsProducer(), endJob(), and produce().

EcalPreshowerRecHitsMaker* CaloRecHitsProducer::EcalPreshowerRecHitsMaker_
private

Definition at line 38 of file CaloRecHitsProducer.h.

Referenced by beginRun(), CaloRecHitsProducer(), endJob(), and produce().

HcalRecHitsMaker* CaloRecHitsProducer::HcalRecHitsMaker_
private

Definition at line 41 of file CaloRecHitsProducer.h.

Referenced by beginRun(), CaloRecHitsProducer(), endJob(), and produce().

const RandomEngine* CaloRecHitsProducer::random
private

Definition at line 47 of file CaloRecHitsProducer.h.

Referenced by CaloRecHitsProducer(), and ~CaloRecHitsProducer().

std::vector<unsigned int> CaloRecHitsProducer::theInputRecHitCollectionTypes
private

Definition at line 44 of file CaloRecHitsProducer.h.

Referenced by beginRun(), CaloRecHitsProducer(), and produce().

std::vector<std::string> CaloRecHitsProducer::theOutputRecHitCollections
private

Definition at line 43 of file CaloRecHitsProducer.h.

Referenced by CaloRecHitsProducer(), and produce().