00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef G4ExcitedString_h
00030 #define G4ExcitedString_h 1
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include "G4ios.hh"
00041 #include "globals.hh"
00042 #include "G4ThreeVector.hh"
00043 #include "G4LorentzVector.hh"
00044 #include "G4LorentzRotation.hh"
00045 #include "G4Parton.hh"
00046 #include "G4PartonVector.hh"
00047 #include "G4KineticTrack.hh"
00048 #include "G4HadronicException.hh"
00049 #include <algorithm>
00050
00051 class G4ExcitedString
00052 {
00053
00054 public:
00055
00056 enum {
00057 PROJECTILE = 1,
00058 TARGET = -1
00059 };
00060
00061 G4ExcitedString(G4Parton* Color, G4Parton* Gluon, G4Parton* AntiColor, G4int Direction=PROJECTILE);
00062 G4ExcitedString(G4Parton* Color, G4Parton* AntiColor, G4int Direction=PROJECTILE);
00063 G4ExcitedString(G4KineticTrack * atrack);
00064
00065
00066 ~G4ExcitedString();
00067
00068 private:
00069 G4ExcitedString(const G4ExcitedString &right);
00070 G4ExcitedString& operator= (const G4ExcitedString &right);
00071
00072 public:
00073 int operator==(const G4ExcitedString &right) const;
00074 int operator!=(const G4ExcitedString &right) const;
00075
00076 public:
00077 G4double GetTimeOfCreation() const;
00078
00079 void SetTimeOfCreation(G4double aTime);
00080
00081 const G4ThreeVector & GetPosition() const;
00082
00083 void SetPosition(const G4ThreeVector &aPosition);
00084
00085 const G4PartonVector * GetPartonList() const;
00086
00087 G4LorentzVector Get4Momentum() const;
00088 void LorentzRotate(const G4LorentzRotation & rotation);
00089
00090 void InsertParton(G4Parton * aParton, const G4Parton * addafter = NULL);
00091
00092 G4LorentzRotation TransformToCenterOfMass();
00093 G4LorentzRotation TransformToAlignedCms();
00094
00095
00096 void Boost(G4ThreeVector& Velocity);
00097
00098 G4Parton* GetColorParton(void) const;
00099 G4Parton* GetGluon(void) const;
00100 G4Parton* GetAntiColorParton(void) const;
00101 G4Parton* GetGluon(G4int GluonPos) const;
00102
00103 G4KineticTrack * GetKineticTrack() const;
00104
00105 G4Parton* GetLeftParton(void) const;
00106 G4Parton* GetRightParton(void) const;
00107
00108 G4bool IsItKinkyString(void) const;
00109 G4int GetDirection(void) const;
00110
00111 G4bool IsExcited() const;
00112
00113
00114 private:
00115
00116 G4int theDirection;
00117 G4double theTimeOfCreation;
00118 G4ThreeVector thePosition;
00119 G4PartonVector thePartons;
00120 G4KineticTrack* theTrack;
00121
00122 };
00123
00124 inline
00125 int G4ExcitedString::operator==(const G4ExcitedString &right) const
00126 {
00127 return this == &right;
00128 }
00129
00130 inline
00131 int G4ExcitedString::operator!=(const G4ExcitedString &right) const
00132 {
00133 return this != &right;
00134 }
00135
00136 inline
00137 G4double G4ExcitedString::GetTimeOfCreation() const
00138 {
00139 return theTimeOfCreation;
00140 }
00141
00142 inline
00143 void G4ExcitedString::SetTimeOfCreation(G4double aTime)
00144 {
00145 theTimeOfCreation=aTime;
00146 }
00147
00148 inline
00149 const G4ThreeVector & G4ExcitedString::GetPosition() const
00150 {
00151 return thePosition;
00152 }
00153
00154 inline
00155 void G4ExcitedString::SetPosition(const G4ThreeVector &aPosition)
00156 {
00157 thePosition= aPosition;
00158 }
00159
00160 inline
00161 G4LorentzVector G4ExcitedString::Get4Momentum() const
00162 {
00163 G4LorentzVector momentum;
00164 for ( unsigned int index=0; index < thePartons.size() ; index++ )
00165 {
00166
00167 momentum += thePartons[index]->Get4Momentum();
00168 }
00169 return momentum;
00170 }
00171
00172 inline
00173 void G4ExcitedString::LorentzRotate(const G4LorentzRotation & rotation)
00174 {
00175 for ( unsigned int index=0; index < thePartons.size() ; index++ )
00176 {
00177 thePartons[index]->Set4Momentum(rotation*thePartons[index]->Get4Momentum());
00178 }
00179 }
00180
00181 inline
00182 void G4ExcitedString::InsertParton(G4Parton *aParton, const G4Parton * addafter)
00183 {
00184
00185 G4PartonVector::iterator insert_index;
00186
00187 if ( addafter != NULL )
00188 {
00189 insert_index=std::find(thePartons.begin(), thePartons.end(), addafter);
00190 if (insert_index == thePartons.end())
00191 {
00192 G4String text = "G4ExcitedString::InsertParton called with invalid second argument";
00193 throw G4HadronicException(__FILE__, __LINE__, text);
00194 }
00195 }
00196
00197 thePartons.insert(insert_index+1, aParton);
00198 }
00199
00200 inline
00201 G4LorentzRotation G4ExcitedString::TransformToCenterOfMass()
00202 {
00203 G4LorentzVector momentum=Get4Momentum();
00204 G4LorentzRotation toCms(-1*momentum.boostVector());
00205
00206 for ( unsigned int index=0; index < thePartons.size() ; index++ )
00207 {
00208 momentum=toCms * thePartons[index]->Get4Momentum();
00209 thePartons[index]->Set4Momentum(momentum);
00210 }
00211 return toCms;
00212 }
00213
00214 inline
00215 G4LorentzRotation G4ExcitedString::TransformToAlignedCms()
00216 {
00217 G4LorentzVector momentum=Get4Momentum();
00218 G4LorentzRotation toAlignedCms(-1*momentum.boostVector());
00219
00220 momentum= toAlignedCms* thePartons[0]->Get4Momentum();
00221 toAlignedCms.rotateZ(-1*momentum.phi());
00222 toAlignedCms.rotateY(-1*momentum.theta());
00223
00224 for ( unsigned int index=0; index < thePartons.size() ; index++ )
00225 {
00226 momentum=toAlignedCms * thePartons[index]->Get4Momentum();
00227 thePartons[index]->Set4Momentum(momentum);
00228 }
00229 return toAlignedCms;
00230 }
00231
00232
00233 inline
00234 const G4PartonVector * G4ExcitedString::GetPartonList() const
00235 {
00236 return &thePartons;
00237 }
00238
00239 inline
00240 G4KineticTrack * G4ExcitedString::GetKineticTrack() const
00241 {
00242 return theTrack;
00243 }
00244
00245 inline
00246 G4bool G4ExcitedString::IsExcited() const
00247 {
00248 return theTrack == 0;
00249 }
00250
00251
00252 #endif
00253
00254