BOSS 7.0.7
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 G4Exception("Invalid size");
58 }
59}
InputRawInit init
Definition: JobInputRaw.cxx:29

◆ ~BesEmcWaveform()

BesEmcWaveform::~BesEmcWaveform ( )
virtual

Definition at line 62 of file BesEmcWaveform.cc.

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

Member Function Documentation

◆ addElecNoise()

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().

◆ digitize()

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_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 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}
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252

Referenced by updateWaveform().

◆ max()

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+=().

◆ operator*=()

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+=()

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/=()

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=()

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[]()

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 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}

◆ updateWaveform() [1/2]

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
125 makeWaveform(energy, time);
126}
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 112 of file BesEmcWaveform.cc.

113{
114 G4double energy = hit->GetEdepCrystal();
115 G4double time = hit->GetTimeCrystal();
116
117 makeWaveform(energy, time);
118}
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: