Geant4  10.00.p02
G4ExcitedString.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 
29 #ifndef G4ExcitedString_h
30 #define G4ExcitedString_h 1
31 
32 // ------------------------------------------------------------
33 // GEANT 4 class header file
34 //
35 // ---------------- G4ExcitedString ----------------
36 // by Gunter Folger, June 1998.
37 // class for an excited string used by Parton String Models
38 // ------------------------------------------------------------
39 
40 #include "G4ios.hh"
41 #include "globals.hh"
42 #include "G4ThreeVector.hh"
43 #include "G4LorentzVector.hh"
44 #include "G4LorentzRotation.hh"
45 #include "G4Parton.hh"
46 #include "G4PartonVector.hh"
47 #include "G4KineticTrack.hh"
48 #include "G4HadronicException.hh"
49 #include <algorithm>
50 
52 {
53 
54  public:
55 
56  enum {
57  PROJECTILE = 1,
58  TARGET = -1
59  };
60 
61  G4ExcitedString(G4Parton* Color, G4Parton* Gluon, G4Parton* AntiColor, G4int Direction=PROJECTILE);
62  G4ExcitedString(G4Parton* Color, G4Parton* AntiColor, G4int Direction=PROJECTILE);
64 
65 
67 
68 private:
71 
72 public:
73  int operator==(const G4ExcitedString &right) const;
74  int operator!=(const G4ExcitedString &right) const;
75 
76 public:
77  G4double GetTimeOfCreation() const; // Uzhi 15.05.08
78 
79  void SetTimeOfCreation(G4double aTime); // Uzhi 15.05.08
80 
81  const G4ThreeVector & GetPosition() const;
82 
83  void SetPosition(const G4ThreeVector &aPosition);
84 
85  const G4PartonVector * GetPartonList() const;
86 
88  void LorentzRotate(const G4LorentzRotation & rotation);
89 
90  void InsertParton(G4Parton * aParton, const G4Parton * addafter = NULL);
91 
94 
95 
96  void Boost(G4ThreeVector& Velocity);
97 
98  G4Parton* GetColorParton(void) const;
99  G4Parton* GetGluon(void) const;
100  G4Parton* GetAntiColorParton(void) const;
101  G4Parton* GetGluon(G4int GluonPos) const;
102 
104 
105  G4Parton* GetLeftParton(void) const;
106  G4Parton* GetRightParton(void) const;
107 
108  G4bool IsItKinkyString(void) const;
109  G4int GetDirection(void) const;
110 
111  G4bool IsExcited() const;
112 
113 
114  private:
115 
116  G4int theDirection; // must be 1 or -1 (PROJECTILE or TARGET)
117  G4double theTimeOfCreation; // Uzhi 15.05.08
119  G4PartonVector thePartons; // would like initial capacity for 3 Partons.
121 
122 };
123 
124 inline
126 {
127  return this == &right;
128 }
129 
130 inline
132 {
133  return this != &right;
134 }
135 
136 inline
138 {
139  return theTimeOfCreation;
140 }
141 
142 inline
143 void G4ExcitedString::SetTimeOfCreation(G4double aTime) // Uzhi 15.05.08
144 {
145  theTimeOfCreation=aTime; // Uzhi 15.05.08
146 }
147 
148 inline
150 {
151  return thePosition;
152 }
153 
154 inline
156 {
157  thePosition= aPosition;
158 }
159 
160 inline
162 {
163  G4LorentzVector momentum;
164  for ( unsigned int index=0; index < thePartons.size() ; index++ )
165  {
166  // std::cout << "HPW "<<thePartons[index]->Get4Momentum()<<std::endl;
167  momentum += thePartons[index]->Get4Momentum();
168  }
169  return momentum;
170 }
171 
172 inline
174 {
175  for ( unsigned int index=0; index < thePartons.size() ; index++ )
176  {
177  thePartons[index]->Set4Momentum(rotation*thePartons[index]->Get4Momentum());
178  }
179 }
180 
181 inline
182 void G4ExcitedString::InsertParton(G4Parton *aParton, const G4Parton * addafter)
183 {
184 
185  G4PartonVector::iterator insert_index;
186 
187  if ( addafter != NULL )
188  {
189  insert_index=std::find(thePartons.begin(), thePartons.end(), addafter);
190  if (insert_index == thePartons.end()) // No object addafter in thePartons
191  {
192  G4String text = "G4ExcitedString::InsertParton called with invalid second argument";
193  throw G4HadronicException(__FILE__, __LINE__, text);
194  }
195  }
196 
197  thePartons.insert(insert_index+1, aParton);
198 }
199 
200 inline
202 {
203  G4LorentzVector momentum=Get4Momentum();
204  G4LorentzRotation toCms(-1*momentum.boostVector());
205 
206  for ( unsigned int index=0; index < thePartons.size() ; index++ )
207  {
208  momentum=toCms * thePartons[index]->Get4Momentum();
209  thePartons[index]->Set4Momentum(momentum);
210  }
211  return toCms;
212 }
213 
214 inline
216 {
217  G4LorentzVector momentum=Get4Momentum();
218  G4LorentzRotation toAlignedCms(-1*momentum.boostVector());
219 
220  momentum= toAlignedCms* thePartons[0]->Get4Momentum();
221  toAlignedCms.rotateZ(-1*momentum.phi());
222  toAlignedCms.rotateY(-1*momentum.theta());
223 
224  for ( unsigned int index=0; index < thePartons.size() ; index++ )
225  {
226  momentum=toAlignedCms * thePartons[index]->Get4Momentum();
227  thePartons[index]->Set4Momentum(momentum);
228  }
229  return toAlignedCms;
230 }
231 
232 
233 inline
235 {
236  return &thePartons;
237 }
238 
239 inline
241 {
242  return theTrack;
243 }
244 
245 inline
247 {
248  return theTrack == 0;
249 }
250 
251 
252 #endif
253 
254 
G4Parton * GetGluon(void) const
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepLorentzRotation G4LorentzRotation
G4double theTimeOfCreation
G4LorentzRotation TransformToCenterOfMass()
G4Parton * GetLeftParton(void) const
G4bool IsItKinkyString(void) const
int G4int
Definition: G4Types.hh:78
G4PartonVector thePartons
G4ThreeVector thePosition
G4bool IsExcited() const
void LorentzRotate(const G4LorentzRotation &rotation)
void Boost(G4ThreeVector &Velocity)
void InsertParton(G4Parton *aParton, const G4Parton *addafter=NULL)
G4Parton * GetAntiColorParton(void) const
const G4ThreeVector & GetPosition() const
G4ExcitedString & operator=(const G4ExcitedString &right)
G4ExcitedString(G4Parton *Color, G4Parton *Gluon, G4Parton *AntiColor, G4int Direction=PROJECTILE)
void SetPosition(const G4ThreeVector &aPosition)
void SetTimeOfCreation(G4double aTime)
const G4PartonVector * GetPartonList() const
G4LorentzVector Get4Momentum() const
bool G4bool
Definition: G4Types.hh:79
G4LorentzRotation TransformToAlignedCms()
G4KineticTrack * GetKineticTrack() const
int operator==(const G4ExcitedString &right) const
G4Parton * GetColorParton(void) const
G4Parton * GetRightParton(void) const
Color
Definition: test07.cc:36
std::vector< G4Parton * > G4PartonVector
G4double GetTimeOfCreation() const
G4int GetDirection(void) const
G4KineticTrack * theTrack
double G4double
Definition: G4Types.hh:76
int operator!=(const G4ExcitedString &right) const
CLHEP::HepLorentzVector G4LorentzVector