49 stringFragmentationModel(nullptr)
72 #ifdef debug_PartonStringModel
74 G4cout<<
"-----------------------Parton-String model is runnung ------------"<<
G4endl;
84 G4cout<<
"-------------- Parton-String model: Generation of strings -------"<<
G4endl<<
G4endl;
90 G4int QsumSec(0), BsumSec(0);
102 G4int attempts = 0, maxAttempts=1000;
105 if (attempts++ > maxAttempts )
107 Init(theNucleus,thePrimary);
111 while( theNuclNucleon )
113 if(theNuclNucleon->
AreYouHit()) theNuclNucleon->
Hit(
nullptr);
118 if(ProjResNucleus != 0)
121 while( theNuclNucleon )
123 if(theNuclNucleon->
AreYouHit()) theNuclNucleon->
Hit(
nullptr);
132 ed <<
"Target nucleus A Z " << theNucleus.
GetA_asInt() <<
" "
134 ed <<
"Initial states of projectile and target nucleus will be returned!"<<
G4endl;
135 G4Exception(
"G4VPartonStringModel::Scatter(): fails to generate or fragment strings ",
142 theResult->push_back(Hadron);
148 Init(theNucleus,thePrimary);
152 if (strings->empty()) { Success=
false;
continue; }
157 #ifdef debug_PartonStringModel
158 G4cout<<
"------------ Parton-String model: Number of produced strings ---- "<<strings->size()<<
G4endl;
161 #ifdef debug_heavyHadrons
167 G4int count_charm_strings = 0, count_bottom_strings = 0;
168 G4int count_charm_hadrons = 0, count_bottom_hadrons = 0;
171 for (
unsigned int astring=0; astring < strings->size(); astring++)
174 if((*strings)[astring]->IsExcited())
176 stringEnergy += (*strings)[astring]->GetLeftParton()->Get4Momentum().t();
177 stringEnergy += (*strings)[astring]->GetRightParton()->Get4Momentum().t();
178 (*strings)[astring]->LorentzRotate(toLab);
179 SumStringMom+=(*strings)[astring]->Get4Momentum();
180 #ifdef debug_PartonStringModel
181 G4cout<<
"String No "<<astring+1<<
" "<<(*strings)[astring]->Get4Momentum()<<
" "
182 <<(*strings)[astring]->Get4Momentum().mag()
183 <<
" Partons "<<(*strings)[astring]->GetLeftParton()->GetDefinition()->GetPDGEncoding()
184 <<
" "<<(*strings)[astring]->GetRightParton()->GetDefinition()->GetPDGEncoding()<<
G4endl;
187 #ifdef debug_heavyHadrons
188 G4int left_charm = (*strings)[astring]->GetLeftParton()->GetDefinition()->GetQuarkContent( 4 );
189 G4int left_anticharm = (*strings)[astring]->GetLeftParton()->GetDefinition()->GetAntiQuarkContent( 4 );
190 G4int right_charm = (*strings)[astring]->GetRightParton()->GetDefinition()->GetQuarkContent( 4 );
191 G4int right_anticharm = (*strings)[astring]->GetRightParton()->GetDefinition()->GetAntiQuarkContent( 4 );
192 G4int left_bottom = (*strings)[astring]->GetLeftParton()->GetDefinition()->GetQuarkContent( 5 );
193 G4int left_antibottom = (*strings)[astring]->GetLeftParton()->GetDefinition()->GetAntiQuarkContent( 5 );
194 G4int right_bottom = (*strings)[astring]->GetRightParton()->GetDefinition()->GetQuarkContent( 5 );
195 G4int right_antibottom = (*strings)[astring]->GetRightParton()->GetDefinition()->GetAntiQuarkContent( 5 );
196 if ( left_charm != 0 || left_anticharm != 0 || right_charm != 0 || right_anticharm != 0 ||
197 left_bottom != 0 || left_antibottom != 0 || right_bottom != 0 || right_antibottom != 0 ) {
198 count_charm_strings += left_charm - left_anticharm + right_charm - right_anticharm;
199 count_bottom_strings += left_bottom - left_antibottom + right_bottom - right_antibottom;
200 G4cout <<
"G4VPartonStringModel::Scatter : string #" << astring <<
" ("
201 << (*strings)[astring]->GetLeftParton()->GetDefinition()->GetParticleName() <<
" , "
202 << (*strings)[astring]->GetRightParton()->GetDefinition()->GetParticleName() <<
")" <<
G4endl;
208 stringEnergy += (*strings)[astring]->GetKineticTrack()->Get4Momentum().t();
209 (*strings)[astring]->LorentzRotate(toLab);
210 SumStringMom+=(*strings)[astring]->GetKineticTrack()->Get4Momentum();
211 #ifdef debug_PartonStringModel
212 G4cout<<
"A track No "<<astring+1<<
" "
213 <<(*strings)[astring]->GetKineticTrack()->Get4Momentum()<<
" "
214 <<(*strings)[astring]->GetKineticTrack()->Get4Momentum().mag()<<
" "
215 <<(*strings)[astring]->GetKineticTrack()->GetDefinition()->GetParticleName()<<
G4endl;
218 #ifdef debug_heavyHadrons
219 G4int charm = (*strings)[astring]->GetKineticTrack()->GetDefinition()->GetQuarkContent( 4 );
220 G4int anticharm = (*strings)[astring]->GetKineticTrack()->GetDefinition()->GetAntiQuarkContent( 4 );
221 G4int bottom = (*strings)[astring]->GetKineticTrack()->GetDefinition()->GetQuarkContent( 5 );
222 G4int antibottom = (*strings)[astring]->GetKineticTrack()->GetDefinition()->GetAntiQuarkContent( 5 );
223 if ( charm != 0 || anticharm != 0 || bottom != 0 || antibottom != 0 ) {
224 count_charm_strings += charm - anticharm;
225 count_bottom_strings += bottom - antibottom;
226 G4cout <<
"G4VPartonStringModel::Scatter : track #" << astring <<
"\t"
227 << (*strings)[astring]->GetKineticTrack()->GetDefinition()->GetParticleName() <<
G4endl;
233 #ifdef debug_heavyHadrons
234 if ( count_charm_projectile != count_charm_strings ) {
235 G4cout <<
"G4VPartonStringModel::Scatter : CHARM VIOLATION in String formation ! #projectile="
236 << count_charm_projectile <<
" ; #strings=" << count_charm_strings <<
G4endl;
238 if ( count_bottom_projectile != count_bottom_strings ) {
239 G4cout <<
"G4VPartonStringModel::Scatter : BOTTOM VIOLATION in String formation ! #projectile="
240 << count_bottom_projectile <<
" ; #strings=" << count_bottom_strings <<
G4endl;
244 #ifdef debug_PartonStringModel
248 G4int hitsT(0), charged_hitsT(0);
249 G4int hitsP(0), charged_hitsP(0);
250 G4double ExcitationEt(0.), ExcitationEp(0.);
255 G4int numberProtonProjectileResidual( 0 ), numberNeutronProjectileResidual( 0 );
256 if(ProjResNucleus != 0)
259 G4int numberProtonProjectileHits( 0 ), numberNeutronProjectileHits( 0 );
260 while( theNuclNucleon )
265 #ifdef debug_PartonStringModel
266 ProjectileResidual4Momentum += tmp;
277 #ifdef debug_PartonStringModel
278 G4cout<<
"Projectile residual A, Z and E* "
282 G4cout<<
"Projectile residual 4 momentum "<<ProjectileResidual4Momentum<<
G4endl;
293 G4int numberProtonTargetHits( 0 ), numberNeutronTargetHits( 0 );
294 while( theNuclNucleon )
299 #ifdef debug_PartonStringModel
300 TargetResidual4Momentum += tmp;
312 #ifdef debug_PartonStringModel
313 G4cout<<
"Target residual A, Z and E* "
315 <<theNucleus.
GetZ_asInt() - charged_hitsT<<
" "
317 G4cout<<
"Target residual 4 momentum "<<TargetResidual4Momentum<<
G4endl;
318 Bsum+=( hitsT + hitsP);
319 Qsum+=(charged_hitsT + charged_hitsP);
320 G4cout<<
"Hitted # of nucleons of projectile and target "<<hitsP<<
" "<<hitsT<<
G4endl;
321 G4cout<<
"Hitted # of protons of projectile and target "
329 G4int numberProtonTargetResidual = theNucleus.
GetZ_asInt() - numberProtonTargetHits;
331 G4bool unphysicalResidual =
false;
332 if ( ( numberProtonTargetResidual > 3 && numberNeutronTargetResidual == 0 ) ||
333 ( numberProtonTargetResidual == 0 && numberNeutronTargetResidual > 1 ) ) {
334 unphysicalResidual =
true;
338 if ( ( numberProtonProjectileResidual > 3 && numberNeutronProjectileResidual == 0 ) ||
339 ( numberProtonProjectileResidual == 0 && numberNeutronProjectileResidual > 1 ) ) {
340 unphysicalResidual =
true;
344 if ( unphysicalResidual ) {
352 #ifdef debug_PartonStringModel
353 G4cout<<
"---------------- Attempt to fragment strings ------------- "<<attempts<<
G4endl;
359 #ifdef debug_PartonStringModel
360 QsumSec=0; BsumSec=0;
364 if(theResult !=
nullptr)
372 #ifdef debug_PartonStringModel
373 G4cout<<
"String fragmentation success (OK - #0, Not OK - 0) : "<<theResult<<
G4endl;
376 if(theResult == 0) {Success=
false;
continue;}
378 #ifdef debug_PartonStringModel
379 G4cout<<
"Parton-String model: Number of produced particles "<<theResult->size()<<
G4endl;
381 QsumSec = 0; BsumSec = 0;
385 for (
unsigned int i=0; i < theResult->size(); i++)
387 SumMass+=(*theResult)[i]->Get4Momentum().mag();
388 #ifdef debug_PartonStringModel
389 G4cout<<i<<
" : "<<(*theResult)[i]->GetDefinition()->GetParticleName()<<
" "
390 <<(*theResult)[i]->Get4Momentum()<<
" "
391 <<(*theResult)[i]->Get4Momentum().mag()<<
" "
392 <<(*theResult)[i]->GetDefinition()->GetPDGMass()<<
G4endl;
393 SumPsecondr+=(*theResult)[i]->Get4Momentum();
394 BsumSec += (*theResult)[i]->GetDefinition()->GetBaryonNumber();
395 QsumSec += (*theResult)[i]->GetDefinition()->GetPDGCharge();
398 #ifdef debug_heavyHadrons
399 G4int charm = (*theResult)[i]->GetDefinition()->GetQuarkContent( 4 );
400 G4int anticharm = (*theResult)[i]->GetDefinition()->GetAntiQuarkContent( 4 );
401 G4int bottom = (*theResult)[i]->GetDefinition()->GetQuarkContent( 5 );
402 G4int antibottom = (*theResult)[i]->GetDefinition()->GetAntiQuarkContent( 5 );
403 if ( charm != 0 || anticharm != 0 || bottom != 0 || antibottom != 0 ) {
404 count_charm_hadrons += charm - anticharm;
405 count_bottom_hadrons += bottom - antibottom;
406 G4cout <<
"G4VPartonStringModel::Scatter : hadron #" << i <<
"\t"
407 << (*theResult)[i]->GetDefinition()->GetParticleName() <<
G4endl;
412 #ifdef debug_heavyHadrons
413 if ( count_charm_projectile != count_charm_hadrons ) {
414 G4cout <<
"G4VPartonStringModel::Scatter : CHARM VIOLATION in String hadronization ! #projectile="
415 << count_charm_projectile <<
" ; #hadrons=" << count_charm_hadrons <<
G4endl;
417 if ( count_bottom_projectile != count_bottom_hadrons ) {
418 G4cout <<
"G4VPartonStringModel::Scatter : BOTTOM VIOLATION in String hadronization ! #projectile="
419 << count_bottom_projectile <<
" ; #hadrons=" << count_bottom_hadrons <<
G4endl;
423 #ifdef debug_PartonStringModel
424 G4cout<<
G4endl<<
"-----------------------Parton-String model: balances -------------"<<
G4endl;
425 if(Qsum != QsumSec) {
427 G4cout<<
" Qsum != QsumSec "<<Qsum<<
" "<<QsumSec<<
G4endl;
429 if(Bsum != BsumSec) {
431 G4cout<<
" Bsum != BsumSec "<<Bsum<<
" "<<BsumSec<<
G4endl;
435 if((SumMass > InvMass)||(SumMass == 0.)) {Success=
false;}
436 std::for_each(strings->begin(), strings->end(),
DeleteString() );
441 #ifdef debug_PartonStringModel
442 G4cout <<
"Baryon number balance "<<Bsum-BsumSec<<
G4endl;
444 G4cout <<
"4 momentum balance "<<SumStringMom-SumPsecondr<<
G4endl;
445 G4cout<<
"---------------------End of Parton-String model work -------------"<<
G4endl<<
G4endl;
453 outFile <<
GetModelName() <<
" has no description yet.\n";
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::vector< G4ExcitedString * > G4ExcitedStringVector
CLHEP::HepLorentzVector G4LorentzVector
G4GLOB_DLL std::ostream G4cout
HepLorentzRotation & rotateY(double delta)
HepLorentzRotation & rotateZ(double delta)
HepLorentzRotation inverse() const
const G4ParticleDefinition * GetParticleDefinition() const
G4ParticleDefinition * GetDefinition() const
G4LorentzVector Get4Momentum() const
void Set4Momentum(const G4LorentzVector &momentum)
const G4String & GetModelName() const
static G4Neutron * Neutron()
void SetMomentum(G4LorentzVector &aMomentum)
virtual const G4LorentzVector & Get4Momentum() const
void Hit(G4VSplitableHadron *aHit)
G4double GetBindingEnergy() const
virtual const G4ParticleDefinition * GetDefinition() const
G4int GetQuarkContent(G4int flavor) const
G4double GetPDGCharge() const
G4int GetBaryonNumber() const
const G4String & GetParticleName() const
G4int GetAntiQuarkContent(G4int flavor) const
static G4Proton * Proton()
virtual G4double GetOuterRadius()=0
virtual G4Nucleon * GetNextNucleon()=0
virtual G4bool StartLoop()=0
virtual G4V3DNucleus * GetWoundedNucleus() const =0
G4VPartonStringModel(const G4String &modelName="Parton String Model")
virtual void Init(const G4Nucleus &theNucleus, const G4DynamicParticle &thePrimary)=0
virtual G4ExcitedStringVector * GetStrings()=0
G4V3DNucleus * GetProjectileNucleus() const override
void ModelDescription(std::ostream &outFile) const override
~G4VPartonStringModel() override
G4KineticTrackVector * Scatter(const G4Nucleus &theNucleus, const G4DynamicParticle &thePrimary) override
virtual G4KineticTrackVector * FragmentStrings(const G4ExcitedStringVector *theStrings)=0