source: trunk/source/processes/hadronic/models/util/include/G4ExcitedString.hh @ 1358

Last change on this file since 1358 was 962, checked in by garnier, 15 years ago

update processes

File size: 7.1 KB
Line 
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
51class G4ExcitedString 
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);
63      G4ExcitedString(G4KineticTrack * atrack);
64     
65      G4ExcitedString(const G4ExcitedString &right);
66
67      ~G4ExcitedString();
68
69      int operator==(const G4ExcitedString &right) const;
70
71      int operator!=(const G4ExcitedString &right) const;
72
73      G4double GetTimeOfCreation() const;               // Uzhi 15.05.08
74
75      void  SetTimeOfCreation(G4double aTime);          // Uzhi 15.05.08
76
77      const G4ThreeVector & GetPosition() const;
78
79      void SetPosition(const G4ThreeVector &aPosition); 
80
81      const G4PartonVector * GetPartonList() const;
82     
83      G4LorentzVector Get4Momentum() const;
84      void LorentzRotate(const G4LorentzRotation & rotation);
85
86      void InsertParton(G4Parton * aParton, const G4Parton * addafter = NULL);
87
88      G4LorentzRotation TransformToCenterOfMass();
89      G4LorentzRotation TransformToAlignedCms();
90
91
92      void      Boost(G4ThreeVector& Velocity);
93
94      G4Parton* GetColorParton(void) const;
95      G4Parton* GetGluon(void) const;
96      G4Parton* GetAntiColorParton(void) const;
97      G4Parton* GetGluon(G4int GluonPos) const;
98     
99      G4KineticTrack * GetKineticTrack() const;
100
101      G4Parton* GetLeftParton(void) const;
102      G4Parton* GetRightParton(void) const;
103
104      G4bool    IsItKinkyString(void) const;
105      G4int     GetDirection(void) const;
106     
107      G4bool    IsExcited() const;
108
109
110  private:
111
112      G4int    theDirection;  // must be 1 or -1 (PROJECTILE or TARGET)
113      G4double theTimeOfCreation;                   // Uzhi 15.05.08
114      G4ThreeVector thePosition;
115      G4PartonVector thePartons;  // would like initial capacity for 3 Partons.
116      G4KineticTrack* theTrack;
117
118};
119
120inline
121int G4ExcitedString::operator==(const G4ExcitedString &right) const
122{
123        return this == &right;
124}
125
126inline
127int G4ExcitedString::operator!=(const G4ExcitedString &right) const
128{
129        return this != &right;
130}
131
132inline
133G4double G4ExcitedString::GetTimeOfCreation() const      // Uzhi 15.05.08
134{
135        return theTimeOfCreation;
136}
137
138inline
139void G4ExcitedString::SetTimeOfCreation(G4double aTime)  // Uzhi 15.05.08
140{
141        theTimeOfCreation=aTime;                         // Uzhi 15.05.08
142}
143
144inline
145const G4ThreeVector & G4ExcitedString::GetPosition() const 
146{
147        return thePosition;
148}
149
150inline
151void G4ExcitedString::SetPosition(const G4ThreeVector &aPosition)
152{
153        thePosition= aPosition;
154}
155
156inline
157G4LorentzVector G4ExcitedString::Get4Momentum() const
158{
159        G4LorentzVector momentum;
160        for ( unsigned int index=0; index < thePartons.size() ; index++ )
161        {
162            // std::cout << "HPW "<<thePartons[index]->Get4Momentum()<<std::endl;
163            momentum += thePartons[index]->Get4Momentum();
164        }
165        return momentum;
166}
167
168inline
169void G4ExcitedString::LorentzRotate(const G4LorentzRotation & rotation)
170{
171        for ( unsigned int index=0; index < thePartons.size() ; index++ )
172        {
173            thePartons[index]->Set4Momentum(rotation*thePartons[index]->Get4Momentum());
174        }
175}
176
177inline
178void G4ExcitedString::InsertParton(G4Parton *aParton, const G4Parton * addafter)
179{
180
181        G4PartonVector::iterator insert_index;
182       
183        if ( addafter != NULL ) 
184        {
185           insert_index=std::find(thePartons.begin(), thePartons.end(), addafter);
186           if (insert_index == thePartons.end())                // No object addafter in thePartons
187           {
188              G4String text = "G4ExcitedString::InsertParton called with invalid second argument";
189              throw G4HadronicException(__FILE__, __LINE__, text);
190           }
191        }
192       
193        thePartons.insert(insert_index+1, aParton);
194} 
195
196inline
197G4LorentzRotation G4ExcitedString::TransformToCenterOfMass()
198{
199        G4LorentzVector momentum=Get4Momentum();
200        G4LorentzRotation toCms(-1*momentum.boostVector());
201
202        for ( unsigned int index=0; index < thePartons.size() ; index++ )
203        {
204            momentum=toCms * thePartons[index]->Get4Momentum();
205            thePartons[index]->Set4Momentum(momentum);
206        }
207        return toCms;
208}
209
210inline
211G4LorentzRotation G4ExcitedString::TransformToAlignedCms()
212{
213        G4LorentzVector momentum=Get4Momentum();
214        G4LorentzRotation toAlignedCms(-1*momentum.boostVector());
215
216        momentum= toAlignedCms* thePartons[0]->Get4Momentum();
217        toAlignedCms.rotateZ(-1*momentum.phi());
218        toAlignedCms.rotateY(-1*momentum.theta());
219       
220        for ( unsigned int index=0; index < thePartons.size() ; index++ )
221        {
222            momentum=toAlignedCms * thePartons[index]->Get4Momentum();
223            thePartons[index]->Set4Momentum(momentum);
224        }
225        return toAlignedCms;
226}
227
228
229inline 
230const G4PartonVector * G4ExcitedString::GetPartonList() const
231{
232        return &thePartons;
233}
234
235inline 
236G4KineticTrack * G4ExcitedString::GetKineticTrack() const
237{
238        return theTrack;
239}
240
241inline 
242G4bool G4ExcitedString::IsExcited() const
243{
244        return theTrack == 0;
245}
246
247
248#endif
249
250
Note: See TracBrowser for help on using the repository browser.