BOSS 7.1.0
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 ()
 

Protected Attributes

G4double * emcWave
 
G4long array_size
 

Detailed Description

Definition at line 44 of file BesEmcWaveform.hh.

Constructor & Destructor Documentation

◆ BesEmcWaveform() [1/2]

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}
G4double GetHighRange()
G4double GetPeakTime()
static BesEmcParameter & GetInstance()
G4double GetNonuniformity()
G4double GetMidRange()
G4double GetTimeOffset()
G4double GetLowRange()
G4double GetPhotonsPerMeV()
G4double GetSampleTime()
G4double * emcWave

◆ BesEmcWaveform() [2/2]

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 G4cout<<"BesEmcWaveform:: Invalid size"<<G4endl;
58 exit(-1);
59 }
60}
InputRawInit init
Definition: JobInputRaw.cxx:29

◆ ~BesEmcWaveform()

BesEmcWaveform::~BesEmcWaveform ( )
virtual

Definition at line 63 of file BesEmcWaveform.cc.

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

Member Function Documentation

◆ addElecNoise()

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

Definition at line 197 of file BesEmcWaveform.cc.

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

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

◆ digitize()

void BesEmcWaveform::digitize ( )

Definition at line 160 of file BesEmcWaveform.cc.

161{
162 G4double oneBitResolution;
163 oneBitResolution = m_midRange*2/((G4double)(1<<m_bitNb)); //not used now
164 G4double energy;
165
166 for(G4long i=0;i<array_size;i++)
167 {
168 energy = emcWave[i];
169 if(energy > m_highRange)
170 G4cout<<"---In BesEmcWaveform: Over measurement!--- energy="<<energy<<G4endl;
171 else if(energy > m_midRange)
172 {
173 m_flag = 2;
174 emcWave[i] = (G4double)((G4long)(emcWave[i]/m_highPrecision))*m_highPrecision;
175 }
176 else if(energy > m_lowRange)
177 {
178 m_flag = 1;
179 emcWave[i] = (G4double)((G4long)(emcWave[i]/m_midPrecision))*m_midPrecision;
180 }
181 else
182 {
183 m_flag = 0;
184 emcWave[i] = (G4double)((G4long)(emcWave[i]/m_lowPrecision))*m_lowPrecision;
185 }
186 }
187}
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP 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().

◆ GetBitNb()

G4int BesEmcWaveform::GetBitNb ( ) const
inline

Definition at line 69 of file BesEmcWaveform.hh.

69{ return m_bitNb; }

◆ GetGainFlag()

G4int BesEmcWaveform::GetGainFlag ( ) const
inline

Definition at line 70 of file BesEmcWaveform.hh.

70{ return m_flag; }

◆ GetNonuniformity()

G4double BesEmcWaveform::GetNonuniformity ( ) const
inline

Definition at line 72 of file BesEmcWaveform.hh.

72{ return m_nonuniformity; }

◆ GetPeakTime()

G4double BesEmcWaveform::GetPeakTime ( ) const
inline

Definition at line 67 of file BesEmcWaveform.hh.

67{ return m_peakTime; }

◆ GetPhotonsPerMeV()

G4double BesEmcWaveform::GetPhotonsPerMeV ( ) const
inline

Definition at line 71 of file BesEmcWaveform.hh.

71{ return m_photonsPerMeV; }

◆ GetSampleTime()

G4double BesEmcWaveform::GetSampleTime ( ) const
inline

Definition at line 66 of file BesEmcWaveform.hh.

66{ return m_sampleTime; }

◆ GetTau()

G4double BesEmcWaveform::GetTau ( ) const
inline

Definition at line 65 of file BesEmcWaveform.hh.

65{ return m_tau; }

◆ GetTimeOffset()

G4double BesEmcWaveform::GetTimeOffset ( ) const
inline

Definition at line 68 of file BesEmcWaveform.hh.

68{ return m_timeOffset; }

◆ GetWave()

G4double * BesEmcWaveform::GetWave ( ) const
inline

Definition at line 64 of file BesEmcWaveform.hh.

64{ return emcWave; }

◆ length()

G4long BesEmcWaveform::length ( ) const
inline

Definition at line 63 of file BesEmcWaveform.hh.

63{ return array_size;}

◆ makeWaveform()

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

Definition at line 129 of file BesEmcWaveform.cc.

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

Referenced by updateWaveform().

◆ max()

G4double BesEmcWaveform::max ( G4long &  binOfMax) const

Definition at line 98 of file BesEmcWaveform.cc.

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

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

◆ operator*=()

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

Definition at line 69 of file BesEmcWaveform.cc.

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

◆ operator+=()

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

Definition at line 81 of file BesEmcWaveform.cc.

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

◆ operator/=()

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

Definition at line 75 of file BesEmcWaveform.cc.

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

◆ operator=()

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

Definition at line 87 of file BesEmcWaveform.cc.

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

◆ operator[]()

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

Definition at line 112 of file 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}

◆ print()

void BesEmcWaveform::print ( )

Definition at line 189 of file BesEmcWaveform.cc.

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

◆ updateWaveform() [1/2]

void BesEmcWaveform::updateWaveform ( BesEmcDigi digi)

Definition at line 121 of file BesEmcWaveform.cc.

122{
123 G4double energy = digi->GetEnergy();
124 G4double time = digi->GetTime()*m_sampleTime+m_timeOffset-m_peakTime;
125
127}
G4double GetEnergy()
Definition: BesEmcDigi.hh:52
G4double GetTime()
Definition: BesEmcDigi.hh:53
void makeWaveform(G4double energy, G4double time)

◆ updateWaveform() [2/2]

void BesEmcWaveform::updateWaveform ( BesEmcHit hit)

Definition at line 113 of file BesEmcWaveform.cc.

114{
115 G4double energy = hit->GetEdepCrystal();
116 G4double time = hit->GetTimeCrystal();
117
119}
G4double GetTimeCrystal()
Definition: BesEmcHit.hh:60
G4double GetEdepCrystal()
Definition: BesEmcHit.hh:56

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

Member Data Documentation

◆ array_size

G4long BesEmcWaveform::array_size
protected

◆ emcWave

G4double* BesEmcWaveform::emcWave
protected

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