49 stringFragmentationModel(0),
70 #ifdef debug_PartonStringModel
72 G4cout<<
"-----------------------Parton-String model is runnung ------------"<<
G4endl;
82 G4cout<<
"-------------- Parton-String model: Generation of strings -------"<<G4endl<<
G4endl;
88 G4int QsumSec(0), BsumSec(0);
100 G4int attempts = 0, maxAttempts=1000;
103 if (attempts++ > maxAttempts )
109 while( theNuclNucleon )
111 if(theNuclNucleon->
AreYouHit()) theNuclNucleon->
Hit(
nullptr);
116 if(ProjResNucleus != 0)
119 while( theNuclNucleon )
121 if(theNuclNucleon->
AreYouHit()) theNuclNucleon->
Hit(
nullptr);
130 ed <<
"Target nucleus A Z " << theNucleus.
GetA_asInt() <<
" "
132 ed <<
"Initial states of projectile and target nucleus will be returned!"<<
G4endl;
133 G4Exception(
"G4VPartonStringModel::Scatter(): fails to generate or fragment strings ",
140 theResult->push_back(Hadron);
150 if(strings == 0) {Success=
false;
continue;}
155 #ifdef debug_PartonStringModel
156 G4cout<<
"------------ Parton-String model: Number of produced strings ---- "<<strings->size()<<
G4endl;
159 for (
unsigned int astring=0; astring < strings->size(); astring++)
162 if((*strings)[astring]->IsExcited())
164 stringEnergy += (*strings)[astring]->GetLeftParton()->Get4Momentum().t();
165 stringEnergy += (*strings)[astring]->GetRightParton()->Get4Momentum().t();
166 (*strings)[astring]->LorentzRotate(toLab);
167 SumStringMom+=(*strings)[astring]->Get4Momentum();
168 #ifdef debug_PartonStringModel
169 G4cout<<
"String No "<<astring+1<<
" "<<(*strings)[astring]->Get4Momentum()<<
" "
170 <<(*strings)[astring]->Get4Momentum().mag()
171 <<
" Partons "<<(*strings)[astring]->GetLeftParton()->GetDefinition()->GetPDGEncoding()
172 <<
" "<<(*strings)[astring]->GetRightParton()->GetDefinition()->GetPDGEncoding()<<
G4endl;
177 stringEnergy += (*strings)[astring]->GetKineticTrack()->Get4Momentum().t();
178 (*strings)[astring]->LorentzRotate(toLab);
179 SumStringMom+=(*strings)[astring]->GetKineticTrack()->Get4Momentum();
180 #ifdef debug_PartonStringModel
181 G4cout<<
"A track No "<<astring+1<<
" "
182 <<(*strings)[astring]->GetKineticTrack()->Get4Momentum()<<
" "
183 <<(*strings)[astring]->GetKineticTrack()->Get4Momentum().mag()<<
" "
184 <<(*strings)[astring]->GetKineticTrack()->GetDefinition()->GetParticleName()<<
G4endl;
189 #ifdef debug_PartonStringModel
193 G4int hitsT(0), charged_hitsT(0);
194 G4int hitsP(0), charged_hitsP(0);
195 G4double ExcitationEt(0.), ExcitationEp(0.);
200 if(ProjResNucleus != 0)
203 while( theNuclNucleon )
208 #ifdef debug_PartonStringModel
209 ProjectileResidual4Momentum +=
tmp;
218 #ifdef debug_PartonStringModel
219 G4cout<<
"Projectile residual A, Z and E* "
223 G4cout<<
"Projectile residual 4 momentum "<<ProjectileResidual4Momentum<<
G4endl;
231 while( theNuclNucleon )
236 #ifdef debug_PartonStringModel
237 TargetResidual4Momentum +=
tmp;
247 #ifdef debug_PartonStringModel
248 G4cout<<
"Target residual A, Z and E* "
250 <<theNucleus.
GetZ_asInt() - charged_hitsT<<
" "
252 G4cout<<
"Target residual 4 momentum "<<TargetResidual4Momentum<<
G4endl;
253 Bsum+=( hitsT + hitsP);
254 Qsum+=(charged_hitsT + charged_hitsP);
255 G4cout<<
"Hitted # of nucleons of projectile and target "<<hitsP<<
" "<<hitsT<<
G4endl;
256 G4cout<<
"Hitted # of protons of projectile and target "
257 <<charged_hitsP<<
" "<<charged_hitsT<<G4endl<<
G4endl;
263 #ifdef debug_PartonStringModel
264 G4cout<<
"---------------- Attempt to fragment strings ------------- "<<attempts<<
G4endl;
270 #ifdef debug_PartonStringModel
271 QsumSec=0; BsumSec=0;
283 #ifdef debug_PartonStringModel
284 G4cout<<
"String fragmentation success (OK - #0, Not OK - 0) : "<<theResult<<
G4endl;
287 if(theResult == 0) {Success=
false;
continue;}
289 #ifdef debug_PartonStringModel
290 G4cout<<
"Parton-String model: Number of produced particles "<<theResult->size()<<
G4endl;
292 QsumSec = 0; BsumSec = 0;
297 for (
unsigned int i=0; i < theResult->size(); i++)
299 SumMass+=(*theResult)[i]->Get4Momentum().mag();
300 #ifdef debug_PartonStringModel
301 G4cout<<i<<
" : "<<(*theResult)[i]->GetDefinition()->GetParticleName()<<
" "
302 <<(*theResult)[i]->Get4Momentum()<<
" "
303 <<(*theResult)[i]->Get4Momentum().mag()<<
" "
304 <<(*theResult)[i]->GetDefinition()->GetPDGMass()<<
G4endl;
305 SumPsecondr+=(*theResult)[i]->Get4Momentum();
306 BsumSec += (*theResult)[i]->GetDefinition()->GetBaryonNumber();
307 QsumSec += (*theResult)[i]->GetDefinition()->GetPDGCharge();
311 #ifdef debug_PartonStringModel
312 G4cout<<G4endl<<
"-----------------------Parton-String model: balances -------------"<<
G4endl;
313 if(Qsum != QsumSec) {
315 G4cout<<
" Qsum != QsumSec "<<Qsum<<
" "<<QsumSec<<
G4endl;
317 if(Bsum != BsumSec) {
319 G4cout<<
" Bsum != BsumSec "<<Bsum<<
" "<<BsumSec<<
G4endl;
323 if((SumMass > InvMass)||(SumMass == 0.)) {Success=
false;}
324 std::for_each(strings->begin(), strings->end(),
DeleteString() );
329 #ifdef debug_PartonStringModel
330 G4cout <<
"Baryon number balance "<<Bsum-BsumSec<<
G4endl;
332 G4cout <<
"4 momentum balance "<<SumStringMom-SumPsecondr<<
G4endl;
333 G4cout<<
"---------------------End of Parton-String model work -------------"<<G4endl<<
G4endl;
341 outFile <<
GetModelName() <<
" has no description yet.\n";
virtual void Init(const G4Nucleus &theNucleus, const G4DynamicParticle &thePrimary)=0
std::ostringstream G4ExceptionDescription
void SetMomentum(G4LorentzVector &aMomentum)
std::vector< G4ExcitedString * > G4ExcitedStringVector
const G4String & GetParticleName() const
G4double GetPDGCharge() const
static G4Proton * Proton()
G4KineticTrackVector * Scatter(const G4Nucleus &theNucleus, const G4DynamicParticle &thePrimary)
virtual void ModelDescription(std::ostream &outFile) const
static void ConstructParticle()
G4ParticleDefinition * GetDefinition() const
G4double GetBindingEnergy() const
HepLorentzRotation & rotateZ(double delta)
G4int GetBaryonNumber() const
virtual G4V3DNucleus * GetWoundedNucleus() const =0
virtual G4String GetModelName() const
void Set4Momentum(const G4LorentzVector &momentum)
G4LorentzVector Get4Momentum() const
virtual G4V3DNucleus * GetProjectileNucleus() const
HepLorentzRotation inverse() const
virtual G4Nucleon * GetNextNucleon()=0
virtual const G4LorentzVector & Get4Momentum() const
virtual const G4ParticleDefinition * GetDefinition() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
virtual G4KineticTrackVector * FragmentStrings(const G4ExcitedStringVector *theStrings)=0
G4VPartonStringModel(const G4String &modelName="Parton String Model")
G4VStringFragmentation * stringFragmentationModel
void Hit(G4VSplitableHadron *aHit)
virtual ~G4VPartonStringModel()
G4VPartonStringModel * theThis
G4GLOB_DLL std::ostream G4cout
virtual G4ExcitedStringVector * GetStrings()=0
CLHEP::HepLorentzVector G4LorentzVector
HepLorentzRotation & rotateY(double delta)
const G4ParticleDefinition * GetParticleDefinition() const
virtual G4double GetOuterRadius()=0
virtual G4bool StartLoop()=0