TpcGas.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // -----------------------------------------------------------------
  2. // $Id: TpcGas.hh,v 1.10 2006/03/10 14:45:24 sneubert Exp $
  3. //
  4. // Description:
  5. // Data class which provides access to various gas-parameters
  6. // for drift detectors
  7. //
  8. // Environment:
  9. // Software developed for the PANDA Detector at FAIR.
  10. //
  11. // Author List:
  12. // Sebastian Neubert TUM Original Author
  13. // Cristoforo Simonetto TUM
  14. // Salmin Roman Bugfix
  15. //
  16. // -----------------------------------------------------------------
  17. #ifndef TPCGAS_HH
  18. #define TPCGAS_HH
  19. #include <assert.h>
  20. #include <ostream>
  21. #include <vector>
  22. #include <string>
  23. enum gascomponents {Ne,Ar,CO2,CH4};
  24. class TpcGas {
  25. public:
  26. // constructors
  27. TpcGas();
  28. ~TpcGas();
  29. TpcGas(double const E,
  30. double const B,
  31. double const T,
  32. double const p,
  33. double const VDrift,
  34. double const Dl,
  35. double const Dt,
  36. double const k,
  37. double const W,
  38. const std::vector<double>& CSD,
  39. double const CSDEpol);
  40. TpcGas(const std::string& Filename,
  41. double const E);
  42. // accessors
  43. double VDrift() const {return _VDrift;}
  44. double Dl() const {return _Dl;}
  45. double Dt() const {return _Dt;}
  46. double VDrift(double const Ee, double const Bb) const {return _VDrift;}
  47. double Dl(double const Ee, double const Bb) const {return _Dl;}
  48. double Dt(double const Ee, double const Bb) const {return _Dt;}
  49. double k() const {return _k;}
  50. double W() const {return _W;}
  51. double CSD(int i) const {return _CSD.at(i);}
  52. const std::vector<double>& CSD() const {return _CSD;}
  53. int nCSD() const {return _CSD.size();}
  54. double CSDNorm() const {return _CSDNorm;}
  55. double CSDEpol() const {return _CSDEpol;}
  56. double E() const {return _E;}
  57. double B() const {return _B;}
  58. double T() const {return _T;}
  59. double p() const {return _p;}
  60. int GetRandomCS(double const r) const; //has problem with not normalized table
  61. int GetRandomCSUniform() const;
  62. void PrintAll(std::ostream& s) const {s<<*this;}
  63. void operator=(const TpcGas& GasToCopy);
  64. friend std::ostream& operator<< (std::ostream&, const TpcGas&);
  65. // modifiers
  66. void SetE(double const Ee){_E=Ee;} // later this method should also retrieve
  67. // updated gas values for the new field!
  68. void SetB(double const Bb){_B=Bb;}
  69. void SetT(double const Tt){_T=Tt;}
  70. void Setp(double const pp){_p=pp;}
  71. void SetCSD(const std::vector<double>& CSD);
  72. void SetCSDEpol(double const CSDEpoll){_CSDEpol=CSDEpoll;}
  73. private:
  74. double _E; // electric field [V/cm](some gas parameters depend on it)
  75. double _B; // B field [T] assumption: B || E !!!
  76. double _T; // Temperature [K]
  77. double _p; // pressure [mbar]
  78. double _VDrift; // electron Drift velocity [cm/ns]
  79. double _Dl; // longitudinal diffusion coefficient [sqrt(cm)]
  80. double _Dt; // transversal diffusion coefficient [sqrt(cm)]
  81. double _k; // attachment coefficient[1/cm]
  82. double _W; // effective ionisation energy [eV]
  83. std::vector<double> _CSD; // Cluster size distribution
  84. double _CSDNorm; // Intergral of CSD must be 1 but actually not. Used for correction.
  85. double _CSDEpol; // Constant used for the inverse quadratic extrapolation
  86. // of Cluster Sizes bigger than _nCSD
  87. const double LinExpolation(double const inTable, const double* const table,
  88. int const nTable);
  89. int ReadGasBegin(std::ifstream* const pinfile);
  90. int ReadGasArrays(std::ifstream* const pinfile, int const noent,
  91. double* const e, double* const vdrift, double* const dt,
  92. double* const dl, double* const k);
  93. const double GetPositionOfE(int const noent, const double* const e);
  94. };
  95. #endif