BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEmcWaveform Class Reference

#include <BesEmcWaveform.hh>

Public Member Functions

 BesEmcWaveform ()
 
 BesEmcWaveform (G4long, G4double, G4double)
 
virtual ~BesEmcWaveform ()
 
G4double & operator[] (G4long) const
 
virtual BesEmcWaveformoperator*= (const G4double &)
 
virtual BesEmcWaveformoperator/= (const G4double &)
 
virtual BesEmcWaveformoperator+= (const BesEmcWaveform &)
 
virtual BesEmcWaveformoperator= (const BesEmcWaveform &)
 
G4long length () const
 
G4double * GetWave () const
 
G4double GetTau () const
 
G4double GetSampleTime () const
 
G4double GetPeakTime () const
 
G4double GetTimeOffset () const
 
G4int GetBitNb () const
 
G4int GetGainFlag () const
 
G4double GetPhotonsPerMeV () const
 
G4double GetNonuniformity () const
 
G4double max (G4long &binOfMax) const
 
void updateWaveform (BesEmcHit *)
 
void updateWaveform (BesEmcDigi *)
 
void makeWaveform (G4double energy, G4double time)
 
void digitize ()
 
void addElecNoise (G4double, G4double)
 
void print ()
 
 BesEmcWaveform ()
 
 BesEmcWaveform (G4long, G4double, G4double)
 
virtual ~BesEmcWaveform ()
 
G4double & operator[] (G4long) const
 
virtual BesEmcWaveformoperator*= (const G4double &)
 
virtual BesEmcWaveformoperator/= (const G4double &)
 
virtual BesEmcWaveformoperator+= (const BesEmcWaveform &)
 
virtual BesEmcWaveformoperator= (const BesEmcWaveform &)
 
G4long length () const
 
G4double * GetWave () const
 
G4double GetTau () const
 
G4double GetSampleTime () const
 
G4double GetPeakTime () const
 
G4double GetTimeOffset () const
 
G4int GetBitNb () const
 
G4int GetGainFlag () const
 
G4double GetPhotonsPerMeV () const
 
G4double GetNonuniformity () const
 
G4double max (G4long &binOfMax) const
 
void updateWaveform (BesEmcHit *)
 
void updateWaveform (BesEmcDigi *)
 
void makeWaveform (G4double energy, G4double time)
 
void digitize ()
 
void addElecNoise (G4double, G4double)
 
void print ()
 

Protected Attributes

G4double * emcWave
 
G4long array_size
 

Detailed Description

Constructor & Destructor Documentation

◆ BesEmcWaveform() [1/4]

BesEmcWaveform::BesEmcWaveform ( )

Definition at line 21 of file BesEmcWaveform.cc.

22{
24 //BesEmcParameter emcPara;
25 //emcPara.ReadData();
26 array_size = emcPara.GetArraySize();
27 m_tau = emcPara.GetTau();
28 m_highRange = emcPara.GetHighRange();
29 m_midRange = emcPara.GetMidRange();
30 m_lowRange = emcPara.GetLowRange();
31 m_sampleTime = emcPara.GetSampleTime();
32 m_peakTime = emcPara.GetPeakTime();
33 m_timeOffset = emcPara.GetTimeOffset();
34 m_bitNb = emcPara.GetADCbit();
35 m_photonsPerMeV = emcPara.GetPhotonsPerMeV();
36 m_nonuniformity = emcPara.GetNonuniformity();
37 m_flag = -1;
38 m_highPrecision = m_highRange/((G4double)(1<<m_bitNb));
39 m_midPrecision = m_midRange/((G4double)(1<<m_bitNb));
40 m_lowPrecision = m_lowRange/((G4double)(1<<m_bitNb));
41 emcWave=new G4double[array_size];
42
43 for (G4long i=0; i<array_size;i++)
44 emcWave[i]=0;
45}
static BesEmcParameter & GetInstance()

◆ BesEmcWaveform() [2/4]

BesEmcWaveform::BesEmcWaveform ( G4long  size,
G4double  tau,
G4double  sampleTime 
)

Definition at line 47 of file BesEmcWaveform.cc.

48 :m_tau(tau),m_sampleTime(sampleTime)
49{
50 if(size>0){
51 array_size=size;
52 emcWave=new G4double[array_size];
53 G4double *init=emcWave+array_size;
54 while(init!=emcWave) *--init=0.0;
55 }
56 else{
57 G4Exception("Invalid size");
58 }
59}
InputRawInit init
Definition: JobInputRaw.cxx:29

◆ ~BesEmcWaveform() [1/2]

BesEmcWaveform::~BesEmcWaveform ( )
virtual

Definition at line 62 of file BesEmcWaveform.cc.

62 {
63 delete []emcWave;
64 emcWave=0;
65}

◆ BesEmcWaveform() [3/4]

BesEmcWaveform::BesEmcWaveform ( )

◆ BesEmcWaveform() [4/4]

BesEmcWaveform::BesEmcWaveform ( G4long  ,
G4double  ,
G4double   
)

◆ ~BesEmcWaveform() [2/2]

virtual BesEmcWaveform::~BesEmcWaveform ( )
virtual

Member Function Documentation

◆ addElecNoise() [1/2]

void BesEmcWaveform::addElecNoise ( G4double  width,
G4double  coherentNoise 
)

Definition at line 196 of file BesEmcWaveform.cc.

197{
198 for(G4int i=0;i<array_size;i++)
199 {
200 emcWave[i] += RandGauss::shoot()*width;
201 emcWave[i] += coherentNoise;
202 emcWave[i] = emcWave[i]>0?emcWave[i]:0;
203 }
204}

Referenced by BesEmcDigitizer::AddNoise5x5(), BesEmcDigitizer::AddNoiseAll(), and BesEmcDigitizer::Digitize().

◆ addElecNoise() [2/2]

void BesEmcWaveform::addElecNoise ( G4double  ,
G4double   
)

◆ digitize() [1/2]

void BesEmcWaveform::digitize ( )

Definition at line 159 of file BesEmcWaveform.cc.

160{
161 G4double oneBitResolution;
162 oneBitResolution = m_midRange*2/((G4double)(1<<m_bitNb)); //not used now
163 G4double energy;
164
165 for(G4long i=0;i<array_size;i++)
166 {
167 energy = emcWave[i];
168 if(energy > m_highRange)
169 G4cout<<"---In BesEmcWaveform: Over measurement!--- energy="<<energy<<G4endl;
170 else if(energy > m_midRange)
171 {
172 m_flag = 2;
173 emcWave[i] = (G4double)((G4long)(emcWave[i]/m_highPrecision))*m_highPrecision;
174 }
175 else if(energy > m_lowRange)
176 {
177 m_flag = 1;
178 emcWave[i] = (G4double)((G4long)(emcWave[i]/m_midPrecision))*m_midPrecision;
179 }
180 else
181 {
182 m_flag = 0;
183 emcWave[i] = (G4double)((G4long)(emcWave[i]/m_lowPrecision))*m_lowPrecision;
184 }
185 }
186}
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition: KK2f.h:50

Referenced by BesEmcDigitizer::AddNoise5x5(), BesEmcDigitizer::AddNoiseAll(), and BesEmcDigitizer::Digitize().

◆ digitize() [2/2]

void BesEmcWaveform::digitize ( )

◆ GetBitNb() [1/2]

G4int BesEmcWaveform::GetBitNb ( ) const
inline

Definition at line 69 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

69{ return m_bitNb; }

◆ GetBitNb() [2/2]

G4int BesEmcWaveform::GetBitNb ( ) const
inline

Definition at line 69 of file Simulation/BOOST/EmcSim/EmcSim-00-00-46/EmcSim/BesEmcWaveform.hh.

69{ return m_bitNb; }

◆ GetGainFlag() [1/2]

G4int BesEmcWaveform::GetGainFlag ( ) const
inline

Definition at line 70 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

70{ return m_flag; }

◆ GetGainFlag() [2/2]

G4int BesEmcWaveform::GetGainFlag ( ) const
inline

Definition at line 70 of file Simulation/BOOST/EmcSim/EmcSim-00-00-46/EmcSim/BesEmcWaveform.hh.

70{ return m_flag; }

◆ GetNonuniformity() [1/2]

G4double BesEmcWaveform::GetNonuniformity ( ) const
inline

Definition at line 72 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

72{ return m_nonuniformity; }

◆ GetNonuniformity() [2/2]

G4double BesEmcWaveform::GetNonuniformity ( ) const
inline

Definition at line 72 of file Simulation/BOOST/EmcSim/EmcSim-00-00-46/EmcSim/BesEmcWaveform.hh.

72{ return m_nonuniformity; }

◆ GetPeakTime() [1/2]

G4double BesEmcWaveform::GetPeakTime ( ) const
inline

Definition at line 67 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

67{ return m_peakTime; }

◆ GetPeakTime() [2/2]

G4double BesEmcWaveform::GetPeakTime ( ) const
inline

Definition at line 67 of file Simulation/BOOST/EmcSim/EmcSim-00-00-46/EmcSim/BesEmcWaveform.hh.

67{ return m_peakTime; }

◆ GetPhotonsPerMeV() [1/2]

G4double BesEmcWaveform::GetPhotonsPerMeV ( ) const
inline

Definition at line 71 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

71{ return m_photonsPerMeV; }

◆ GetPhotonsPerMeV() [2/2]

G4double BesEmcWaveform::GetPhotonsPerMeV ( ) const
inline

Definition at line 71 of file Simulation/BOOST/EmcSim/EmcSim-00-00-46/EmcSim/BesEmcWaveform.hh.

71{ return m_photonsPerMeV; }

◆ GetSampleTime() [1/2]

G4double BesEmcWaveform::GetSampleTime ( ) const
inline

Definition at line 66 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

66{ return m_sampleTime; }

◆ GetSampleTime() [2/2]

G4double BesEmcWaveform::GetSampleTime ( ) const
inline

Definition at line 66 of file Simulation/BOOST/EmcSim/EmcSim-00-00-46/EmcSim/BesEmcWaveform.hh.

66{ return m_sampleTime; }

◆ GetTau() [1/2]

G4double BesEmcWaveform::GetTau ( ) const
inline

Definition at line 65 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

65{ return m_tau; }

◆ GetTau() [2/2]

G4double BesEmcWaveform::GetTau ( ) const
inline

Definition at line 65 of file Simulation/BOOST/EmcSim/EmcSim-00-00-46/EmcSim/BesEmcWaveform.hh.

65{ return m_tau; }

◆ GetTimeOffset() [1/2]

G4double BesEmcWaveform::GetTimeOffset ( ) const
inline

Definition at line 68 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

68{ return m_timeOffset; }

◆ GetTimeOffset() [2/2]

G4double BesEmcWaveform::GetTimeOffset ( ) const
inline

Definition at line 68 of file Simulation/BOOST/EmcSim/EmcSim-00-00-46/EmcSim/BesEmcWaveform.hh.

68{ return m_timeOffset; }

◆ GetWave() [1/2]

G4double * BesEmcWaveform::GetWave ( ) const
inline

Definition at line 64 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

64{ return emcWave; }

◆ GetWave() [2/2]

G4double * BesEmcWaveform::GetWave ( ) const
inline

◆ length() [1/2]

G4long BesEmcWaveform::length ( ) const
inline

Definition at line 63 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

63{ return array_size;}

◆ length() [2/2]

G4long BesEmcWaveform::length ( ) const
inline

◆ makeWaveform() [1/2]

void BesEmcWaveform::makeWaveform ( G4double  energy,
G4double  time 
)

Definition at line 128 of file BesEmcWaveform.cc.

129{
130 G4double amplitude;
131 if(m_photonsPerMeV==0)
132 {
133 amplitude = energy;
134 }
135 else
136 {
137 G4double photons = energy*m_photonsPerMeV;
138 if(photons>0) {
139 G4double photonStatFactor = RandGauss::shoot(photons, sqrt(photons))/photons;
140 amplitude = energy*photonStatFactor;
141 } else {
142 amplitude = 0;
143 }
144 }
145
146 G4double tempTime;
147 tempTime = 0;
148
149 G4double peak = m_peakTime*m_peakTime*m_peakTime*m_peakTime*exp(-m_peakTime/m_tau)/24;
150
151 for (G4long i=0;i<array_size;i++)
152 {
153 tempTime = i*m_sampleTime + m_timeOffset - time;
154 if(tempTime>0)
155 emcWave[i] += amplitude*tempTime*tempTime*tempTime*tempTime*exp(-tempTime/m_tau)/(24*peak);
156 }
157}
Double_t time
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252

Referenced by updateWaveform().

◆ makeWaveform() [2/2]

void BesEmcWaveform::makeWaveform ( G4double  energy,
G4double  time 
)

◆ max() [1/2]

G4double BesEmcWaveform::max ( G4long &  binOfMax) const

Definition at line 97 of file BesEmcWaveform.cc.

98{
99 G4double maxi=emcWave[0];
100 binOfMax = 0;
101 for (G4long i=1;i<array_size;i++)
102 {
103 if (emcWave[i]>maxi)
104 {
105 maxi=emcWave[i];
106 binOfMax = i;
107 }
108 }
109 return maxi;
110}

Referenced by BesEmcDigitizer::AddNoise5x5(), BesEmcDigitizer::AddNoiseAll(), BesEmcDigitizer::Digitize(), and BesEmcDigi::operator+=().

◆ max() [2/2]

G4double BesEmcWaveform::max ( G4long &  binOfMax) const

◆ operator*=() [1/2]

BesEmcWaveform & BesEmcWaveform::operator*= ( const G4double &  scale)
virtual

Definition at line 68 of file BesEmcWaveform.cc.

69{
70 for (G4long i=0; i<array_size;i++) emcWave[i]*=scale;
71 return *this;
72}

◆ operator*=() [2/2]

virtual BesEmcWaveform & BesEmcWaveform::operator*= ( const G4double &  )
virtual

◆ operator+=() [1/2]

BesEmcWaveform & BesEmcWaveform::operator+= ( const BesEmcWaveform assign)
virtual

Definition at line 80 of file BesEmcWaveform.cc.

81{
82 for (G4long i=0; i<array_size;i++) emcWave[i]+=assign[i];
83 return *this;
84}

◆ operator+=() [2/2]

virtual BesEmcWaveform & BesEmcWaveform::operator+= ( const BesEmcWaveform )
virtual

◆ operator/=() [1/2]

BesEmcWaveform & BesEmcWaveform::operator/= ( const G4double &  scale)
virtual

Definition at line 74 of file BesEmcWaveform.cc.

75{
76 for (G4long i=0; i<array_size;i++) emcWave[i]/=scale;
77 return *this;
78}

◆ operator/=() [2/2]

virtual BesEmcWaveform & BesEmcWaveform::operator/= ( const G4double &  )
virtual

◆ operator=() [1/2]

BesEmcWaveform & BesEmcWaveform::operator= ( const BesEmcWaveform assign)
virtual

Definition at line 86 of file BesEmcWaveform.cc.

87{
88 if (this != &assign) {
89 if (emcWave!=0) delete []emcWave;
90 emcWave=new G4double[assign.array_size];
92 for (G4long i=0;i<array_size;i++) emcWave[i]=assign[i];
93 }
94 return *this;
95}

◆ operator=() [2/2]

virtual BesEmcWaveform & BesEmcWaveform::operator= ( const BesEmcWaveform )
virtual

◆ operator[]() [1/2]

G4double & BesEmcWaveform::operator[] ( G4long  index) const
inline

Definition at line 112 of file InstallArea/include/EmcSim/EmcSim/BesEmcWaveform.hh.

113{
114 if(index<0 || index>array_size-1){
115 G4cout << "Array bounds exceeded. Index " << index << G4endl;
116 ::abort();
117 }
118 return emcWave[index];
119}

◆ operator[]() [2/2]

G4double & BesEmcWaveform::operator[] ( G4long  ) const
inline

◆ print() [1/2]

void BesEmcWaveform::print ( )

Definition at line 188 of file BesEmcWaveform.cc.

189{
190 G4cout<<"New Wave!"<<G4endl;
191 for(G4long i=0;i<array_size;i++)
192 G4cout<<emcWave[i]<<"\t";
193 G4cout<<G4endl;
194}

◆ print() [2/2]

void BesEmcWaveform::print ( )

◆ updateWaveform() [1/4]

void BesEmcWaveform::updateWaveform ( BesEmcDigi digi)

Definition at line 120 of file BesEmcWaveform.cc.

121{
122 G4double energy = digi->GetEnergy();
123 G4double time = digi->GetTime()*m_sampleTime+m_timeOffset-m_peakTime;
124
126}
void makeWaveform(G4double energy, G4double time)

◆ updateWaveform() [2/4]

void BesEmcWaveform::updateWaveform ( BesEmcDigi )

◆ updateWaveform() [3/4]

void BesEmcWaveform::updateWaveform ( BesEmcHit hit)

◆ updateWaveform() [4/4]

void BesEmcWaveform::updateWaveform ( BesEmcHit )

Member Data Documentation

◆ array_size

◆ emcWave


The documentation for this class was generated from the following files: