CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
CaloTDigitizer< Traits, runHelper > 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 addNoiseSignals (CLHEP::HepRandomEngine *engine)
 
 CaloTDigitizer (CaloHitResponse *hitResponse, ElectronicsSim *electronicsSim, bool addNoise)
 
const std::vector< DetId > & detIds () const
 tell the digitizer which cells exist More...
 
const CaloSamplesCollectiongetCaloSamples () const
 
void initializeHits ()
 
void run (MixCollection< PCaloHit > &, DigiCollection &)
 turns hits into digis More...
 
void run (DigiCollection &output, CLHEP::HepRandomEngine *engine)
 Collects the digis. More...
 
void setDebugCaloSamples (bool debug)
 
void setDetIds (const std::vector< DetId > &detIds)
 
void setNoiseSignalGenerator (CaloVNoiseSignalGenerator *generator)
 
 ~CaloTDigitizer ()
 doesn't delete the pointers passed in More...
 

Private Attributes

bool addNoise_
 
CaloSamplesCollection csColl_
 
bool debugCS_
 
runHelper< Traits > runAnalogToDigital
 
const std::vector< DetId > * theDetIds
 
ElectronicsSimtheElectronicsSim
 
CaloHitResponsetheHitResponse
 
CaloVNoiseSignalGeneratortheNoiseSignalGenerator
 

Detailed Description

template<class Traits, template< class > class runHelper = CaloTDigitizerDefaultRun>
class CaloTDigitizer< Traits, runHelper >

Definition at line 37 of file CaloTDigitizer.h.

Member Typedef Documentation

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
typedef Traits::Digi CaloTDigitizer< Traits, runHelper >::Digi

Definition at line 44 of file CaloTDigitizer.h.

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
typedef Traits::DigiCollection CaloTDigitizer< Traits, runHelper >::DigiCollection

Definition at line 45 of file CaloTDigitizer.h.

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
typedef Traits::ElectronicsSim CaloTDigitizer< Traits, runHelper >::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 43 of file CaloTDigitizer.h.

Constructor & Destructor Documentation

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

Definition at line 47 of file CaloTDigitizer.h.

48  : theHitResponse(hitResponse),
50  theElectronicsSim(electronicsSim),
51  theDetIds(0),
52  addNoise_(addNoise),
53  debugCS_(false)
54  {
55  }
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
CaloHitResponse * theHitResponse
ElectronicsSim * theElectronicsSim
const std::vector< DetId > * theDetIds
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
CaloTDigitizer< Traits, runHelper >::~CaloTDigitizer ( )
inline

doesn't delete the pointers passed in

Definition at line 59 of file CaloTDigitizer.h.

59 {}

Member Function Documentation

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

Definition at line 78 of file CaloTDigitizer.h.

Referenced by HcalTBDigiProducer::accumulateCaloHits(), CastorDigiProducer::accumulateCaloHits(), HcalDigitizer::accumulateCaloHits(), and counter.Counter::register().

78  {
79  if(theHitResponse->withinBunchRange(bunchCrossing)) {
80  for(std::vector<PCaloHit>::const_iterator it = hits.begin(), itEnd = hits.end(); it != itEnd; ++it) {
81  theHitResponse->add(*it, engine);
82  }
83  }
84  }
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 , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::addNoiseSignals ( CLHEP::HepRandomEngine *  engine)
inline

Definition at line 140 of file CaloTDigitizer.h.

141  {
142  std::vector<CaloSamples> noiseSignals;
143  // noise signals need to be in units of photoelectrons. Fractional is OK
146  for(std::vector<CaloSamples>::const_iterator signalItr = noiseSignals.begin(),
147  signalEnd = noiseSignals.end(); signalItr != signalEnd; ++signalItr)
148  {
149  theHitResponse->add(*signalItr);
150  }
151  }
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 , template< class > class runHelper = CaloTDigitizerDefaultRun>
const std::vector<DetId>& CaloTDigitizer< Traits, runHelper >::detIds ( void  ) const
inline

tell the digitizer which cells exist

Definition at line 62 of file CaloTDigitizer.h.

62 {assert( 0 != theDetIds ) ; return *theDetIds;}
const std::vector< DetId > * theDetIds
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
const CaloSamplesCollection& CaloTDigitizer< Traits, runHelper >::getCaloSamples ( ) const
inline

Definition at line 74 of file CaloTDigitizer.h.

Referenced by HcalDigitizer::finalizeEvent().

74  {
75  return csColl_;
76  }
CaloSamplesCollection csColl_
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::initializeHits ( )
inline

Definition at line 86 of file CaloTDigitizer.h.

Referenced by CastorDigiProducer::initializeEvent(), HcalTBDigiProducer::initializeEvent(), and HcalDigitizer::initializeEvent().

86  {
88  }
virtual void initializeHits()
Initialize hits.
CaloHitResponse * theHitResponse
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::run ( MixCollection< PCaloHit > &  ,
DigiCollection  
)
inline

turns hits into digis

Definition at line 91 of file CaloTDigitizer.h.

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

91  {
92  assert(0);
93  }
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::run ( DigiCollection output,
CLHEP::HepRandomEngine *  engine 
)
inline

Collects the digis.

Definition at line 97 of file CaloTDigitizer.h.

97  {
98  assert(theDetIds->size() != 0);
99 
100  if(theNoiseSignalGenerator != 0) addNoiseSignals(engine);
101 
102  theHitResponse->finalizeHits(engine);
103  //std::cout << " In CaloTDigitizer, after finalize hits " << std::endl;
104 
105  theElectronicsSim->newEvent(engine);
106 
107  // reserve space for how many digis we expect
108  int nDigisExpected = addNoise_ ? theDetIds->size() : theHitResponse->nSignals();
109  output.reserve(nDigisExpected);
110  if(debugCS_) {
111  csColl_.clear();
112  csColl_.reserve(nDigisExpected);
114  }
115 
116  // make a raw digi for evey cell
117  for(std::vector<DetId>::const_iterator idItr = theDetIds->begin();
118  idItr != theDetIds->end(); ++idItr)
119  {
120  CaloSamples * analogSignal = theHitResponse->findSignal(*idItr);
121  if(analogSignal && debugCS_) csColl_.push_back(*analogSignal);
122  bool needToDeleteSignal = false;
123  // don't bother digitizing if no signal and no noise
124  if(analogSignal == 0 && addNoise_) {
125  // I guess we need to make a blank signal for this cell.
126  // Don't bother storing it anywhere.
127  analogSignal = new CaloSamples(theHitResponse->makeBlankSignal(*idItr));
128  needToDeleteSignal = true;
129  }
130  if(analogSignal != 0) {
131  runAnalogToDigital(output,engine,analogSignal,idItr,theElectronicsSim);
132  if(needToDeleteSignal) delete analogSignal;
133  }
134  }
135 
136  // free up some memory
138  }
void setStorePrecise(bool sp)
CaloSamplesCollection csColl_
CaloSamples makeBlankSignal(const DetId &detId) const
creates an empty signal for this DetId
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
virtual void finalizeHits(CLHEP::HepRandomEngine *)
Finalize hits.
void addNoiseSignals(CLHEP::HepRandomEngine *engine)
CaloHitResponse * theHitResponse
runHelper< Traits > runAnalogToDigital
ElectronicsSim * theElectronicsSim
CaloSamples * findSignal(const DetId &detId)
users can look for the signal for a given cell
void clear()
frees up memory
int nSignals() const
number of signals in the current cache
const std::vector< DetId > * theDetIds
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::setDebugCaloSamples ( bool  debug)
inline

Definition at line 70 of file CaloTDigitizer.h.

References debug.

Referenced by HcalDigitizer::HcalDigitizer().

70  {
71  debugCS_ = debug;
72  }
#define debug
Definition: HDRShower.cc:19
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::setDetIds ( const std::vector< DetId > &  detIds)
inline

Definition at line 63 of file CaloTDigitizer.h.

Referenced by HcalDigitizer::buildHBHEQIECells(), HcalDigitizer::buildHFQIECells(), HcalDigitizer::buildHOSiPMCells(), CastorDigiProducer::checkGeometry(), HcalTBDigiProducer::updateGeometry(), and HcalDigitizer::updateGeometry().

63 {theDetIds = &detIds;}
const std::vector< DetId > & detIds() const
tell the digitizer which cells exist
const std::vector< DetId > * theDetIds
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::setNoiseSignalGenerator ( CaloVNoiseSignalGenerator generator)
inline

Member Data Documentation

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
bool CaloTDigitizer< Traits, runHelper >::addNoise_
private

Definition at line 159 of file CaloTDigitizer.h.

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
CaloSamplesCollection CaloTDigitizer< Traits, runHelper >::csColl_
private

Definition at line 161 of file CaloTDigitizer.h.

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
bool CaloTDigitizer< Traits, runHelper >::debugCS_
private

Definition at line 160 of file CaloTDigitizer.h.

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
runHelper<Traits> CaloTDigitizer< Traits, runHelper >::runAnalogToDigital
private

Definition at line 154 of file CaloTDigitizer.h.

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
const std::vector<DetId>* CaloTDigitizer< Traits, runHelper >::theDetIds
private

Definition at line 158 of file CaloTDigitizer.h.

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
ElectronicsSim* CaloTDigitizer< Traits, runHelper >::theElectronicsSim
private

Definition at line 157 of file CaloTDigitizer.h.

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
CaloHitResponse* CaloTDigitizer< Traits, runHelper >::theHitResponse
private

Definition at line 155 of file CaloTDigitizer.h.

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
CaloVNoiseSignalGenerator* CaloTDigitizer< Traits, runHelper >::theNoiseSignalGenerator
private

Definition at line 156 of file CaloTDigitizer.h.