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 HcalTBDigiProducer::accumulateCaloHits(), CastorDigiProducer::accumulateCaloHits(), HcalDigitizer::accumulateCaloHits(), and counter.Counter::register().

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

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

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

122  {
123  std::vector<PCaloHit> noiseHits;
125  for(std::vector<PCaloHit>::const_iterator hitItr = noiseHits.begin(),
126  hitEnd = noiseHits.end(); hitItr != hitEnd; ++hitItr)
127  {
128  theHitResponse->add(*hitItr, engine);
129  }
130  }
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 132 of file CaloTDigitizer.h.

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

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

133  {
134  std::vector<CaloSamples> noiseSignals;
135  // noise signals need to be in units of photoelectrons. Fractional is OK
138  for(std::vector<CaloSamples>::const_iterator signalItr = noiseSignals.begin(),
139  signalEnd = noiseSignals.end(); signalItr != signalEnd; ++signalItr)
140  {
141  theHitResponse->add(*signalItr);
142  }
143  }
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 assert(), and CaloTDigitizer< Traits >::theDetIds.

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

47 {assert( 0 != theDetIds ) ; return *theDetIds;}
assert(m_qm.get())
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.

References assert().

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

73  {
74  assert(0);
75  }
assert(m_qm.get())
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(), assert(), CaloHitResponse::clear(), CaloHitResponse::finalizeHits(), CaloHitResponse::findSignal(), CaloHitResponse::makeBlankSignal(), eostools::move(), CaloHitResponse::nSignals(), CaloTDigitizer< Traits >::theDetIds, CaloTDigitizer< Traits >::theElectronicsSim, CaloTDigitizer< Traits >::theHitResponse, CaloTDigitizer< Traits >::theNoiseHitGenerator, and CaloTDigitizer< Traits >::theNoiseSignalGenerator.

79  {
81  //std::cout << " In CaloTDigitizer, after finalize hits " << std::endl;
82 
83  assert(theDetIds->size() != 0);
84 
85  if(theNoiseHitGenerator != 0) addNoiseHits(engine);
87 
88  theElectronicsSim->newEvent(engine);
89 
90  // reserve space for how many digis we expect
91  int nDigisExpected = addNoise_ ? theDetIds->size() : theHitResponse->nSignals();
92  output.reserve(nDigisExpected);
93 
94  // make a raw digi for evey cell
95  for(std::vector<DetId>::const_iterator idItr = theDetIds->begin();
96  idItr != theDetIds->end(); ++idItr)
97  {
98  Digi digi(*idItr);
99  CaloSamples * analogSignal = theHitResponse->findSignal(*idItr);
100  bool needToDeleteSignal = false;
101  // don't bother digitizing if no signal and no noise
102  if(analogSignal == 0 && addNoise_) {
103  // I guess we need to make a blank signal for this cell.
104  // Don't bother storing it anywhere.
105  analogSignal = new CaloSamples(theHitResponse->makeBlankSignal(*idItr));
106  needToDeleteSignal = true;
107  }
108  if(analogSignal != 0) {
109 
110  theElectronicsSim->analogToDigital(engine, *analogSignal , digi);
111  output.push_back(std::move(digi));
112  if(needToDeleteSignal) delete analogSignal;
113  }
114  }
115 
116  // free up some memory
118  }
CaloSamples makeBlankSignal(const DetId &detId) const
creates an empty signal for this DetId
Traits::Digi Digi
assert(m_qm.get())
virtual void finalizeHits(CLHEP::HepRandomEngine *)
Finalize hits.
def move
Definition: eostools.py:510
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

Definition at line 48 of file CaloTDigitizer.h.

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

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

48 {theDetIds = &detIds;}
const std::vector< DetId > * theDetIds
const std::vector< DetId > & detIds() const
tell the digitizer which cells exist
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 151 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 149 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