test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
ESElectronicsSimFast Class Reference

#include <ESElectronicsSimFast.h>

Public Types

enum  { MAXADC = 4095, MINADC = 0 }
 
typedef CaloTSamples< float, 3 > ESSamples
 

Public Member Functions

void analogToDigital (CLHEP::HepRandomEngine *, ESSamples &cs, ESDataFrame &df, bool isNoise=false) const
 
 ESElectronicsSimFast (bool addNoise, bool PreMix1)
 
void newEvent ()
 
void setMIPs (const ESIntercalibConstants *mips)
 
void setMIPToGeV (double MIPToGeV)
 
void setPedestals (const ESPedestals *peds)
 
 ~ESElectronicsSimFast ()
 

Private Attributes

bool m_addNoise
 
const ESIntercalibConstantsm_mips
 
double m_MIPToGeV
 
const ESPedestalsm_peds
 
bool m_PreMix1
 

Detailed Description

Definition at line 16 of file ESElectronicsSimFast.h.

Member Typedef Documentation

Definition at line 20 of file ESElectronicsSimFast.h.

Member Enumeration Documentation

anonymous enum
Enumerator
MAXADC 
MINADC 

Definition at line 22 of file ESElectronicsSimFast.h.

Constructor & Destructor Documentation

ESElectronicsSimFast::ESElectronicsSimFast ( bool  addNoise,
bool  PreMix1 
)

Definition at line 8 of file ESElectronicsSimFast.cc.

8  :
9  m_addNoise ( addNoise ) ,
10  m_PreMix1 ( PreMix1 ) ,
11  m_MIPToGeV ( 0 ) ,
12  m_peds ( 0 ) ,
13  m_mips ( 0 )
14 {
15  // Preshower "Fast" Electronics Simulation
16  // gain = 1 : low gain for data taking
17  // gain = 2 : high gain for calibration and low energy runs
18  // For 300(310/320) um Si, the MIP is 78.47(81.08/83.7) keV
19 }
const ESIntercalibConstants * m_mips
const ESPedestals * m_peds
ESElectronicsSimFast::~ESElectronicsSimFast ( )

Definition at line 21 of file ESElectronicsSimFast.cc.

22 {
23 }

Member Function Documentation

void ESElectronicsSimFast::analogToDigital ( CLHEP::HepRandomEngine *  engine,
ESSamples cs,
ESDataFrame df,
bool  isNoise = false 
) const

Definition at line 44 of file ESElectronicsSimFast.cc.

References ecalMGPA::adc(), assert(), ESCondObjectContainer< T >::end(), ESCondObjectContainer< T >::find(), ESCondObjectContainer< T >::getMap(), i, CaloTSamplesBase< Ttype >::id(), m_addNoise, m_mips, m_MIPToGeV, m_peds, m_PreMix1, MAXADC, MINADC, ESDataFrame::setSample(), ESDataFrame::setSize(), and CaloTSamplesBase< Ttype >::size().

48 {
49  assert( 0 != m_peds &&
50  0 != m_mips &&
51  0 < m_MIPToGeV ) ; // sanity check
52 
53  df.setSize( cs.size() ) ;
54 
55  const DetId id ( cs.id() ) ;
56  ESPedestals::const_iterator it_ped ( m_peds->find( id ) ) ;
58  isNoise ? m_mips->getMap().end() : m_mips->getMap().find( id ) ) ;
59 
60  const double baseline ( (double) it_ped->getMean() ) ;
61  const double sigma ( isNoise ? 0. : (double) it_ped->getRms() ) ;
62  const double MIPADC ( isNoise ? 0. : (double) (*it_mip) ) ;
63  const double ADCGeV ( isNoise ? 1. : MIPADC/m_MIPToGeV ) ;
64 
65  int adc = 0 ;
66 // std::cout<<" **Id="<<ESDetId(df.id())<<", size="<<df.size();
67  for( unsigned int i ( 0 ) ; i != cs.size(); ++i )
68  {
69  const double noi ( isNoise || (!m_addNoise) ? 0 :
70  sigma*CLHEP::RandGaussQ::shoot(engine, 0, 1) ) ;
71  double signal;
72 
73  if(!m_PreMix1) signal = cs[i]*ADCGeV + noi + baseline ;
74  else signal = cs[i]*ADCGeV ;
75 
76  if( 0 <= signal )
77  {
78  signal += 0.5 ;
79  }
80  else
81  {
82  signal -= 0.5 ;
83  }
84 
85  adc = int( signal ) ;
86 
87  if(!m_PreMix1) assert( 0 < adc ) ;
88 
89  if( 0.5 < signal - adc ) ++adc ;
90 
91  if( MAXADC < adc )
92  {
93  adc = MAXADC ;
94  }
95  else
96  {
97  if( MINADC > adc ) adc = MINADC ;
98  }
99 
100  df.setSample( i, ESSample( adc ) ) ;
101 // std::cout<<", "<<df[i];
102  }
103 // std::cout<<std::endl ;
104 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
auto_ptr< ClusterSequence > cs
const ESIntercalibConstants * m_mips
const_iterator end() const
const self & getMap() const
assert(m_qm.get())
void setSize(int size)
Definition: ESDataFrame.cc:27
const_iterator find(uint32_t rawId) const
void setSample(int i, const ESSample &sam)
Definition: ESDataFrame.h:30
Definition: DetId.h:18
const ESPedestals * m_peds
std::vector< Item >::const_iterator const_iterator
void ESElectronicsSimFast::newEvent ( )
inline

Definition at line 39 of file ESElectronicsSimFast.h.

39 {}
void ESElectronicsSimFast::setMIPs ( const ESIntercalibConstants mips)

Definition at line 32 of file ESElectronicsSimFast.cc.

References m_mips.

33 {
34  m_mips = mips ;
35 }
const ESIntercalibConstants * m_mips
void ESElectronicsSimFast::setMIPToGeV ( double  MIPToGeV)

Definition at line 38 of file ESElectronicsSimFast.cc.

References m_MIPToGeV.

39 {
40  m_MIPToGeV = MIPToGeV ;
41 }
void ESElectronicsSimFast::setPedestals ( const ESPedestals peds)

Definition at line 26 of file ESElectronicsSimFast.cc.

References m_peds.

27 {
28  m_peds = peds ;
29 }
const ESPedestals * m_peds

Member Data Documentation

bool ESElectronicsSimFast::m_addNoise
private

Definition at line 45 of file ESElectronicsSimFast.h.

Referenced by analogToDigital().

const ESIntercalibConstants* ESElectronicsSimFast::m_mips
private

Definition at line 53 of file ESElectronicsSimFast.h.

Referenced by analogToDigital(), and setMIPs().

double ESElectronicsSimFast::m_MIPToGeV
private

Definition at line 49 of file ESElectronicsSimFast.h.

Referenced by analogToDigital(), and setMIPToGeV().

const ESPedestals* ESElectronicsSimFast::m_peds
private

Definition at line 51 of file ESElectronicsSimFast.h.

Referenced by analogToDigital(), and setPedestals().

bool ESElectronicsSimFast::m_PreMix1
private

Definition at line 47 of file ESElectronicsSimFast.h.

Referenced by analogToDigital().