1 #ifndef CaloSimAlgos_CaloTDigitizer_h
2 #define CaloSimAlgos_CaloTDigitizer_h
18 class HepRandomEngine;
21 template <
class Traits>
25 typedef typename Traits::Digi
Digi;
29 CLHEP::HepRandomEngine *engine,
31 std::vector<DetId>::const_iterator idItr,
34 theElectronicsSim->analogToDigital(engine, *analogSignal, digi);
48 typedef typename Traits::Digi
Digi;
63 const std::vector<DetId> &
detIds()
const {
75 void add(
const std::vector<PCaloHit> &hits,
int bunchCrossing, CLHEP::HepRandomEngine *engine) {
77 for (std::vector<PCaloHit>::const_iterator it = hits.begin(), itEnd = hits.end(); it != itEnd; ++it) {
103 output.reserve(nDigisExpected);
106 csColl_.reserve(nDigisExpected);
111 for (std::vector<DetId>::const_iterator idItr =
theDetIds->begin(); idItr !=
theDetIds->end(); ++idItr) {
114 csColl_.push_back(*analogSignal);
115 bool needToDeleteSignal =
false;
117 if (analogSignal ==
nullptr &&
addNoise_) {
121 needToDeleteSignal =
true;
123 if (analogSignal !=
nullptr) {
125 if (needToDeleteSignal)
135 std::vector<CaloSamples> noiseSignals;
139 for (std::vector<CaloSamples>::const_iterator signalItr = noiseSignals.begin(), signalEnd = noiseSignals.end();
140 signalItr != signalEnd;
void setStorePrecise(bool sp)
CaloSamplesCollection csColl_
CaloSamples makeBlankSignal(const DetId &detId) const
creates an empty signal for this DetId
std::vector< CaloSamples > CaloSamplesCollection
void add(const std::vector< PCaloHit > &hits, int bunchCrossing, CLHEP::HepRandomEngine *engine)
Traits::ElectronicsSim ElectronicsSim
bool withinBunchRange(int bunchCrossing) const
check if crossing is within bunch range:
const std::vector< DetId > & detIds() const
tell the digitizer which cells exist
void operator()(DigiCollection &output, CLHEP::HepRandomEngine *engine, CaloSamples *analogSignal, std::vector< DetId >::const_iterator idItr, ElectronicsSim *theElectronicsSim)
Traits::ElectronicsSim ElectronicsSim
CaloVNoiseSignalGenerator * theNoiseSignalGenerator
Creates electronics signals from hits.
CaloTDigitizer(CaloHitResponse *hitResponse, ElectronicsSim *electronicsSim, bool addNoise)
virtual void initializeHits()
Initialize hits.
void addNoiseSignals(CLHEP::HepRandomEngine *engine)
void setNoiseSignalGenerator(CaloVNoiseSignalGenerator *generator)
CaloHitResponse * theHitResponse
runHelper< Traits > runAnalogToDigital
~CaloTDigitizer()
doesn't delete the pointers passed in
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
ElectronicsSim * theElectronicsSim
CaloSamples * findSignal(const DetId &detId)
users can look for the signal for a given cell
virtual void finalizeHits(CLHEP::HepRandomEngine *)
Finalize hits.
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
Traits::DigiCollection DigiCollection
void setDebugCaloSamples(bool debug)
void getNoiseSignals(std::vector< CaloSamples > &noiseSignals)
Traits::DigiCollection DigiCollection
int nSignals() const
number of signals in the current cache
const CaloSamplesCollection & getCaloSamples() const
void run(DigiCollection &output, CLHEP::HepRandomEngine *engine)
Collects the digis.
void setDetIds(const std::vector< DetId > &detIds)
const std::vector< DetId > * theDetIds