URun.cxx 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. #include <iostream>
  2. using namespace std;
  3. #include "TMath.h"
  4. #include "URun.h"
  5. //#include "FairLogger.h"
  6. //____________________________________________________________________
  7. //
  8. // URun
  9. //
  10. // Class for handling the run description.
  11. // See the standard constructor and public accessors
  12. //
  13. //--------------------------------------------------------------------
  14. URun::URun()
  15. : TNamed("run","Run Header"),
  16. fGenerator(""),
  17. fComment(""),
  18. fDecayer(""),
  19. fAProj(0),
  20. fZProj(0),
  21. fPProj(0.),
  22. fATarg(0),
  23. fZTarg(0),
  24. fPTarg(0.),
  25. fBMin(0.),
  26. fBMax(0.),
  27. fBWeight(0),
  28. fPhiMin(0.),
  29. fPhiMax(0.),
  30. fSigma(0.),
  31. fNEvents(0)
  32. {
  33. }
  34. //--------------------------------------------------------------------
  35. //--------------------------------------------------------------------
  36. URun::URun(const char* generator, const char* comment, Int_t aProj,
  37. Int_t zProj, Double_t pProj, Int_t aTarg, Int_t zTarg,
  38. Double_t pTarg, Double_t bMin, Double_t bMax, Int_t bWeight,
  39. Double_t phiMin, Double_t phiMax, Double_t sigma,
  40. Int_t nEvents)
  41. : TNamed("run", "Run Header"),
  42. fGenerator(generator),
  43. fComment(comment),
  44. fDecayer(""),
  45. fAProj(aProj),
  46. fZProj(zProj),
  47. fPProj(pProj),
  48. fATarg(aTarg),
  49. fZTarg(zTarg),
  50. fPTarg(pTarg),
  51. fBMin(bMin),
  52. fBMax(bMax),
  53. fBWeight(bWeight),
  54. fPhiMin(phiMin),
  55. fPhiMax(phiMax),
  56. fSigma(sigma),
  57. fNEvents(nEvents)
  58. {
  59. }
  60. //--------------------------------------------------------------------
  61. //--------------------------------------------------------------------
  62. URun::~URun()
  63. {
  64. // Destructor
  65. }
  66. //--------------------------------------------------------------------
  67. //--------------------------------------------------------------------
  68. void URun::Print(Option_t* /*option*/) const
  69. {
  70. // Print all data members to the standard output
  71. cout << "--------------------------------------------------" << endl
  72. << "-I- Run Header -I-" << endl
  73. << "Generator : " << fGenerator << endl
  74. << "Comment : " << fComment << endl
  75. << "Decayer : " << fDecayer << endl
  76. << "Projectile mass : " << fAProj << endl
  77. << "Projectile charge : " << fZProj << endl
  78. << "Projectile momentum (AGeV/c) : " << fPProj << endl
  79. << "Target mass : " << fATarg << endl
  80. << "Target charge : " << fZTarg << endl
  81. << "Target momentum (AGeV/c) : " << fPTarg << endl
  82. << "Minimal impact parameter (fm) : " << fBMin << endl
  83. << "Maximal impact parameter (fm) : " << fBMax << endl
  84. << "Impact parameter weightning : " << fBWeight << endl
  85. << "Minimal azimuthal angle (rad) : " << fPhiMin << endl
  86. << "Maximal azimuthal angle (rad) : " << fPhiMax << endl
  87. << "Cross-section (mb) : " << fSigma << endl
  88. << "Requested number of events : " << fNEvents << endl
  89. << "--------------------------------------------------" << endl;
  90. }
  91. //--------------------------------------------------------------------
  92. //--------------------------------------------------------------------
  93. Double_t URun::GetProjectileEnergy()
  94. {
  95. // Get the projectile energy
  96. Double_t mProt = 0.938272029;
  97. Double_t mNeut = 0.939565360;
  98. Double_t mPion = 0.13957018;
  99. Double_t eProj = 0.;
  100. if ( fAProj > 0 ) // nucleus
  101. eProj = fZProj * TMath::Sqrt( fPProj*fPProj + mProt*mProt )
  102. + (fAProj - fZProj) * TMath::Sqrt( fPProj*fPProj + mNeut*mNeut );
  103. else if ( fAProj == 0 ) // photon
  104. eProj = fPProj;
  105. else if ( fAProj == -1 ) // pion
  106. eProj = TMath::Sqrt( fPProj*fPProj + mPion*mPion );
  107. else cout << "Warning:: URun: Projectile mass " << fAProj
  108. << " not valid! " << endl;
  109. return eProj;
  110. }
  111. //--------------------------------------------------------------------
  112. //--------------------------------------------------------------------
  113. Double_t URun::GetTargetEnergy()
  114. {
  115. // Get the target energy
  116. Double_t mProt = 0.938272029;
  117. Double_t mNeut = 0.939565360;
  118. Double_t mPion = 0.13957018;
  119. Double_t eTarg = 0.;
  120. if ( fATarg > 0 ) // nucleus
  121. eTarg = fZTarg * TMath::Sqrt( fPTarg*fPTarg + mProt*mProt )
  122. + (fATarg - fZTarg) * TMath::Sqrt( fPTarg*fPTarg + mNeut*mNeut );
  123. else if ( fAProj == 0 ) // photon
  124. eTarg = fPTarg;
  125. else if ( fAProj == -1 ) // pion
  126. eTarg = TMath::Sqrt( fPTarg*fPTarg + mPion*mPion );
  127. else cout << "Warning:: URun: Target mass " << fATarg
  128. << " not valid! " << endl;
  129. return eTarg;
  130. }
  131. //--------------------------------------------------------------------
  132. //--------------------------------------------------------------------
  133. Double_t URun::GetNNSqrtS()
  134. {
  135. // Get the cm energy
  136. Double_t eSum = TMath::Sqrt( fPTarg*fPTarg + 0.938272029*0.938272029 ) + TMath::Sqrt( fPProj*fPProj + 0.938272029*0.938272029 );
  137. Double_t pSum = Double_t(fPProj + fPTarg);
  138. Double_t ecm = TMath::Sqrt( eSum*eSum - pSum*pSum );
  139. return ecm;
  140. }
  141. //--------------------------------------------------------------------
  142. Double_t URun::GetSqrtS()
  143. {
  144. // Get the cm energy
  145. Double_t eSum = GetProjectileEnergy() + GetTargetEnergy();
  146. Double_t pSum = Double_t(fAProj) * fPProj + Double_t(fATarg) * fPTarg;
  147. Double_t ecm = TMath::Sqrt( eSum*eSum - pSum*pSum );
  148. return ecm;
  149. }
  150. //--------------------------------------------------------------------
  151. //--------------------------------------------------------------------
  152. Double_t URun::GetBetaCM()
  153. {
  154. // Get cm velocity
  155. Double_t eSum = GetProjectileEnergy() + GetTargetEnergy();
  156. Double_t pSum = Double_t(fAProj) * fPProj + Double_t(fATarg) * fPTarg;
  157. return pSum / eSum;
  158. }
  159. //--------------------------------------------------------------------
  160. //--------------------------------------------------------------------
  161. Double_t URun::GetGammaCM()
  162. {
  163. // Get cm gamma factor
  164. Double_t betaCM = GetBetaCM();
  165. return 1. / TMath::Sqrt( 1. - betaCM*betaCM );
  166. }
  167. //--------------------------------------------------------------------
  168. ClassImp(URun);