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 (DigiCollection &output, CLHEP::HepRandomEngine *engine)
 Collects the digis. More...
 
void run (MixCollection< PCaloHit > &, DigiCollection &)
 turns hits into 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) {}

◆ ~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.

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  }

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

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

◆ 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.

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  }

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

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

◆ 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.

63  {
64  assert(0 != theDetIds);
65  return *theDetIds;
66  }

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

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

◆ 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.

73 { return csColl_; }

References CaloTDigitizer< Traits, runHelper >::csColl_.

◆ initializeHits()

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

◆ run() [1/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.

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  }

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(), convertSQLitetoXML_cfg::output, CaloTDigitizer< Traits, runHelper >::runAnalogToDigital, CaloHitResponse::setStorePrecise(), CaloTDigitizer< Traits, runHelper >::theDetIds, CaloTDigitizer< Traits, runHelper >::theElectronicsSim, CaloTDigitizer< Traits, runHelper >::theHitResponse, and CaloTDigitizer< Traits, runHelper >::theNoiseSignalGenerator.

◆ run() [2/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.

86 { assert(0); }

References cms::cuda::assert().

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

◆ 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.

71 { debugCS_ = debug; }

References debug, and CaloTDigitizer< Traits, runHelper >::debugCS_.

◆ setDetIds()

template<class Traits , template< class > class runHelper = CaloTDigitizerDefaultRun>
void CaloTDigitizer< Traits, runHelper >::setDetIds ( const std::vector< DetId > &  detIds)
inline

◆ 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
CaloTDigitizer::csColl_
CaloSamplesCollection csColl_
Definition: CaloTDigitizer.h:154
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
CaloTDigitizer::theElectronicsSim
ElectronicsSim * theElectronicsSim
Definition: CaloTDigitizer.h:150
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
cms::cuda::assert
assert(be >=bs)
CaloTDigitizer::theHitResponse
CaloHitResponse * theHitResponse
Definition: CaloTDigitizer.h:148
CaloHitResponse::withinBunchRange
bool withinBunchRange(int bunchCrossing) const
check if crossing is within bunch range:
Definition: CaloHitResponse.h:112
CaloTDigitizer::detIds
const std::vector< DetId > & detIds() const
tell the digitizer which cells exist
Definition: CaloTDigitizer.h:63
debug
#define debug
Definition: HDRShower.cc:19
CaloHitResponse::nSignals
int nSignals() const
number of signals in the current cache
Definition: CaloHitResponse.h:98
CaloHitResponse::initializeHits
virtual void initializeHits()
Initialize hits.
Definition: CaloHitResponse.h:54
CaloTDigitizer::addNoiseSignals
void addNoiseSignals(CLHEP::HepRandomEngine *engine)
Definition: CaloTDigitizer.h:134
CaloHitResponse::add
virtual void add(const PCaloHit &hit, CLHEP::HepRandomEngine *)
process a single SimHit
Definition: CaloHitResponse.cc:66
CaloHitResponse::finalizeHits
virtual void finalizeHits(CLHEP::HepRandomEngine *)
Finalize hits.
Definition: CaloHitResponse.h:57
CaloTDigitizer::addNoise_
bool addNoise_
Definition: CaloTDigitizer.h:152
CaloSamples
Definition: CaloSamples.h:14
CaloHitResponse::makeBlankSignal
CaloSamples makeBlankSignal(const DetId &detId) const
creates an empty signal for this DetId
Definition: CaloHitResponse.cc:175
CaloTDigitizer::theNoiseSignalGenerator
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
Definition: CaloTDigitizer.h:149
CaloVNoiseSignalGenerator::getNoiseSignals
void getNoiseSignals(std::vector< CaloSamples > &noiseSignals)
Definition: CaloVNoiseSignalGenerator.h:21
genfragment_ptgun_cfg.generator
generator
Definition: genfragment_ptgun_cfg.py:4
CaloTDigitizer::runAnalogToDigital
runHelper< Traits > runAnalogToDigital
Definition: CaloTDigitizer.h:147
CaloTDigitizer::debugCS_
bool debugCS_
Definition: CaloTDigitizer.h:153
CaloHitResponse::findSignal
CaloSamples * findSignal(const DetId &detId)
users can look for the signal for a given cell
Definition: CaloHitResponse.cc:164
CaloVNoiseSignalGenerator::fillEvent
void fillEvent(CLHEP::HepRandomEngine *)
fill theNoiseSignals with one event's worth of noise, in units of pe
Definition: CaloVNoiseSignalGenerator.cc:7
CaloTDigitizer::theDetIds
const std::vector< DetId > * theDetIds
Definition: CaloTDigitizer.h:151
CaloHitResponse::clear
void clear()
frees up memory
Definition: CaloHitResponse.h:79
CaloHitResponse::setStorePrecise
void setStorePrecise(bool sp)
Definition: CaloHitResponse.h:116