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, 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 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_
 
runHelper< Traits > runAnalogToDigital
 
const std::vector< DetId > * theDetIds
 
ElectronicsSimtheElectronicsSim
 
CaloHitResponsetheHitResponse
 
CaloVNoiseHitGeneratortheNoiseHitGenerator
 
CaloVNoiseSignalGeneratortheNoiseSignalGenerator
 

Detailed Description

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

Definition at line 38 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 45 of file CaloTDigitizer.h.

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

Definition at line 46 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 44 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 48 of file CaloTDigitizer.h.

49  : theHitResponse(hitResponse),
52  theElectronicsSim(electronicsSim),
53  theDetIds(0),
54  addNoise_(addNoise)
55  {
56  }
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
CaloHitResponse * theHitResponse
CaloVNoiseHitGenerator * theNoiseHitGenerator
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 60 of file CaloTDigitizer.h.

60 {}

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 76 of file CaloTDigitizer.h.

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

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

76  {
77  if(theHitResponse->withinBunchRange(bunchCrossing)) {
78  for(std::vector<PCaloHit>::const_iterator it = hits.begin(), itEnd = hits.end(); it != itEnd; ++it) {
79  theHitResponse->add(*it, engine);
80  }
81  }
82  }
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 >::addNoiseHits ( CLHEP::HepRandomEngine *  engine)
inline

Definition at line 133 of file CaloTDigitizer.h.

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

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

134  {
135  std::vector<PCaloHit> noiseHits;
137  for(std::vector<PCaloHit>::const_iterator hitItr = noiseHits.begin(),
138  hitEnd = noiseHits.end(); hitItr != hitEnd; ++hitItr)
139  {
140  theHitResponse->add(*hitItr, engine);
141  }
142  }
virtual void getNoiseHits(std::vector< PCaloHit > &noiseHits)=0
CaloHitResponse * theHitResponse
CaloVNoiseHitGenerator * theNoiseHitGenerator
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 144 of file CaloTDigitizer.h.

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

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

145  {
146  std::vector<CaloSamples> noiseSignals;
147  // noise signals need to be in units of photoelectrons. Fractional is OK
150  for(std::vector<CaloSamples>::const_iterator signalItr = noiseSignals.begin(),
151  signalEnd = noiseSignals.end(); signalItr != signalEnd; ++signalItr)
152  {
153  theHitResponse->add(*signalItr);
154  }
155  }
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 63 of file CaloTDigitizer.h.

References assert(), and CaloTDigitizer< Traits, runHelper >::theDetIds.

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

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

turns hits into digis

Definition at line 89 of file CaloTDigitizer.h.

References assert().

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

89  {
90  assert(0);
91  }
assert(m_qm.get())
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 95 of file CaloTDigitizer.h.

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

95  {
97  //std::cout << " In CaloTDigitizer, after finalize hits " << std::endl;
98 
99  assert(theDetIds->size() != 0);
100 
101  if(theNoiseHitGenerator != 0) addNoiseHits(engine);
102  if(theNoiseSignalGenerator != 0) addNoiseSignals(engine);
103 
104  theElectronicsSim->newEvent(engine);
105 
106  // reserve space for how many digis we expect
107  int nDigisExpected = addNoise_ ? theDetIds->size() : theHitResponse->nSignals();
108  output.reserve(nDigisExpected);
109 
110  // make a raw digi for evey cell
111  for(std::vector<DetId>::const_iterator idItr = theDetIds->begin();
112  idItr != theDetIds->end(); ++idItr)
113  {
114  CaloSamples * analogSignal = theHitResponse->findSignal(*idItr);
115  bool needToDeleteSignal = false;
116  // don't bother digitizing if no signal and no noise
117  if(analogSignal == 0 && addNoise_) {
118  // I guess we need to make a blank signal for this cell.
119  // Don't bother storing it anywhere.
120  analogSignal = new CaloSamples(theHitResponse->makeBlankSignal(*idItr));
121  needToDeleteSignal = true;
122  }
123  if(analogSignal != 0) {
124  runAnalogToDigital(output,engine,analogSignal,idItr,theElectronicsSim);
125  if(needToDeleteSignal) delete analogSignal;
126  }
127  }
128 
129  // free up some memory
131  }
CaloSamples makeBlankSignal(const DetId &detId) const
creates an empty signal for this DetId
assert(m_qm.get())
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
virtual void finalizeHits(CLHEP::HepRandomEngine *)
Finalize hits.
void addNoiseSignals(CLHEP::HepRandomEngine *engine)
void addNoiseHits(CLHEP::HepRandomEngine *engine)
CaloHitResponse * theHitResponse
runHelper< Traits > runAnalogToDigital
CaloVNoiseHitGenerator * theNoiseHitGenerator
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 >::setDetIds ( const std::vector< DetId > &  detIds)
inline
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::setNoiseHitGenerator ( CaloVNoiseHitGenerator generator)
inline
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 164 of file CaloTDigitizer.h.

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

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

Definition at line 158 of file CaloTDigitizer.h.

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

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

Definition at line 162 of file CaloTDigitizer.h.

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

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
CaloHitResponse* CaloTDigitizer< Traits, runHelper >::theHitResponse
private
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
CaloVNoiseHitGenerator* CaloTDigitizer< Traits, runHelper >::theNoiseHitGenerator
private
template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
CaloVNoiseSignalGenerator* CaloTDigitizer< Traits, runHelper >::theNoiseSignalGenerator
private