CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
CaloTDigitizer< Traits > Class Template Reference

#include <CaloTDigitizer.h>

Public Types

typedef Traits::Digi Digi
 
typedef Traits::DigiCollection DigiCollection
 
typedef Traits::ElectronicsSim ElectronicsSim
 

Public Member Functions

void add (const std::vector< PCaloHit > &hits, int bunchCrossing, CLHEP::HepRandomEngine *engine)
 
void addNoiseHits (CLHEP::HepRandomEngine *engine)
 
void addNoiseSignals (CLHEP::HepRandomEngine *engine)
 
 CaloTDigitizer (CaloHitResponse *hitResponse, ElectronicsSim *electronicsSim, bool addNoise)
 
const std::vector< DetId > & detIds () const
 tell the digitizer which cells exist More...
 
void initializeHits ()
 
void run (MixCollection< PCaloHit > &, DigiCollection &)
 turns hits into digis More...
 
void run (DigiCollection &output, CLHEP::HepRandomEngine *engine)
 Collects the digis. More...
 
void setDetIds (const std::vector< DetId > &detIds)
 
void setNoiseHitGenerator (CaloVNoiseHitGenerator *generator)
 
void setNoiseSignalGenerator (CaloVNoiseSignalGenerator *generator)
 
 ~CaloTDigitizer ()
 doesn't delete the pointers passed in More...
 

Private Attributes

bool addNoise_
 
const std::vector< DetId > * theDetIds
 
ElectronicsSimtheElectronicsSim
 
CaloHitResponsetheHitResponse
 
CaloVNoiseHitGeneratortheNoiseHitGenerator
 
CaloVNoiseSignalGeneratortheNoiseSignalGenerator
 

Detailed Description

template<class Traits>
class CaloTDigitizer< Traits >

Definition at line 22 of file CaloTDigitizer.h.

Member Typedef Documentation

template<class Traits >
typedef Traits::Digi CaloTDigitizer< Traits >::Digi

Definition at line 29 of file CaloTDigitizer.h.

template<class Traits >
typedef Traits::DigiCollection CaloTDigitizer< Traits >::DigiCollection

Definition at line 30 of file CaloTDigitizer.h.

template<class Traits >
typedef Traits::ElectronicsSim CaloTDigitizer< Traits >::ElectronicsSim

these are the types that need to be defined in the Traits class. The ElectronicsSim needs to have an interface that you'll see in the run() method

Definition at line 28 of file CaloTDigitizer.h.

Constructor & Destructor Documentation

template<class Traits >
CaloTDigitizer< Traits >::CaloTDigitizer ( CaloHitResponse hitResponse,
ElectronicsSim electronicsSim,
bool  addNoise 
)
inline

Definition at line 32 of file CaloTDigitizer.h.

33  : theHitResponse(hitResponse),
36  theElectronicsSim(electronicsSim),
37  theDetIds(0),
38  addNoise_(addNoise)
39  {
40  }
CaloVNoiseHitGenerator * theNoiseHitGenerator
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
CaloHitResponse * theHitResponse
ElectronicsSim * theElectronicsSim
const std::vector< DetId > * theDetIds
template<class Traits >
CaloTDigitizer< Traits >::~CaloTDigitizer ( )
inline

doesn't delete the pointers passed in

Definition at line 44 of file CaloTDigitizer.h.

44 {}

Member Function Documentation

template<class Traits >
void CaloTDigitizer< Traits >::add ( const std::vector< PCaloHit > &  hits,
int  bunchCrossing,
CLHEP::HepRandomEngine *  engine 
)
inline

Definition at line 60 of file CaloTDigitizer.h.

References CaloHitResponse::add(), CaloTDigitizer< Traits >::theHitResponse, and CaloHitResponse::withinBunchRange().

Referenced by CastorDigiProducer::accumulateCaloHits(), HcalTBDigiProducer::accumulateCaloHits(), HcalDigitizer::accumulateCaloHits(), and EcalDigiProducer::accumulateCaloHits().

60  {
61  if(theHitResponse->withinBunchRange(bunchCrossing)) {
62  for(std::vector<PCaloHit>::const_iterator it = hits.begin(), itEnd = hits.end(); it != itEnd; ++it) {
63  theHitResponse->add(*it, engine);
64  }
65  }
66  }
bool withinBunchRange(int bunchCrossing) const
check if crossing is within bunch range:
CaloHitResponse * theHitResponse
virtual void add(const PCaloHit &hit, CLHEP::HepRandomEngine *)
process a single SimHit
template<class Traits >
void CaloTDigitizer< Traits >::addNoiseHits ( CLHEP::HepRandomEngine *  engine)
inline

Definition at line 123 of file CaloTDigitizer.h.

References CaloHitResponse::add(), CaloVNoiseHitGenerator::getNoiseHits(), CaloTDigitizer< Traits >::theHitResponse, and CaloTDigitizer< Traits >::theNoiseHitGenerator.

Referenced by CaloTDigitizer< Traits >::run().

124  {
125  std::vector<PCaloHit> noiseHits;
127  for(std::vector<PCaloHit>::const_iterator hitItr = noiseHits.begin(),
128  hitEnd = noiseHits.end(); hitItr != hitEnd; ++hitItr)
129  {
130  theHitResponse->add(*hitItr, engine);
131  }
132  }
virtual void getNoiseHits(std::vector< PCaloHit > &noiseHits)=0
CaloVNoiseHitGenerator * theNoiseHitGenerator
CaloHitResponse * theHitResponse
virtual void add(const PCaloHit &hit, CLHEP::HepRandomEngine *)
process a single SimHit
template<class Traits >
void CaloTDigitizer< Traits >::addNoiseSignals ( CLHEP::HepRandomEngine *  engine)
inline

Definition at line 134 of file CaloTDigitizer.h.

References CaloHitResponse::add(), CaloVNoiseSignalGenerator::fillEvent(), CaloVNoiseSignalGenerator::getNoiseSignals(), CaloTDigitizer< Traits >::theHitResponse, and CaloTDigitizer< Traits >::theNoiseSignalGenerator.

Referenced by CaloTDigitizer< Traits >::run().

135  {
136  std::vector<CaloSamples> noiseSignals;
137  // noise signals need to be in units of photoelectrons. Fractional is OK
140  for(std::vector<CaloSamples>::const_iterator signalItr = noiseSignals.begin(),
141  signalEnd = noiseSignals.end(); signalItr != signalEnd; ++signalItr)
142  {
143  theHitResponse->add(*signalItr);
144  }
145  }
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
CaloHitResponse * theHitResponse
virtual void add(const PCaloHit &hit, CLHEP::HepRandomEngine *)
process a single SimHit
void fillEvent(CLHEP::HepRandomEngine *)
fill theNoiseSignals with one event&#39;s worth of noise, in units of pe
void getNoiseSignals(std::vector< CaloSamples > &noiseSignals)
template<class Traits >
const std::vector<DetId>& CaloTDigitizer< Traits >::detIds ( void  ) const
inline

tell the digitizer which cells exist

Definition at line 47 of file CaloTDigitizer.h.

References CaloTDigitizer< Traits >::theDetIds.

Referenced by CaloTDigitizer< Traits >::setDetIds().

47 {assert( 0 != theDetIds ) ; return *theDetIds;}
const std::vector< DetId > * theDetIds
template<class Traits >
void CaloTDigitizer< Traits >::initializeHits ( )
inline
template<class Traits >
void CaloTDigitizer< Traits >::run ( MixCollection< PCaloHit > &  ,
DigiCollection  
)
inline

turns hits into digis

Definition at line 73 of file CaloTDigitizer.h.

Referenced by CastorDigiProducer::finalizeEvent(), HcalTBDigiProducer::finalizeEvent(), HcalDigitizer::finalizeEvent(), and EcalDigiProducer::finalizeEvent().

73  {
74  assert(0);
75  }
template<class Traits >
void CaloTDigitizer< Traits >::run ( DigiCollection output,
CLHEP::HepRandomEngine *  engine 
)
inline

Collects the digis.

Definition at line 79 of file CaloTDigitizer.h.

References CaloTDigitizer< Traits >::addNoise_, CaloTDigitizer< Traits >::addNoiseHits(), CaloTDigitizer< Traits >::addNoiseSignals(), CaloHitResponse::clear(), CaloHitResponse::finalizeHits(), CaloHitResponse::findSignal(), CaloHitResponse::makeBlankSignal(), CaloHitResponse::nSignals(), CaloTDigitizer< Traits >::theDetIds, CaloTDigitizer< Traits >::theElectronicsSim, CaloTDigitizer< Traits >::theHitResponse, CaloTDigitizer< Traits >::theNoiseHitGenerator, and CaloTDigitizer< Traits >::theNoiseSignalGenerator.

79  {
81 
82  //std::cout << " In CaloTDigitizer, after finalize hits " << std::endl;
83 
84  assert(theDetIds->size() != 0);
85 
86  if(theNoiseHitGenerator != 0) addNoiseHits(engine);
88 
89  theElectronicsSim->newEvent(engine);
90 
91  // reserve space for how many digis we expect
92  int nDigisExpected = addNoise_ ? theDetIds->size() : theHitResponse->nSignals();
93  output.reserve(nDigisExpected);
94 
95  //std::cout << " In CaloTDigitizer, nDigisExpected " << nDigisExpected << std::endl;
96 
97  // make a raw digi for evey cell
98  for(std::vector<DetId>::const_iterator idItr = theDetIds->begin();
99  idItr != theDetIds->end(); ++idItr)
100  {
101  Digi digi(*idItr);
102  CaloSamples * analogSignal = theHitResponse->findSignal(*idItr);
103  bool needToDeleteSignal = false;
104  // don't bother digitizing if no signal and no noise
105  if(analogSignal == 0 && addNoise_) {
106  // I guess we need to make a blank signal for this cell.
107  // Don't bother storing it anywhere.
108  analogSignal = new CaloSamples(theHitResponse->makeBlankSignal(*idItr));
109  needToDeleteSignal = true;
110  }
111  if(analogSignal != 0) {
112  theElectronicsSim->analogToDigital(engine, *analogSignal , digi);
113  output.push_back(std::move(digi));
114  if(needToDeleteSignal) delete analogSignal;
115  }
116  }
117 
118  // free up some memory
120  }
CaloSamples makeBlankSignal(const DetId &detId) const
creates an empty signal for this DetId
Traits::Digi Digi
virtual void finalizeHits(CLHEP::HepRandomEngine *)
Finalize hits.
CaloVNoiseHitGenerator * theNoiseHitGenerator
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
CaloHitResponse * theHitResponse
ElectronicsSim * theElectronicsSim
void addNoiseHits(CLHEP::HepRandomEngine *engine)
CaloSamples * findSignal(const DetId &detId)
users can look for the signal for a given cell
void addNoiseSignals(CLHEP::HepRandomEngine *engine)
void clear()
frees up memory
const std::vector< DetId > * theDetIds
int nSignals() const
number of signals in the current cache
template<class Traits >
void CaloTDigitizer< Traits >::setDetIds ( const std::vector< DetId > &  detIds)
inline
template<class Traits >
void CaloTDigitizer< Traits >::setNoiseHitGenerator ( CaloVNoiseHitGenerator generator)
inline

Definition at line 50 of file CaloTDigitizer.h.

References python.IdGenerator::generator, and CaloTDigitizer< Traits >::theNoiseHitGenerator.

Referenced by HcalDigitizer::HcalDigitizer().

51  {
53  }
CaloVNoiseHitGenerator * theNoiseHitGenerator
template<class Traits >
void CaloTDigitizer< Traits >::setNoiseSignalGenerator ( CaloVNoiseSignalGenerator generator)
inline

Member Data Documentation

template<class Traits >
bool CaloTDigitizer< Traits >::addNoise_
private

Definition at line 153 of file CaloTDigitizer.h.

Referenced by CaloTDigitizer< Traits >::run().

template<class Traits >
const std::vector<DetId>* CaloTDigitizer< Traits >::theDetIds
private
template<class Traits >
ElectronicsSim* CaloTDigitizer< Traits >::theElectronicsSim
private

Definition at line 151 of file CaloTDigitizer.h.

Referenced by CaloTDigitizer< Traits >::run().

template<class Traits >
CaloHitResponse* CaloTDigitizer< Traits >::theHitResponse
private
template<class Traits >
CaloVNoiseHitGenerator* CaloTDigitizer< Traits >::theNoiseHitGenerator
private
template<class Traits >
CaloVNoiseSignalGenerator* CaloTDigitizer< Traits >::theNoiseSignalGenerator
private