00001 //---------------------------------------------------------------------------// 00002 // BOOST --- BESIII Object_Oriented Simulation Tool // 00003 //---------------------------------------------------------------------------// 00004 //Description: 00005 //Author: An Fenfen 00006 //Created: Nov, 2015 00007 00008 //---------------------------------------------------------------------------// 00009 // $Id: BesTofDigitizerEcV4.hh 00010 00011 #ifndef BesTofDigitizerEcV4_h 00012 #define BesTofDigitizerEcV4_h 1 00013 00014 #include "BesTofDigitizerV.hh" 00015 #include "BesTofDigi.hh" 00016 #include "BesTofGeoParameter.hh" 00017 #include "globals.hh" 00018 #include "TFile.h" 00019 #include "TTree.h" 00020 #include "ScintSingle.hh" 00021 #include <vector> 00022 00023 using namespace std; 00024 00025 typedef std::map<int, double> AVALANCH; 00026 00027 class BesTofDigitizerEcV4 : public BesTofDigitizerV 00028 { 00029 public: 00030 BesTofDigitizerEcV4(); 00031 ~BesTofDigitizerEcV4(); 00032 00033 void initial(); 00034 virtual void Digitize(ScintSingle*, BesTofDigitsCollection*); 00035 int calStrip(double locZ); 00036 bool underStrip(double locX, double locZ); 00037 double calTdcRes_charge(double charge_fC); 00038 double charge2Time(double charge_fC); 00039 double calAdcRes_charge(double charge_fC); 00040 double calTdcRes_charge1(double charge_fC); 00041 double charge2Time1(double charge_fC); 00042 double calAdcRes_charge1(double charge_fC); 00043 00044 struct Param 00045 { 00046 Param(); 00047 void print(); 00048 void setPar(int nstep, double E_weight); 00049 00050 //parameters fixed 00051 BesTofGeoParameter* tofPara; 00052 int nstrip; 00053 int nmodule; 00054 double strip_x[12]; 00055 double strip_z; 00056 double strip_gap; 00057 int deadChannel[72][12]; 00058 double ngap; 00059 double gapWidth; 00060 int nstep; 00061 double stepWidth; 00062 double E_weight; 00063 double eCharge; 00064 }; 00065 00066 struct HitStruct 00067 { 00068 //HitStruct(const Param&); 00069 HitStruct(); 00070 void initial(); 00071 void print(); 00072 void calTPropagate(); 00073 double calAvaLength(); 00074 00075 Param m_param; 00076 int trkIndex; 00077 int pdgCode; 00078 int ions; 00079 int strip; 00080 int underStrip; 00081 int gap; 00082 double glbTime; 00083 double locx; 00084 double locy; 00085 double locz; 00086 double x; 00087 double y; 00088 double z; 00089 double px; 00090 double py; 00091 double pz; 00092 double v_propagate; 00093 double tPropagate_sphi; 00094 double tPropagate_xphi; 00095 00096 00097 AVALANCH ava_num; 00098 AVALANCH ava_pos; 00099 }; 00100 00101 struct StripStruct 00102 { 00103 //StripStruct(const Param&); 00104 StripStruct(); 00105 void initial(); 00106 void print(); 00107 void avalanche(); 00108 void calFirstHit(); 00109 long int calNextN(int num); 00110 long int multiply(double rdm); 00111 double calSigma(); 00112 void setPar(double V, double threshold, bool saturationFlag=true); 00113 double getAlpha(double E); 00114 double getEta(double E); 00115 double getV(double E); 00116 00117 Param m_param; 00118 vector<HitStruct> hitStructCol; 00119 00120 //properties to get 00121 int strip; 00122 int trkIndex; 00123 double tStart; 00124 double tPropagate_sphi; 00125 double tPropagate_xphi; 00126 double tThreshold; 00127 double charge; 00128 00129 //parameters to tune 00130 double E; 00131 double alpha; 00132 double eta; 00133 long int threshold; 00134 double v_drift; 00135 bool saturationFlag; 00136 }; 00137 00138 00139 private: 00140 Param m_param; 00141 int partId; 00142 int module; 00143 00144 double tdc_sphi; 00145 double tdc_xphi; 00146 double tdcRes_const; 00147 double tdcRes; 00148 double adc; 00149 double adcRes_const; 00150 double adcRes; 00151 00152 double time_leading_sphi; 00153 double time_leading_xphi; 00154 double time_trailing_sphi; 00155 double time_trailing_xphi; 00156 00157 bool m_rootFlag; 00158 string m_fileName; 00159 double m_V; 00160 double m_threshold; 00161 TFile* m_file; 00162 TTree* m_tree; 00163 00164 int m_nstep; 00165 double m_E_weight; 00166 bool m_saturationFlag; 00167 int m_calTdcRes_charge_flag; 00168 int m_charge2Time_flag; 00169 int m_calAdcRes_charge_flag; 00170 00171 double m_event; 00172 double m_partId; 00173 double m_module; 00174 double m_time_leading_sphi; 00175 double m_time_leading_xphi; 00176 double m_time_trailing_sphi; 00177 double m_time_trailing_xphi; 00178 double m_tdcRes; 00179 double m_tdcRes_charge; 00180 double m_adc; 00181 double m_adcRes; 00182 double m_adcRes_charge; 00183 double m_strip; 00184 double m_trkIndex; 00185 double m_tStart; 00186 double m_tPropagate_sphi; 00187 double m_tPropagate_xphi; 00188 double m_tThreshold; 00189 double m_charge; 00190 int m_nhit; 00191 double m_ions_hit[10000]; 00192 double m_trkIndex_hit[10000]; 00193 double m_pdgCode_hit[10000]; 00194 double m_gap_hit[10000]; 00195 double m_underStrip_hit[10000]; 00196 double m_locx_hit[10000]; 00197 double m_locy_hit[10000]; 00198 double m_locz_hit[10000]; 00199 double m_x_hit[10000]; 00200 double m_y_hit[10000]; 00201 double m_z_hit[10000]; 00202 double m_px_hit[10000]; 00203 double m_py_hit[10000]; 00204 double m_pz_hit[10000]; 00205 }; 00206 00207 00208 #endif 00209