1 #ifndef CaloSimAlgos_CaloTDigitizer_h
2 #define CaloSimAlgos_CaloTDigitizer_h
18 class HepRandomEngine;
21 template<
class Traits>
29 typedef typename Traits::Digi
Digi;
60 void add(
const std::vector<PCaloHit> & hits,
int bunchCrossing, CLHEP::HepRandomEngine* engine) {
62 for(std::vector<PCaloHit>::const_iterator it = hits.begin(), itEnd = hits.end(); it != itEnd; ++it) {
93 output.reserve(nDigisExpected);
98 for(std::vector<DetId>::const_iterator idItr =
theDetIds->begin();
103 bool needToDeleteSignal =
false;
109 needToDeleteSignal =
true;
111 if(analogSignal != 0) {
113 output.push_back(std::move(digi));
114 if(needToDeleteSignal)
delete analogSignal;
125 std::vector<PCaloHit> noiseHits;
127 for(std::vector<PCaloHit>::const_iterator hitItr = noiseHits.begin(),
128 hitEnd = noiseHits.end(); hitItr != hitEnd; ++hitItr)
136 std::vector<CaloSamples> noiseSignals;
140 for(std::vector<CaloSamples>::const_iterator signalItr = noiseSignals.begin(),
141 signalEnd = noiseSignals.end(); signalItr != signalEnd; ++signalItr)
void setNoiseHitGenerator(CaloVNoiseHitGenerator *generator)
void run(DigiCollection &output, CLHEP::HepRandomEngine *engine)
Collects the digis.
CaloSamples makeBlankSignal(const DetId &detId) const
creates an empty signal for this DetId
CaloTDigitizer(CaloHitResponse *hitResponse, ElectronicsSim *electronicsSim, bool addNoise)
bool withinBunchRange(int bunchCrossing) const
check if crossing is within bunch range:
void add(const std::vector< PCaloHit > &hits, int bunchCrossing, CLHEP::HepRandomEngine *engine)
virtual void getNoiseHits(std::vector< PCaloHit > &noiseHits)=0
Traits::DigiCollection DigiCollection
virtual void finalizeHits(CLHEP::HepRandomEngine *)
Finalize hits.
Creates electronics signals from hits.
virtual void initializeHits()
Initialize hits.
CaloVNoiseHitGenerator * theNoiseHitGenerator
void setNoiseSignalGenerator(CaloVNoiseSignalGenerator *generator)
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
CaloHitResponse * theHitResponse
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
ElectronicsSim * theElectronicsSim
Traits::ElectronicsSim ElectronicsSim
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)
virtual void add(const PCaloHit &hit, CLHEP::HepRandomEngine *)
process a single SimHit
void fillEvent(CLHEP::HepRandomEngine *)
fill theNoiseSignals with one event's worth of noise, in units of pe
void clear()
frees up memory
void setDetIds(const std::vector< DetId > &detIds)
void getNoiseSignals(std::vector< CaloSamples > &noiseSignals)
const std::vector< DetId > * theDetIds
int nSignals() const
number of signals in the current cache
~CaloTDigitizer()
doesn't delete the pointers passed in
const std::vector< DetId > & detIds() const
tell the digitizer which cells exist