CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcWaveform Class Reference

#include <EmcWaveform.h>

Public Member Functions

 EmcWaveform ()
 
 EmcWaveform (int, double, double)
 
 ~EmcWaveform ()
 
double & operator[] (int) const
 
EmcWaveformoperator*= (const double)
 
EmcWaveformoperator/= (const double)
 
EmcWaveformoperator+= (const EmcWaveform &)
 
EmcWaveformoperator= (const EmcWaveform &)
 
int length () const
 
double * GetWave () const
 
double GetTau () const
 
double GetTauTrg () const
 
double GetSampleTime () const
 
double GetSampleTimeTrg () const
 
double GetPeakTime () const
 
double GetPeakTimeTrg () const
 
double GetTimeOffset () const
 
double GetTimeOffsetTrg () const
 
double max (int &binOfMax) const
 
double getADCTrg (int time)
 
int frontEdgeTrg (double thres)
 
void makeWaveform (double energy, double time)
 
void makeWaveformTrg (double energy, double time)
 
void print ()
 

Protected Attributes

double * emcWave
 
int array_size
 

Detailed Description

Definition at line 42 of file EmcWaveform.h.

Constructor & Destructor Documentation

◆ EmcWaveform() [1/2]

EmcWaveform::EmcWaveform ( )

Definition at line 17 of file EmcWaveform.cxx.

18{
19 array_size = 60;
20 m_tau = 1000.;
21 m_sampleTime = 50.;
22 m_peakTime = 4000.;
23 m_timeOffset = 2500.;
24 emcWave=new double[array_size];
25
26 for (int i=0; i<array_size;i++)
27 emcWave[i]=0;
28}
int array_size
Definition: EmcWaveform.h:85
double * emcWave
Definition: EmcWaveform.h:84

◆ EmcWaveform() [2/2]

EmcWaveform::EmcWaveform ( int  size,
double  tau,
double  sampleTime 
)

Definition at line 30 of file EmcWaveform.cxx.

31 :m_tau(tau),m_sampleTime(sampleTime)
32{
33 if(size>0){
34 array_size=size;
35 emcWave=new double[array_size];
36 double *init=emcWave+array_size;
37 while(init!=emcWave) *--init=0.0;
38 }
39}

◆ ~EmcWaveform()

EmcWaveform::~EmcWaveform ( )

Definition at line 42 of file EmcWaveform.cxx.

42 {
43 delete [] emcWave;
44 emcWave=0;
45}

Member Function Documentation

◆ frontEdgeTrg()

int EmcWaveform::frontEdgeTrg ( double  thres)

Definition at line 101 of file EmcWaveform.cxx.

102{
103 int binOfMax = -1;
104 for (int i=0;i<array_size;i++)
105 {
106 if (emcWave[i]>thres)
107 {
108 binOfMax = i;
109 break;
110 }
111 }
112 return binOfMax;
113}

Referenced by BesTrigL1::getEmcAnalogSig().

◆ getADCTrg()

double EmcWaveform::getADCTrg ( int  time)

Definition at line 92 of file EmcWaveform.cxx.

93{
94 double adc = emcWave[0];
95 for(int i = 0; i < array_size; i++) {
96 if(time >= i*m_sampleTime && time < (i+1)*m_sampleTime) adc = emcWave[i];
97 }
98 return adc;
99}
Double_t time

◆ GetPeakTime()

double EmcWaveform::GetPeakTime ( ) const
inline

Definition at line 67 of file EmcWaveform.h.

67{ return m_peakTime; }

◆ GetPeakTimeTrg()

double EmcWaveform::GetPeakTimeTrg ( ) const
inline

Definition at line 68 of file EmcWaveform.h.

68{ return m_peakTimeTrg; }

◆ GetSampleTime()

double EmcWaveform::GetSampleTime ( ) const
inline

Definition at line 65 of file EmcWaveform.h.

65{ return m_sampleTime; }

◆ GetSampleTimeTrg()

double EmcWaveform::GetSampleTimeTrg ( ) const
inline

Definition at line 66 of file EmcWaveform.h.

66{ return m_sampleTimeTrg; }

◆ GetTau()

double EmcWaveform::GetTau ( ) const
inline

Definition at line 63 of file EmcWaveform.h.

63{ return m_tau; }

◆ GetTauTrg()

double EmcWaveform::GetTauTrg ( ) const
inline

Definition at line 64 of file EmcWaveform.h.

64{ return m_tauTrg; }

◆ GetTimeOffset()

double EmcWaveform::GetTimeOffset ( ) const
inline

Definition at line 69 of file EmcWaveform.h.

69{ return m_timeOffset; }

◆ GetTimeOffsetTrg()

double EmcWaveform::GetTimeOffsetTrg ( ) const
inline

Definition at line 70 of file EmcWaveform.h.

70{ return m_timeOffsetTrg; }

◆ GetWave()

double * EmcWaveform::GetWave ( ) const
inline

Definition at line 62 of file EmcWaveform.h.

62{ return emcWave; }

◆ length()

int EmcWaveform::length ( ) const
inline

Definition at line 61 of file EmcWaveform.h.

61{ return array_size;}

◆ makeWaveform()

void EmcWaveform::makeWaveform ( double  energy,
double  time 
)

Definition at line 131 of file EmcWaveform.cxx.

132{
133 double time0 = time*m_sampleTime+m_timeOffset-m_peakTime; //start time
134 double tempTime = 0; //time for each bin
135
136 double peak = m_peakTime*m_peakTime*m_peakTime*m_peakTime*exp(-m_peakTime/m_tau)/24;
137
138 for (int i=0;i<array_size;i++)
139 {
140 tempTime = i*m_sampleTime + m_timeOffset - time0;
141 if(tempTime>0)
142 emcWave[i] +=
143 energy*tempTime*tempTime*tempTime*tempTime*exp(-tempTime/m_tau)/(24*peak);
144 }
145}
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252
************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 EmcDigi::operator+=().

◆ makeWaveformTrg()

void EmcWaveform::makeWaveformTrg ( double  energy,
double  time 
)

Definition at line 115 of file EmcWaveform.cxx.

116{
117 double time0 = time*m_sampleTime+m_timeOffset-m_peakTime; //start time
118 double tempTime = 0; //time for each bin
119
120 double peak = m_peakTime*m_peakTime*m_peakTime*m_peakTime*exp(-m_peakTime/m_tau)/24;
121
122 for (int i=0;i<array_size;i++)
123 {
124 tempTime = i*m_sampleTime + m_timeOffset - time0;
125 if(tempTime>0)
126 emcWave[i] +=
127 energy*tempTime*tempTime*tempTime*tempTime*exp(-tempTime/m_tau)/(24*peak);
128 }
129}

Referenced by BesTrigL1::getEmcAnalogSig().

◆ max()

double EmcWaveform::max ( int &  binOfMax) const

Definition at line 77 of file EmcWaveform.cxx.

78{
79 double maxi=emcWave[0];
80 binOfMax = 0;
81 for (int i=1;i<array_size;i++)
82 {
83 if (emcWave[i]>maxi)
84 {
85 maxi=emcWave[i];
86 binOfMax = i;
87 }
88 }
89 return maxi;
90}

Referenced by BesTrigL1::findEmcPeakTime(), and EmcDigi::operator+=().

◆ operator*=()

EmcWaveform & EmcWaveform::operator*= ( const double  scale)

Definition at line 48 of file EmcWaveform.cxx.

49{
50 for (int i=0; i<array_size;i++) emcWave[i]*=scale;
51 return *this;
52}

◆ operator+=()

EmcWaveform & EmcWaveform::operator+= ( const EmcWaveform assign)

Definition at line 60 of file EmcWaveform.cxx.

61{
62 for (int i=0; i<array_size;i++) emcWave[i]+=assign[i];
63 return *this;
64}

◆ operator/=()

EmcWaveform & EmcWaveform::operator/= ( const double  scale)

Definition at line 54 of file EmcWaveform.cxx.

55{
56 for (int i=0; i<array_size;i++) emcWave[i]/=scale;
57 return *this;
58}

◆ operator=()

EmcWaveform & EmcWaveform::operator= ( const EmcWaveform assign)

Definition at line 66 of file EmcWaveform.cxx.

67{
68 if (this != &assign) {
69 if (emcWave!=0) delete [] emcWave;
70 emcWave=new double[assign.array_size];
72 for (int i=0;i<array_size;i++) emcWave[i]=assign[i];
73 }
74 return *this;
75}

◆ operator[]()

double & EmcWaveform::operator[] ( int  index) const
inline

Definition at line 100 of file EmcWaveform.h.

101{
102 if(index<0 || index>array_size-1){
103 cout << "Array bounds exceeded. Index " << index << endl;
104 ::abort();
105 }
106 return emcWave[index];
107}

◆ print()

void EmcWaveform::print ( )

Definition at line 147 of file EmcWaveform.cxx.

148{
149 cout<<"New Wave!"<<endl;
150 for(int i=0;i<array_size;i++)
151 cout<<emcWave[i]<<"\t";
152 cout<<endl;
153}

Member Data Documentation

◆ array_size

int EmcWaveform::array_size
protected

◆ emcWave


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