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

◆ Digi

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

Definition at line 48 of file CaloTDigitizer.h.

◆ DigiCollection

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

Definition at line 49 of file CaloTDigitizer.h.

◆ ElectronicsSim

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

◆ CaloTDigitizer()

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

◆ ~CaloTDigitizer()

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

◆ add()

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.

References CaloHitResponse::add(), hfClusterShapes_cfi::hits, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, CaloTDigitizer< Traits, runHelper >::theHitResponse, and CaloHitResponse::withinBunchRange().

Referenced by CastorDigiProducer::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  }
CaloHitResponse * theHitResponse
bool withinBunchRange(int bunchCrossing) const
check if crossing is within bunch range:
virtual void add(const PCaloHit &hit, CLHEP::HepRandomEngine *)
process a single SimHit

◆ addNoiseSignals()

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.

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

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

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)

◆ detIds()

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 cms::cuda::assert(), and CaloTDigitizer< Traits, runHelper >::theDetIds.

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

63  {
64  assert(nullptr != theDetIds);
65  return *theDetIds;
66  }
assert(be >=bs)
const std::vector< DetId > * theDetIds

◆ getCaloSamples()

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
const CaloSamplesCollection& CaloTDigitizer< Traits, runHelper >::getCaloSamples ( ) const
inline

Definition at line 73 of file CaloTDigitizer.h.

References CaloTDigitizer< Traits, runHelper >::csColl_.

73 { return csColl_; }
CaloSamplesCollection csColl_

◆ initializeHits()

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::initializeHits ( )
inline

Definition at line 83 of file CaloTDigitizer.h.

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

Referenced by CastorDigiProducer::initializeEvent().

virtual void initializeHits()
Initialize hits.
CaloHitResponse * theHitResponse

◆ run() [1/2]

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.

References cms::cuda::assert().

Referenced by CastorDigiProducer::finalizeEvent().

86 { assert(0); }
assert(be >=bs)

◆ run() [2/2]

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.

References CaloTDigitizer< Traits, runHelper >::addNoise_, CaloTDigitizer< Traits, runHelper >::addNoiseSignals(), cms::cuda::assert(), CaloHitResponse::clear(), CaloTDigitizer< Traits, runHelper >::csColl_, CaloTDigitizer< Traits, runHelper >::debugCS_, CaloHitResponse::finalizeHits(), CaloHitResponse::findSignal(), CaloHitResponse::makeBlankSignal(), CaloHitResponse::nSignals(), CaloTDigitizer< Traits, runHelper >::runAnalogToDigital, CaloHitResponse::setStorePrecise(), CaloTDigitizer< Traits, runHelper >::theDetIds, CaloTDigitizer< Traits, runHelper >::theElectronicsSim, CaloTDigitizer< Traits, runHelper >::theHitResponse, and CaloTDigitizer< Traits, runHelper >::theNoiseSignalGenerator.

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_
int nSignals() const
number of signals in the current cache
assert(be >=bs)
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
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
virtual void finalizeHits(CLHEP::HepRandomEngine *)
Finalize hits.
void clear()
frees up memory
Definition: output.py:1
CaloSamples makeBlankSignal(const DetId &detId) const
creates an empty signal for this DetId
const std::vector< DetId > * theDetIds

◆ setDebugCaloSamples()

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, and CaloTDigitizer< Traits, runHelper >::debugCS_.

71 { debugCS_ = debug; }
#define debug
Definition: HDRShower.cc:19

◆ setDetIds()

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.

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

Referenced by CastorDigiProducer::checkGeometry().

67 { theDetIds = &detIds; }
const std::vector< DetId > & detIds() const
tell the digitizer which cells exist
const std::vector< DetId > * theDetIds

◆ setNoiseSignalGenerator()

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::setNoiseSignalGenerator ( CaloVNoiseSignalGenerator generator)
inline

Member Data Documentation

◆ addNoise_

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

Definition at line 152 of file CaloTDigitizer.h.

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

◆ csColl_

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

◆ debugCS_

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

◆ runAnalogToDigital

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

Definition at line 147 of file CaloTDigitizer.h.

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

◆ theDetIds

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

◆ theElectronicsSim

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

Definition at line 150 of file CaloTDigitizer.h.

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

◆ theHitResponse

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

◆ theNoiseSignalGenerator

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