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

Private Attributes

bool doDigis_
 
bool doMiscalib_
 
EcalBarrelRecHitsMakerEcalBarrelRecHitsMaker_
 
EcalEndcapRecHitsMakerEcalEndcapRecHitsMaker_
 
EcalPreshowerRecHitsMakerEcalPreshowerRecHitsMaker_
 
HcalRecHitsMakerHcalRecHitsMaker_
 
std::vector< unsigned int > theInputRecHitCollectionTypes
 
std::vector< std::string > theOutputRecHitCollections
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::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 22 of file CaloRecHitsProducer.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file CaloRecHitsProducer.cc.

References gather_cfg::cout, doDigis_, doMiscalib_, EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, edm::ParameterSet::getParameter(), HcalRecHitsMaker_, input, theInputRecHitCollectionTypes, and theOutputRecHitCollections.

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

Definition at line 126 of file CaloRecHitsProducer.cc.

127 {
128 }

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 131 of file CaloRecHitsProducer.cc.

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

131  {
132 
133  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
134  switch ( theInputRecHitCollectionTypes[input] ) {
135  case 1:
136  {
137  // preshower
139  }
140  break;
141  case 2:
142  {
143  // ecal barrel
145  }
146  break;
147  case 3:
148  {
149  // ecal endcap
151  }
152  break;
153  case 4:
154  case 5:
155  case 6:
156  {
158  }
159  break;
160  default:
161  break;
162  }
163  }
164 }
EcalEndcapRecHitsMaker * EcalEndcapRecHitsMaker_
EcalPreshowerRecHitsMaker * EcalPreshowerRecHitsMaker_
static std::string const input
Definition: EdmProvDump.cc:44
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 166 of file CaloRecHitsProducer.cc.

References EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, and HcalRecHitsMaker_.

167 {
168  //std::cout << " (Fast)RecHitsProducer terminating " << std::endl;
173 }
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 175 of file CaloRecHitsProducer.cc.

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

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

176 {
178  es.get<IdealGeometryRecord>().get( topo );
179 
181 
182  // create empty outputs for HCAL
183  // see RecoLocalCalo/HcalRecProducers/src/HcalSimpleReconstructor.cc
184  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
185  switch ( theInputRecHitCollectionTypes[input] ) {
186  case 1:
187  {
188  // preshower
189  std::auto_ptr<ESRecHitCollection> reces(new ESRecHitCollection); // ECAL pre-shower
192  iEvent.put(reces,theOutputRecHitCollections[input]);
193  else
194  iEvent.put(reces);
195  break;
196  }
197 
198  case 2:
199  {
200  // ecal barrel
201  std::auto_ptr<EBRecHitCollection> receb(new EBRecHitCollection); // ECAL Barrel
202  std::auto_ptr<EBDigiCollection> digieb(new EBDigiCollection(1));
204  // std::cout << " ECALBarrel " << receb->size() << std::endl;
206  iEvent.put(receb,theOutputRecHitCollections[input]);
207  else
208  iEvent.put(receb);
209 
210  if(doDigis_)
211  iEvent.put(digieb);
212  }
213  break;
214  case 3:
215  {
216  // ecal endcap
217  std::auto_ptr<EERecHitCollection> recee(new EERecHitCollection); // ECAL Endcap
218  std::auto_ptr<EEDigiCollection> digiee(new EEDigiCollection(1));
220  // std::cout << " ECALEndcap " << recee->size() << std::endl;
222  iEvent.put(recee,theOutputRecHitCollections[input]);
223  else
224  iEvent.put(recee);
225 
226  if(doDigis_)
227  iEvent.put(digiee);
228  }
229  break;
230  case 4:
231  {
232  // hbhe
233  std::auto_ptr<HBHERecHitCollection> rec1(new HBHERecHitCollection); // Barrel+Endcap
234  std::auto_ptr<HBHEDigiCollection> digihbhe(new HBHEDigiCollection);
235  HcalRecHitsMaker_->loadHcalRecHits(iEvent,(*topo),*rec1,*digihbhe, &random);
237  iEvent.put(rec1,theOutputRecHitCollections[input]);
238  else
239  iEvent.put(rec1);
240 
241  if(doDigis_)
242  iEvent.put(digihbhe);
243  }
244  break;
245  case 5:
246  {
247  //ho
248  std::auto_ptr<HORecHitCollection> rec2(new HORecHitCollection); // Outer
249  std::auto_ptr<HODigiCollection> digiho(new HODigiCollection);
250 
251  HcalRecHitsMaker_->loadHcalRecHits(iEvent,(*topo),*rec2,*digiho, &random);
253  iEvent.put(rec2,theOutputRecHitCollections[input]);
254  else
255  iEvent.put(rec2);
256  if(doDigis_)
257  iEvent.put(digiho);
258  }
259  break;
260  case 6:
261  {
262  //hf
263  std::auto_ptr<HFRecHitCollection> rec3(new HFRecHitCollection); // Forward
264  std::auto_ptr<HFDigiCollection> digihf(new HFDigiCollection);
265  HcalRecHitsMaker_->loadHcalRecHits(iEvent,(*topo),*rec3,*digihf, &random);
267  iEvent.put(rec3,theOutputRecHitCollections[input]);
268  else
269  iEvent.put(rec3);
270  if(doDigis_)
271  iEvent.put(digihf);
272  }
273  break;
274  default:
275  break;
276  }
277  }
278 }
void loadHcalRecHits(edm::Event &iEvent, const HcalTopology &, HBHERecHitCollection &hbheHits, HBHEDigiCollection &hbheDigis, RandomEngineAndDistribution const *)
EcalEndcapRecHitsMaker * EcalEndcapRecHitsMaker_
TRandom random
Definition: MVATrainer.cc:138
EcalPreshowerRecHitsMaker * EcalPreshowerRecHitsMaker_
void loadEcalPreshowerRecHits(edm::Event &iEvent, ESRecHitCollection &esRecHits, RandomEngineAndDistribution const *)
static std::string const input
Definition: EdmProvDump.cc:44
HcalRecHitsMaker * HcalRecHitsMaker_
int iEvent
Definition: GenABIO.cc:230
std::vector< std::string > theOutputRecHitCollections
void loadEcalEndcapRecHits(edm::Event &iEvent, EERecHitCollection &ecalHits, EEDigiCollection &ecalDigis, RandomEngineAndDistribution const *)
std::vector< unsigned int > theInputRecHitCollectionTypes
EcalBarrelRecHitsMaker * EcalBarrelRecHitsMaker_
void loadEcalBarrelRecHits(edm::Event &iEvent, EBRecHitCollection &ecalHits, EBDigiCollection &ecaldigis, RandomEngineAndDistribution const *)

Member Data Documentation

bool CaloRecHitsProducer::doDigis_
private

Definition at line 34 of file CaloRecHitsProducer.h.

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

bool CaloRecHitsProducer::doMiscalib_
private

Definition at line 35 of file CaloRecHitsProducer.h.

Referenced by beginRun(), and CaloRecHitsProducer().

EcalBarrelRecHitsMaker* CaloRecHitsProducer::EcalBarrelRecHitsMaker_
private

Definition at line 38 of file CaloRecHitsProducer.h.

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

EcalEndcapRecHitsMaker* CaloRecHitsProducer::EcalEndcapRecHitsMaker_
private

Definition at line 39 of file CaloRecHitsProducer.h.

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

EcalPreshowerRecHitsMaker* CaloRecHitsProducer::EcalPreshowerRecHitsMaker_
private

Definition at line 37 of file CaloRecHitsProducer.h.

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

HcalRecHitsMaker* CaloRecHitsProducer::HcalRecHitsMaker_
private

Definition at line 40 of file CaloRecHitsProducer.h.

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

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

Definition at line 43 of file CaloRecHitsProducer.h.

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

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

Definition at line 42 of file CaloRecHitsProducer.h.

Referenced by CaloRecHitsProducer(), and produce().