BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcWaveform.cxx
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oriented Simulation Tool //
3//---------------------------------------------------------------------------//
4//Description:
5//Author: Hemiao
6//Created: Oct 25, 2004
7//Modified:
8//Comment:
9//---------------------------------------------------------------------------//
10// $Id: EmcWaveform.cxx
11
13#include <math.h>
14
15// Constructors
16
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}
29
30EmcWaveform::EmcWaveform(int size, double tau, double sampleTime)
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}
40
41// Destructors
43 delete [] emcWave;
44 emcWave=0;
45}
46
47// Operators
49{
50 for (int i=0; i<array_size;i++) emcWave[i]*=scale;
51 return *this;
52}
53
55{
56 for (int i=0; i<array_size;i++) emcWave[i]/=scale;
57 return *this;
58}
59
61{
62 for (int i=0; i<array_size;i++) emcWave[i]+=assign[i];
63 return *this;
64}
65
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}
76
77double EmcWaveform::max(int &binOfMax) const
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}
91
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}
100
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}
114
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}
130
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}
146
148{
149 cout<<"New Wave!"<<endl;
150 for(int i=0;i<array_size;i++)
151 cout<<emcWave[i]<<"\t";
152 cout<<endl;
153}
Double_t time
EvtComplex exp(const EvtComplex &c)
************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
EmcWaveform & operator+=(const EmcWaveform &)
double getADCTrg(int time)
double max(int &binOfMax) const
EmcWaveform & operator/=(const double)
EmcWaveform & operator=(const EmcWaveform &)
void makeWaveformTrg(double energy, double time)
double * emcWave
Definition EmcWaveform.h:84
EmcWaveform & operator*=(const double)
void makeWaveform(double energy, double time)
int frontEdgeTrg(double thres)