#include <EBHitResponse.h>
Public Types | |
enum | { kNOffsets = 2000 } |
typedef CaloTSamples< float, 10 > | EBSamples |
typedef std::vector< double > | VecD |
Public Member Functions | |
virtual void | add (const PCaloHit &hit) |
EBHitResponse (const CaloVSimParameterMap *parameterMap, const CaloVShape *shape, bool apdOnly, const APDSimParameters *apdPars, const CaloVShape *apdShape) | |
virtual void | finalizeHits () |
virtual void | initializeHits () |
virtual bool | keepBlank () const |
const VecD & | offsets () const |
virtual EcalSamples * | operator[] (unsigned int i) |
virtual const EcalSamples * | operator[] (unsigned int i) const |
virtual void | run (MixCollection< PCaloHit > &hits) |
virtual unsigned int | samplesSize () const |
void | setIntercal (const EcalIntercalibConstantsMC *ical) |
virtual | ~EBHitResponse () |
Protected Member Functions | |
void | putAPDSignal (const DetId &detId, double npe, double time) |
virtual unsigned int | samplesSizeAll () const |
virtual EcalSamples * | vSam (unsigned int i) |
virtual const EcalSamples * | vSamAll (unsigned int i) const |
virtual EcalSamples * | vSamAll (unsigned int i) |
Private Member Functions | |
const APDSimParameters * | apdParameters () const |
const CaloVShape * | apdShape () const |
double | apdSignalAmplitude (const PCaloHit &hit) const |
void | findIntercalibConstant (const DetId &detId, double &icalconst) const |
const double | nonlFunc (double enr) const |
const double | nonlFunc1 (double energy) const |
Private Attributes | |
std::vector< double > | m_apdNpeVec |
const bool | m_apdOnly |
const APDSimParameters * | m_apdPars |
const CaloVShape * | m_apdShape |
std::vector< double > | m_apdTimeVec |
const EcalIntercalibConstantsMC * | m_intercal |
std::vector< double > | m_timeOffVec |
std::vector< EBSamples > | m_vSam |
const double | pasy |
const double | pcon |
const double | pcub |
const double | pehi |
const double | pelo |
const double | pext |
const double | pfac |
const double | plin |
const double | poff |
const double | pqua |
Definition at line 10 of file EBHitResponse.h.
typedef CaloTSamples<float,10> EBHitResponse::EBSamples |
Definition at line 14 of file EBHitResponse.h.
typedef std::vector<double> EBHitResponse::VecD |
Definition at line 16 of file EBHitResponse.h.
anonymous enum |
EBHitResponse::EBHitResponse | ( | const CaloVSimParameterMap * | parameterMap, |
const CaloVShape * | shape, | ||
bool | apdOnly, | ||
const APDSimParameters * | apdPars = 0 , |
||
const CaloVShape * | apdShape = 0 |
||
) |
Definition at line 14 of file EBHitResponse.cc.
References apdParameters(), DetId::det(), EBDetId::detIdFromDenseIndex(), i, kNOffsets, EBDetId::kSizeForDenseIndexing, m_timeOffVec, m_vSam, Parameters::parameters, EcalHitResponse::ranGauss(), CaloVSimParameterMap::simParameters(), findQualityFiles::size, and DetId::subdetId().
: EcalHitResponse( parameterMap, shape ) , m_apdOnly ( apdOnly ) , m_apdPars ( apdPars ) , m_apdShape ( apdShape ) , m_timeOffVec ( kNOffsets, apdParameters()->timeOffset() ) , pcub ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[0] ) , pqua ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[1] ) , plin ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[2] ) , pcon ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[3] ) , pelo ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[4] ) , pehi ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[5] ) , pasy ( 0 == apdPars ? 0 : apdParameters()->nonlParms()[6] ) , pext ( 0 == apdPars ? 0 : nonlFunc1( pelo ) ) , poff ( 0 == apdPars ? 0 : nonlFunc1( pehi ) ) , pfac ( 0 == apdPars ? 0 : ( pasy - poff )*2./M_PI ) { for( unsigned int i ( 0 ) ; i != kNOffsets ; ++i ) { m_timeOffVec[ i ] += ranGauss()->fire( 0 , apdParameters()->timeOffWidth() ) ; } const EBDetId detId ( EBDetId::detIdFromDenseIndex( 0 ) ) ; const CaloSimParameters& parameters ( parameterMap->simParameters( detId ) ) ; const unsigned int rSize ( parameters.readoutFrameSize() ) ; const unsigned int nPre ( parameters.binOfMaximum() - 1 ) ; const unsigned int size ( EBDetId::kSizeForDenseIndexing ) ; m_vSam.reserve( size ) ; for( unsigned int i ( 0 ) ; i != size ; ++i ) { m_vSam.emplace_back(CaloGenericDetId( detId.det(), detId.subdetId(), i ) , rSize, nPre ); } }
EBHitResponse::~EBHitResponse | ( | ) | [virtual] |
Definition at line 60 of file EBHitResponse.cc.
{ }
void EBHitResponse::add | ( | const PCaloHit & | hit | ) | [virtual] |
Reimplemented from EcalHitResponse.
Definition at line 213 of file EBHitResponse.cc.
References CaloVHitFilter::accepts(), apdParameters(), apdSignalAmplitude(), PCaloHit::depth(), EcalHitResponse::hitFilter(), PCaloHit::id(), edm::isNotFinite(), m_apdNpeVec, m_apdOnly, m_apdTimeVec, EcalHitResponse::putAnalogSignal(), and PCaloHit::time().
{ if (!edm::isNotFinite( hit.time() ) && ( 0 == hitFilter() || hitFilter()->accepts( hit ) ) ) { if( 0 == hit.depth() ) // for now take only nonAPD hits { if( !m_apdOnly ) putAnalogSignal( hit ) ; } else // APD hits here { if( apdParameters()->addToBarrel() || m_apdOnly ) { const unsigned int icell ( EBDetId( hit.id() ).denseIndex() ) ; m_apdNpeVec[ icell ] += apdSignalAmplitude( hit ) ; if( 0 == m_apdTimeVec[ icell ] ) m_apdTimeVec[ icell ] = hit.time() ; } } } }
const APDSimParameters * EBHitResponse::apdParameters | ( | ) | const [private] |
Definition at line 65 of file EBHitResponse.cc.
References m_apdPars.
Referenced by add(), apdSignalAmplitude(), EBHitResponse(), finalizeHits(), and run().
const CaloVShape * EBHitResponse::apdShape | ( | ) | const [private] |
Definition at line 72 of file EBHitResponse.cc.
References m_apdShape.
Referenced by putAPDSignal().
{ assert( 0 != m_apdShape ) ; return m_apdShape ; }
double EBHitResponse::apdSignalAmplitude | ( | const PCaloHit & | hit | ) | const [private] |
Definition at line 113 of file EBHitResponse.cc.
References apdParameters(), PCaloHit::depth(), PCaloHit::energy(), findIntercalibConstant(), PCaloHit::id(), m_apdOnly, m_intercal, EcalHitResponse::ranPois(), APDSimParameters::simToPEHigh(), and APDSimParameters::simToPELow().
Referenced by add(), and run().
{ assert( 1 == hit.depth() || 2 == hit.depth() ) ; double npe ( hit.energy()*( 2 == hit.depth() ? apdParameters()->simToPELow() : apdParameters()->simToPEHigh() ) ) ; // do we need to do Poisson statistics for the photoelectrons? if( apdParameters()->doPEStats() && !m_apdOnly ) npe = ranPois()->fire( npe ) ; assert( 0 != m_intercal ) ; double fac ( 1 ) ; findIntercalibConstant( hit.id(), fac ) ; npe *= fac ; // edm::LogError( "EBHitResponse" ) << "--- # photoelectrons for " /* std::cout << "--- # photoelectrons for " << EBDetId( hit.id() ) <<" is " << npe //; <<std::endl ;*/ return npe ; }
void EBHitResponse::finalizeHits | ( | ) | [virtual] |
Reimplemented from EcalHitResponse.
Definition at line 191 of file EBHitResponse.cc.
References apdParameters(), EBDetId::detIdFromDenseIndex(), i, EBDetId::kSizeForDenseIndexing, m_apdNpeVec, m_apdOnly, m_apdTimeVec, and putAPDSignal().
{ const unsigned int bSize ( EBDetId::kSizeForDenseIndexing ) ; if( apdParameters()->addToBarrel() || m_apdOnly ) { for( unsigned int i ( 0 ) ; i != bSize ; ++i ) { if( 0 < m_apdNpeVec[i] ) { putAPDSignal( EBDetId::detIdFromDenseIndex( i ), m_apdNpeVec[i] , m_apdTimeVec[i] ) ; // now zero out for next time m_apdNpeVec[i] = 0. ; m_apdTimeVec[i] = 0. ; } } } }
void EBHitResponse::findIntercalibConstant | ( | const DetId & | detId, |
double & | icalconst | ||
) | const [private] |
Definition at line 148 of file EBHitResponse.cc.
References EcalCondObjectContainer< T >::getMap(), m_intercal, and DetId::rawId().
Referenced by apdSignalAmplitude().
{ EcalIntercalibConstantMC thisconst ( 1. ) ; if( 0 == m_intercal ) { edm::LogError( "EBHitResponse" ) << "No intercal constant defined for EBHitResponse" ; } else { const EcalIntercalibConstantMCMap& icalMap ( m_intercal->getMap() ) ; EcalIntercalibConstantMCMap::const_iterator icalit ( icalMap.find( detId ) ) ; if( icalit != icalMap.end() ) { thisconst = *icalit ; if ( thisconst == 0. ) thisconst = 1. ; } else { edm::LogError("EBHitResponse") << "No intercalib const found for xtal " << detId.rawId() << "! something wrong with EcalIntercalibConstants in your DB? "; } } icalconst = thisconst ; }
void EBHitResponse::initializeHits | ( | ) | [virtual] |
Reimplemented from EcalHitResponse.
Definition at line 178 of file EBHitResponse.cc.
References EcalHitResponse::blankOutUsedSamples(), EcalHitResponse::index(), EBDetId::kSizeForDenseIndexing, m_apdNpeVec, m_apdTimeVec, and findQualityFiles::size.
{ if( 0 != index().size() ) blankOutUsedSamples() ; const unsigned int bSize ( EBDetId::kSizeForDenseIndexing ) ; if( 0 == m_apdNpeVec.size() ) { m_apdNpeVec = std::vector<double>( bSize, (double)0.0 ) ; m_apdTimeVec = std::vector<double>( bSize, (double)0.0 ) ; } }
virtual bool EBHitResponse::keepBlank | ( | ) | const [inline, virtual] |
const double EBHitResponse::nonlFunc | ( | double | enr | ) | const [inline, private] |
const double EBHitResponse::nonlFunc1 | ( | double | energy | ) | const [inline, private] |
const VecD& EBHitResponse::offsets | ( | ) | const [inline] |
Definition at line 32 of file EBHitResponse.h.
References m_timeOffVec.
Referenced by putAPDSignal().
{ return m_timeOffVec ; }
EcalHitResponse::EcalSamples * EBHitResponse::operator[] | ( | unsigned int | i | ) | [virtual] |
Implements EcalHitResponse.
Definition at line 312 of file EBHitResponse.cc.
const EcalHitResponse::EcalSamples * EBHitResponse::operator[] | ( | unsigned int | i | ) | const [virtual] |
Implements EcalHitResponse.
Definition at line 306 of file EBHitResponse.cc.
void EBHitResponse::putAPDSignal | ( | const DetId & | detId, |
double | npe, | ||
double | time | ||
) | [protected] |
Definition at line 79 of file EBHitResponse.cc.
References apdShape(), newFWLiteAna::bin, CaloSimParameters::binOfMaximum(), EcalHitResponse::BUNCHSPACE, EcalHitResponse::findSignal(), kNOffsets, nonlFunc(), offsets(), Parameters::parameters, EcalHitResponse::params(), EcalHitResponse::phaseShift(), query::result, CaloSimParameters::simHitToPhotoelectrons(), CaloTSamplesBase< Ttype >::size(), EcalHitResponse::timeOfFlight(), and tzero.
Referenced by finalizeHits(), and run().
{ const CaloSimParameters& parameters ( *params( detId ) ) ; const double energyFac ( 1./parameters.simHitToPhotoelectrons( detId ) ) ; // std::cout<<"******** Input APD Npe="<<npe<<", Efactor="<<energyFac // <<", Energy="<<npe*energyFac // <<", nonlFunc="<<nonlFunc( npe*energyFac )<<std::endl ; const double signal ( npe*nonlFunc( npe*energyFac ) ) ; const double jitter ( time - timeOfFlight( detId ) ) ; const double tzero ( apdShape()->timeToRise() - jitter - offsets()[ EBDetId( detId ).denseIndex()%kNOffsets ] - BUNCHSPACE*( parameters.binOfMaximum() - phaseShift() ) ) ; double binTime ( tzero ) ; EcalSamples& result ( *findSignal( detId ) ); for( unsigned int bin ( 0 ) ; bin != result.size(); ++bin ) { result[bin] += (*apdShape())(binTime)*signal ; binTime += BUNCHSPACE ; } }
void EBHitResponse::run | ( | MixCollection< PCaloHit > & | hits | ) | [virtual] |
Reimplemented from EcalHitResponse.
Definition at line 234 of file EBHitResponse.cc.
References CaloVHitFilter::accepts(), apdParameters(), apdSignalAmplitude(), MixCollection< T >::begin(), EcalHitResponse::blankOutUsedSamples(), PCaloHit::depth(), EBDetId::detIdFromDenseIndex(), MixCollection< T >::end(), EcalHitResponse::hitFilter(), i, PCaloHit::id(), EcalHitResponse::index(), edm::isNotFinite(), EBDetId::kSizeForDenseIndexing, m_apdNpeVec, m_apdOnly, m_apdTimeVec, EcalHitResponse::maxBunch(), EcalHitResponse::minBunch(), EcalHitResponse::putAnalogSignal(), putAPDSignal(), findQualityFiles::size, and PCaloHit::time().
{ if( 0 != index().size() ) blankOutUsedSamples() ; const unsigned int bSize ( EBDetId::kSizeForDenseIndexing ) ; if( 0 == m_apdNpeVec.size() ) { m_apdNpeVec = std::vector<double>( bSize, (double)0.0 ) ; m_apdTimeVec = std::vector<double>( bSize, (double)0.0 ) ; } for( MixCollection<PCaloHit>::MixItr hitItr ( hits.begin() ) ; hitItr != hits.end() ; ++hitItr ) { const PCaloHit& hit ( *hitItr ) ; const int bunch ( hitItr.bunch() ) ; if( minBunch() <= bunch && maxBunch() >= bunch && !edm::isNotFinite( hit.time() ) && ( 0 == hitFilter() || hitFilter()->accepts( hit ) ) ) { if( 0 == hit.depth() ) // for now take only nonAPD hits { if( !m_apdOnly ) putAnalogSignal( hit ) ; } else // APD hits here { if( apdParameters()->addToBarrel() || m_apdOnly ) { const unsigned int icell ( EBDetId( hit.id() ).denseIndex() ) ; m_apdNpeVec[ icell ] += apdSignalAmplitude( hit ) ; if( 0 == m_apdTimeVec[ icell ] ) m_apdTimeVec[ icell ] = hit.time() ; } } } } if( apdParameters()->addToBarrel() || m_apdOnly ) { for( unsigned int i ( 0 ) ; i != bSize ; ++i ) { if( 0 < m_apdNpeVec[i] ) { putAPDSignal( EBDetId::detIdFromDenseIndex( i ), m_apdNpeVec[i] , m_apdTimeVec[i] ) ; // now zero out for next time m_apdNpeVec[i] = 0. ; m_apdTimeVec[i] = 0. ; } } } }
unsigned int EBHitResponse::samplesSize | ( | ) | const [virtual] |
Implements EcalHitResponse.
Definition at line 294 of file EBHitResponse.cc.
References m_vSam.
{ return m_vSam.size() ; }
unsigned int EBHitResponse::samplesSizeAll | ( | ) | const [protected, virtual] |
Implements EcalHitResponse.
Definition at line 300 of file EBHitResponse.cc.
References m_vSam.
{ return m_vSam.size() ; }
void EBHitResponse::setIntercal | ( | const EcalIntercalibConstantsMC * | ical | ) |
Definition at line 142 of file EBHitResponse.cc.
References m_intercal.
Referenced by EcalDigiProducer::checkCalibrations().
{ m_intercal = ical ; }
EcalHitResponse::EcalSamples * EBHitResponse::vSam | ( | unsigned int | i | ) | [protected, virtual] |
Implements EcalHitResponse.
Definition at line 318 of file EBHitResponse.cc.
EcalHitResponse::EcalSamples * EBHitResponse::vSamAll | ( | unsigned int | i | ) | [protected, virtual] |
Implements EcalHitResponse.
Definition at line 324 of file EBHitResponse.cc.
const EcalHitResponse::EcalSamples * EBHitResponse::vSamAll | ( | unsigned int | i | ) | const [protected, virtual] |
Implements EcalHitResponse.
Definition at line 330 of file EBHitResponse.cc.
std::vector<double> EBHitResponse::m_apdNpeVec [private] |
Definition at line 88 of file EBHitResponse.h.
Referenced by add(), finalizeHits(), initializeHits(), and run().
const bool EBHitResponse::m_apdOnly [private] |
Definition at line 81 of file EBHitResponse.h.
Referenced by add(), apdSignalAmplitude(), finalizeHits(), and run().
const APDSimParameters* EBHitResponse::m_apdPars [private] |
Definition at line 82 of file EBHitResponse.h.
Referenced by apdParameters().
const CaloVShape* EBHitResponse::m_apdShape [private] |
Definition at line 83 of file EBHitResponse.h.
Referenced by apdShape().
std::vector<double> EBHitResponse::m_apdTimeVec [private] |
Definition at line 89 of file EBHitResponse.h.
Referenced by add(), finalizeHits(), initializeHits(), and run().
const EcalIntercalibConstantsMC* EBHitResponse::m_intercal [private] |
Definition at line 84 of file EBHitResponse.h.
Referenced by apdSignalAmplitude(), findIntercalibConstant(), and setIntercal().
std::vector<double> EBHitResponse::m_timeOffVec [private] |
Definition at line 86 of file EBHitResponse.h.
Referenced by EBHitResponse(), and offsets().
std::vector<EBSamples> EBHitResponse::m_vSam [private] |
Definition at line 93 of file EBHitResponse.h.
Referenced by EBHitResponse(), operator[](), samplesSize(), samplesSizeAll(), vSam(), and vSamAll().
const double EBHitResponse::pasy [private] |
Definition at line 91 of file EBHitResponse.h.
const double EBHitResponse::pcon [private] |
Definition at line 91 of file EBHitResponse.h.
Referenced by nonlFunc1().
const double EBHitResponse::pcub [private] |
Definition at line 91 of file EBHitResponse.h.
Referenced by nonlFunc1().
const double EBHitResponse::pehi [private] |
Definition at line 91 of file EBHitResponse.h.
Referenced by nonlFunc().
const double EBHitResponse::pelo [private] |
Definition at line 91 of file EBHitResponse.h.
Referenced by nonlFunc().
const double EBHitResponse::pext [private] |
Definition at line 91 of file EBHitResponse.h.
Referenced by nonlFunc().
const double EBHitResponse::pfac [private] |
Definition at line 91 of file EBHitResponse.h.
Referenced by nonlFunc().
const double EBHitResponse::plin [private] |
Definition at line 91 of file EBHitResponse.h.
Referenced by nonlFunc1().
const double EBHitResponse::poff [private] |
Definition at line 91 of file EBHitResponse.h.
Referenced by nonlFunc().
const double EBHitResponse::pqua [private] |
Definition at line 91 of file EBHitResponse.h.
Referenced by nonlFunc1().