#include <ESElectronicsSimFast.h>
Public Types | |
enum | { MAXADC = 4095, MINADC = 0 } |
typedef CaloTSamples< float, 3 > | ESSamples |
Public Member Functions | |
void | analogToDigital (ESSamples &cs, ESDataFrame &df, bool isNoise=false) const |
ESElectronicsSimFast (bool addNoise) | |
void | newEvent () |
void | setMIPs (const ESIntercalibConstants *mips) |
void | setMIPToGeV (double MIPToGeV) |
void | setPedestals (const ESPedestals *peds) |
~ESElectronicsSimFast () | |
Private Attributes | |
bool | m_addNoise |
const ESIntercalibConstants * | m_mips |
double | m_MIPToGeV |
const ESPedestals * | m_peds |
CLHEP::RandGaussQ * | m_ranGau |
Definition at line 15 of file ESElectronicsSimFast.h.
typedef CaloTSamples<float,3> ESElectronicsSimFast::ESSamples |
Definition at line 19 of file ESElectronicsSimFast.h.
anonymous enum |
Definition at line 21 of file ESElectronicsSimFast.h.
ESElectronicsSimFast::ESElectronicsSimFast | ( | bool | addNoise | ) |
Definition at line 11 of file ESElectronicsSimFast.cc.
References Exception, edm::Service< T >::isAvailable(), m_addNoise, and m_ranGau.
: m_addNoise ( addNoise ) , m_MIPToGeV ( 0 ) , m_peds ( 0 ) , m_mips ( 0 ) , m_ranGau ( 0 ) { // Preshower "Fast" Electronics Simulation // gain = 1 : low gain for data taking // gain = 2 : high gain for calibration and low energy runs // For 300(310/320) um Si, the MIP is 78.47(81.08/83.7) keV if( m_addNoise ) { edm::Service<edm::RandomNumberGenerator> rng; if( !rng.isAvailable() ) { throw cms::Exception("Configuration") << "ESElectroncSimFast 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_ranGau = new CLHEP::RandGaussQ( rng->getEngine(), 0, 1 ) ; } }
ESElectronicsSimFast::~ESElectronicsSimFast | ( | ) |
void ESElectronicsSimFast::analogToDigital | ( | ESSamples & | cs, |
ESDataFrame & | df, | ||
bool | isNoise = false |
||
) | const |
Definition at line 61 of file ESElectronicsSimFast.cc.
References ecalMGPA::adc(), ESCondObjectContainer< T >::find(), ESCondObjectContainer< T >::getMap(), i, CaloTSamplesBase< Ttype >::id(), errorMatrix2Lands_multiChannel::id, m_addNoise, m_mips, m_MIPToGeV, m_peds, m_ranGau, MAXADC, MINADC, ESDataFrame::setSample(), ESDataFrame::setSize(), and CaloTSamplesBase< Ttype >::size().
{ assert( 0 != m_peds && 0 != m_mips && 0 < m_MIPToGeV ) ; // sanity check assert( ( !m_addNoise ) || 0 != m_ranGau ) ; // sanity check df.setSize( cs.size() ) ; const DetId id ( cs.id() ) ; ESPedestals::const_iterator it_ped ( m_peds->find( id ) ) ; ESIntercalibConstantMap::const_iterator it_mip ( isNoise ? m_mips->getMap().end() : m_mips->getMap().find( id ) ) ; const double baseline ( (double) it_ped->getMean() ) ; const double sigma ( isNoise ? 0. : (double) it_ped->getRms() ) ; const double MIPADC ( isNoise ? 0. : (double) (*it_mip) ) ; const double ADCGeV ( isNoise ? 1. : MIPADC/m_MIPToGeV ) ; int adc = 0 ; // std::cout<<" **Id="<<ESDetId(df.id())<<", size="<<df.size(); for( unsigned int i ( 0 ) ; i != cs.size(); ++i ) { const double noi ( isNoise || (!m_addNoise) ? 0 : sigma*m_ranGau->fire() ) ; double signal = cs[i]*ADCGeV + noi + baseline ; if( 0 <= signal ) { signal += 0.5 ; } else { signal -= 0.5 ; } adc = int( signal ) ; assert( 0 < adc ) ; if( 0.5 < signal - adc ) ++adc ; if( MAXADC < adc ) { adc = MAXADC ; } else { if( MINADC > adc ) adc = MINADC ; } df.setSample( i, ESSample( adc ) ) ; // std::cout<<", "<<df[i]; } // std::cout<<std::endl ; }
void ESElectronicsSimFast::newEvent | ( | ) | [inline] |
Definition at line 37 of file ESElectronicsSimFast.h.
{}
void ESElectronicsSimFast::setMIPs | ( | const ESIntercalibConstants * | mips | ) |
Definition at line 49 of file ESElectronicsSimFast.cc.
References m_mips.
Referenced by EcalDigiProducer::checkCalibrations().
{ m_mips = mips ; }
void ESElectronicsSimFast::setMIPToGeV | ( | double | MIPToGeV | ) |
Definition at line 55 of file ESElectronicsSimFast.cc.
References m_MIPToGeV.
Referenced by EcalDigiProducer::checkCalibrations().
{ m_MIPToGeV = MIPToGeV ; }
void ESElectronicsSimFast::setPedestals | ( | const ESPedestals * | peds | ) |
Definition at line 43 of file ESElectronicsSimFast.cc.
References m_peds.
Referenced by EcalDigiProducer::checkCalibrations().
{ m_peds = peds ; }
bool ESElectronicsSimFast::m_addNoise [private] |
Definition at line 41 of file ESElectronicsSimFast.h.
Referenced by analogToDigital(), and ESElectronicsSimFast().
const ESIntercalibConstants* ESElectronicsSimFast::m_mips [private] |
Definition at line 47 of file ESElectronicsSimFast.h.
Referenced by analogToDigital(), and setMIPs().
double ESElectronicsSimFast::m_MIPToGeV [private] |
Definition at line 43 of file ESElectronicsSimFast.h.
Referenced by analogToDigital(), and setMIPToGeV().
const ESPedestals* ESElectronicsSimFast::m_peds [private] |
Definition at line 45 of file ESElectronicsSimFast.h.
Referenced by analogToDigital(), and setPedestals().
CLHEP::RandGaussQ* ESElectronicsSimFast::m_ranGau [private] |
Definition at line 49 of file ESElectronicsSimFast.h.
Referenced by analogToDigital(), ESElectronicsSimFast(), and ~ESElectronicsSimFast().