Creates electronics signals from hits. More...
#include <CaloHitRespoNew.h>
Public Types | |
enum | { BUNCHSPACE = 25 } |
typedef std::vector< unsigned int > | VecInd |
typedef std::vector< CaloSamples > | VecSam |
Public Member Functions | |
CaloHitRespoNew (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape) | |
const CaloSamples & | operator[] (unsigned int i) const |
virtual void | run (MixCollection< PCaloHit > &hits) |
unsigned int | samplesSize () const |
void | setBunchRange (int minBunch, int maxBunch) |
void | setGeometry (const CaloSubdetectorGeometry *geometry) |
void | setHitCorrection (const CaloVHitCorrection *hitCorrection) |
void | setHitFilter (const CaloVHitFilter *filter) |
void | setPECorrection (const CaloVPECorrection *peCorrection) |
void | setPhaseShift (double phaseShift) |
virtual void | setRandomEngine (CLHEP::HepRandomEngine &engine) const |
virtual | ~CaloHitRespoNew () |
Protected Member Functions | |
double | analogSignalAmplitude (const PCaloHit &hit) const |
void | blankOutUsedSamples () |
CaloSamples * | findSignal (const DetId &detId) |
const CaloSubdetectorGeometry * | geometry () 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 |
void | setupSamples (const DetId &detId) |
const CaloVShape * | shape () const |
double | timeOfFlight (const DetId &detId) const |
Private Attributes | |
const CaloSubdetectorGeometry * | m_geometry |
const CaloVHitCorrection * | m_hitCorrection |
const CaloVHitFilter * | m_hitFilter |
VecInd | m_index |
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 |
bool | m_setup |
const CaloVShape * | m_shape |
VecSam | m_vSamp |
Creates electronics signals from hits.
Definition at line 34 of file CaloHitRespoNew.h.
typedef std::vector< unsigned int > CaloHitRespoNew::VecInd |
Definition at line 39 of file CaloHitRespoNew.h.
typedef std::vector< CaloSamples > CaloHitRespoNew::VecSam |
Definition at line 38 of file CaloHitRespoNew.h.
anonymous enum |
CaloHitRespoNew::CaloHitRespoNew | ( | const CaloVSimParameterMap * | parameterMap, |
const CaloVShape * | shape | ||
) |
Definition at line 23 of file CaloHitRespoNew.cc.
: m_parameterMap ( parameterMap ) , m_shape ( shape ) , m_hitCorrection ( 0 ) , m_PECorrection ( 0 ) , m_hitFilter ( 0 ) , m_geometry ( 0 ) , m_RandPoisson ( 0 ) , m_RandGauss ( 0 ) , m_minBunch ( -10 ) , m_maxBunch ( 10 ) , m_phaseShift ( 1 ) , m_setup ( false ) { }
CaloHitRespoNew::~CaloHitRespoNew | ( | ) | [virtual] |
Definition at line 40 of file CaloHitRespoNew.cc.
References m_RandGauss, and m_RandPoisson.
{ delete m_RandPoisson ; delete m_RandGauss ; }
double CaloHitRespoNew::analogSignalAmplitude | ( | const PCaloHit & | hit | ) | const [protected] |
Definition at line 264 of file CaloHitRespoNew.cc.
References CaloVPECorrection::correctPE(), PCaloHit::energy(), PCaloHit::id(), m_PECorrection, Parameters::parameters, params(), and ranPois().
Referenced by putAnalogSignal().
{ const DetId& detId ( hit.id() ) ; 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 double npe ( hit.energy()*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 CaloHitRespoNew::blankOutUsedSamples | ( | ) | [protected] |
Definition at line 189 of file CaloHitRespoNew.cc.
References i, m_index, m_vSamp, and findQualityFiles::size.
Referenced by run().
CaloSamples * CaloHitRespoNew::findSignal | ( | const DetId & | detId | ) | [protected] |
Definition at line 256 of file CaloHitRespoNew.cc.
References CaloSamples::isBlank(), m_index, m_vSamp, and query::result.
Referenced by putAnalogSignal(), and EBHitResponse::putAnalogSignal().
{ CaloSamples& result ( m_vSamp[ CaloGenericDetId( detId ).denseIndex() ] ) ; if( result.isBlank() ) m_index.push_back( &result - &m_vSamp.front() ) ; return &result ; }
const CaloSubdetectorGeometry * CaloHitRespoNew::geometry | ( | ) | const [protected] |
Definition at line 97 of file CaloHitRespoNew.cc.
References m_geometry.
Referenced by setGeometry(), and timeOfFlight().
{ assert( 0 != m_geometry ) ; return m_geometry ; }
const CaloSamples & CaloHitRespoNew::operator[] | ( | unsigned int | i | ) | const |
const CaloSimParameters * CaloHitRespoNew::params | ( | const DetId & | detId | ) | const [protected] |
Definition at line 83 of file CaloHitRespoNew.cc.
References m_parameterMap, and CaloVSimParameterMap::simParameters().
Referenced by analogSignalAmplitude(), putAnalogSignal(), EBHitResponse::putAnalogSignal(), and setupSamples().
{ assert( 0 != m_parameterMap ) ; return &m_parameterMap->simParameters( detId ) ; }
double CaloHitRespoNew::phaseShift | ( | ) | const [protected] |
Definition at line 124 of file CaloHitRespoNew.cc.
References m_phaseShift.
Referenced by EBHitResponse::putAnalogSignal(), and setPhaseShift().
{ return m_phaseShift ; }
void CaloHitRespoNew::putAnalogSignal | ( | const PCaloHit & | inputHit | ) | [protected, virtual] |
Reimplemented in EBHitResponse.
Definition at line 223 of file CaloHitRespoNew.cc.
References analogSignalAmplitude(), newFWLiteAna::bin, BUNCHSPACE, CaloVHitCorrection::correct(), findSignal(), PCaloHit::id(), m_hitCorrection, m_phaseShift, Parameters::parameters, params(), query::result, shape(), CaloSamples::size(), PCaloHit::time(), timeOfFlight(), CaloVShape::timeToRise(), and tzero.
Referenced by EBHitResponse::putAnalogSignal(), and run().
{ PCaloHit hit ( inputHit ) ; if( 0 != m_hitCorrection ) m_hitCorrection->correct( hit ) ; const DetId detId ( hit.id() ) ; const CaloSimParameters* parameters ( params( detId ) ) ; const double signal ( analogSignalAmplitude( hit ) ) ; const double jitter ( hit.time() - timeOfFlight( detId ) ) ; const double tzero = ( shape()->timeToRise() + parameters->timePhase() - jitter - BUNCHSPACE*( parameters->binOfMaximum() - m_phaseShift ) ) ; double binTime ( tzero ) ; CaloSamples& 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 * CaloHitRespoNew::ranGauss | ( | ) | const [protected] |
Definition at line 65 of file CaloHitRespoNew.cc.
References Exception, edm::Service< T >::isAvailable(), and m_RandGauss.
Referenced by EBHitResponse::EBHitResponse().
{ if( 0 == m_RandGauss ) { edm::Service<edm::RandomNumberGenerator> rng ; if ( !rng.isAvailable() ) { throw cms::Exception("Configuration") << "CaloHitRespoNew 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_RandGauss = new CLHEP::RandGaussQ( rng->getEngine() ); } return m_RandGauss ; }
CLHEP::RandPoissonQ * CaloHitRespoNew::ranPois | ( | ) | const [protected] |
Definition at line 47 of file CaloHitRespoNew.cc.
References Exception, edm::Service< T >::isAvailable(), and m_RandPoisson.
Referenced by analogSignalAmplitude(), and EBHitResponse::apdSignalAmplitude().
{ if( 0 == m_RandPoisson ) { edm::Service<edm::RandomNumberGenerator> rng ; if ( !rng.isAvailable() ) { throw cms::Exception("Configuration") << "CaloHitRespoNew 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() ); } return m_RandPoisson ; }
void CaloHitRespoNew::run | ( | MixCollection< PCaloHit > & | hits | ) | [virtual] |
Definition at line 202 of file CaloHitRespoNew.cc.
References CaloVHitFilter::accepts(), MixCollection< T >::begin(), blankOutUsedSamples(), MixCollection< T >::end(), edm::detail::isnan(), m_hitFilter, m_index, m_maxBunch, m_minBunch, m_setup, putAnalogSignal(), setupSamples(), MixCollection< T >::size(), and PCaloHit::time().
{ if( !m_setup && 0 < hits.size() ) setupSamples( hits.begin()->id() ) ; if( 0 != m_index.size() ) blankOutUsedSamples() ; for( MixCollection<PCaloHit>::MixItr hitItr ( hits.begin() ) ; hitItr != hits.end() ; ++hitItr ) { const PCaloHit& hit ( *hitItr ) ; const int bunch ( hitItr.bunch() ) ; if( m_minBunch <= bunch && m_maxBunch >= bunch && !isnan( hit.time() ) && ( 0 == m_hitFilter || m_hitFilter->accepts( hit ) ) ) putAnalogSignal( hit ) ; } }
unsigned int CaloHitRespoNew::samplesSize | ( | ) | const |
void CaloHitRespoNew::setBunchRange | ( | int | minBunch, |
int | maxBunch | ||
) |
Definition at line 104 of file CaloHitRespoNew.cc.
References m_maxBunch, and m_minBunch.
{ m_minBunch = minBunch ; m_maxBunch = maxBunch ; }
void CaloHitRespoNew::setGeometry | ( | const CaloSubdetectorGeometry * | geometry | ) |
Definition at line 112 of file CaloHitRespoNew.cc.
References geometry(), and m_geometry.
Referenced by EcalTBDigiProducer::produce(), and EcalDigiProducer::updateGeometry().
{ m_geometry = geometry ; }
void CaloHitRespoNew::setHitCorrection | ( | const CaloVHitCorrection * | hitCorrection | ) |
Definition at line 136 of file CaloHitRespoNew.cc.
References m_hitCorrection.
{ m_hitCorrection = hitCorrection ; }
void CaloHitRespoNew::setHitFilter | ( | const CaloVHitFilter * | filter | ) |
Definition at line 130 of file CaloHitRespoNew.cc.
References align_tpl::filter, and m_hitFilter.
{ m_hitFilter = filter ; }
void CaloHitRespoNew::setPECorrection | ( | const CaloVPECorrection * | peCorrection | ) |
Definition at line 142 of file CaloHitRespoNew.cc.
References m_PECorrection.
{ m_PECorrection = peCorrection ; }
void CaloHitRespoNew::setPhaseShift | ( | double | phaseShift | ) |
Definition at line 118 of file CaloHitRespoNew.cc.
References m_phaseShift, and phaseShift().
Referenced by EcalDigiProducer::EcalDigiProducer(), and EcalTBDigiProducer::setPhaseShift().
{ m_phaseShift = phaseShift ; }
void CaloHitRespoNew::setRandomEngine | ( | CLHEP::HepRandomEngine & | engine | ) | const [virtual] |
Definition at line 148 of file CaloHitRespoNew.cc.
References m_RandGauss, and m_RandPoisson.
{ m_RandPoisson = new CLHEP::RandPoissonQ( engine ) ; m_RandGauss = new CLHEP::RandGaussQ( engine ) ; }
void CaloHitRespoNew::setupSamples | ( | const DetId & | detId | ) | [protected] |
Definition at line 168 of file CaloHitRespoNew.cc.
References CaloSimParameters::binOfMaximum(), DetId::det(), i, m_setup, m_vSamp, Parameters::parameters, params(), CaloSimParameters::readoutFrameSize(), findQualityFiles::size, DetId::subdetId(), and funct::true.
Referenced by run().
{ const CaloSimParameters& parameters ( *params( detId ) ) ; const unsigned int rSize ( parameters.readoutFrameSize() ) ; const unsigned int nPre ( parameters.binOfMaximum() - 1 ) ; m_vSamp = VecSam( CaloGenericDetId( detId ).sizeForDenseIndexing() ) ; const unsigned int size ( m_vSamp.size() ) ; for( unsigned int i ( 0 ) ; i != size ; ++i ) { m_vSamp[ i ].setDetId( CaloGenericDetId( detId.det(), detId.subdetId(), i ) ) ; m_vSamp[ i ].setSize( rSize ) ; m_vSamp[ i ].setPresamples( nPre ) ; } m_setup = true ; }
const CaloVShape * CaloHitRespoNew::shape | ( | ) | const [protected] |
Definition at line 90 of file CaloHitRespoNew.cc.
References m_shape.
Referenced by putAnalogSignal().
double CaloHitRespoNew::timeOfFlight | ( | const DetId & | detId | ) | const [protected] |
Definition at line 284 of file CaloHitRespoNew.cc.
References geometry(), CaloCellGeometry::getPosition(), and PV3DBase< T, PVType, FrameType >::mag().
Referenced by putAnalogSignal(), and EBHitResponse::putAnalogSignal().
{ const CaloCellGeometry* cellGeometry ( geometry()->getGeometry( detId ) ) ; assert( 0 != cellGeometry ) ; return cellGeometry->getPosition().mag()*cm/c_light ; // Units of c_light: mm/ns }
const CaloSubdetectorGeometry* CaloHitRespoNew::m_geometry [private] |
Definition at line 102 of file CaloHitRespoNew.h.
Referenced by geometry(), and setGeometry().
const CaloVHitCorrection* CaloHitRespoNew::m_hitCorrection [private] |
Definition at line 99 of file CaloHitRespoNew.h.
Referenced by putAnalogSignal(), and setHitCorrection().
const CaloVHitFilter* CaloHitRespoNew::m_hitFilter [private] |
Definition at line 101 of file CaloHitRespoNew.h.
Referenced by run(), and setHitFilter().
VecInd CaloHitRespoNew::m_index [private] |
Definition at line 114 of file CaloHitRespoNew.h.
Referenced by blankOutUsedSamples(), findSignal(), and run().
int CaloHitRespoNew::m_maxBunch [private] |
Definition at line 109 of file CaloHitRespoNew.h.
Referenced by run(), and setBunchRange().
int CaloHitRespoNew::m_minBunch [private] |
Definition at line 108 of file CaloHitRespoNew.h.
Referenced by run(), and setBunchRange().
const CaloVSimParameterMap* CaloHitRespoNew::m_parameterMap [private] |
Definition at line 97 of file CaloHitRespoNew.h.
Referenced by params().
const CaloVPECorrection* CaloHitRespoNew::m_PECorrection [private] |
Definition at line 100 of file CaloHitRespoNew.h.
Referenced by analogSignalAmplitude(), and setPECorrection().
double CaloHitRespoNew::m_phaseShift [private] |
Definition at line 110 of file CaloHitRespoNew.h.
Referenced by phaseShift(), putAnalogSignal(), and setPhaseShift().
CLHEP::RandGaussQ* CaloHitRespoNew::m_RandGauss [mutable, private] |
Definition at line 106 of file CaloHitRespoNew.h.
Referenced by ranGauss(), setRandomEngine(), and ~CaloHitRespoNew().
CLHEP::RandPoissonQ* CaloHitRespoNew::m_RandPoisson [mutable, private] |
Definition at line 104 of file CaloHitRespoNew.h.
Referenced by ranPois(), setRandomEngine(), and ~CaloHitRespoNew().
bool CaloHitRespoNew::m_setup [private] |
Definition at line 111 of file CaloHitRespoNew.h.
Referenced by run(), and setupSamples().
const CaloVShape* CaloHitRespoNew::m_shape [private] |
Definition at line 98 of file CaloHitRespoNew.h.
Referenced by shape().
VecSam CaloHitRespoNew::m_vSamp [private] |
Definition at line 113 of file CaloHitRespoNew.h.
Referenced by blankOutUsedSamples(), findSignal(), operator[](), samplesSize(), and setupSamples().