#include <EcalHitResponse.h>
Public Types | |
enum | { BUNCHSPACE = 25 } |
typedef CaloTSamplesBase< float > | EcalSamples |
typedef std::vector< unsigned int > | VecInd |
Public Member Functions | |
void | add (const EcalSamples *pSam) |
virtual void | add (const PCaloHit &hit) |
EcalHitResponse (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape) | |
virtual void | finalizeHits () |
const EcalSamples * | findDetId (const DetId &detId) const |
virtual void | initializeHits () |
virtual const EcalSamples * | operator[] (unsigned int i) const =0 |
virtual EcalSamples * | operator[] (unsigned int i)=0 |
virtual void | run (MixCollection< PCaloHit > &hits) |
virtual unsigned int | samplesSize () const =0 |
void | setBunchRange (int minBunch, int maxBunch) |
void | setEventTime (const edm::TimeValue_t &iTime) |
void | setGeometry (const CaloSubdetectorGeometry *geometry) |
void | setHitCorrection (const CaloVHitCorrection *hitCorrection) |
void | setHitFilter (const CaloVHitFilter *filter) |
void | setLaserConstants (const EcalLaserDbService *laser, bool &useLCcorrection) |
void | setPECorrection (const CaloVPECorrection *peCorrection) |
void | setPhaseShift (double phaseShift) |
bool | withinBunchRange (int bunchCrossing) const |
virtual | ~EcalHitResponse () |
Protected Member Functions | |
double | analogSignalAmplitude (const DetId &id, float energy) const |
void | blankOutUsedSamples () |
double | findLaserConstant (const DetId &detId) const |
EcalSamples * | findSignal (const DetId &detId) |
const CaloSubdetectorGeometry * | geometry () const |
const CaloVHitFilter * | hitFilter () const |
VecInd & | index () |
const VecInd & | index () const |
int | maxBunch () const |
int | minBunch () const |
const CaloSimParameters * | params (const DetId &detId) const |
double | phaseShift () const |
virtual void | putAnalogSignal (const PCaloHit &inputHit) |
CLHEP::RandGaussQ * | ranGauss () const |
CLHEP::RandPoissonQ * | ranPois () const |
virtual unsigned int | samplesSizeAll () const =0 |
const CaloVShape * | shape () const |
double | timeOfFlight (const DetId &detId) const |
virtual EcalSamples * | vSam (unsigned int i)=0 |
virtual EcalSamples * | vSamAll (unsigned int i)=0 |
virtual const EcalSamples * | vSamAll (unsigned int i) const =0 |
Private Attributes | |
const CaloSubdetectorGeometry * | m_geometry |
const CaloVHitCorrection * | m_hitCorrection |
const CaloVHitFilter * | m_hitFilter |
VecInd | m_index |
edm::TimeValue_t | m_iTime |
const EcalLaserDbService * | m_lasercals |
int | m_maxBunch |
int | m_minBunch |
const CaloVSimParameterMap * | m_parameterMap |
const CaloVPECorrection * | m_PECorrection |
double | m_phaseShift |
CLHEP::RandGaussQ * | m_RandGauss |
CLHEP::RandPoissonQ * | m_RandPoisson |
const CaloVShape * | m_shape |
bool | m_useLCcorrection |
Definition at line 29 of file EcalHitResponse.h.
typedef CaloTSamplesBase<float> EcalHitResponse::EcalSamples |
Definition at line 33 of file EcalHitResponse.h.
typedef std::vector< unsigned int > EcalHitResponse::VecInd |
Definition at line 35 of file EcalHitResponse.h.
anonymous enum |
EcalHitResponse::EcalHitResponse | ( | const CaloVSimParameterMap * | parameterMap, |
const CaloVShape * | shape | ||
) |
Definition at line 26 of file EcalHitResponse.cc.
References Exception, edm::Service< T >::isAvailable(), m_RandGauss, and m_RandPoisson.
: m_parameterMap ( parameterMap ) , m_shape ( shape ) , m_hitCorrection ( 0 ) , m_PECorrection ( 0 ) , m_hitFilter ( 0 ) , m_geometry ( 0 ) , m_lasercals ( 0 ) , m_RandPoisson ( 0 ) , m_RandGauss ( 0 ) , m_minBunch ( -10 ) , m_maxBunch ( 10 ) , m_phaseShift ( 1 ) , m_iTime ( 0 ) , m_useLCcorrection ( 0 ) { edm::Service<edm::RandomNumberGenerator> rng ; if ( !rng.isAvailable() ) { throw cms::Exception("Configuration") << "EcalHitResponse requires the RandomNumberGeneratorService\n" "which is not present in the configuration file. You must add the service\n" "in the configuration file or remove the modules that require it."; } m_RandPoisson = new CLHEP::RandPoissonQ( rng->getEngine() ) ; m_RandGauss = new CLHEP::RandGaussQ( rng->getEngine() ) ; }
EcalHitResponse::~EcalHitResponse | ( | ) | [virtual] |
Definition at line 55 of file EcalHitResponse.cc.
References m_RandGauss, and m_RandPoisson.
{ delete m_RandPoisson ; delete m_RandGauss ; }
void EcalHitResponse::add | ( | const EcalSamples * | pSam | ) |
Definition at line 289 of file EcalHitResponse.cc.
References findSignal(), and CaloTSamplesBase< Ttype >::id().
{ EcalSamples& sam ( *findSignal( pSam->id() ) ) ; sam += (*pSam) ; }
void EcalHitResponse::add | ( | const PCaloHit & | hit | ) | [virtual] |
Reimplemented in EBHitResponse.
Definition at line 165 of file EcalHitResponse.cc.
References CaloVHitFilter::accepts(), edm::isNotFinite(), m_hitFilter, putAnalogSignal(), and PCaloHit::time().
{ if (!edm::isNotFinite( hit.time() ) && ( 0 == m_hitFilter || m_hitFilter->accepts( hit ) ) ) { putAnalogSignal( hit ) ; } }
double EcalHitResponse::analogSignalAmplitude | ( | const DetId & | id, |
float | energy | ||
) | const [protected] |
Definition at line 258 of file EcalHitResponse.cc.
References CaloVPECorrection::correctPE(), CaloSimParameters::doPhotostatistics(), findLaserConstant(), m_PECorrection, m_useLCcorrection, Parameters::parameters, params(), ranPois(), CaloSimParameters::simHitToPhotoelectrons(), and DetId::subdetId().
Referenced by putAnalogSignal().
{ const CaloSimParameters& parameters ( *params( detId ) ) ; // OK, the "energy" in the hit could be a real energy, deposited energy, // or pe count. This factor converts to photoelectrons float lasercalib = 1.; if(m_useLCcorrection == true && detId.subdetId() != 3) { lasercalib = findLaserConstant(detId); } double npe ( energy/lasercalib*parameters.simHitToPhotoelectrons( detId ) ) ; // do we need to doPoisson statistics for the photoelectrons? if( parameters.doPhotostatistics() ) npe = ranPois()->fire( npe ) ; if( 0 != m_PECorrection ) npe = m_PECorrection->correctPE( detId, npe ) ; return npe ; }
void EcalHitResponse::blankOutUsedSamples | ( | ) | [protected] |
Definition at line 152 of file EcalHitResponse.cc.
References i, m_index, CaloTSamplesBase< Ttype >::setZero(), findQualityFiles::size, and vSamAll().
Referenced by EBHitResponse::initializeHits(), initializeHits(), run(), and EBHitResponse::run().
void EcalHitResponse::finalizeHits | ( | ) | [virtual] |
const EcalHitResponse::EcalSamples * EcalHitResponse::findDetId | ( | const DetId & | detId | ) | const |
Definition at line 326 of file EcalHitResponse.cc.
References vSamAll().
Referenced by ESDigitizer::run().
{ const unsigned int di ( CaloGenericDetId( detId ).denseIndex() ) ; return vSamAll( di ) ; }
double EcalHitResponse::findLaserConstant | ( | const DetId & | detId | ) | const [protected] |
Definition at line 242 of file EcalHitResponse.cc.
References EcalLaserDbService::getLaserCorrection(), m_iTime, and m_lasercals.
Referenced by analogSignalAmplitude().
{ const edm::Timestamp& evtTimeStamp = edm::Timestamp(m_iTime); return (m_lasercals->getLaserCorrection(detId, evtTimeStamp)); }
EcalHitResponse::EcalSamples * EcalHitResponse::findSignal | ( | const DetId & | detId | ) | [protected] |
Definition at line 249 of file EcalHitResponse.cc.
References m_index, query::result, vSamAll(), and CaloTSamplesBase< Ttype >::zero().
Referenced by add(), putAnalogSignal(), and EBHitResponse::putAPDSignal().
{ const unsigned int di ( CaloGenericDetId( detId ).denseIndex() ) ; EcalSamples* result ( vSamAll( di ) ) ; if( result->zero() ) m_index.push_back( di ) ; return result ; }
const CaloSubdetectorGeometry * EcalHitResponse::geometry | ( | ) | const [protected] |
Definition at line 88 of file EcalHitResponse.cc.
References m_geometry.
Referenced by setGeometry(), and timeOfFlight().
{ assert( 0 != m_geometry ) ; return m_geometry ; }
const CaloVHitFilter * EcalHitResponse::hitFilter | ( | ) | const [protected] |
Definition at line 320 of file EcalHitResponse.cc.
References m_hitFilter.
Referenced by EBHitResponse::add(), and EBHitResponse::run().
{ return m_hitFilter ; }
const EcalHitResponse::VecInd & EcalHitResponse::index | ( | ) | const [protected] |
EcalHitResponse::VecInd & EcalHitResponse::index | ( | ) | [protected] |
Definition at line 308 of file EcalHitResponse.cc.
References m_index.
Referenced by EBHitResponse::initializeHits(), ESHitResponse::operator[](), EBHitResponse::run(), ESHitResponse::samplesSize(), and ESHitResponse::vSam().
{ return m_index ; }
void EcalHitResponse::initializeHits | ( | ) | [virtual] |
Reimplemented in EBHitResponse.
Definition at line 179 of file EcalHitResponse.cc.
References blankOutUsedSamples().
{ blankOutUsedSamples() ; }
int EcalHitResponse::maxBunch | ( | ) | const [protected] |
Definition at line 302 of file EcalHitResponse.cc.
References m_maxBunch.
Referenced by EBHitResponse::run(), and setBunchRange().
{ return m_maxBunch ; }
int EcalHitResponse::minBunch | ( | ) | const [protected] |
Definition at line 296 of file EcalHitResponse.cc.
References m_minBunch.
Referenced by EBHitResponse::run(), and setBunchRange().
{ return m_minBunch ; }
virtual const EcalSamples* EcalHitResponse::operator[] | ( | unsigned int | i | ) | const [pure virtual] |
Implemented in EBHitResponse, EEHitResponse, and ESHitResponse.
virtual EcalSamples* EcalHitResponse::operator[] | ( | unsigned int | i | ) | [pure virtual] |
Implemented in EBHitResponse, EEHitResponse, and ESHitResponse.
const CaloSimParameters * EcalHitResponse::params | ( | const DetId & | detId | ) | const [protected] |
Definition at line 74 of file EcalHitResponse.cc.
References m_parameterMap, and CaloVSimParameterMap::simParameters().
Referenced by analogSignalAmplitude(), putAnalogSignal(), and EBHitResponse::putAPDSignal().
{ assert( 0 != m_parameterMap ) ; return &m_parameterMap->simParameters( detId ) ; }
double EcalHitResponse::phaseShift | ( | ) | const [protected] |
Definition at line 115 of file EcalHitResponse.cc.
References m_phaseShift.
Referenced by EBHitResponse::putAPDSignal(), and setPhaseShift().
{ return m_phaseShift ; }
void EcalHitResponse::putAnalogSignal | ( | const PCaloHit & | inputHit | ) | [protected, virtual] |
Definition at line 207 of file EcalHitResponse.cc.
References analogSignalAmplitude(), newFWLiteAna::bin, BUNCHSPACE, CaloVHitCorrection::delay(), PCaloHit::energy(), findSignal(), PCaloHit::id(), m_hitCorrection, m_phaseShift, Parameters::parameters, params(), query::result, shape(), CaloTSamplesBase< Ttype >::size(), cond::rpcobgas::time, PCaloHit::time(), timeOfFlight(), CaloVShape::timeToRise(), and tzero.
Referenced by add(), EBHitResponse::add(), run(), and EBHitResponse::run().
{ const DetId detId ( hit.id() ) ; const CaloSimParameters* parameters ( params( detId ) ) ; const double signal ( analogSignalAmplitude( detId, hit.energy() ) ) ; double time = hit.time(); if(m_hitCorrection) { time += m_hitCorrection->delay( hit ) ; } const double jitter ( time - timeOfFlight( detId ) ) ; const double tzero = ( shape()->timeToRise() + parameters->timePhase() - jitter - BUNCHSPACE*( parameters->binOfMaximum() - m_phaseShift ) ) ; double binTime ( tzero ) ; EcalSamples& result ( *findSignal( detId ) ) ; const unsigned int rsize ( result.size() ) ; for( unsigned int bin ( 0 ) ; bin != rsize ; ++bin ) { result[ bin ] += (*shape())( binTime )*signal ; binTime += BUNCHSPACE ; } }
CLHEP::RandGaussQ * EcalHitResponse::ranGauss | ( | ) | const [protected] |
Definition at line 68 of file EcalHitResponse.cc.
References m_RandGauss.
Referenced by EBHitResponse::EBHitResponse().
{ return m_RandGauss ; }
CLHEP::RandPoissonQ * EcalHitResponse::ranPois | ( | ) | const [protected] |
Definition at line 62 of file EcalHitResponse.cc.
References m_RandPoisson.
Referenced by analogSignalAmplitude(), and EBHitResponse::apdSignalAmplitude().
{ return m_RandPoisson ; }
void EcalHitResponse::run | ( | MixCollection< PCaloHit > & | hits | ) | [virtual] |
Reimplemented in EBHitResponse.
Definition at line 190 of file EcalHitResponse.cc.
References CaloVHitFilter::accepts(), MixCollection< T >::begin(), blankOutUsedSamples(), MixCollection< T >::end(), edm::isNotFinite(), m_hitFilter, putAnalogSignal(), PCaloHit::time(), and withinBunchRange().
{ blankOutUsedSamples() ; for( MixCollection<PCaloHit>::MixItr hitItr ( hits.begin() ) ; hitItr != hits.end() ; ++hitItr ) { const PCaloHit& hit ( *hitItr ) ; const int bunch ( hitItr.bunch() ) ; if( withinBunchRange(bunch) && !edm::isNotFinite( hit.time() ) && ( 0 == m_hitFilter || m_hitFilter->accepts( hit ) ) ) putAnalogSignal( hit ) ; } }
virtual unsigned int EcalHitResponse::samplesSize | ( | ) | const [pure virtual] |
Implemented in EBHitResponse, EEHitResponse, and ESHitResponse.
virtual unsigned int EcalHitResponse::samplesSizeAll | ( | ) | const [protected, pure virtual] |
Implemented in EBHitResponse, EEHitResponse, and ESHitResponse.
void EcalHitResponse::setBunchRange | ( | int | minBunch, |
int | maxBunch | ||
) |
Definition at line 95 of file EcalHitResponse.cc.
References m_maxBunch, m_minBunch, maxBunch(), and minBunch().
{ m_minBunch = minBunch ; m_maxBunch = maxBunch ; }
void EcalHitResponse::setEventTime | ( | const edm::TimeValue_t & | iTime | ) |
Definition at line 139 of file EcalHitResponse.cc.
References m_iTime.
Referenced by EcalDigiProducer::checkCalibrations().
{ m_iTime = iTime; }
void EcalHitResponse::setGeometry | ( | const CaloSubdetectorGeometry * | geometry | ) |
Definition at line 103 of file EcalHitResponse.cc.
References geometry(), and m_geometry.
Referenced by EcalDigiProducer::updateGeometry().
{ m_geometry = geometry ; }
void EcalHitResponse::setHitCorrection | ( | const CaloVHitCorrection * | hitCorrection | ) |
Definition at line 127 of file EcalHitResponse.cc.
References m_hitCorrection.
{ m_hitCorrection = hitCorrection ; }
void EcalHitResponse::setHitFilter | ( | const CaloVHitFilter * | filter | ) |
Definition at line 121 of file EcalHitResponse.cc.
References alcazmumu_cfi::filter, and m_hitFilter.
{ m_hitFilter = filter ; }
void EcalHitResponse::setLaserConstants | ( | const EcalLaserDbService * | laser, |
bool & | useLCcorrection | ||
) |
Definition at line 145 of file EcalHitResponse.cc.
References m_lasercals, and m_useLCcorrection.
Referenced by EcalDigiProducer::checkCalibrations().
{ m_lasercals = laser; m_useLCcorrection = useLCcorrection; }
void EcalHitResponse::setPECorrection | ( | const CaloVPECorrection * | peCorrection | ) |
Definition at line 133 of file EcalHitResponse.cc.
References m_PECorrection.
{ m_PECorrection = peCorrection ; }
void EcalHitResponse::setPhaseShift | ( | double | phaseShift | ) |
Definition at line 109 of file EcalHitResponse.cc.
References m_phaseShift, and phaseShift().
Referenced by EcalDigiProducer::EcalDigiProducer(), and EcalTBDigiProducer::setPhaseShift().
{ m_phaseShift = phaseShift ; }
const CaloVShape * EcalHitResponse::shape | ( | void | ) | const [protected] |
Definition at line 81 of file EcalHitResponse.cc.
References m_shape.
Referenced by putAnalogSignal().
double EcalHitResponse::timeOfFlight | ( | const DetId & | detId | ) | const [protected] |
Definition at line 281 of file EcalHitResponse.cc.
References geometry(), CaloCellGeometry::getPosition(), and PV3DBase< T, PVType, FrameType >::mag().
Referenced by putAnalogSignal(), and EBHitResponse::putAPDSignal().
{ const CaloCellGeometry* cellGeometry ( geometry()->getGeometry( detId ) ) ; assert( 0 != cellGeometry ) ; return cellGeometry->getPosition().mag()*cm/c_light ; // Units of c_light: mm/ns }
virtual EcalSamples* EcalHitResponse::vSam | ( | unsigned int | i | ) | [protected, pure virtual] |
Implemented in EBHitResponse, EEHitResponse, and ESHitResponse.
virtual const EcalSamples* EcalHitResponse::vSamAll | ( | unsigned int | i | ) | const [protected, pure virtual] |
Implemented in EBHitResponse, EEHitResponse, and ESHitResponse.
virtual EcalSamples* EcalHitResponse::vSamAll | ( | unsigned int | i | ) | [protected, pure virtual] |
Implemented in EBHitResponse, EEHitResponse, and ESHitResponse.
Referenced by blankOutUsedSamples(), findDetId(), and findSignal().
bool EcalHitResponse::withinBunchRange | ( | int | bunchCrossing | ) | const |
Definition at line 173 of file EcalHitResponse.cc.
Referenced by run().
{
return(m_minBunch <= bunchCrossing && m_maxBunch >= bunchCrossing);
}
const CaloSubdetectorGeometry* EcalHitResponse::m_geometry [private] |
Definition at line 132 of file EcalHitResponse.h.
Referenced by geometry(), and setGeometry().
const CaloVHitCorrection* EcalHitResponse::m_hitCorrection [private] |
Definition at line 129 of file EcalHitResponse.h.
Referenced by putAnalogSignal(), and setHitCorrection().
const CaloVHitFilter* EcalHitResponse::m_hitFilter [private] |
Definition at line 131 of file EcalHitResponse.h.
Referenced by add(), hitFilter(), run(), and setHitFilter().
VecInd EcalHitResponse::m_index [private] |
Definition at line 145 of file EcalHitResponse.h.
Referenced by blankOutUsedSamples(), findSignal(), and index().
edm::TimeValue_t EcalHitResponse::m_iTime [private] |
Definition at line 142 of file EcalHitResponse.h.
Referenced by findLaserConstant(), and setEventTime().
const EcalLaserDbService* EcalHitResponse::m_lasercals [private] |
Definition at line 133 of file EcalHitResponse.h.
Referenced by findLaserConstant(), and setLaserConstants().
int EcalHitResponse::m_maxBunch [private] |
Definition at line 139 of file EcalHitResponse.h.
Referenced by maxBunch(), and setBunchRange().
int EcalHitResponse::m_minBunch [private] |
Definition at line 138 of file EcalHitResponse.h.
Referenced by minBunch(), and setBunchRange().
const CaloVSimParameterMap* EcalHitResponse::m_parameterMap [private] |
Definition at line 127 of file EcalHitResponse.h.
Referenced by params().
const CaloVPECorrection* EcalHitResponse::m_PECorrection [private] |
Definition at line 130 of file EcalHitResponse.h.
Referenced by analogSignalAmplitude(), and setPECorrection().
double EcalHitResponse::m_phaseShift [private] |
Definition at line 140 of file EcalHitResponse.h.
Referenced by phaseShift(), putAnalogSignal(), and setPhaseShift().
CLHEP::RandGaussQ* EcalHitResponse::m_RandGauss [mutable, private] |
Definition at line 136 of file EcalHitResponse.h.
Referenced by EcalHitResponse(), ranGauss(), and ~EcalHitResponse().
CLHEP::RandPoissonQ* EcalHitResponse::m_RandPoisson [mutable, private] |
Definition at line 135 of file EcalHitResponse.h.
Referenced by EcalHitResponse(), ranPois(), and ~EcalHitResponse().
const CaloVShape* EcalHitResponse::m_shape [private] |
Definition at line 128 of file EcalHitResponse.h.
Referenced by shape().
bool EcalHitResponse::m_useLCcorrection [private] |
Definition at line 143 of file EcalHitResponse.h.
Referenced by analogSignalAmplitude(), and setLaserConstants().