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::stream::EDProducer<> edm::stream::EDProducerBase 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 produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~CaloRecHitsProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
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:43
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.

References EcalBarrelRecHitsMaker_, EcalEndcapRecHitsMaker_, EcalPreshowerRecHitsMaker_, and HcalRecHitsMaker_.

127 {
132 }
EcalEndcapRecHitsMaker * EcalEndcapRecHitsMaker_
EcalPreshowerRecHitsMaker * EcalPreshowerRecHitsMaker_
HcalRecHitsMaker * HcalRecHitsMaker_
EcalBarrelRecHitsMaker * EcalBarrelRecHitsMaker_

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 135 of file CaloRecHitsProducer.cc.

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

135  {
136 
137  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
138  switch ( theInputRecHitCollectionTypes[input] ) {
139  case 1:
140  {
141  // preshower
143  }
144  break;
145  case 2:
146  {
147  // ecal barrel
149  }
150  break;
151  case 3:
152  {
153  // ecal endcap
155  }
156  break;
157  case 4:
158  case 5:
159  case 6:
160  {
162  }
163  break;
164  default:
165  break;
166  }
167  }
168 }
EcalEndcapRecHitsMaker * EcalEndcapRecHitsMaker_
EcalPreshowerRecHitsMaker * EcalPreshowerRecHitsMaker_
static std::string const input
Definition: EdmProvDump.cc:43
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::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 170 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().

171 {
173  es.get<IdealGeometryRecord>().get( topo );
174 
176 
177  // create empty outputs for HCAL
178  // see RecoLocalCalo/HcalRecProducers/src/HcalSimpleReconstructor.cc
179  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
180  switch ( theInputRecHitCollectionTypes[input] ) {
181  case 1:
182  {
183  // preshower
184  std::auto_ptr<ESRecHitCollection> reces(new ESRecHitCollection); // ECAL pre-shower
187  iEvent.put(reces,theOutputRecHitCollections[input]);
188  else
189  iEvent.put(reces);
190  break;
191  }
192 
193  case 2:
194  {
195  // ecal barrel
196  std::auto_ptr<EBRecHitCollection> receb(new EBRecHitCollection); // ECAL Barrel
197  std::auto_ptr<EBDigiCollection> digieb(new EBDigiCollection(1));
199  // std::cout << " ECALBarrel " << receb->size() << std::endl;
201  iEvent.put(receb,theOutputRecHitCollections[input]);
202  else
203  iEvent.put(receb);
204 
205  if(doDigis_)
206  iEvent.put(digieb);
207  }
208  break;
209  case 3:
210  {
211  // ecal endcap
212  std::auto_ptr<EERecHitCollection> recee(new EERecHitCollection); // ECAL Endcap
213  std::auto_ptr<EEDigiCollection> digiee(new EEDigiCollection(1));
215  // std::cout << " ECALEndcap " << recee->size() << std::endl;
217  iEvent.put(recee,theOutputRecHitCollections[input]);
218  else
219  iEvent.put(recee);
220 
221  if(doDigis_)
222  iEvent.put(digiee);
223  }
224  break;
225  case 4:
226  {
227  // hbhe
228  std::auto_ptr<HBHERecHitCollection> rec1(new HBHERecHitCollection); // Barrel+Endcap
229  std::auto_ptr<HBHEDigiCollection> digihbhe(new HBHEDigiCollection);
230  HcalRecHitsMaker_->loadHcalRecHits(iEvent,(*topo),*rec1,*digihbhe, &random);
232  iEvent.put(rec1,theOutputRecHitCollections[input]);
233  else
234  iEvent.put(rec1);
235 
236  if(doDigis_)
237  iEvent.put(digihbhe);
238  }
239  break;
240  case 5:
241  {
242  //ho
243  std::auto_ptr<HORecHitCollection> rec2(new HORecHitCollection); // Outer
244  std::auto_ptr<HODigiCollection> digiho(new HODigiCollection);
245 
246  HcalRecHitsMaker_->loadHcalRecHits(iEvent,(*topo),*rec2,*digiho, &random);
248  iEvent.put(rec2,theOutputRecHitCollections[input]);
249  else
250  iEvent.put(rec2);
251  if(doDigis_)
252  iEvent.put(digiho);
253  }
254  break;
255  case 6:
256  {
257  //hf
258  std::auto_ptr<HFRecHitCollection> rec3(new HFRecHitCollection); // Forward
259  std::auto_ptr<HFDigiCollection> digihf(new HFDigiCollection);
260  HcalRecHitsMaker_->loadHcalRecHits(iEvent,(*topo),*rec3,*digihf, &random);
262  iEvent.put(rec3,theOutputRecHitCollections[input]);
263  else
264  iEvent.put(rec3);
265  if(doDigis_)
266  iEvent.put(digihf);
267  }
268  break;
269  default:
270  break;
271  }
272  }
273 }
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:43
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 33 of file CaloRecHitsProducer.h.

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

bool CaloRecHitsProducer::doMiscalib_
private

Definition at line 34 of file CaloRecHitsProducer.h.

Referenced by beginRun(), and CaloRecHitsProducer().

EcalBarrelRecHitsMaker* CaloRecHitsProducer::EcalBarrelRecHitsMaker_
private

Definition at line 37 of file CaloRecHitsProducer.h.

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

EcalEndcapRecHitsMaker* CaloRecHitsProducer::EcalEndcapRecHitsMaker_
private

Definition at line 38 of file CaloRecHitsProducer.h.

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

EcalPreshowerRecHitsMaker* CaloRecHitsProducer::EcalPreshowerRecHitsMaker_
private

Definition at line 36 of file CaloRecHitsProducer.h.

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

HcalRecHitsMaker* CaloRecHitsProducer::HcalRecHitsMaker_
private

Definition at line 39 of file CaloRecHitsProducer.h.

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

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

Definition at line 42 of file CaloRecHitsProducer.h.

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

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

Definition at line 41 of file CaloRecHitsProducer.h.

Referenced by CaloRecHitsProducer(), and produce().