CMS 3D CMS Logo

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

◆ ESSamples

Definition at line 18 of file ESElectronicsSimFast.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAXADC 
MINADC 

Definition at line 20 of file ESElectronicsSimFast.h.

20 { MAXADC = 4095, MINADC = 0 };

Constructor & Destructor Documentation

◆ ESElectronicsSimFast()

ESElectronicsSimFast::ESElectronicsSimFast ( bool  addNoise,
bool  PreMix1 
)

Definition at line 8 of file ESElectronicsSimFast.cc.

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

◆ ~ESElectronicsSimFast()

ESElectronicsSimFast::~ESElectronicsSimFast ( )

Definition at line 16 of file ESElectronicsSimFast.cc.

16 {}

Member Function Documentation

◆ analogToDigital()

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

Definition at line 24 of file ESElectronicsSimFast.cc.

27  {
28  assert(nullptr != m_peds && nullptr != m_mips && 0 < m_MIPToGeV); // sanity check
29 
30  df.setSize(cs.size());
31 
32  const DetId id(cs.id());
35 
36  const double baseline((double)it_ped->getMean());
37  const double sigma(isNoise ? 0. : (double)it_ped->getRms());
38  const double MIPADC(isNoise ? 0. : (double)(*it_mip));
39  const double ADCGeV(isNoise ? 1. : MIPADC / m_MIPToGeV);
40 
41  int adc = 0;
42  // std::cout<<" **Id="<<ESDetId(df.id())<<", size="<<df.size();
43  for (unsigned int i(0); i != cs.size(); ++i) {
44  const double noi(isNoise || (!m_addNoise) ? 0 : sigma * CLHEP::RandGaussQ::shoot(engine, 0, 1));
45  double signal;
46 
47  if (!m_PreMix1)
48  signal = cs[i] * ADCGeV + noi + baseline;
49  else
50  signal = cs[i] * ADCGeV;
51 
52  if (0 <= signal) {
53  signal += 0.5;
54  } else {
55  signal -= 0.5;
56  }
57 
58  adc = int(signal);
59 
60  if (!m_PreMix1)
61  assert(0 < adc);
62 
63  if (0.5 < signal - adc)
64  ++adc;
65 
66  if (MAXADC < adc) {
67  adc = MAXADC;
68  } else {
69  if (MINADC > adc)
70  adc = MINADC;
71  }
72 
73  df.setSample(i, ESSample(adc));
74  // std::cout<<", "<<df[i];
75  }
76  // std::cout<<std::endl ;
77 }

References ecalMGPA::adc(), cms::cuda::assert(), fwrapper::cs, ESCondObjectContainer< T >::end(), ESCondObjectContainer< T >::find(), ESCondObjectContainer< T >::getMap(), mps_fire::i, triggerObjects_cff::id, createfilelist::int, m_addNoise, m_mips, m_MIPToGeV, m_peds, m_PreMix1, MAXADC, MINADC, ESDataFrame::setSample(), and ESDataFrame::setSize().

◆ newEvent()

void ESElectronicsSimFast::newEvent ( )
inline

Definition at line 33 of file ESElectronicsSimFast.h.

33 {}

◆ setMIPs()

void ESElectronicsSimFast::setMIPs ( const ESIntercalibConstants mips)

Definition at line 20 of file ESElectronicsSimFast.cc.

20 { m_mips = mips; }

References m_mips.

◆ setMIPToGeV()

void ESElectronicsSimFast::setMIPToGeV ( double  MIPToGeV)

Definition at line 22 of file ESElectronicsSimFast.cc.

22 { m_MIPToGeV = MIPToGeV; }

References m_MIPToGeV.

◆ setPedestals()

void ESElectronicsSimFast::setPedestals ( const ESPedestals peds)

Definition at line 18 of file ESElectronicsSimFast.cc.

18 { m_peds = peds; }

References m_peds.

Member Data Documentation

◆ m_addNoise

bool ESElectronicsSimFast::m_addNoise
private

Definition at line 36 of file ESElectronicsSimFast.h.

Referenced by analogToDigital().

◆ m_mips

const ESIntercalibConstants* ESElectronicsSimFast::m_mips
private

Definition at line 44 of file ESElectronicsSimFast.h.

Referenced by analogToDigital(), and setMIPs().

◆ m_MIPToGeV

double ESElectronicsSimFast::m_MIPToGeV
private

Definition at line 40 of file ESElectronicsSimFast.h.

Referenced by analogToDigital(), and setMIPToGeV().

◆ m_peds

const ESPedestals* ESElectronicsSimFast::m_peds
private

Definition at line 42 of file ESElectronicsSimFast.h.

Referenced by analogToDigital(), and setPedestals().

◆ m_PreMix1

bool ESElectronicsSimFast::m_PreMix1
private

Definition at line 38 of file ESElectronicsSimFast.h.

Referenced by analogToDigital().

ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
ESCondObjectContainer::end
const_iterator end() const
Definition: ESCondObjectContainer.h:37
mps_fire.i
i
Definition: mps_fire.py:355
ESElectronicsSimFast::m_peds
const ESPedestals * m_peds
Definition: ESElectronicsSimFast.h:42
fwrapper::cs
unique_ptr< ClusterSequence > cs
Definition: fastjetfortran_madfks.cc:45
ESCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: ESCondObjectContainer.h:33
cms::cuda::assert
assert(be >=bs)
ESElectronicsSimFast::m_mips
const ESIntercalibConstants * m_mips
Definition: ESElectronicsSimFast.h:44
DetId
Definition: DetId.h:17
ESCondObjectContainer< ESPedestal >::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: ESCondObjectContainer.h:17
ESDataFrame::setSize
void setSize(int size)
Definition: ESDataFrame.cc:17
ESSample
Definition: ESSample.h:7
ESDataFrame::setSample
void setSample(int i, const ESSample &sam)
Definition: ESDataFrame.h:28
createfilelist.int
int
Definition: createfilelist.py:10
ESElectronicsSimFast::m_PreMix1
bool m_PreMix1
Definition: ESElectronicsSimFast.h:38
ESCondObjectContainer::getMap
const self & getMap() const
Definition: ESCondObjectContainer.h:41
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ESElectronicsSimFast::MINADC
Definition: ESElectronicsSimFast.h:20
ESElectronicsSimFast::MAXADC
Definition: ESElectronicsSimFast.h:20
ESElectronicsSimFast::m_addNoise
bool m_addNoise
Definition: ESElectronicsSimFast.h:36
ESElectronicsSimFast::m_MIPToGeV
double m_MIPToGeV
Definition: ESElectronicsSimFast.h:40