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 Types | Private Member Functions | Private Attributes
CastorDigiProducer Class Reference

#include <CastorDigiProducer.h>

Inheritance diagram for CastorDigiProducer:
DigiAccumulatorMixMod

Public Member Functions

virtual void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
virtual void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c) override
 
 CastorDigiProducer (const edm::ParameterSet &ps, edm::one::EDProducerBase &mixMod, edm::ConsumesCollector &iC)
 
virtual void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
virtual void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
virtual ~CastorDigiProducer ()
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &setup)
 
virtual void finalizeBunchCrossing (edm::Event &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual ~DigiAccumulatorMixMod ()
 

Private Types

typedef CaloTDigitizer
< CastorDigitizerTraits
CastorDigitizer
 

Private Member Functions

void accumulateCaloHits (std::vector< PCaloHit > const &, int bunchCrossing)
 
void checkGeometry (const edm::EventSetup &eventSetup)
 
void fillFakeHits ()
 some hits in each subdetector, just for testing purposes More...
 
void sortHits (const edm::PCaloHitContainer &hits)
 fills the vectors for each subdetector More...
 

Private Attributes

CastorAmplifiertheAmplifier
 
CastorDigitizertheCastorDigitizer
 
CastorHitFilter theCastorHitFilter
 
std::vector< PCaloHittheCastorHits
 
CaloVShapetheCastorIntegratedShape
 
CaloHitResponsetheCastorResponse
 
CaloVShapetheCastorShape
 
CastorCoderFactorytheCoderFactory
 
CastorElectronicsSimtheElectronicsSim
 
CastorHitCorrectiontheHitCorrection
 
CastorSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 26 of file CastorDigiProducer.h.

Member Typedef Documentation

Reconstruction algorithm

Definition at line 49 of file CastorDigiProducer.h.

Constructor & Destructor Documentation

CastorDigiProducer::CastorDigiProducer ( const edm::ParameterSet ps,
edm::one::EDProducerBase mixMod,
edm::ConsumesCollector iC 
)
explicit

Definition at line 21 of file CastorDigiProducer.cc.

References edm::ConsumesCollector::consumes(), CastorCoderFactory::DB, edm::hlt::Exception, edm::RandomNumberGenerator::getEngine(), edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), CaloHitResponse::setHitCorrection(), CaloHitResponse::setHitFilter(), CastorElectronicsSim::setRandomEngine(), theAmplifier, theCastorDigitizer, theCastorHitFilter, theCastorResponse, theCoderFactory, theElectronicsSim, theHitCorrection, and theParameterMap.

26  theAmplifier(0),
27  theCoderFactory(0),
32 {
33  iC.consumes<std::vector<PCaloHit> >(edm::InputTag("g4SimHits", "CastorFI"));
34 
35  mixMod.produces<CastorDigiCollection>();
36 
38 
39  bool doTimeSlew = ps.getParameter<bool>("doTimeSlew");
40  if(doTimeSlew) {
41  // no time slewing for HF
43  }
44 
45  bool doNoise = ps.getParameter<bool>("doNoise");
49 
51 
53  if ( ! rng.isAvailable()) {
54  throw cms::Exception("Configuration")
55  << "CastorDigiProducer requires the RandomNumberGeneratorService\n"
56  "which is not present in the configuration file. You must add the service\n"
57  "in the configuration file or remove the modules that require it.";
58  }
59 
60  CLHEP::HepRandomEngine& engine = rng->getEngine();
61  theAmplifier->setRandomEngine(engine);
63 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
CastorAmplifier * theAmplifier
CaloVShape * theCastorShape
CaloTDigitizer< CastorDigitizerTraits > CastorDigitizer
CastorSimParameterMap * theParameterMap
CastorElectronicsSim * theElectronicsSim
CastorHitFilter theCastorHitFilter
void setHitFilter(const CaloVHitFilter *filter)
if you want to reject hits, for example, from a certain subdetector, set this
Creates electronics signals from hits.
CaloHitResponse * theCastorResponse
bool isAvailable() const
Definition: Service.h:46
std::vector< PCaloHit > theCastorHits
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
void setRandomEngine(CLHEP::HepRandomEngine &engine)
CastorHitCorrection * theHitCorrection
CastorDigitizer * theCastorDigitizer
void setHitCorrection(const CaloVHitCorrection *hitCorrection)
If you want to correct hits, for attenuation or delay, set this.
CastorCoderFactory * theCoderFactory
shaper for Castor
Definition: CastorShape.h:16
CaloVShape * theCastorIntegratedShape
CastorDigiProducer::~CastorDigiProducer ( )
virtual

Definition at line 66 of file CastorDigiProducer.cc.

References theAmplifier, theCastorDigitizer, theCastorIntegratedShape, theCastorResponse, theCastorShape, theCoderFactory, theElectronicsSim, theHitCorrection, and theParameterMap.

66  {
67  delete theCastorDigitizer;
68  delete theParameterMap;
69  delete theCastorShape;
71  delete theCastorResponse;
72  delete theElectronicsSim;
73  delete theAmplifier;
74  delete theCoderFactory;
75  delete theHitCorrection;
76 }
CastorAmplifier * theAmplifier
CaloVShape * theCastorShape
CastorSimParameterMap * theParameterMap
CastorElectronicsSim * theElectronicsSim
CaloHitResponse * theCastorResponse
CastorHitCorrection * theHitCorrection
CastorDigitizer * theCastorDigitizer
CastorCoderFactory * theCoderFactory
CaloVShape * theCastorIntegratedShape

Member Function Documentation

void CastorDigiProducer::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 105 of file CastorDigiProducer.cc.

References accumulateCaloHits(), edm::Event::getByLabel(), and edm::Handle< T >::product().

105  {
106  // Step A: Get and accumulate digitized hits
107  edm::Handle<std::vector<PCaloHit> > castorHandle;
108  e.getByLabel(edm::InputTag("g4SimHits", "CastorFI"), castorHandle);
109 
110  accumulateCaloHits(*castorHandle.product(), 0);
111 }
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing)
T const * product() const
Definition: Handle.h:81
void CastorDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 113 of file CastorDigiProducer.cc.

References accumulateCaloHits(), PileUpEventPrincipal::bunchCrossing(), PileUpEventPrincipal::getByLabel(), and edm::Handle< T >::product().

113  {
114  // Step A: Get and accumulate digitized hits
115  edm::Handle<std::vector<PCaloHit> > castorHandle;
116  e.getByLabel(edm::InputTag("g4SimHits", "CastorFI"), castorHandle);
117 
118  accumulateCaloHits(*castorHandle.product(), e.bunchCrossing());
119 }
void accumulateCaloHits(std::vector< PCaloHit > const &, int bunchCrossing)
T const * product() const
Definition: Handle.h:81
void CastorDigiProducer::accumulateCaloHits ( std::vector< PCaloHit > const &  hcalHits,
int  bunchCrossing 
)
private

Definition at line 96 of file CastorDigiProducer.cc.

References CaloTDigitizer< Traits >::add(), CastorHitCorrection::fillChargeSums(), theCastorDigitizer, and theHitCorrection.

Referenced by accumulate().

96  {
97  //fillFakeHits();
98 
99  if(theHitCorrection != 0) {
100  theHitCorrection->fillChargeSums(hcalHits);
101  }
102  theCastorDigitizer->add(hcalHits, bunchCrossing);
103 }
void fillChargeSums(MixCollection< PCaloHit > &hits)
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
CastorHitCorrection * theHitCorrection
CastorDigitizer * theCastorDigitizer
void CastorDigiProducer::checkGeometry ( const edm::EventSetup eventSetup)
private

make sure the digitizer has the correct list of all cells that exist in the geometry

Definition at line 156 of file CastorDigiProducer.cc.

References DetId::Calo, geometry, edm::EventSetup::get(), CaloTDigitizer< Traits >::setDetIds(), CaloHitResponse::setGeometry(), HcalCastorDetId::SubdetectorId, theCastorDigitizer, and theCastorResponse.

Referenced by initializeEvent().

156  {
157  // TODO find a way to avoid doing this every event
159  eventSetup.get<CaloGeometryRecord>().get(geometry);
160  theCastorResponse->setGeometry(&*geometry);
161 
162  const std::vector<DetId>& castorCells = geometry->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId);
163 
164  //std::cout<<"CastorDigiProducer::CheckGeometry number of cells: "<<castorCells.size()<<std::endl;
165  theCastorDigitizer->setDetIds(castorCells);
166 }
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
CaloHitResponse * theCastorResponse
static const int SubdetectorId
const T & get() const
Definition: EventSetup.h:55
ESHandle< TrackerGeometry > geometry
CastorDigitizer * theCastorDigitizer
void setDetIds(const std::vector< DetId > &detIds)
void CastorDigiProducer::fillFakeHits ( )
private

some hits in each subdetector, just for testing purposes

Definition at line 149 of file CastorDigiProducer.cc.

References DetId::rawId(), and theCastorHits.

149  {
150  HcalCastorDetId castorDetId(HcalCastorDetId::Section(2),true,1,1);
151 
152  theCastorHits.emplace_back(castorDetId.rawId(), 50.0, 0.);
153 }
std::vector< PCaloHit > theCastorHits
void CastorDigiProducer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 121 of file CastorDigiProducer.cc.

References edm::Event::put(), CaloTDigitizer< Traits >::run(), and theCastorDigitizer.

121  {
122  // Step B: Create empty output
123 
124  std::auto_ptr<CastorDigiCollection> castorResult(new CastorDigiCollection());
125 
126  // Step C: Invoke the algorithm, getting back outputs.
127  theCastorDigitizer->run(*castorResult);
128 
129  edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size();
130 
131  // Step D: Put outputs into event
132  e.put(castorResult);
133 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
CastorDigitizer * theCastorDigitizer
edm::SortedCollection< CastorDataFrame > CastorDigiCollection
void CastorDigiProducer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 78 of file CastorDigiProducer.cc.

References checkGeometry(), edm::EventSetup::get(), CaloTDigitizer< Traits >::initializeHits(), edm::ESHandle< class >::product(), CastorCoderFactory::setDbService(), CastorAmplifier::setDbService(), CastorSimParameterMap::setDbService(), theAmplifier, theCastorDigitizer, theCastorHits, theCoderFactory, and theParameterMap.

78  {
79  // get the appropriate gains, noises, & widths for this event
81  eventSetup.get<CastorDbRecord>().get(conditions);
82  theAmplifier->setDbService(conditions.product());
83  theCoderFactory->setDbService(conditions.product());
84  theParameterMap->setDbService(conditions.product());
85 
86  edm::LogInfo("CastorDigiProducer") << "checking the geometry...";
87 
88  // get the correct geometry
89  checkGeometry(eventSetup);
90 
91  theCastorHits.clear();
92 
94 }
CastorAmplifier * theAmplifier
void initializeHits()
void checkGeometry(const edm::EventSetup &eventSetup)
void setDbService(const CastorDbService *service)
CastorSimParameterMap * theParameterMap
std::vector< PCaloHit > theCastorHits
T const * product() const
Definition: ESHandle.h:62
CastorDigitizer * theCastorDigitizer
CastorCoderFactory * theCoderFactory
void setDbService(const CastorDbService *service)
the Producer will probably update this every event
void setDbService(const CastorDbService *service)
void CastorDigiProducer::sortHits ( const edm::PCaloHitContainer hits)
private

fills the vectors for each subdetector

Definition at line 136 of file CastorDigiProducer.cc.

References DetId::Calo, DetId::det(), HcalCastorDetId::SubdetectorId, DetId::subdetId(), and theCastorHits.

136  {
137  for(edm::PCaloHitContainer::const_iterator hitItr = hits.begin();
138  hitItr != hits.end(); ++hitItr){
139  DetId detId = hitItr->id();
140  if (detId.det()==DetId::Calo && detId.subdetId()==HcalCastorDetId::SubdetectorId){
141  theCastorHits.push_back(*hitItr);
142  }
143  else {
144  edm::LogError("CastorDigiProducer") << "Bad Hit subdetector " << detId.subdetId();
145  }
146  }
147 }
std::vector< PCaloHit > theCastorHits
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
static const int SubdetectorId
Definition: DetId.h:18
Detector det() const
get the detector field from this detid
Definition: DetId.h:35

Member Data Documentation

CastorAmplifier* CastorDigiProducer::theAmplifier
private

Definition at line 57 of file CastorDigiProducer.h.

Referenced by CastorDigiProducer(), initializeEvent(), and ~CastorDigiProducer().

CastorDigitizer* CastorDigiProducer::theCastorDigitizer
private
CastorHitFilter CastorDigiProducer::theCastorHitFilter
private

Definition at line 61 of file CastorDigiProducer.h.

Referenced by CastorDigiProducer().

std::vector<PCaloHit> CastorDigiProducer::theCastorHits
private

Definition at line 67 of file CastorDigiProducer.h.

Referenced by fillFakeHits(), initializeEvent(), and sortHits().

CaloVShape* CastorDigiProducer::theCastorIntegratedShape
private

Definition at line 53 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

CaloHitResponse* CastorDigiProducer::theCastorResponse
private

Definition at line 55 of file CastorDigiProducer.h.

Referenced by CastorDigiProducer(), checkGeometry(), and ~CastorDigiProducer().

CaloVShape* CastorDigiProducer::theCastorShape
private

Definition at line 52 of file CastorDigiProducer.h.

Referenced by ~CastorDigiProducer().

CastorCoderFactory* CastorDigiProducer::theCoderFactory
private

Definition at line 58 of file CastorDigiProducer.h.

Referenced by CastorDigiProducer(), initializeEvent(), and ~CastorDigiProducer().

CastorElectronicsSim* CastorDigiProducer::theElectronicsSim
private

Definition at line 59 of file CastorDigiProducer.h.

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

CastorHitCorrection* CastorDigiProducer::theHitCorrection
private
CastorSimParameterMap* CastorDigiProducer::theParameterMap
private

Definition at line 51 of file CastorDigiProducer.h.

Referenced by CastorDigiProducer(), initializeEvent(), and ~CastorDigiProducer().