StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Nucleon.cxx
1 
2 #include <assert.h>
3 #include "Nucleon.h"
4 
5 ClassImp(Nucleon)
6 
7 //____________________________________________________________________________________________________
8 // Default constructor
10 {
11  Reset() ;
12 }
13 
14 //____________________________________________________________________________________________________
15 // Default destructor
16 Nucleon::~Nucleon()
17 {
18 }
19 
20 //____________________________________________________________________________________________________
22 {
23  mPosition.SetMagThetaPhi(-9999., -9999., -9999.);
24  mNpart = 0;
25  mNcoll = 0;
26  mMultiplicity = 0.0;
27 }
28 
29 //____________________________________________________________________________________________________
30 void Nucleon::Set(const Double_t r, const Double_t theta, const Double_t phi,
31  const Double_t impactParameter, const Double_t Theta, const Double_t Phi,
32  const Bool_t isThetaFirst)
33 {
35  mPosition.SetMagThetaPhi(r, theta, phi);
36 
38  if( Theta != 0.0 && Phi != 0.0 ){
39  if(isThetaFirst){
41  mPosition.RotateY(Theta);
42  mPosition.RotateZ(Phi);
43  }
44  else{
46  mPosition.RotateZ(Phi);
47  mPosition.RotateY(Theta);
48  }
49  }
50 
51  mPosition.SetX( mPosition.X() + impactParameter );
52  mNpart = 0;
53  mNcoll = 0;
54  mMultiplicity = 0.0;
55 }
56 
57 
58 //____________________________________________________________________________________________________
59 Double_t Nucleon::GetX() const
60 {
61  return mPosition.X() ;
62 }
63 
64 //____________________________________________________________________________________________________
65 Double_t Nucleon::GetY() const
66 {
67  return mPosition.Y() ;
68 }
69 
70 //____________________________________________________________________________________________________
71 Double_t Nucleon::GetZ() const
72 {
73  return mPosition.Z() ;
74 }
75 
76 //____________________________________________________________________________________________________
77 Double_t Nucleon::GetPhi() const
78 {
79  return mPosition.Phi() ;
80 }
81 
82 //____________________________________________________________________________________________________
83 Double_t Nucleon::GetR() const
84 {
85  return mPosition.Mag() ;
86 }
87 
88 //____________________________________________________________________________________________________
89 Double_t Nucleon::GetXYZ(const Char_t* name) const
90 {
93  const TString type(name);
94 
95  if( type.CompareTo("x", TString::kIgnoreCase) == 0 ) return GetX() ;
96  else if( type.CompareTo("y", TString::kIgnoreCase) == 0 ) return GetY() ;
97  else if( type.CompareTo("z", TString::kIgnoreCase) == 0 ) return GetZ() ;
98  else if( type.CompareTo("xx", TString::kIgnoreCase) == 0 ) return GetX() * GetX() ;
99  else if( type.CompareTo("yy", TString::kIgnoreCase) == 0 ) return GetY() * GetY() ;
100  else if( type.CompareTo("xy", TString::kIgnoreCase) == 0 ) return GetX() * GetY() ;
101  else if( type.CompareTo("xxx", TString::kIgnoreCase) == 0 ) return GetX() * GetX() * GetX() ;
102  else if( type.CompareTo("yyy", TString::kIgnoreCase) == 0 ) return GetY() * GetY() * GetY() ;
103  else if( type.CompareTo("xxy", TString::kIgnoreCase) == 0 ) return GetX() * GetX() * GetY() ;
104  else if( type.CompareTo("xyy", TString::kIgnoreCase) == 0 ) return GetX() * GetY() * GetY() ;
105  else{
106  Error("IcGenerator::GetXYZ", "Invalid name for sum, name=%s", name);
107  assert(0);
108  }
109 
110  // Never happen
111  Error("Nucleon::GetXYZ", "Something is wrong");
112  assert(0);
113 }
114 
115 
116 //____________________________________________________________________________________________________
117 const TVector3& Nucleon::GetVector() const
118 {
119  return mPosition ;
120 }
121 
122 //____________________________________________________________________________________________________
123 Double_t Nucleon::GetWeight(const UInt_t weightId) const
124 {
126 
127  switch ( weightId ) {
128  case 0: return 1.0 ; // Npart weight
129  case 1: return GetNcoll() ; // Ncoll weight
130  case 2: return GetMultiplicity() ; // Multiplicity weight
131  default:
132  Warning("Nucleon::GetWeight", "Invalid weightId, id=%3d. Return unit weight", weightId);
133  return 1.0;
134  }
135 
136  // Never happen
137  Error("Nucleon::GetWeight", "Something is wrong");
138  assert(0);
139 }
140 
Definition: FJcore.h:367
Double_t GetR() const
Get azimuthal angle of nucleon.
Definition: Nucleon.cxx:83
Double_t GetY() const
Get x position.
Definition: Nucleon.cxx:65
void Set(const Double_t r, const Double_t theta, const Double_t phi, const Double_t impactParameter, const Double_t Theta, const Double_t Phi, const Bool_t isThetaFirst=kTRUE)
Reset all data members.
Definition: Nucleon.cxx:30
void Reset()
Default destructor.
Definition: Nucleon.cxx:21
Double_t GetMultiplicity() const
Get Ncoll(x,y)
Definition: Nucleon.h:55
Double_t GetZ() const
Get y position.
Definition: Nucleon.cxx:71
Double_t GetPhi() const
Get x/y/z or their product (see source)
Definition: Nucleon.cxx:77
Double_t GetXYZ(const Char_t *name="X") const
Get z position.
Definition: Nucleon.cxx:89
UInt_t GetNcoll() const
Get Npart(x,y)
Definition: Nucleon.h:54
Double_t GetWeight(const UInt_t weightId=0) const
Get Multiplicity(x,y)
Definition: Nucleon.cxx:123
const TVector3 & GetVector() const
Set multiplicity.
Definition: Nucleon.cxx:117
Definition: Nucleon.h:9