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

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

Definition at line 49 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 47 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 51 of file CaloTDigitizer.h.

52  : theHitResponse(hitResponse),
53  theNoiseSignalGenerator(nullptr),
54  theElectronicsSim(electronicsSim),
55  theDetIds(nullptr),
56  addNoise_(addNoise),
57  debugCS_(false) {}
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 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 75 of file CaloTDigitizer.h.

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

75  {
76  if (theHitResponse->withinBunchRange(bunchCrossing)) {
77  for (std::vector<PCaloHit>::const_iterator it = hits.begin(), itEnd = hits.end(); it != itEnd; ++it) {
78  theHitResponse->add(*it, engine);
79  }
80  }
81  }
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 134 of file CaloTDigitizer.h.

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

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

Definition at line 73 of file CaloTDigitizer.h.

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

Definition at line 83 of file CaloTDigitizer.h.

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

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

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

86 { assert(0); }
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 90 of file CaloTDigitizer.h.

90  {
91  assert(!theDetIds->empty());
92 
93  if (theNoiseSignalGenerator != nullptr)
94  addNoiseSignals(engine);
95 
97  // std::cout << " In CaloTDigitizer, after finalize hits " << std::endl;
98 
99  theElectronicsSim->newEvent(engine);
100 
101  // reserve space for how many digis we expect
102  int nDigisExpected = addNoise_ ? theDetIds->size() : theHitResponse->nSignals();
103  output.reserve(nDigisExpected);
104  if (debugCS_) {
105  csColl_.clear();
106  csColl_.reserve(nDigisExpected);
108  }
109 
110  // make a raw digi for evey cell
111  for (std::vector<DetId>::const_iterator idItr = theDetIds->begin(); idItr != theDetIds->end(); ++idItr) {
112  CaloSamples *analogSignal = theHitResponse->findSignal(*idItr);
113  if (analogSignal && debugCS_)
114  csColl_.push_back(*analogSignal);
115  bool needToDeleteSignal = false;
116  // don't bother digitizing if no signal and no noise
117  if (analogSignal == nullptr && 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 != nullptr) {
124  runAnalogToDigital(output, engine, analogSignal, idItr, theElectronicsSim);
125  if (needToDeleteSignal)
126  delete analogSignal;
127  }
128  }
129 
130  // free up some memory
132  }
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 71 of file CaloTDigitizer.h.

References debug.

71 { debugCS_ = debug; }
#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 67 of file CaloTDigitizer.h.

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

67 { 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

Definition at line 69 of file CaloTDigitizer.h.

References genfragment_ptgun_cfg::generator.

CaloVNoiseSignalGenerator * theNoiseSignalGenerator

Member Data Documentation

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

Definition at line 152 of file CaloTDigitizer.h.

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

Definition at line 154 of file CaloTDigitizer.h.

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

Definition at line 153 of file CaloTDigitizer.h.

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

Definition at line 147 of file CaloTDigitizer.h.

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

Definition at line 151 of file CaloTDigitizer.h.

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

Definition at line 150 of file CaloTDigitizer.h.

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

Definition at line 148 of file CaloTDigitizer.h.

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

Definition at line 149 of file CaloTDigitizer.h.