#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) |
void | addNoiseHits () |
void | addNoiseSignals () |
CaloTDigitizer (CaloHitResponse *hitResponse, ElectronicsSim *electronicsSim, bool addNoise) | |
const std::vector< DetId > & | detIds () const |
tell the digitizer which cells exist | |
void | initializeHits () |
void | run (DigiCollection &output) |
Collects the digis. | |
void | run (MixCollection< PCaloHit > &, DigiCollection &) |
turns hits into digis | |
void | setDetIds (const std::vector< DetId > &detIds) |
void | setNoiseHitGenerator (CaloVNoiseHitGenerator *generator) |
void | setNoiseSignalGenerator (CaloVNoiseSignalGenerator *generator) |
void | setRandomEngine (CLHEP::HepRandomEngine &engine) |
~CaloTDigitizer () | |
doesn't delete the pointers passed in | |
Private Attributes | |
bool | addNoise_ |
const std::vector< DetId > * | theDetIds |
ElectronicsSim * | theElectronicsSim |
CaloHitResponse * | theHitResponse |
CaloVNoiseHitGenerator * | theNoiseHitGenerator |
CaloVNoiseSignalGenerator * | theNoiseSignalGenerator |
Turns hits into digis. Assumes that there's an ElectroncsSim class with the interface analogToDigital(const CaloSamples &, Digi &);
Definition at line 18 of file CaloTDigitizer.h.
typedef Traits::Digi CaloTDigitizer< Traits >::Digi |
Definition at line 25 of file CaloTDigitizer.h.
typedef Traits::DigiCollection CaloTDigitizer< Traits >::DigiCollection |
Definition at line 26 of file CaloTDigitizer.h.
typedef Traits::ElectronicsSim CaloTDigitizer< Traits >::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 24 of file CaloTDigitizer.h.
CaloTDigitizer< Traits >::CaloTDigitizer | ( | CaloHitResponse * | hitResponse, |
ElectronicsSim * | electronicsSim, | ||
bool | addNoise | ||
) | [inline] |
Definition at line 28 of file CaloTDigitizer.h.
: theHitResponse(hitResponse), theNoiseHitGenerator(0), theNoiseSignalGenerator(0), theElectronicsSim(electronicsSim), theDetIds(0), addNoise_(addNoise) { }
CaloTDigitizer< Traits >::~CaloTDigitizer | ( | ) | [inline] |
void CaloTDigitizer< Traits >::add | ( | const std::vector< PCaloHit > & | hits, |
int | bunchCrossing | ||
) | [inline] |
Definition at line 62 of file CaloTDigitizer.h.
References CaloHitResponse::add(), CaloTDigitizer< Traits >::theHitResponse, and CaloHitResponse::withinBunchRange().
Referenced by EcalDigiProducer::accumulateCaloHits(), HcalDigitizer::accumulateCaloHits(), CastorDigiProducer::accumulateCaloHits(), and HcalTBDigiProducer::accumulateCaloHits().
{ if(theHitResponse->withinBunchRange(bunchCrossing)) { for(std::vector<PCaloHit>::const_iterator it = hits.begin(), itEnd = hits.end(); it != itEnd; ++it) { theHitResponse->add(*it); } } }
void CaloTDigitizer< Traits >::addNoiseHits | ( | ) | [inline] |
Definition at line 120 of file CaloTDigitizer.h.
References CaloHitResponse::add(), CaloVNoiseHitGenerator::getNoiseHits(), CaloTDigitizer< Traits >::theHitResponse, and CaloTDigitizer< Traits >::theNoiseHitGenerator.
Referenced by CaloTDigitizer< Traits >::run().
{ std::vector<PCaloHit> noiseHits; theNoiseHitGenerator->getNoiseHits(noiseHits); for(std::vector<PCaloHit>::const_iterator hitItr = noiseHits.begin(), hitEnd = noiseHits.end(); hitItr != hitEnd; ++hitItr) { theHitResponse->add(*hitItr); } }
void CaloTDigitizer< Traits >::addNoiseSignals | ( | ) | [inline] |
Definition at line 131 of file CaloTDigitizer.h.
References CaloHitResponse::add(), CaloVNoiseSignalGenerator::fillEvent(), CaloVNoiseSignalGenerator::getNoiseSignals(), CaloTDigitizer< Traits >::theHitResponse, and CaloTDigitizer< Traits >::theNoiseSignalGenerator.
Referenced by CaloTDigitizer< Traits >::run().
{ std::vector<CaloSamples> noiseSignals; // noise signals need to be in units of photoelectrons. Fractional is OK theNoiseSignalGenerator->fillEvent(); theNoiseSignalGenerator->getNoiseSignals(noiseSignals); for(std::vector<CaloSamples>::const_iterator signalItr = noiseSignals.begin(), signalEnd = noiseSignals.end(); signalItr != signalEnd; ++signalItr) { theHitResponse->add(*signalItr); } }
const std::vector<DetId>& CaloTDigitizer< Traits >::detIds | ( | void | ) | const [inline] |
tell the digitizer which cells exist
Definition at line 43 of file CaloTDigitizer.h.
References CaloTDigitizer< Traits >::theDetIds.
Referenced by CaloTDigitizer< Traits >::setDetIds().
void CaloTDigitizer< Traits >::initializeHits | ( | ) | [inline] |
Definition at line 70 of file CaloTDigitizer.h.
References CaloHitResponse::initializeHits(), and CaloTDigitizer< Traits >::theHitResponse.
Referenced by HcalTBDigiProducer::initializeEvent(), EcalDigiProducer::initializeEvent(), HcalDigitizer::initializeEvent(), and CastorDigiProducer::initializeEvent().
{ theHitResponse->initializeHits(); }
void CaloTDigitizer< Traits >::run | ( | DigiCollection & | output | ) | [inline] |
Collects the digis.
Definition at line 80 of file CaloTDigitizer.h.
References CaloTDigitizer< Traits >::addNoise_, CaloTDigitizer< Traits >::addNoiseHits(), CaloTDigitizer< Traits >::addNoiseSignals(), CaloHitResponse::clear(), CaloHitResponse::finalizeHits(), CaloHitResponse::findSignal(), CaloHitResponse::makeBlankSignal(), CaloHitResponse::nSignals(), CaloTDigitizer< Traits >::theDetIds, CaloTDigitizer< Traits >::theElectronicsSim, CaloTDigitizer< Traits >::theHitResponse, CaloTDigitizer< Traits >::theNoiseHitGenerator, and CaloTDigitizer< Traits >::theNoiseSignalGenerator.
{ theHitResponse->finalizeHits(); assert(theDetIds->size() != 0); if(theNoiseHitGenerator != 0) addNoiseHits(); if(theNoiseSignalGenerator != 0) addNoiseSignals(); theElectronicsSim->newEvent(); // reserve space for how many digis we expect int nDigisExpected = addNoise_ ? theDetIds->size() : theHitResponse->nSignals(); output.reserve(nDigisExpected); // make a raw digi for evey cell for(std::vector<DetId>::const_iterator idItr = theDetIds->begin(); idItr != theDetIds->end(); ++idItr) { Digi digi(*idItr); CaloSamples * analogSignal = theHitResponse->findSignal(*idItr); bool needToDeleteSignal = false; // don't bother digitizing if no signal and no noise if(analogSignal == 0 && addNoise_) { // I guess we need to make a blank signal for this cell. // Don't bother storing it anywhere. analogSignal = new CaloSamples(theHitResponse->makeBlankSignal(*idItr)); needToDeleteSignal = true; } if(analogSignal != 0) { theElectronicsSim->analogToDigital(*analogSignal , digi); output.push_back(std::move(digi)); if(needToDeleteSignal) delete analogSignal; } } // free up some memory theHitResponse->clear(); }
void CaloTDigitizer< Traits >::run | ( | MixCollection< PCaloHit > & | , |
DigiCollection & | |||
) | [inline] |
turns hits into digis
Definition at line 75 of file CaloTDigitizer.h.
Referenced by EcalDigiProducer::finalizeEvent(), HcalDigitizer::finalizeEvent(), HcalTBDigiProducer::finalizeEvent(), and CastorDigiProducer::finalizeEvent().
{ assert(0); }
void CaloTDigitizer< Traits >::setDetIds | ( | const std::vector< DetId > & | detIds | ) | [inline] |
Definition at line 44 of file CaloTDigitizer.h.
References CaloTDigitizer< Traits >::detIds(), and CaloTDigitizer< Traits >::theDetIds.
Referenced by HcalDigitizer::buildHOSiPMCells(), CastorDigiProducer::checkGeometry(), HcalTBDigiProducer::updateGeometry(), HcalDigitizer::updateGeometry(), and EcalDigiProducer::updateGeometry().
void CaloTDigitizer< Traits >::setNoiseHitGenerator | ( | CaloVNoiseHitGenerator * | generator | ) | [inline] |
Definition at line 46 of file CaloTDigitizer.h.
References python::IdGenerator::generator, and CaloTDigitizer< Traits >::theNoiseHitGenerator.
Referenced by HcalDigitizer::HcalDigitizer().
{ theNoiseHitGenerator = generator; }
void CaloTDigitizer< Traits >::setNoiseSignalGenerator | ( | CaloVNoiseSignalGenerator * | generator | ) | [inline] |
Definition at line 51 of file CaloTDigitizer.h.
References python::IdGenerator::generator, and CaloTDigitizer< Traits >::theNoiseSignalGenerator.
Referenced by HcalDigitizer::HcalDigitizer(), HcalDigitizer::setHBHENoiseSignalGenerator(), HcalDigitizer::setHFNoiseSignalGenerator(), HcalDigitizer::setHONoiseSignalGenerator(), and HcalDigitizer::setZDCNoiseSignalGenerator().
{ theNoiseSignalGenerator = generator; }
void CaloTDigitizer< Traits >::setRandomEngine | ( | CLHEP::HepRandomEngine & | engine | ) | [inline] |
Definition at line 56 of file CaloTDigitizer.h.
References CaloHitResponse::setRandomEngine(), CaloTDigitizer< Traits >::theElectronicsSim, and CaloTDigitizer< Traits >::theHitResponse.
Referenced by HcalDigitizer::HcalDigitizer().
{ theHitResponse->setRandomEngine(engine); theElectronicsSim->setRandomEngine(engine); }
bool CaloTDigitizer< Traits >::addNoise_ [private] |
Definition at line 150 of file CaloTDigitizer.h.
Referenced by CaloTDigitizer< Traits >::run().
const std::vector<DetId>* CaloTDigitizer< Traits >::theDetIds [private] |
Definition at line 149 of file CaloTDigitizer.h.
Referenced by CaloTDigitizer< Traits >::detIds(), CaloTDigitizer< Traits >::run(), and CaloTDigitizer< Traits >::setDetIds().
ElectronicsSim* CaloTDigitizer< Traits >::theElectronicsSim [private] |
Definition at line 148 of file CaloTDigitizer.h.
Referenced by CaloTDigitizer< Traits >::run(), and CaloTDigitizer< Traits >::setRandomEngine().
CaloHitResponse* CaloTDigitizer< Traits >::theHitResponse [private] |
Definition at line 145 of file CaloTDigitizer.h.
Referenced by CaloTDigitizer< Traits >::add(), CaloTDigitizer< Traits >::addNoiseHits(), CaloTDigitizer< Traits >::addNoiseSignals(), CaloTDigitizer< Traits >::initializeHits(), CaloTDigitizer< Traits >::run(), and CaloTDigitizer< Traits >::setRandomEngine().
CaloVNoiseHitGenerator* CaloTDigitizer< Traits >::theNoiseHitGenerator [private] |
Definition at line 146 of file CaloTDigitizer.h.
Referenced by CaloTDigitizer< Traits >::addNoiseHits(), CaloTDigitizer< Traits >::run(), and CaloTDigitizer< Traits >::setNoiseHitGenerator().
CaloVNoiseSignalGenerator* CaloTDigitizer< Traits >::theNoiseSignalGenerator [private] |
Definition at line 147 of file CaloTDigitizer.h.
Referenced by CaloTDigitizer< Traits >::addNoiseSignals(), CaloTDigitizer< Traits >::run(), and CaloTDigitizer< Traits >::setNoiseSignalGenerator().