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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
 CaloRecHitsProducer (edm::ParameterSet const &p)
 
virtual void endJob () override
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
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 &)
 
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 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
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 23 of file CaloRecHitsProducer.h.

Constructor & Destructor Documentation

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

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

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

References random.

140 {
141  if ( random ) {
142  delete random;
143  }
144 }
const RandomEngine * random

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 147 of file CaloRecHitsProducer.cc.

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

147  {
148 
149  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
150  switch ( theInputRecHitCollectionTypes[input] ) {
151  case 1:
152  {
153  // preshower
155  }
156  break;
157  case 2:
158  {
159  // ecal barrel
161  }
162  break;
163  case 3:
164  {
165  // ecal endcap
167  }
168  break;
169  case 4:
170  case 5:
171  case 6:
172  {
174  }
175  break;
176  default:
177  break;
178  }
179  }
180 }
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  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 182 of file CaloRecHitsProducer.cc.

References EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, and HcalRecHitsMaker_.

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

Implements edm::EDProducer.

Definition at line 191 of file CaloRecHitsProducer.cc.

References doDigis_, EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, edm::EventSetup::get(), 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().

192 {
194  es.get<IdealGeometryRecord>().get( topo );
195 
196 
197  // create empty outputs for HCAL
198  // see RecoLocalCalo/HcalRecProducers/src/HcalSimpleReconstructor.cc
199  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
200  switch ( theInputRecHitCollectionTypes[input] ) {
201  case 1:
202  {
203  // preshower
204  std::auto_ptr<ESRecHitCollection> reces(new ESRecHitCollection); // ECAL pre-shower
207  iEvent.put(reces,theOutputRecHitCollections[input]);
208  else
209  iEvent.put(reces);
210  break;
211  }
212 
213  case 2:
214  {
215  // ecal barrel
216  std::auto_ptr<EBRecHitCollection> receb(new EBRecHitCollection); // ECAL Barrel
217  std::auto_ptr<EBDigiCollection> digieb(new EBDigiCollection(1));
219  // std::cout << " ECALBarrel " << receb->size() << std::endl;
221  iEvent.put(receb,theOutputRecHitCollections[input]);
222  else
223  iEvent.put(receb);
224 
225  if(doDigis_)
226  iEvent.put(digieb);
227  }
228  break;
229  case 3:
230  {
231  // ecal endcap
232  std::auto_ptr<EERecHitCollection> recee(new EERecHitCollection); // ECAL Endcap
233  std::auto_ptr<EEDigiCollection> digiee(new EEDigiCollection(1));
235  // std::cout << " ECALEndcap " << recee->size() << std::endl;
237  iEvent.put(recee,theOutputRecHitCollections[input]);
238  else
239  iEvent.put(recee);
240 
241  if(doDigis_)
242  iEvent.put(digiee);
243  }
244  break;
245  case 4:
246  {
247  // hbhe
248  std::auto_ptr<HBHERecHitCollection> rec1(new HBHERecHitCollection); // Barrel+Endcap
249  std::auto_ptr<HBHEDigiCollection> digihbhe(new HBHEDigiCollection);
250  HcalRecHitsMaker_->loadHcalRecHits(iEvent,(*topo),*rec1,*digihbhe);
252  iEvent.put(rec1,theOutputRecHitCollections[input]);
253  else
254  iEvent.put(rec1);
255 
256  if(doDigis_)
257  iEvent.put(digihbhe);
258  }
259  break;
260  case 5:
261  {
262  //ho
263  std::auto_ptr<HORecHitCollection> rec2(new HORecHitCollection); // Outer
264  std::auto_ptr<HODigiCollection> digiho(new HODigiCollection);
265 
266  HcalRecHitsMaker_->loadHcalRecHits(iEvent,(*topo),*rec2,*digiho);
268  iEvent.put(rec2,theOutputRecHitCollections[input]);
269  else
270  iEvent.put(rec2);
271  if(doDigis_)
272  iEvent.put(digiho);
273  }
274  break;
275  case 6:
276  {
277  //hf
278  std::auto_ptr<HFRecHitCollection> rec3(new HFRecHitCollection); // Forward
279  std::auto_ptr<HFDigiCollection> digihf(new HFDigiCollection);
280  HcalRecHitsMaker_->loadHcalRecHits(iEvent,(*topo),*rec3,*digihf);
282  iEvent.put(rec3,theOutputRecHitCollections[input]);
283  else
284  iEvent.put(rec3);
285  if(doDigis_)
286  iEvent.put(digihf);
287  }
288  break;
289  default:
290  break;
291  }
292  }
293 }
EcalEndcapRecHitsMaker * EcalEndcapRecHitsMaker_
void loadEcalEndcapRecHits(edm::Event &iEvent, EERecHitCollection &ecalHits, EEDigiCollection &ecalDigis)
void loadEcalBarrelRecHits(edm::Event &iEvent, EBRecHitCollection &ecalHits, EBDigiCollection &ecaldigis)
EcalPreshowerRecHitsMaker * EcalPreshowerRecHitsMaker_
HcalRecHitsMaker * HcalRecHitsMaker_
void loadHcalRecHits(edm::Event &iEvent, const HcalTopology &, HBHERecHitCollection &hbheHits, HBHEDigiCollection &hbheDigis)
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_

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().