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