File indexing completed on 2025-07-12 08:36:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef G4ExcitedString_h
0030 #define G4ExcitedString_h 1
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #include "G4ios.hh"
0041 #include "globals.hh"
0042 #include "G4ThreeVector.hh"
0043 #include "G4LorentzVector.hh"
0044 #include "G4LorentzRotation.hh"
0045 #include "G4Parton.hh"
0046 #include "G4PartonVector.hh"
0047 #include "G4KineticTrack.hh"
0048 #include "G4HadronicException.hh"
0049 #include <algorithm>
0050
0051 class G4ExcitedString
0052 {
0053
0054 public:
0055
0056 enum {
0057 PROJECTILE = 1,
0058 TARGET = -1
0059 };
0060
0061 G4ExcitedString(G4Parton* Color, G4Parton* Gluon, G4Parton* AntiColor, G4int Direction=PROJECTILE);
0062 G4ExcitedString(G4Parton* Color, G4Parton* AntiColor, G4int Direction=PROJECTILE);
0063 G4ExcitedString(G4KineticTrack * atrack);
0064
0065
0066 ~G4ExcitedString();
0067
0068 private:
0069 G4ExcitedString(const G4ExcitedString &right);
0070 G4ExcitedString& operator= (const G4ExcitedString &right);
0071
0072 public:
0073 G4bool operator==(const G4ExcitedString &right) const;
0074 G4bool operator!=(const G4ExcitedString &right) const;
0075
0076 public:
0077 G4double GetTimeOfCreation() const;
0078
0079 void SetTimeOfCreation(G4double aTime);
0080
0081 const G4ThreeVector & GetPosition() const;
0082
0083 void SetPosition(const G4ThreeVector &aPosition);
0084
0085 const G4PartonVector * GetPartonList() const;
0086
0087 G4LorentzVector Get4Momentum() const;
0088 void LorentzRotate(const G4LorentzRotation & rotation);
0089
0090 void InsertParton(G4Parton * aParton, const G4Parton * addafter = NULL);
0091
0092 G4LorentzRotation TransformToCenterOfMass();
0093 G4LorentzRotation TransformToAlignedCms();
0094
0095
0096 void Boost(G4ThreeVector& Velocity);
0097
0098 G4Parton* GetColorParton(void) const;
0099 G4Parton* GetGluon(void) const;
0100 G4Parton* GetAntiColorParton(void) const;
0101 G4Parton* GetGluon(G4int GluonPos) const;
0102
0103 G4KineticTrack * GetKineticTrack() const;
0104
0105 G4Parton* GetLeftParton(void) const;
0106 G4Parton* GetRightParton(void) const;
0107
0108 G4bool IsItKinkyString(void) const;
0109 G4int GetDirection(void) const;
0110
0111 G4bool IsExcited() const;
0112
0113
0114 private:
0115
0116 G4int theDirection;
0117 G4double theTimeOfCreation;
0118 G4ThreeVector thePosition;
0119 G4PartonVector thePartons;
0120 G4KineticTrack* theTrack;
0121
0122 };
0123
0124 inline
0125 G4bool G4ExcitedString::operator==(const G4ExcitedString &right) const
0126 {
0127 return this == &right;
0128 }
0129
0130 inline
0131 G4bool G4ExcitedString::operator!=(const G4ExcitedString &right) const
0132 {
0133 return this != &right;
0134 }
0135
0136 inline
0137 G4double G4ExcitedString::GetTimeOfCreation() const
0138 {
0139 return theTimeOfCreation;
0140 }
0141
0142 inline
0143 void G4ExcitedString::SetTimeOfCreation(G4double aTime)
0144 {
0145 theTimeOfCreation=aTime;
0146 }
0147
0148 inline
0149 const G4ThreeVector & G4ExcitedString::GetPosition() const
0150 {
0151 return thePosition;
0152 }
0153
0154 inline
0155 void G4ExcitedString::SetPosition(const G4ThreeVector &aPosition)
0156 {
0157 thePosition= aPosition;
0158 }
0159
0160 inline
0161 G4LorentzVector G4ExcitedString::Get4Momentum() const
0162 {
0163 G4LorentzVector momentum;
0164 if ( IsExcited() )
0165 {
0166 for ( unsigned int index=0; index < thePartons.size() ; index++ )
0167 {
0168
0169 momentum += thePartons[index]->Get4Momentum();
0170 }
0171 }
0172 else
0173 {
0174 momentum=theTrack->Get4Momentum();
0175 }
0176 return momentum;
0177 }
0178
0179 inline
0180 void G4ExcitedString::LorentzRotate(const G4LorentzRotation & rotation)
0181 {
0182 if ( IsExcited() )
0183 {
0184 for ( unsigned int index=0; index < thePartons.size() ; index++ )
0185 {
0186 thePartons[index]->Set4Momentum(rotation*thePartons[index]->Get4Momentum());
0187 }
0188 }
0189 else
0190 {
0191 theTrack->Set4Momentum(rotation*theTrack->Get4Momentum());
0192 }
0193 }
0194
0195 inline
0196 void G4ExcitedString::InsertParton(G4Parton *aParton, const G4Parton * addafter)
0197 {
0198
0199 G4PartonVector::iterator insert_index;
0200
0201 if ( addafter != NULL )
0202 {
0203 insert_index=std::find(thePartons.begin(), thePartons.end(), addafter);
0204 if ( insert_index == thePartons.end() )
0205 {
0206 G4String text = "G4ExcitedString::InsertParton called with invalid second argument";
0207 throw G4HadronicException(__FILE__, __LINE__, text);
0208 }
0209 }
0210
0211 thePartons.insert(insert_index+1, aParton);
0212 }
0213
0214 inline
0215 G4LorentzRotation G4ExcitedString::TransformToCenterOfMass()
0216 {
0217 G4LorentzVector momentum=Get4Momentum();
0218 G4LorentzRotation toCms(-1*momentum.boostVector());
0219
0220 if ( IsExcited() )
0221 {
0222 for ( unsigned int index=0; index < thePartons.size() ; index++ )
0223 {
0224 momentum=toCms * thePartons[index]->Get4Momentum();
0225 thePartons[index]->Set4Momentum(momentum);
0226 }
0227 }
0228 else
0229 {
0230 momentum*=toCms;
0231 theTrack->Set4Momentum(momentum);
0232 }
0233 return toCms;
0234 }
0235
0236 inline
0237 G4LorentzRotation G4ExcitedString::TransformToAlignedCms()
0238 {
0239 G4LorentzVector momentum=Get4Momentum();
0240 G4LorentzRotation toAlignedCms(-1*momentum.boostVector());
0241
0242 momentum= toAlignedCms* thePartons[0]->Get4Momentum();
0243 toAlignedCms.rotateZ(-1*momentum.phi());
0244 toAlignedCms.rotateY(-1*momentum.theta());
0245
0246 for ( unsigned int index=0; index < thePartons.size() ; index++ )
0247 {
0248 momentum=toAlignedCms * thePartons[index]->Get4Momentum();
0249 thePartons[index]->Set4Momentum(momentum);
0250 }
0251 return toAlignedCms;
0252 }
0253
0254
0255 inline
0256 const G4PartonVector * G4ExcitedString::GetPartonList() const
0257 {
0258 return &thePartons;
0259 }
0260
0261 inline
0262 G4KineticTrack * G4ExcitedString::GetKineticTrack() const
0263 {
0264 return theTrack;
0265 }
0266
0267 inline
0268 G4bool G4ExcitedString::IsExcited() const
0269 {
0270 return theTrack == 0;
0271 }
0272
0273
0274 #endif