TStraw.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. #ifndef __TSTRAW__
  2. #define __TSTRAW__
  3. #include "TNamed.h"
  4. #include "TMatrix.h"
  5. #include "TVector3.h"
  6. #include "TH2.h"
  7. #include <vector>
  8. #include <iostream>
  9. #include <string>
  10. using namespace std;
  11. #include "TMatrixD.h"
  12. //ClassImp(TMatrixDBase)
  13. //class TMatrixD;;
  14. class TH2F;
  15. class TStraw : public TNamed {
  16. // --------------------------------------------------------------------
  17. public:
  18. TStraw();
  19. virtual ~TStraw() {};
  20. ClassDef(TStraw,1);
  21. // Get methods
  22. Double_t GetCDist(Int_t k){ return CDist[k];};
  23. Double_t GetCNele(Int_t k){ return CNele[k];};
  24. Double_t GetCNeleT(Int_t k){return CNeleT[k];};
  25. Double_t GetTeleTime(Int_t k){return TeleTime[k];};
  26. Double_t GetPulse(Int_t k){return Pulse[k];};
  27. Double_t GetPulseT(Int_t k){return PulseT[k];};
  28. Double_t GetWi(){return Wi*1.e-09;}; // in GeV
  29. Double_t GetGasGain(){return GasGain;};
  30. Double_t GetXmax(){return Xmax;};
  31. Double_t GetDx(){return Dx;};
  32. Double_t GetEmed(){return Emed;};
  33. Double_t GetEmin(){return Emin;};
  34. Double_t GetNcl(){return Ncl;};
  35. Double_t GetCsi(){return Csi;};
  36. Double_t GetDelta(){return Delta;};
  37. Double_t GetEmax(){return Emax;};
  38. Double_t GetIAr(){return IAr;};
  39. Int_t GetNNClus(){return NNClus;};
  40. Int_t GetNchann(){return Nchann;};
  41. Double_t GetPulseMax(){return PulseMax;};
  42. Double_t GetGamma(){return gamma;};
  43. Double_t GetBeta(){return beta;};
  44. Double_t GetpSTP(){return pSTP;};
  45. Double_t GetPulseTime(){return PulseTime;};
  46. Double_t GetbPolya(){return bPolya;};
  47. // coordinates
  48. Double_t GetXin() {return Xin;};
  49. Double_t GetYin() {return Yin;};
  50. Double_t GetZin() {return Zin;};
  51. Double_t GetXout(){return Xout;};
  52. Double_t GetYout(){return Yout;};
  53. Double_t GetZout(){return Zout;};
  54. Double_t GetRpath(){return Rpath;};
  55. TVector3 GetWDist(Int_t k){return WDist[k];};
  56. // put methods
  57. void PutTrackXYZ(Double_t v1, Double_t v2, Double_t v3,
  58. Double_t v4, Double_t v5, Double_t v6)
  59. {Xin=v1; Yin=v2; Zin=v3; Xout=v4; Yout=v5; Zout=v6;};
  60. void PutRpath(Double_t value){Rpath=value;};
  61. void PutPolya(Double_t par){bPolya=par;};
  62. void PutRadius(Double_t value){Radius=value;};
  63. void PutPress(Double_t value){pSTP=value;};
  64. // ----------------------------------------------------------------------------
  65. // calls at each track for MC applications
  66. // define the wire
  67. void PutWireXYZ(Double_t w1, Double_t w2, Double_t w3,
  68. Double_t w4, Double_t w5, Double_t w6);
  69. // straw time
  70. Double_t PartToTime(Double_t Mass, Double_t Momentum,
  71. Double_t InOut[] );
  72. // ADC signal corresponding to the energy loss of StrawCharge
  73. Double_t PartToADC();
  74. // ----------------------------------------------------------------------------
  75. // standard calls
  76. // once to set constants
  77. void TConst(Double_t Radius, Double_t pSTP,Double_t ArP, Double_t CO2P);
  78. // to define the track
  79. void TInit(Double_t Mass, Double_t Momentum, Double_t InOut[] ); // for each track
  80. // other possible calls
  81. Double_t StrawCharge(); // total discharge electron calculation
  82. // energy loss in GeV
  83. Int_t StrawSignal(Int_t nsteps); // oscilloscope signal generation (ns)
  84. // Pulse[PulseT] in ns
  85. // return number of primary electrons
  86. Int_t StrawTime(); // output time of the straw (ns) &
  87. // PulseTime[Int_t] in ns
  88. Double_t TimnsToDiscm(Double_t time); // from time (ns) to
  89. //radius in cm
  90. //-----------------------------------------------------------------------------
  91. // utility methods
  92. void TDirCos(); // track director cosines
  93. Double_t TrueDist(Double_t Point[]); // true ditance wire-track
  94. Double_t DiffLong(Double_t distcm); // longituinal dffusion in microns
  95. Double_t DiffTran(Double_t distcm); // transverse diffusion in microns
  96. void Polya(Double_t bpar); // Polya cumulative calculation
  97. Double_t PolyaSamp(); // sampling from Polya distribution
  98. Double_t RRise(Double_t gamma_r); // relativistic rise calculation
  99. Int_t Cluster(); // cluster generation
  100. Int_t Eject(); // primary electron generation
  101. TVector3 WDistCalc(Double_t d); // distance electron-wire
  102. Double_t Signal(Double_t t, Double_t t0);// signal functional form
  103. Double_t STEloss(); // Landau energy loss
  104. Int_t TimeEle(); // arrivals times of all the electrons
  105. Double_t DistEle(Double_t tns); // distance of all the electrons
  106. //------------------------------------------------------------------------------
  107. private:
  108. //-----------------------------------------------------------------
  109. // distance, number of electrons (with delta rays),
  110. // distance from wire of the cluster
  111. vector<Double_t> CDist, CDistC, CNele, CNeleT, TeleTime, AmplSig;
  112. vector<Double_t> Pulse, PulseT;
  113. vector<TVector3> WDist;
  114. // set constants
  115. // masses in GeV, energies in GeV, cgs system
  116. // Input for the medium
  117. Double_t CumClus[21], CH4Clus[20];
  118. Double_t Wi;
  119. Double_t ArPerc, CO2Perc, CH4Perc; // volume percentages
  120. Double_t ArWPerc, CO2WPerc, CH4WPerc; // weight percentages
  121. Double_t pSTP; // pressure (STP reference)
  122. Double_t Radius; // straw radius
  123. Double_t AAr; // Argon
  124. Double_t ZAr; // Argon
  125. Double_t RhoAr; // g/cm3 (1.78 mg/cm3)
  126. Double_t NclAr; // clusters/cm
  127. Double_t EmedAr;
  128. Double_t EminAr;
  129. Double_t EmpAr;
  130. Double_t CsiAr;
  131. Double_t IAr; // ionization potential (188 eV)
  132. Double_t WiAr; // energy to reate an ion pair in Argon
  133. Double_t Ncl; // mean number of cluster in Argon
  134. Double_t Ecl; // electron per cluster
  135. Double_t Lcl; // mean free path between clusters
  136. Double_t Ntote; // mean total number of eletrons
  137. Double_t GasGain; // gain of the gas
  138. Double_t Cutoff; // limit the number of primry electrons
  139. // CO2
  140. Double_t EmedCO2;
  141. Double_t EminCO2;
  142. Double_t EmpCO2;
  143. Double_t CsiCO2;
  144. Double_t ACO2; // CO2 (39.948)
  145. Double_t ZCO2; // CO2 (18)
  146. Double_t RhoCO2; // g/cm3 CO2 (1.98 mg/cm3)
  147. Double_t ICO2; // ionization potential (GeV) (188 eV)
  148. Double_t WiCO2; // energy to create an ion pair
  149. Double_t NclCO2; // clusters/cm
  150. // Methane CH4 ------------------------------------------------
  151. Double_t EmedCH4;
  152. Double_t EmpCH4;
  153. Double_t CsiCH4;
  154. Double_t EminCH4;
  155. Double_t ACH4; // CO2 (39.948)
  156. Double_t ZCH4; // CO2 (18)
  157. Double_t RhoCH4; // g/cm3 CO2 (0.71 mg/cm3)
  158. Double_t ICH4; // ionization potential (GeV) (188 eV)
  159. Double_t WiCH4; // energy to create an ion pair
  160. Double_t NclCH4; // clusters/cm
  161. Double_t RhoMixCO2;
  162. Double_t RhoMixCH4;
  163. //----------------------------------------------------------------------
  164. // Input for the particle (Gev, energy loses in Kev
  165. Double_t PZeta; // charge
  166. Double_t piMass; // particle mass (GeV)
  167. Double_t PMass; // incident particle mass
  168. Double_t PMom; // particle momentum (GeV)
  169. Double_t Dx; // distance travelled in gas (cm)
  170. Double_t eMass; // electron mass (GeV) (0.511 MeV)
  171. Double_t prMass; // proton mass
  172. Double_t Delta; // polarization Sternheimer parameter
  173. Int_t CNumb; // current number of clusters
  174. // ------------------------------------------------------
  175. // quantities for each track
  176. // calculated in TInit
  177. Double_t PEn; // particle energy GeV
  178. Double_t beta;
  179. Double_t gamma;
  180. Double_t Emed; // GeV
  181. Double_t Emin; // GeV/cm (2.7 keV)
  182. Double_t Csi;
  183. Double_t Emax;
  184. Double_t Emp; // most probable energy
  185. Int_t NNClus; // number of clusters
  186. // ---------------------------------------------------------------------
  187. // mathematical and statistical parameters
  188. Double_t PolyaCum[100], Xs[100];
  189. Double_t Xin, Yin, Zin, Xout, Yout, Zout, Rpath;
  190. Int_t NPolya;
  191. Double_t Xmax;
  192. Double_t bPolya;
  193. Double_t Calpha, Cbeta, Cgamma;
  194. // --------------------------------------------------------------
  195. // for the straws
  196. Double_t Wx1,Wy1,Wz1, Wx2,Wy2,Wz2; // wire coordinates
  197. Double_t Wp,Wq,Wr; // director cosine of the wire
  198. Double_t PulseMax;
  199. Double_t PulseTime;
  200. Double_t Thresh1; // first threshold
  201. Double_t Thresh2;
  202. Int_t Nchann; // number of channels for the straw signal
  203. // ----------------------------------------------------------------------
  204. // dummy
  205. Double_t Out1;
  206. Int_t Out2, Out3;
  207. };
  208. #endif