/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Emc/EmcWaveform/EmcWaveform-00-00-03/EmcWaveform/EmcWaveform.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------//
00002 //      BOOST --- BESIII Object_Oriented Simulation Tool                     //
00003 //---------------------------------------------------------------------------//
00004 //Description:
00005 //
00006 //  The shape of the ideal signal is generated from the response function of 
00007 //  the crystal-photodiode-preAmplifier-mainAmplifier combination. The signal
00008 //  from crystal is an exponential decay with the time constant tau_CsI. In 
00009 //  the Laplace domain, it equals 1/(s+a), where a=1/tau_CsI. Assume that the
00010 //  preAmplifier has a step function 1/s. The mainAmplifier has a CR-RC-RC 
00011 //  shape. CR=s/(s+b), RC=1/(s+b), where b=1/tau_s, the shaping time constant.
00012 //  The response time of the photodiode, and the time of deposition of energy
00013 //  in the CsI crystal are presumed to be infinitely short, the response 
00014 //  funtion is then
00015 //  
00016 //            F(s) = [1/(s+a)]*(1/s)*[s/(s+b)^3] = 1/(s+a)(s+b)^3.
00017 //
00018 //  In BESIII EMC, tau_CsI=tau_s=1.0e-6s. So the response fuction is 1/(s+a)^4.
00019 //  In time domain, it is 
00020 //  
00021 //            f(t) = t^3*exp(-t/tau)/6
00022 //            
00023 //Author: Hemiao
00024 //Created: Oct 25, 2004
00025 //Modified:
00026 //  May 23, 2005
00027 //  The mainAmplifier changes to CR-RC-RC-RC, and the response funtion is then
00028 //      F(s) = [1/(s+a)]*(1/s)*[s/(s+b)^4] = 1/(s+a)(s+b)^4.
00029 //  In time domain, it is
00030 //      f(t) = t^4*exp(-t/tau)/24
00031 //Comment:
00032 //---------------------------------------------------------------------------//
00033 // $Id: EmcWaveform.h
00034 
00035 #ifndef EMC_WAVEFORM_H
00036 #define EMC_WAVEFORM_H
00037 
00038 #include <iostream>
00039 #include <stdlib.h>
00040 using namespace std;
00041 
00042 class EmcWaveform{
00043 
00044 public:
00045   
00046   // Constructors
00047   EmcWaveform();
00048   EmcWaveform(int, double, double);
00049 
00050   // Destructors
00051   ~EmcWaveform();
00052 
00053   // Operators
00054   inline  double &operator[](int ) const;
00055   EmcWaveform &operator*=(const double);
00056   EmcWaveform &operator/=(const double);
00057   EmcWaveform &operator+=(const EmcWaveform &);
00058   EmcWaveform &operator=(const EmcWaveform &);
00059   
00060   // Selectors
00061   inline int length() const {  return array_size;}
00062   inline double* GetWave() const { return emcWave; }
00063   inline double GetTau() const { return m_tau; }
00064   inline double GetTauTrg() const { return m_tauTrg; }
00065   inline double GetSampleTime() const { return m_sampleTime; }
00066   inline double GetSampleTimeTrg() const { return m_sampleTimeTrg; }
00067   inline double GetPeakTime() const { return m_peakTime; }
00068   inline double GetPeakTimeTrg() const { return m_peakTimeTrg; }
00069   inline double GetTimeOffset() const { return m_timeOffset; }
00070   inline double GetTimeOffsetTrg() const { return m_timeOffsetTrg; }
00071   
00072   double max(int &binOfMax) const; // returns the max of the array
00073   double getADCTrg(int time); // return ADC in a certain time
00074   int frontEdgeTrg(double thres); // returns the time over the threshold
00075   
00076   // Modifiers
00077   void makeWaveform(double energy, double time);
00078   void makeWaveformTrg(double energy, double time);
00079   
00080   void print();
00081 
00082 protected:
00083 
00084   double *emcWave;
00085   int array_size;
00086 
00087 private:
00088 
00089   double m_tau;             //tau_CsI=tau_CR=tau_RC=1000.*ns
00090   double m_tauTrg;             //tau_CsI=tau_CR=tau_RC=1000.*ns
00091   double m_sampleTime;      //sample time = 50.*ns
00092   double m_sampleTimeTrg;      //sample time = 50.*ns
00093   double m_peakTime;        //peak time = 4000.*ns
00094   double m_peakTimeTrg;        //peak time = 4000.*ns
00095   double m_timeOffset;      //the beginning of sample time = 2500.*ns
00096   double m_timeOffsetTrg;      //the beginning of sample time = 2500.*ns
00097   
00098 };
00099 
00100 inline double &EmcWaveform::operator[](int index) const
00101 {
00102   if(index<0 || index>array_size-1){
00103     cout << "Array bounds exceeded. Index " << index << endl;
00104     ::abort();
00105   }
00106   return emcWave[index];
00107 }
00108 
00109 #endif

Generated on Tue Nov 29 22:58:18 2016 for BOSS_7.0.2 by  doxygen 1.4.7