Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -1,4 +1,4 @@
$Id: History 106967 2017-10-31 08:41:49Z gcosmo $
$Id: History 108179 2018-01-18 08:53:39Z gcosmo $
-------------------------------------------------------------------
==========================================================
@@ -15,6 +15,21 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
18-Jan-2018 A. Ribon (had-hadronization-V10-04-03)
- G4VLongitudinalStringDecay : removed useless caching in the method
FragmentationMass which was causing rare irreproducibilities in
gamma-nuclear reactions (i.e. involving QGS).
19-Dec-2017 V. Uzhinsky (had-hadronization-V10-04-02)
- Fine tuning of LUND and QGS fragmentations.
14-Dec-2017 V. Uzhinsky (had-hadronization-V10-04-01)
- Improved versions of LUND and QGS fragmentations.
07-Dec-2017 A. Ribon (had-hadronization-V10-04-00)
- Brought back the development version of hadronization
(as it was in had-hadronization-V10-03-07).
27-Oct-2017 A. Ribon (had-hadronization-V10-03-09)
- G4ExcitedStringDecay : introduced smearing of resonance masses
(as requested by the PANDA Collaboration).
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FragmentingString.hh 106967 2017-10-31 08:41:49Z gcosmo $
// $Id: G4FragmentingString.hh 107869 2017-12-07 14:46:39Z gcosmo $
//
#ifndef G4FragmentingString_h
@@ -42,12 +42,14 @@
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4LorentzVector.hh"
#include "G4LorentzRotation.hh"
#include "G4ParticleDefinition.hh"
class G4ExcitedString;
class G4FragmentingString
{
public:
G4FragmentingString(const G4FragmentingString &right);
@@ -64,7 +66,8 @@ class G4FragmentingString
int operator==(const G4FragmentingString &right) const;
int operator!=(const G4FragmentingString &right) const;
G4LorentzVector Get4Momentum() const;
G4ThreeVector StablePt();
@@ -93,6 +96,17 @@ class G4FragmentingString
G4bool StableIsQuark();
G4bool FourQuarkString(void) const;
G4LorentzVector GetPstring();
G4LorentzVector GetPleft();
void SetPleft(G4LorentzVector a4momentum);
G4LorentzVector GetPright();
void SetPright(G4LorentzVector a4momentum);
void LorentzRotate(const G4LorentzRotation & rotation);
G4LorentzRotation TransformToCenterOfMass();
G4LorentzRotation TransformToAlignedCms();
void Boost(G4ThreeVector& Velocity);
private:
G4ParticleDefinition *LeftParton, *RightParton;
@@ -101,6 +115,7 @@ class G4FragmentingString
G4ParticleDefinition * theStableParton, * theDecayParton;
G4LorentzVector Pstring, Pleft, Pright;
enum DecaySide { None, Left, Right };
DecaySide decaying;
};
@@ -121,26 +136,85 @@ int G4FragmentingString::operator!=(const G4FragmentingString &right) const
inline
G4ParticleDefinition * G4FragmentingString::GetStableParton() const
{
return theStableParton;
return theStableParton;
}
inline
G4ParticleDefinition * G4FragmentingString::GetDecayParton() const
{
return theDecayParton;
return theDecayParton;
}
inline
G4ParticleDefinition* G4FragmentingString::GetLeftParton(void) const
{
return LeftParton;
}
{
return LeftParton;
}
inline
G4ParticleDefinition* G4FragmentingString::GetRightParton(void) const
{
return RightParton;
}
//+++++++++++++++++++++++++++
inline
void G4FragmentingString::LorentzRotate(const G4LorentzRotation & rotation)
{
return RightParton;
SetPleft(rotation*Pleft);
SetPright(rotation*Pright);
Pstring = Pleft+Pright;
Ptleft =Pleft.vect(); Ptleft.setZ(0.);
Ptright=Pright.vect(); Ptright.setZ(0.);
Pplus =Pstring.plus();
Pminus=Pstring.minus();
}
inline
G4LorentzRotation G4FragmentingString::TransformToCenterOfMass()
{
G4LorentzVector momentum=Pstring;
G4LorentzRotation toCMS(-1*momentum.boostVector());
Pleft *= toCMS;
Pright *= toCMS;
Pstring *= toCMS;
Ptleft =Pleft.vect(); Ptleft.setZ(0.);
Ptright=Pright.vect(); Ptright.setZ(0.);
Pplus =Pstring.plus();
Pminus=Pstring.minus();
return toCMS;
}
inline
G4LorentzRotation G4FragmentingString::TransformToAlignedCms()
{
G4LorentzVector momentum=Pstring;
G4LorentzRotation toAlignedCms(-1*momentum.boostVector());
momentum= toAlignedCms* Pleft;
toAlignedCms.rotateZ(-1*momentum.phi());
toAlignedCms.rotateY(-1*momentum.theta());
Pleft *= toAlignedCms;
Pright *= toAlignedCms;
Pstring *= toAlignedCms;
Ptleft = G4ThreeVector(0.,0.,0.);
Ptright = G4ThreeVector(0.,0.,0.);
Pplus = Pstring.plus();
Pminus = Pstring.minus();
return toAlignedCms;
}
inline
void G4FragmentingString::SetPleft(G4LorentzVector a4momentum)
{ Pleft = a4momentum;}
inline
void G4FragmentingString::SetPright(G4LorentzVector a4momentum)
{ Pright = a4momentum;}
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4LundStringFragmentation.hh 106967 2017-10-31 08:41:49Z gcosmo $
// $Id: G4LundStringFragmentation.hh 107869 2017-12-07 14:46:39Z gcosmo $
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
@@ -40,102 +40,111 @@
//**************************************************************************************************************
class G4LundStringFragmentation: public G4VLongitudinalStringDecay
{
public:
{
public:
G4LundStringFragmentation();
virtual ~G4LundStringFragmentation();
virtual G4KineticTrackVector* FragmentString(const G4ExcitedString& theString);
private:
private:
// not implemented to protect/forbid use
G4LundStringFragmentation(const G4LundStringFragmentation &right);
const G4LundStringFragmentation & operator=(const G4LundStringFragmentation &right);
int operator==(const G4LundStringFragmentation &right) const;
int operator!=(const G4LundStringFragmentation &right) const;
private:
void SetMinimalStringMass(const G4FragmentingString * const string);
void SetMinimalStringMass2(const G4double aValue);
private:
void SetMinMasses(); // Uzhi 23 Dec. 2016
void SetMinimalStringMass(const G4FragmentingString * const string);
void SetMinimalStringMass2(const G4double aValue);
virtual G4bool StopFragmenting(const G4FragmentingString * const string);
virtual G4bool IsFragmentable(const G4FragmentingString * const string);
virtual G4bool StopFragmenting(const G4FragmentingString * const string);
virtual G4bool IsFragmentable(const G4FragmentingString * const string);
virtual G4bool SplitLast(G4FragmentingString * string,
G4KineticTrackVector * LeftVector,
G4KineticTrackVector * RightVector);
virtual G4bool SplitLast(G4FragmentingString * string,
G4KineticTrackVector * LeftVector,
G4KineticTrackVector * RightVector);
virtual void Sample4Momentum(G4LorentzVector* Mom, G4double Mass,
G4LorentzVector* AntiMom, G4double AntiMass,
G4double InitialMass);
virtual void Sample4Momentum(G4LorentzVector* Mom, G4double Mass,
G4LorentzVector* AntiMom, G4double AntiMass,
G4double InitialMass);
virtual G4LorentzVector * SplitEandP(G4ParticleDefinition * pHadron,
G4FragmentingString * string,
G4FragmentingString * newString);
virtual G4KineticTrack * Splitup(G4FragmentingString *string,
G4FragmentingString *&newString);
virtual G4double GetLightConeZ(G4double zmin, G4double zmax,
G4int PartonEncoding,
G4ParticleDefinition* pHadron,
G4double Px, G4double Py);
virtual G4LorentzVector * SplitEandP(G4ParticleDefinition * pHadron,
G4FragmentingString * string,
G4FragmentingString * newString);
G4double lambda(G4double s, G4double m1_Sqr, G4double m2_Sqr);
virtual G4double GetLightConeZ(G4double zmin, G4double zmax,
G4int PartonEncoding,
G4ParticleDefinition* pHadron,
G4double Px, G4double Py);
virtual G4ParticleDefinition * DiQuarkSplitup(G4ParticleDefinition* decay,
G4ParticleDefinition *&created);
G4double lambda(G4double s, G4double m1_Sqr, G4double m2_Sqr);
private:
// Internal methods introduced to improve the code structure (AR Nov 2011)
virtual G4ParticleDefinition * DiQuarkSplitup(G4ParticleDefinition* decay,
G4ParticleDefinition *&created);
G4bool Loop_toFragmentString(G4ExcitedString * & theStringInCMS,
G4KineticTrackVector * & LeftVector,
G4KineticTrackVector * & RightVector);
private:
// Internal methods introduced to improve the code structure (AR Nov 2011)
G4bool Diquark_AntiDiquark_belowThreshold_lastSplitting(G4FragmentingString * & string,
G4ParticleDefinition * & LeftHadron,
G4ParticleDefinition * & RightHadron);
G4bool Loop_toFragmentString(const G4ExcitedString & theStringInCMS, // * &
G4KineticTrackVector * & LeftVector,
G4KineticTrackVector * & RightVector);
G4bool Diquark_AntiDiquark_aboveThreshold_lastSplitting(G4FragmentingString * & string,
G4ParticleDefinition * & LeftHadron,
G4ParticleDefinition * & RightHadron);
G4bool Diquark_AntiDiquark_belowThreshold_lastSplitting(G4FragmentingString * & string,
G4ParticleDefinition * & LeftHadron,
G4ParticleDefinition * & RightHadron);
G4bool Quark_AntiQuark_lastSplitting(G4FragmentingString * & string,
G4ParticleDefinition * & LeftHadron,
G4ParticleDefinition * & RightHadron);
G4bool Diquark_AntiDiquark_aboveThreshold_lastSplitting(G4FragmentingString * & string,
G4ParticleDefinition * & LeftHadron,
G4ParticleDefinition * & RightHadron);
G4bool Quark_Diquark_lastSplitting(G4FragmentingString * & string,
G4ParticleDefinition * & LeftHadron,
G4ParticleDefinition * & RightHadron );
G4bool Quark_AntiQuark_lastSplitting(G4FragmentingString * & string,
G4ParticleDefinition * & LeftHadron,
G4ParticleDefinition * & RightHadron);
G4int SampleState(void);
G4bool Quark_Diquark_lastSplitting(G4FragmentingString * & string,
G4ParticleDefinition * & LeftHadron,
G4ParticleDefinition * & RightHadron );
private:
// ------ For estimation of a minimal string mass ---------------
G4double Mass_of_light_quark;
G4double Mass_of_heavy_quark;
G4double Mass_of_string_junction;
// ------ An estimated minimal string mass ----------------------
G4double MinimalStringMass;
G4double MinimalStringMass2;
// ------ Minimal invariant mass used at a string fragmentation -
G4double WminLUND;
G4int SampleState(void);
G4int Meson[3][3][6];
G4double MesonWeight[3][3][6];
private:
// ------ For estimation of a minimal string mass ---------------
G4double Mass_of_light_quark;
G4double Mass_of_heavy_quark;
G4double Mass_of_string_junction;
G4int Baryon[3][3][3][4];
G4double BaryonWeight[3][3][3][4];
G4double minMassQQbarStr[3][3];
G4double minMassQDiQStr[3][3][3];
G4double Prob_QQbar[3];
// ------ An estimated minimal string mass ----------------------
G4double MinimalStringMass;
G4double MinimalStringMass2;
// ------ Minimal invariant mass used at a string fragmentation -
G4double WminLUND;
G4int Meson[3][3][6];
G4double MesonWeight[3][3][6];
G4int Baryon[3][3][3][4];
G4double BaryonWeight[3][3][3][4];
G4double Prob_QQbar[3];
// ------ To improve the code structure
G4ParticleDefinition * FS_LeftHadron[35], * FS_RightHadron[35];
G4double FS_Weight[35];
G4int NumberOf_FS;
// ------ To improve the code structure
G4ParticleDefinition * FS_LeftHadron[35], * FS_RightHadron[35];
G4double FS_Weight[35];
G4int NumberOf_FS;
};
//**************************************************************************************************************
// Class G4LundStringFragmentation
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4QGSMFragmentation.hh 106967 2017-10-31 08:41:49Z gcosmo $
// $Id: G4QGSMFragmentation.hh 107869 2017-12-07 14:46:39Z gcosmo $
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
@@ -38,36 +38,38 @@
//******************************************************************************
class G4QGSMFragmentation:public G4VLongitudinalStringDecay
{
public:
G4QGSMFragmentation();
~G4QGSMFragmentation();
virtual G4KineticTrackVector* FragmentString(const G4ExcitedString& theString);
{
public:
G4QGSMFragmentation();
~G4QGSMFragmentation();
virtual G4KineticTrackVector* FragmentString(const G4ExcitedString& theString);
private:
// not implemented to protect/forbid use
G4QGSMFragmentation(const G4QGSMFragmentation &right);
const G4QGSMFragmentation & operator=(const G4QGSMFragmentation &right);
int operator==(const G4QGSMFragmentation &right) const;
int operator!=(const G4QGSMFragmentation &right) const;
// not implemented to protect/forbid use
G4QGSMFragmentation(const G4QGSMFragmentation &right);
const G4QGSMFragmentation & operator=(const G4QGSMFragmentation &right);
int operator==(const G4QGSMFragmentation &right) const;
int operator!=(const G4QGSMFragmentation &right) const;
private:
virtual G4double GetLightConeZ(G4double zmin, G4double zmax, G4int PartonEncoding,
G4ParticleDefinition* pHadron, G4double Px, G4double Py);
virtual G4double GetLightConeZ(G4double zmin, G4double zmax, G4int PartonEncoding, G4ParticleDefinition* pHadron, G4double Px, G4double Py);
virtual void Sample4Momentum(G4LorentzVector* Mom, G4double Mass, G4LorentzVector* AntiMom,
G4double AntiMass, G4double InitialMass);
virtual G4bool StopFragmenting(const G4FragmentingString * const string);
virtual G4bool IsFragmentable(const G4FragmentingString * const string);
virtual G4LorentzVector * SplitEandP(G4ParticleDefinition * pHadron,
G4FragmentingString * string,
G4FragmentingString * newString);
virtual G4bool SplitLast(G4FragmentingString * string,
G4KineticTrackVector * LeftVector,
G4KineticTrackVector * RightVector);
virtual void Sample4Momentum(G4LorentzVector* Mom, G4double Mass, G4LorentzVector* AntiMom, G4double AntiMass, G4double InitialMass);
virtual G4bool StopFragmenting(const G4FragmentingString * const string);
virtual G4bool IsFragmentable(const G4FragmentingString * const string);
virtual G4ParticleDefinition * DiQuarkSplitup(G4ParticleDefinition* decay,
G4ParticleDefinition *&created);
virtual G4KineticTrack * Splitup(G4FragmentingString *string, // Uzhi 28 June 2016
G4FragmentingString *&newString);
virtual G4LorentzVector * SplitEandP(G4ParticleDefinition * pHadron,
G4FragmentingString * string, // Uzhi
G4FragmentingString * newString); // Uzhi
virtual G4bool SplitLast(G4FragmentingString * string,
G4KineticTrackVector * LeftVector,
G4KineticTrackVector * RightVector);
virtual G4ParticleDefinition * DiQuarkSplitup(G4ParticleDefinition* decay, // Uzhi June 2014
G4ParticleDefinition *&created);
private:
// model parameters
@@ -77,9 +79,10 @@ class G4QGSMFragmentation:public G4VLongitudinalStringDecay
const G4double ala;
const G4double aksi;
const G4double alft;
};
// Class G4QGSMFragmentation
// Class G4QGSMFragmentation
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VLongitudinalStringDecay.hh 106967 2017-10-31 08:41:49Z gcosmo $
// $Id: G4VLongitudinalStringDecay.hh 107869 2017-12-07 14:46:39Z gcosmo $
// Maxim Komogorov
//
// -----------------------------------------------------------------------------
@@ -41,158 +41,165 @@
#include "G4HadronBuilder.hh"
class G4FragmentingString;
//**************************************************************************************
class G4VLongitudinalStringDecay
{
public:
G4VLongitudinalStringDecay();
virtual ~G4VLongitudinalStringDecay();
{
public:
G4VLongitudinalStringDecay();
virtual ~G4VLongitudinalStringDecay();
private:
// not implemented to protect/forbid use
G4VLongitudinalStringDecay(const G4VLongitudinalStringDecay &right);
const G4VLongitudinalStringDecay & operator=(const G4VLongitudinalStringDecay &right);
int operator==(const G4VLongitudinalStringDecay &right) const;
int operator!=(const G4VLongitudinalStringDecay &right) const;
private:
// not implemented to protect/forbid use
G4VLongitudinalStringDecay(const G4VLongitudinalStringDecay &right);
const G4VLongitudinalStringDecay & operator=(const G4VLongitudinalStringDecay &right);
int operator==(const G4VLongitudinalStringDecay &right) const;
int operator!=(const G4VLongitudinalStringDecay &right) const;
public:
virtual G4KineticTrackVector* FragmentString(const G4ExcitedString& theString)=0;
public:
virtual G4KineticTrackVector* FragmentString(const G4ExcitedString& theString)=0;
protected:
protected:
// For changing Mass Cut used for selection of very small mass strings
virtual void SetMassCut(G4double aValue);
// For changing Mass Cut used for selection of very small mass strings
virtual void SetMassCut(G4double aValue);
G4double GetMassCut();
// For handling a string with very low mass
G4KineticTrackVector * LightFragmentationTest(const G4ExcitedString * const theString);
// For handling a string with very low mass
G4KineticTrackVector * LightFragmentationTest(const G4ExcitedString * const theString);
// To store created quarks or 2 last hadrons
typedef std::pair<G4ParticleDefinition*, G4ParticleDefinition*> pDefPair;
// To store created quarks or 2 last hadrons
typedef std::pair<G4ParticleDefinition*, G4ParticleDefinition*> pDefPair;
// For creation of hadrons from given quark pair
typedef G4ParticleDefinition * (G4HadronBuilder::*Pcreate)
// For creation of hadrons from given quark pair
typedef G4ParticleDefinition * (G4HadronBuilder::*Pcreate)
(G4ParticleDefinition*, G4ParticleDefinition*);
// Used by LightFragmentationTest for estimation of lowest possible mass of
// given quark system
G4double FragmentationMass(const G4FragmentingString * const string,
Pcreate build=0, pDefPair * pdefs=0);
//-----------------------------------------------------------------------------
// Used by LightFragmentationTest for estimation of lowest possible mass of
// given quark system
G4double FragmentationMass(const G4FragmentingString * const string,
Pcreate build=0,
pDefPair * pdefs=0);
G4ParticleDefinition* FindParticle(G4int Encoding);
G4ParticleDefinition* FindParticle(G4int Encoding);
virtual void Sample4Momentum(G4LorentzVector* Mom, G4double Mass,
G4LorentzVector* AntiMom, G4double AntiMass,
G4double InitialMass)=0;
virtual void Sample4Momentum(G4LorentzVector* Mom, G4double Mass,
G4LorentzVector* AntiMom, G4double AntiMass,
G4double InitialMass)=0;
//-----------------------------------------------------------------------------
// For decision on continue or stop string fragmentation
virtual G4bool StopFragmenting(const G4FragmentingString * const string)=0;
virtual G4bool IsFragmentable(const G4FragmentingString * const string)=0;
// For decision on continue or stop string fragmentation
virtual G4bool StopFragmenting(const G4FragmentingString * const string)=0;
virtual G4bool IsFragmentable(const G4FragmentingString * const string)=0;
// If a string can not fragment, make last break into 2 hadrons
virtual G4bool SplitLast(G4FragmentingString * string,
G4KineticTrackVector * LeftVector,
G4KineticTrackVector * RightVector)=0;
//-----------------------------------------------------------------------------
// If a string can not fragment, make last break into 2 hadrons
virtual G4bool SplitLast(G4FragmentingString * string,
G4KineticTrackVector * LeftVector,
G4KineticTrackVector * RightVector)=0;
// If a string fragments, do the following
// If a string fragments, do the following
// To make a copy of a string
G4ExcitedString *CopyExcited(const G4ExcitedString& string);
// For transver of a string to its CMS frame
G4ExcitedString *CPExcited(const G4ExcitedString& string);
G4ParticleDefinition * QuarkSplitup(G4ParticleDefinition* decay,
G4ParticleDefinition *&created);
G4KineticTrack * Splitup(G4FragmentingString *string,
G4FragmentingString *&newString);
virtual G4ParticleDefinition * DiQuarkSplitup(G4ParticleDefinition* decay,
G4ParticleDefinition *&created)=0;
pDefPair CreatePartonPair(G4int NeedParticle, G4bool AllowDiquarks=true);
G4ParticleDefinition * QuarkSplitup(G4ParticleDefinition* decay,
G4ParticleDefinition *&created);
public:
// used by G4VKinkyStringDecy..
G4int SampleQuarkFlavor(void);
G4ThreeVector SampleQuarkPt(G4double ptMax=-1.); // -1. no limit on maxpt.
virtual G4ParticleDefinition * DiQuarkSplitup(G4ParticleDefinition* decay,
G4ParticleDefinition *&created)=0;
protected:
pDefPair CreatePartonPair(G4int NeedParticle, G4bool AllowDiquarks=true);
//-----------------------------------------------------------------------------
// For determination of kinematical properties of created hadron
// virtual G4LorentzVector * SplitEandP(G4ParticleDefinition * pHadron,
// G4FragmentingString * string )=0;
virtual G4KineticTrack * Splitup(G4FragmentingString *string, // Uzhi 28 June 2016
G4FragmentingString *&newString)=0;
public:
// used by G4VKinkyStringDecy.
G4int SampleQuarkFlavor(void);
G4ThreeVector SampleQuarkPt(G4double ptMax=-1.); // -1. no limit on maxpt.
virtual G4LorentzVector * SplitEandP(G4ParticleDefinition * pHadron,
G4FragmentingString * string,
G4FragmentingString * newString )=0;
protected:
virtual G4double GetLightConeZ(G4double zmin, G4double zmax,
G4int PartonEncoding,
G4ParticleDefinition* pHadron,
G4double Px, G4double Py ) = 0;
// For determination of kinematical properties of created hadron
// virtual G4LorentzVector * SplitEandP(G4ParticleDefinition * pHadron,
// G4FragmentingString * string )=0;
void CalculateHadronTimePosition(G4double theInitialStringMass,
G4KineticTrackVector *);
virtual G4LorentzVector * SplitEandP(G4ParticleDefinition * pHadron,
G4FragmentingString * string,
G4FragmentingString * newString )=0;
// Used for some test purposes ------------------------------------------------
void ConstructParticle();
virtual G4double GetLightConeZ(G4double zmin, G4double zmax,
G4int PartonEncoding,
G4ParticleDefinition* pHadron,
G4double Px, G4double Py ) = 0;
void CalculateHadronTimePosition(G4double theInitialStringMass,
G4KineticTrackVector *);
// Used for some test purposes
void ConstructParticle();
G4ParticleDefinition* CreateHadron(G4int id1, G4int id2,
G4bool theGivenSpin, G4int theSpin);
G4ParticleDefinition* CreateHadron(G4int id1, G4int id2,
G4bool theGivenSpin, G4int theSpin);
public:
//-----------------------------------------------------------------------------
public:
G4KineticTrackVector* DecayResonans (G4KineticTrackVector* aHadrons);
G4KineticTrackVector* DecayResonans (G4KineticTrackVector* aHadrons);
void SetSigmaTransverseMomentum(G4double aQT);
void SetStrangenessSuppression(G4double aValue);
void SetDiquarkSuppression(G4double aValue);
void SetDiquarkBreakProbability(G4double aValue);
void SetSigmaTransverseMomentum(G4double aQT);
void SetStrangenessSuppression(G4double aValue);
void SetDiquarkSuppression(G4double aValue);
void SetDiquarkBreakProbability(G4double aValue);
void SetVectorMesonProbability(G4double aValue);
void SetSpinThreeHalfBarionProbability(G4double aValue);
void SetVectorMesonProbability(G4double aValue);
void SetSpinThreeHalfBarionProbability(G4double aValue);
void SetScalarMesonMixings( std::vector<G4double> aVector);
void SetVectorMesonMixings( std::vector<G4double> aVector);
void SetScalarMesonMixings( std::vector<G4double> aVector);
void SetVectorMesonMixings( std::vector<G4double> aVector);
void SetStringTensionParameter(G4double aValue);
void SetStringTensionParameter(G4double aValue);
protected:
G4double GetDiquarkSuppress() {return DiquarkSuppress;};
G4double GetDiquarkBreakProb() {return DiquarkBreakProb;};
G4double GetStrangeSuppress() {return StrangeSuppress;};
G4double GetClusterMass() {return ClusterMass;};
G4int GetClusterLoopInterrupt() {return ClusterLoopInterrupt;};
// G4LorentzVector RestMomentum; // Uzhi June 2016
//private:
protected:
G4double GetDiquarkSuppress() {return DiquarkSuppress;};
G4double GetDiquarkBreakProb() {return DiquarkBreakProb;};
G4double GetStrangeSuppress() {return StrangeSuppress;};
G4double GetClusterMass() {return ClusterMass;};
G4int GetClusterLoopInterrupt() {return ClusterLoopInterrupt;};
G4double GetStringTensionParameter() {return Kappa;};
G4double GetStringTensionParameter() {return Kappa;};
protected:
G4double MassCut;
G4double ClusterMass;
G4double SigmaQT; // sigma_q_t is quark transverse momentum distribution parameter
G4double DiquarkSuppress; // is Diquark suppression parameter
G4double DiquarkBreakProb; // is Diquark breaking probability
G4double SmoothParam; // model parameter
G4double StrangeSuppress ;
G4int StringLoopInterrupt;
G4int ClusterLoopInterrupt;
G4HadronBuilder *hadronizer;
//private:
protected:
G4double MassCut;
G4double ClusterMass;
G4double SigmaQT; // sigma_q_t is quark transverse momentum distribution parameter
G4double DiquarkSuppress; // is Diquark suppression parameter
G4double DiquarkBreakProb; // is Diquark breaking probability
G4double SmoothParam; // model parameter
G4double StrangeSuppress ;
G4int StringLoopInterrupt;
G4int ClusterLoopInterrupt;
G4HadronBuilder *hadronizer;
G4double pspin_meson;
G4double pspin_barion;
std::vector<G4double> vectorMesonMix;
std::vector<G4double> scalarMesonMix;
G4double pspin_meson;
G4double pspin_barion;
std::vector<G4double> vectorMesonMix;
std::vector<G4double> scalarMesonMix;
G4bool PastInitPhase;
G4bool PastInitPhase;
G4double Kappa; // String tension parameter
G4double Kappa; // String tension parameter
//G4double MinFragmentationMass(G4ExcitedString * theString,
// G4ParticleDefinition*& Hadron1,
// G4ParticleDefinition*& Hadron2);
// G4double MinFragmentationMass(G4ExcitedString * theString,
// G4ParticleDefinition*& Hadron1,
// G4ParticleDefinition*& Hadron2);
};
//*************************************************************************************
// Class G4VLongitudinalStringDecay
#endif
@@ -28,7 +28,8 @@
#include "G4ExcitedStringDecay.hh"
#include "G4SystemOfUnits.hh"
#include "G4KineticTrack.hh"
#include "G4SampleResonance.hh" //AR-Oct2017
#include "G4SampleResonance.hh" // Uzhi July 2017
//#define debug_G4ExcitedStringDecay
//#define debug_G4ExcitedStringCorr
@@ -70,61 +71,66 @@ int G4ExcitedStringDecay::operator!=(const G4ExcitedStringDecay &) const
G4KineticTrackVector *G4ExcitedStringDecay::FragmentString(const G4ExcitedString &theString)
{
if ( theStringDecay == NULL ) theStringDecay=new G4LundStringFragmentation();
return theStringDecay->FragmentString(theString);
if ( theStringDecay == NULL ) theStringDecay=new G4LundStringFragmentation();
return theStringDecay->FragmentString(theString);
}
G4KineticTrackVector *G4ExcitedStringDecay::FragmentStrings(const G4ExcitedStringVector * theStrings)
{
G4LorentzVector KTsum(0.,0.,0.,0.);
#ifdef debug_G4ExcitedStringDecay
#ifdef debug_G4ExcitedStringDecay
G4cout<<G4endl;
G4cout<<"--------------------------- G4ExcitedStringDecay ----------------------"<<G4endl;
G4cout<<"Hadronization of Excited Strings: theStrings->size() "<<theStrings->size()<<G4endl;
#endif
#endif
for ( unsigned int astring=0; astring < theStrings->size(); astring++)
// for ( unsigned int astring=0; astring < 1; astring++)
{
if ( theStrings->operator[](astring)->IsExcited() ) {
KTsum+= theStrings->operator[](astring)->Get4Momentum();
} else {
KTsum+=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
}
//G4cout<<"theStrings->operator[](astring)->IsExcited() "<<" "<<astring<<" "<<theStrings->operator[](astring)->IsExcited()<<G4endl;
if ( theStrings->operator[](astring)->IsExcited() )
{KTsum+= theStrings->operator[](astring)->Get4Momentum();}
else {KTsum+=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();}
}
G4LorentzRotation toCms( -1 * KTsum.boostVector() );
G4LorentzRotation toLab(toCms.inverse());
G4LorentzVector Ptmp;
KTsum=G4LorentzVector(0.,0.,0.,0.);
for ( unsigned int astring=0; astring < theStrings->size(); astring++)
// for ( unsigned int astring=0; astring < 1; astring++)
{
if ( theStrings->operator[](astring)->IsExcited() ) {
Ptmp=toCms * theStrings->operator[](astring)->GetLeftParton()->Get4Momentum();
theStrings->operator[](astring)->GetLeftParton()->Set4Momentum(Ptmp);
if ( theStrings->operator[](astring)->IsExcited() )
{
Ptmp=toCms * theStrings->operator[](astring)->GetLeftParton()->Get4Momentum();
theStrings->operator[](astring)->GetLeftParton()->Set4Momentum(Ptmp);
Ptmp=toCms * theStrings->operator[](astring)->GetRightParton()->Get4Momentum();
theStrings->operator[](astring)->GetRightParton()->Set4Momentum(Ptmp);
Ptmp=toCms * theStrings->operator[](astring)->GetRightParton()->Get4Momentum();
theStrings->operator[](astring)->GetRightParton()->Set4Momentum(Ptmp);
KTsum+= theStrings->operator[](astring)->Get4Momentum();
} else {
Ptmp=toCms * theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
theStrings->operator[](astring)->GetKineticTrack()->Set4Momentum(Ptmp);
KTsum+= theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
}
KTsum+= theStrings->operator[](astring)->Get4Momentum();
}
else
{
Ptmp=toCms * theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
theStrings->operator[](astring)->GetKineticTrack()->Set4Momentum(Ptmp);
KTsum+= theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
}
}
G4SampleResonance BrW; //AR-Oct2017
const G4ParticleDefinition* TrackDefinition = 0; //AR-Oct2017
G4SampleResonance BrW; // Uzhi July 2017
const G4ParticleDefinition* TrackDefinition=0; // Uzhi July 2017
G4KineticTrackVector * theResult = new G4KineticTrackVector;
G4int attempts(0);
G4bool success=false;
G4bool NeedEnergyCorrector=false;
do {
#ifdef debug_G4ExcitedStringDecay
#ifdef debug_G4ExcitedStringDecay
G4cout<<"New try No "<<attempts<<" to hadronize strings"<<G4endl;
#endif
#endif
std::for_each(theResult->begin() , theResult->end() , DeleteKineticTrack());
theResult->clear();
@@ -135,31 +141,33 @@ G4KineticTrackVector *G4ExcitedStringDecay::FragmentStrings(const G4ExcitedStrin
NeedEnergyCorrector=false;
for ( unsigned int astring=0; astring < theStrings->size(); astring++)
// for ( unsigned int astring=0; astring < 1; astring++) // Uzhi For testing purposes
{
#ifdef debug_G4ExcitedStringDecay
#ifdef debug_G4ExcitedStringDecay
G4cout<<"String No "<<astring+1<<" Excited? "<<theStrings->operator[](astring)->IsExcited()<<G4endl;
G4cout<<"String No "<<astring+1<<" 4Momentum "<<theStrings->operator[](astring)->Get4Momentum()
<<" "<<theStrings->operator[](astring)->Get4Momentum().mag()<<G4endl;
#endif
<<" "<<theStrings->operator[](astring)->Get4Momentum().mag()<<G4endl;
#endif
G4KineticTrackVector * generatedKineticTracks = NULL;
if ( theStrings->operator[](astring)->IsExcited() )
{
#ifdef debug_G4ExcitedStringDecay
#ifdef debug_G4ExcitedStringDecay
G4cout<<"Fragment String with partons: "
<<theStrings->operator[](astring)->GetLeftParton()->GetPDGcode() <<" "
<<theStrings->operator[](astring)->GetRightParton()->GetPDGcode()<<" "
<<"Direction "<<theStrings->operator[](astring)->GetDirection()<<G4endl;
#endif
#endif
generatedKineticTracks=FragmentString(*theStrings->operator[](astring));
#ifdef debug_G4ExcitedStringDecay
G4cout<<"(G4ExcitedStringDecay) Number of produced hadrons = "<<generatedKineticTracks->size()<<G4endl;
#endif
#ifdef debug_G4ExcitedStringDecay
G4cout<<"(G4ExcitedStringDecay) Number of produced hadrons = "
<<generatedKineticTracks->size()<<G4endl;
#endif
} else {
#ifdef debug_G4ExcitedStringDecay
G4cout<<" GetTrack from the String"<<G4endl;
#endif
#ifdef debug_G4ExcitedStringDecay
G4cout<<" GetTrack from the String"<<G4endl;
#endif
G4LorentzVector Mom=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
G4KineticTrack * aTrack= new G4KineticTrack(
theStrings->operator[](astring)->GetKineticTrack()->GetDefinition(),
@@ -168,85 +176,88 @@ G4KineticTrackVector *G4ExcitedStringDecay::FragmentStrings(const G4ExcitedStrin
aTrack->SetPosition(theStrings->operator[](astring)->GetKineticTrack()->GetPosition());
#ifdef debug_G4ExcitedStringDecay
#ifdef debug_G4ExcitedStringDecay
G4cout<<" A particle stored in the track is "<<aTrack->GetDefinition()->GetParticleName()<<G4endl;
#endif
#endif
generatedKineticTracks = new G4KineticTrackVector;
generatedKineticTracks->push_back(aTrack);
}
//if (generatedKineticTracks == NULL)
if (generatedKineticTracks->size() == 0)
{
//G4cerr << "G4VPartonStringModel:No KineticTracks produced" << G4endl;
//continue;
success=false; NeedEnergyCorrector=false; break;
// G4cerr << "G4VPartonStringModel:No KineticTracks produced" << G4endl;
// continue;
success=false; NeedEnergyCorrector=false; break;
}
G4LorentzVector KTsum1(0.,0.,0.,0.);
for ( unsigned int aTrack=0; aTrack<generatedKineticTracks->size();aTrack++)
{
#ifdef debug_G4ExcitedStringDecay
#ifdef debug_G4ExcitedStringDecay
G4cout<<"Prod part No. "<<aTrack+1<<" "
<<(*generatedKineticTracks)[aTrack]->GetDefinition()->GetParticleName()<<" "
<<(*generatedKineticTracks)[aTrack]->Get4Momentum()<<G4endl;
#endif
// Sampling mass of unstable hadronic resonances, AR-Oct2017
<<(*generatedKineticTracks)[aTrack]->Get4Momentum()
<<(*generatedKineticTracks)[aTrack]->Get4Momentum().mag()<<G4endl;
#endif
// --------------- Sampling mass of unstable hadronic resonances ---------------- Uzhi July 2017
TrackDefinition = (*generatedKineticTracks)[aTrack]->GetDefinition();
if ( TrackDefinition->IsShortLived() ) {
G4double NewTrackMass = BrW.SampleMass( TrackDefinition, TrackDefinition->GetPDGMass() + 5.0*TrackDefinition->GetPDGWidth() );
G4LorentzVector Tmp = G4LorentzVector( (*generatedKineticTracks)[aTrack]->Get4Momentum() );
Tmp.setE( std::sqrt( sqr(NewTrackMass) + Tmp.vect().mag2() ) );
(*generatedKineticTracks)[aTrack]->Set4Momentum(Tmp);
#ifdef debug_G4ExcitedStringDecay
G4cout<<"Resonance *** "<<aTrack+1<<" "
<<(*generatedKineticTracks)[aTrack]->GetDefinition()->GetParticleName()<<" "
<<(*generatedKineticTracks)[aTrack]->Get4Momentum()
<<(*generatedKineticTracks)[aTrack]->Get4Momentum().mag()<<G4endl;
#endif
if(TrackDefinition->IsShortLived())
{
G4double NewTrackMass = BrW.SampleMass( TrackDefinition,
TrackDefinition->GetPDGMass() + 5.0*TrackDefinition->GetPDGWidth() );
G4LorentzVector Tmp=G4LorentzVector((*generatedKineticTracks)[aTrack]->Get4Momentum());
Tmp.setE(std::sqrt(sqr(NewTrackMass) + Tmp.vect().mag2()));
(*generatedKineticTracks)[aTrack]->Set4Momentum(Tmp);
#ifdef debug_G4ExcitedStringDecay
G4cout<<"Resonance *** "<<aTrack+1<<" "
<<(*generatedKineticTracks)[aTrack]->GetDefinition()->GetParticleName()<<" "
<<(*generatedKineticTracks)[aTrack]->Get4Momentum()
<<(*generatedKineticTracks)[aTrack]->Get4Momentum().mag()<<G4endl;
#endif
}
//--- End AR-Oct2017
// //----------------------------------------------------------------------------------------------
theResult->push_back(generatedKineticTracks->operator[](aTrack));
KTsum1+= (*generatedKineticTracks)[aTrack]->Get4Momentum();
}
KTsecondaries+=KTsum1;
#ifdef debug_G4ExcitedStringDecay
#ifdef debug_G4ExcitedStringDecay
G4cout << "String secondaries(" <<generatedKineticTracks->size()<< ")"<<G4endl
<<"Init string momentum: "<< theStrings->operator[](astring)->Get4Momentum()<<G4endl
<<"Final hadrons momentum: "<< KTsum1 << G4endl;
#endif
#endif
if ( KTsum1.e() > 0 && std::abs((KTsum1.e()-theStrings->operator[](astring)->Get4Momentum().e()) / KTsum1.e()) > perMillion )
{
NeedEnergyCorrector=true;
}
#ifdef debug_G4ExcitedStringDecay
#ifdef debug_G4ExcitedStringDecay
G4cout<<"NeedEnergyCorrection yes/no "<<NeedEnergyCorrector<<G4endl;
#endif
#endif
// clean up
// clean up
delete generatedKineticTracks;
success=true;
success=true;
}
//success=true;
if ( NeedEnergyCorrector ) success=EnergyAndMomentumCorrector(theResult, KTsum);
} while(!success && (attempts < 100)); /* Loop checking, 07.08.2015, A.Ribon */
for ( unsigned int aTrack=0; aTrack<theResult->size();aTrack++)
{
Ptmp=(*theResult)[aTrack]->Get4Momentum();
Ptmp.transform( toLab);
(*theResult)[aTrack]->Set4Momentum(Ptmp);
Ptmp=(*theResult)[aTrack]->Get4Momentum();
Ptmp.transform( toLab);
(*theResult)[aTrack]->Set4Momentum(Ptmp);
}
#ifdef debug_G4ExcitedStringDecay
#ifdef debug_G4ExcitedStringDecay
G4cout<<"End of the strings fragmentation (G4ExcitedStringDecay)"<<G4endl;
G4LorentzVector KTsum1(0.,0.,0.,0.);
@@ -254,8 +265,8 @@ G4KineticTrackVector *G4ExcitedStringDecay::FragmentStrings(const G4ExcitedStrin
for ( unsigned int aTrack=0; aTrack<theResult->size();aTrack++)
{
G4cout << " corrected tracks .. " << (*theResult)[aTrack]->GetDefinition()->GetParticleName()
<<" " << (*theResult)[aTrack]->Get4Momentum()
<<" " << (*theResult)[aTrack]->Get4Momentum().mag()<< G4endl;
<<" " << (*theResult)[aTrack]->Get4Momentum()
<<" " << (*theResult)[aTrack]->Get4Momentum().mag()<< G4endl;
KTsum1+= (*theResult)[aTrack]->Get4Momentum();
}
@@ -264,31 +275,42 @@ G4KineticTrackVector *G4ExcitedStringDecay::FragmentStrings(const G4ExcitedStrin
if ( ! success ) G4cout << "failed to correct E/p" << G4endl;
G4cout<<"End of the Hadronization (G4ExcitedStringDecay)"<<G4endl;
#endif
#endif
if(!success)
{
if(theResult->size() != 0)
{std::for_each(theResult->begin() , theResult->end() , DeleteKineticTrack());
theResult->clear();
delete theResult; theResult=0;
}
for ( unsigned int astring=0; astring < theStrings->size(); astring++)
// for ( unsigned int astring=0; astring < 1; astring++) // Uzhi 2016 Need more correct. For testing purposes.
{
if ( theStrings->operator[](astring)->IsExcited() ) {
Ptmp=theStrings->operator[](astring)->GetLeftParton()->Get4Momentum();
Ptmp.transform( toLab);
theStrings->operator[](astring)->GetLeftParton()->Set4Momentum(Ptmp);
if ( theStrings->operator[](astring)->IsExcited() )
{
Ptmp=theStrings->operator[](astring)->GetLeftParton()->Get4Momentum();
Ptmp.transform( toLab);
theStrings->operator[](astring)->GetLeftParton()->Set4Momentum(Ptmp);
Ptmp=theStrings->operator[](astring)->GetRightParton()->Get4Momentum();
Ptmp.transform( toLab);
theStrings->operator[](astring)->GetRightParton()->Set4Momentum(Ptmp);
} else {
Ptmp=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
Ptmp.transform( toLab);
theStrings->operator[](astring)->GetKineticTrack()->Set4Momentum(Ptmp);
}
Ptmp=theStrings->operator[](astring)->GetRightParton()->Get4Momentum();
Ptmp.transform( toLab);
theStrings->operator[](astring)->GetRightParton()->Set4Momentum(Ptmp);
}
else
{
Ptmp=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
Ptmp.transform( toLab);
theStrings->operator[](astring)->GetKineticTrack()->Set4Momentum(Ptmp);
}
}
}
return theResult;
}
G4bool G4ExcitedStringDecay::EnergyAndMomentumCorrector
(G4KineticTrackVector* Output, G4LorentzVector& TotalCollisionMom)
{
{
const int nAttemptScale = 500;
const double ErrLimit = 1.E-5;
if (Output->empty()) return TRUE;
@@ -296,22 +318,25 @@ G4bool G4ExcitedStringDecay::EnergyAndMomentumCorrector
G4double SumMass = 0;
G4double TotalCollisionMass = TotalCollisionMom.m();
#ifdef debug_G4ExcitedStringCorr
std::vector<G4double> HadronMass; G4double HadronM(0.);
#ifdef debug_G4ExcitedStringCorr
G4cout<<G4endl<<"EnergyAndMomentumCorrector. Number of particles: "<<Output->size()<<G4endl;
#endif
#endif
// Calculate sum hadron 4-momenta and summing hadron mass
unsigned int cHadron;
for(cHadron = 0; cHadron < Output->size(); cHadron++)
{
SumMom += Output->operator[](cHadron)->Get4Momentum();
SumMass += Output->operator[](cHadron)->GetDefinition()->GetPDGMass();
HadronM=Output->operator[](cHadron)->Get4Momentum().mag(); HadronMass.push_back(HadronM);
SumMass += Output->operator[](cHadron)->Get4Momentum().mag(); //GetDefinition()->GetPDGMass();
}
#ifdef debug_G4ExcitedStringCorr
G4cout<<"Sum part mom "<<SumMom<<" "<<SumMom.mag()<<G4endl
<<"Sum str mom "<<TotalCollisionMom<<" "<<TotalCollisionMom.mag()<<G4endl;
G4cout<<"SumMass TotalCollisionMass "<<SumMass<<" "<<TotalCollisionMass<<G4endl;
#endif
#ifdef debug_G4ExcitedStringCorr
G4cout<<"Sum part mom "<<SumMom<<" "<<SumMom.mag()<<G4endl
<<"Sum str mom "<<TotalCollisionMom<<" "<<TotalCollisionMom.mag()<<G4endl;
G4cout<<"SumMass TotalCollisionMass "<<SumMass<<" "<<TotalCollisionMass<<G4endl;
#endif
// Cannot correct a single particle
if (Output->size() < 2) return FALSE;
@@ -321,9 +346,9 @@ G4bool G4ExcitedStringDecay::EnergyAndMomentumCorrector
if (SumMass < 0) return FALSE;
SumMass = std::sqrt(SumMass);
// Compute c.m.s. hadron velocity and boost KTV to hadron c.m.s.
//G4ThreeVector Beta = -SumMom.boostVector();
G4ThreeVector Beta = -TotalCollisionMom.boostVector();
// Compute c.m.s. hadron velocity and boost KTV to hadron c.m.s.
// G4ThreeVector Beta = -SumMom.boostVector();
G4ThreeVector Beta = -TotalCollisionMom.boostVector();
Output->Boost(Beta);
// Scale total c.m.s. hadron energy (hadron system mass).
@@ -337,27 +362,30 @@ G4bool G4ExcitedStringDecay::EnergyAndMomentumCorrector
Sum = 0;
for(cHadron = 0; cHadron < Output->size(); cHadron++)
{
HadronM = HadronMass.at(cHadron);
G4LorentzVector HadronMom = Output->operator[](cHadron)->Get4Momentum();
HadronMom.setVect(Scale*HadronMom.vect());
G4double E = std::sqrt(HadronMom.vect().mag2() + sqr(Output->operator[](cHadron)->GetDefinition()->GetPDGMass()));
G4double E = std::sqrt(HadronMom.vect().mag2() + sqr(HadronM));
//sqr(Output->operator[](cHadron)->GetDefinition()->GetPDGMass()));
HadronMom.setE(E);
Output->operator[](cHadron)->Set4Momentum(HadronMom);
Sum += E;
}
Scale = TotalCollisionMass/Sum;
#ifdef debug_G4ExcitedStringCorr
#ifdef debug_G4ExcitedStringCorr
G4cout << "Scale-1=" << Scale -1
<< ", TotalCollisionMass=" << TotalCollisionMass
<< ", Sum=" << Sum
<< G4endl;
#endif
<< ", TotalCollisionMass=" << TotalCollisionMass
<< ", Sum=" << Sum
<< G4endl;
#endif
if (std::fabs(Scale - 1) <= ErrLimit)
{
success = true;
break;
}
}
#ifdef debug_G4ExcitedStringCorr
#ifdef debug_G4ExcitedStringCorr
if(!success)
{
G4cout << "G4ExcitedStringDecay::EnergyAndMomentumCorrector - Warning"<<G4endl;
@@ -365,13 +393,12 @@ G4bool G4ExcitedStringDecay::EnergyAndMomentumCorrector
G4cout << " Number of secondaries: " << Output->size() << G4endl;
G4cout << " Wanted total energy: " << TotalCollisionMom.e() << G4endl;
G4cout << " Increase number of attempts or increase ERRLIMIT"<<G4endl;
//throw G4HadronicException(__FILE__, __LINE__, "G4ExcitedStringDecay failed to correct...");
// throw G4HadronicException(__FILE__, __LINE__, "G4ExcitedStringDecay failed to correct...");
}
#endif
#endif
// Compute c.m.s. interaction velocity and KTV back boost
Beta = TotalCollisionMom.boostVector();
Output->Boost(Beta);
return success;
}
}
@@ -41,6 +41,8 @@
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
G4FragmentingString::G4FragmentingString(const G4FragmentingString &old)
{
LeftParton=old.LeftParton;
@@ -52,23 +54,29 @@ G4FragmentingString::G4FragmentingString(const G4FragmentingString &old)
theStableParton=old.theStableParton;
theDecayParton=old.theDecayParton;
decaying=old.decaying;
Pstring=old.Pstring;
Pleft =old.Pleft;
Pright =old.Pright;
}
G4FragmentingString & G4FragmentingString::operator =(const G4FragmentingString &old)
{
if (this != &old)
{
LeftParton=old.LeftParton;
RightParton=old.RightParton;
Ptleft=old.Ptleft;
Ptright=old.Ptright;
Pplus=old.Pplus;
Pminus=old.Pminus;
theStableParton=old.theStableParton;
theDecayParton=old.theDecayParton;
decaying=old.decaying;
}
return *this;
if (this != &old)
{
LeftParton=old.LeftParton;
RightParton=old.RightParton;
Ptleft=old.Ptleft;
Ptright=old.Ptright;
Pplus=old.Pplus;
Pminus=old.Pminus;
theStableParton=old.theStableParton;
theDecayParton=old.theDecayParton;
decaying=old.decaying;
Pstring=old.Pstring;
Pleft =old.Pleft;
Pright =old.Pright;
}
return *this;
}
//---------------------------------------------------------------------------------
@@ -86,9 +94,13 @@ G4FragmentingString::G4FragmentingString(const G4ExcitedString &excited)
Pminus=P.e() - P.pz();
theStableParton=0;
theDecayParton=0;
//decaying=None;
if(excited.GetDirection() > 0) {decaying=Left; }
else {decaying=Right;}
Pleft = excited.GetLeftParton()->Get4Momentum();
Pright = excited.GetRightParton()->Get4Momentum();
Pstring= Pleft + Pright;
}
//---------------------------------------------------------------------------------
@@ -98,38 +110,65 @@ G4FragmentingString::G4FragmentingString(const G4FragmentingString &old,
const G4LorentzVector *momentum)
{
decaying=None;
G4LorentzVector Momentum = G4LorentzVector(momentum->vect(),momentum->e());
// Momentum of produced hadron
//G4cout<<"Had Mom "<<Momentum<<G4endl;
//G4cout<<"Str Mom "<<old.Pstring<<G4endl;
Pstring = old.Pstring - Momentum;
//G4cout<<"New Str Mom "<<Pstring<<" "<<Pstring.mag()<<G4endl;
G4double StringMass = Pstring.mag();
G4LorentzRotation toLAB(Pstring.boostVector());
Pleft = toLAB*G4LorentzVector(0.,0., StringMass/2.,StringMass/2.);
Pright = toLAB*G4LorentzVector(0.,0.,-StringMass/2.,StringMass/2.);
Ptleft =Pleft.vect(); Ptleft.setZ(0.);
Ptright=Pright.vect(); Ptright.setZ(0.);
//G4cout<<"Pleft "<<Pleft<<G4endl;
//G4cout<<"Pright "<<Pright<<G4endl;
//G4cout<<"Pstring "<<Pstring<<G4endl;
if ( old.decaying == Left )
{
RightParton= old.RightParton;
Ptright = old.Ptright;
// Ptright = old.Ptright;
//Pright = old.Pright;
LeftParton = newdecay;
Ptleft = old.Ptleft - momentum->vect();
Ptleft.setZ(0.);
// Ptleft = old.Ptleft - momentum->vect();
// Ptleft.setZ(0.);
//Pleft = old.Pleft - Momentum;
//Pstring=Pleft + Pright;
theDecayParton=GetLeftParton();
theStableParton=GetRightParton();
decaying=Left;
} else if ( old.decaying == Right )
{
RightParton = newdecay;
Ptright = old.Ptright - momentum->vect();
Ptright.setZ(0.);
// Ptright = old.Ptright - momentum->vect();
// Ptright.setZ(0.);
//Pright = old.Pright + Momentum;
LeftParton = old.LeftParton;
Ptleft = old.Ptleft;
// Ptleft = old.Ptleft;
//Pleft = old.Pleft;
//Pstring=Pleft + Pright;
theDecayParton=GetRightParton();
theStableParton=GetLeftParton();
decaying=Right;
} else
{
throw G4HadronicException(__FILE__, __LINE__,
"G4FragmentingString::G4FragmentingString: no decay Direction defined");
throw G4HadronicException(__FILE__, __LINE__, "G4FragmentingString::G4FragmentingString: no decay Direction defined");
}
Pplus = old.Pplus - (momentum->e() + momentum->pz());
Pminus = old.Pminus - (momentum->e() - momentum->pz());
//G4double Eold=0.5 * (old.Pplus + old.Pminus);
//G4double Enew=0.5 * (Pplus + Pminus);
Pplus = Pstring.plus(); //old.Pplus - (momentum->e() + momentum->pz());
Pminus = Pstring.minus();//old.Pminus - (momentum->e() - momentum->pz());
}
//---------------------------------------------------------------------------------
G4FragmentingString::G4FragmentingString(const G4FragmentingString &old,
@@ -142,6 +181,10 @@ G4FragmentingString::G4FragmentingString(const G4FragmentingString &old,
Pplus=0.; Pminus=0.;
theStableParton=0; theDecayParton=0;
Pstring=G4LorentzVector(0.,0.,0.,0.);
Pleft =G4LorentzVector(0.,0.,0.,0.);
Pright =G4LorentzVector(0.,0.,0.,0.);
if ( old.decaying == Left )
{
RightParton= old.RightParton;
@@ -154,16 +197,17 @@ G4FragmentingString::G4FragmentingString(const G4FragmentingString &old,
decaying=Right;
} else
{
throw G4HadronicException(__FILE__, __LINE__,
"G4FragmentingString::G4FragmentingString: no decay Direction defined");
throw G4HadronicException(__FILE__, __LINE__, "G4FragmentingString::G4FragmentingString: no decay Direction defined");
}
}
//---------------------------------------------------------------------------------
G4FragmentingString::~G4FragmentingString()
{}
//---------------------------------------------------------------------------------
void G4FragmentingString::SetLeftPartonStable()
@@ -197,7 +241,7 @@ G4int G4FragmentingString::GetDecayDirection() const
G4bool G4FragmentingString::FourQuarkString() const
{
return LeftParton->GetParticleSubType()== "di_quark"
&& RightParton->GetParticleSubType()== "di_quark";
&& RightParton->GetParticleSubType()== "di_quark";
}
//---------------------------------------------------------------------------------
@@ -261,12 +305,14 @@ G4LorentzVector G4FragmentingString::Get4Momentum() const
G4double G4FragmentingString::Mass2() const
{
return Pplus*Pminus - (Ptleft+Ptright).mag2();
// return Pplus*Pminus - (Ptleft+Ptright).mag2();
return Pstring.mag2();
}
G4double G4FragmentingString::Mass() const
{
return std::sqrt(this->Mass2());
// return std::sqrt(this->Mass2());
return Pstring.mag();
}
G4double G4FragmentingString::MassT2() const
@@ -274,3 +320,11 @@ G4double G4FragmentingString::MassT2() const
return Pplus*Pminus;
}
G4LorentzVector G4FragmentingString::GetPstring()
{return Pstring;}
G4LorentzVector G4FragmentingString::GetPleft()
{return Pleft;}
G4LorentzVector G4FragmentingString::GetPright()
{return Pright;}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4HadronBuilder.cc 106967 2017-10-31 08:41:49Z gcosmo $
// $Id: G4HadronBuilder.cc 107968 2017-12-14 13:16:35Z gcosmo $
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
@@ -55,16 +55,16 @@ G4ParticleDefinition * G4HadronBuilder::Build(G4ParticleDefinition * black, G4Pa
if (black->GetParticleSubType()== "di_quark" || white->GetParticleSubType()== "di_quark" ) {
// Baryon
// Barion
Spin spin = (G4UniformRand() < barionSpinMix) ? SpinHalf : SpinThreeHalf;
return Barion(black,white,spin);
} else {
// Meson
// Meson
Spin spin = (G4UniformRand() < mesonSpinMix) ? SpinZero : SpinOne;
return Meson(black,white,spin);
}
}
@@ -75,9 +75,9 @@ G4ParticleDefinition * G4HadronBuilder::BuildLowSpin(G4ParticleDefinition * blac
if ( black->GetParticleSubType()== "quark" && white->GetParticleSubType()== "quark" ) {
return Meson(black,white, SpinZero);
} else {
// will return a SpinThreeHalf Baryon if all quarks the same
// will return a SpinThreeHalf Barion if all quarks the same
return Barion(black,white, SpinHalf);
}
}
}
//-------------------------------------------------------------------------
@@ -96,33 +96,35 @@ G4ParticleDefinition * G4HadronBuilder::BuildHighSpin(G4ParticleDefinition * bla
G4ParticleDefinition * G4HadronBuilder::Meson(G4ParticleDefinition * black,
G4ParticleDefinition * white, Spin theSpin)
{
#ifdef G4VERBOSE
// Verify Input Charge
G4double charge = black->GetPDGCharge() + white->GetPDGCharge();
if (std::abs(charge) > 2 || std::abs(3.*charge - 3*G4int(charge*1.001)) > perCent ) // 1.001 to avoid int(.9999) -> 0
{
#ifdef G4VERBOSE
// Verify Input Charge
G4double charge = black->GetPDGCharge()
+ white->GetPDGCharge();
if (std::abs(charge) > 2 || std::abs(3.*charge - 3*G4int(charge*1.001)) > perCent ) // 1.001 to avoid int(.9999) -> 0
{
G4cerr << " G4HadronBuilder::Build()" << G4endl;
G4cerr << " Invalid total charge found for on input: "
<< charge<< G4endl;
<< charge<< G4endl;
G4cerr << " PGDcode input quark1/quark2 : " <<
black->GetPDGEncoding() << " / "<<
white->GetPDGEncoding() << G4endl;
G4cerr << G4endl;
}
#endif
}
#endif
G4int id1= black->GetPDGEncoding();
G4int id2= white->GetPDGEncoding();
//G4int ifl1= std::max(std::abs(id1), std::abs(id2));
// G4int ifl1= std::max(std::abs(id1), std::abs(id2));
if ( std::abs(id1) < std::abs(id2) )
{
{
G4int xchg = id1;
id1 = id2;
id2 = xchg;
}
}
if (std::abs(id1) > 3 )
throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Meson : Illegal Quark content as input");
throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Meson : Illegal Quark content as input");
G4int PDGEncoding=0;
@@ -145,11 +147,10 @@ G4ParticleDefinition * G4HadronBuilder::Meson(G4ParticleDefinition * black,
if( (IsUp && IsAnti ) || (!IsUp && !IsAnti ) )
PDGEncoding = - PDGEncoding;
}
G4ParticleDefinition * MesonDef=
G4ParticleTable::GetParticleTable()->FindParticle(PDGEncoding);
#ifdef G4VERBOSE
#ifdef G4VERBOSE
if (MesonDef == 0 ) {
G4cerr << " G4HadronBuilder - Warning: No particle for PDGcode= "
<< PDGEncoding << G4endl;
@@ -162,38 +163,39 @@ G4ParticleDefinition * G4HadronBuilder::Meson(G4ParticleDefinition * black,
<< " resulting Hadron " << MesonDef->GetParticleName()
<< G4endl;
}
#endif
#endif
return MesonDef;
}
G4ParticleDefinition * G4HadronBuilder::Barion(G4ParticleDefinition * black,
G4ParticleDefinition * white,Spin theSpin)
G4ParticleDefinition * white,Spin theSpin)
{
#ifdef G4VERBOSE
// Verify Input Charge
G4double charge = black->GetPDGCharge() + white->GetPDGCharge();
if (std::abs(charge) > 2 || std::abs(3.*charge - 3*G4int(charge*1.001)) > perCent )
#ifdef G4VERBOSE
// Verify Input Charge
G4double charge = black->GetPDGCharge()
+ white->GetPDGCharge();
if (std::abs(charge) > 2 || std::abs(3.*charge - 3*G4int(charge*1.001)) > perCent )
{
G4cerr << " G4HadronBuilder::Build()" << G4endl;
G4cerr << " Invalid total charge found for on input: " << charge<< G4endl;
G4cerr << " Invalid total charge found for on input: "
<< charge<< G4endl;
G4cerr << " PGDcode input quark1/quark2 : " <<
black->GetPDGEncoding() << " / "<<
white->GetPDGEncoding() << G4endl;
G4cerr << G4endl;
}
#endif
#endif
G4int id1= black->GetPDGEncoding();
G4int id2= white->GetPDGEncoding();
if ( std::abs(id1) < std::abs(id2) )
{
{
G4int xchg = id1;
id1 = id2;
id2 = xchg;
}
}
if (std::abs(id1) < 1000 || std::abs(id2) > 3 )
throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Barion: Illegal quark content as input");
@@ -203,10 +205,10 @@ G4ParticleDefinition * G4HadronBuilder::Barion(G4ParticleDefinition * black,
G4int diquarkSpin = std::abs(id1)%10;
G4int ifl3 = id2;
if (id1 < 0)
{
{
ifl1 = - ifl1;
ifl2 = - ifl2;
}
}
//... Construct barion, distinguish Lambda and Sigma barions.
G4int kfla = std::abs(ifl1);
G4int kflb = std::abs(ifl2);
@@ -224,10 +226,10 @@ G4ParticleDefinition * G4HadronBuilder::Barion(G4ParticleDefinition * black,
G4int kfll = 0;
if(theSpin == SpinHalf && kfld > kfle && kfle > kflf) {
// Spin J=1/2 and all three quarks different
// Two states exist: (uds -> lambda or sigma0)
// - lambda: s(ud)0 s : 3122; ie. reverse the two lighter quarks
// - sigma0: s(ud)1 s : 3212
// Spin J=1/2 and all three quarks different
// Two states exist: (uds -> lambda or sigma0)
// - lambda: s(ud)0 s : 3122; ie. reverse the two lighter quarks
// - sigma0: s(ud)1 s : 3212
if(diquarkSpin == 1 ) {
if ( kfla == kfld) { // heaviest quark in diquark
kfll = 1;
@@ -240,29 +242,31 @@ G4ParticleDefinition * G4HadronBuilder::Barion(G4ParticleDefinition * black,
}
G4int PDGEncoding;
if (kfll == 1) PDGEncoding = 1000 * kfld + 100 * kflf + 10 * kfle + theSpin;
else PDGEncoding = 1000 * kfld + 100 * kfle + 10 * kflf + theSpin;
if (kfll == 1)
PDGEncoding = 1000 * kfld + 100 * kflf + 10 * kfle + theSpin;
else
PDGEncoding = 1000 * kfld + 100 * kfle + 10 * kflf + theSpin;
if (id1 < 0)
PDGEncoding = -PDGEncoding;
if (id1 < 0) PDGEncoding = -PDGEncoding;
G4ParticleDefinition * BarionDef=
G4ParticleTable::GetParticleTable()->FindParticle(PDGEncoding);
#ifdef G4VERBOSE
#ifdef G4VERBOSE
if (BarionDef == 0 ) {
G4cerr << " G4HadronBuilder - Warning: No particle for PDGcode= "
<< PDGEncoding << G4endl;
} else if ( ( black->GetPDGCharge() + white->GetPDGCharge()
- BarionDef->GetPDGCharge() ) > perCent ) {
G4cerr << " G4HadronBuilder - Warning: Incorrect Charge : "
<< " DiQuark/Quark = "
<< black->GetParticleName() << " / "
<< white->GetParticleName()
<< " resulting Hadron " << BarionDef->GetParticleName()
<< G4endl;
<< " DiQuark/Quark = "
<< black->GetParticleName() << " / "
<< white->GetParticleName()
<< " resulting Hadron " << BarionDef->GetParticleName()
<< G4endl;
}
#endif
#endif
return BarionDef;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4QGSMFragmentation.cc 106967 2017-10-31 08:41:49Z gcosmo $
// $Id: G4QGSMFragmentation.cc 107968 2017-12-14 13:16:35Z gcosmo $
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
@@ -48,160 +48,183 @@
G4QGSMFragmentation::G4QGSMFragmentation() :
arho(0.5), aphi(0.), an(-0.5), ala(-0.75), aksi(-1.), alft(0.5)
{
SetStrangenessSuppression(0.41);
SetDiquarkSuppression(0.25);
SetDiquarkBreakProbability(0.4);
}
{
SetStrangenessSuppression((1.0 - 0.168)/2.);//It was (0.43); Uzhi Dec. 2017
SetDiquarkSuppression(0.299); // 0.087 std 0.07 Uzhi Dec. 2017
SetDiquarkBreakProbability(0.4); // 0.05 std 0.1 Uzhi Dec. 2017
//... pspin_meson is probability to create pseudo-scalar meson
pspin_meson = 0.30; SetVectorMesonProbability(pspin_meson); // Uzhi Dec. 2017
//... pspin_barion is probability to create 1/2 barion
pspin_barion = 0.5; SetSpinThreeHalfBarionProbability(pspin_barion); // Uzhi Dec. 2017
//... vectorMesonMix[] is quark mixing parameters for vector mesons (Variable spin = 3)
vectorMesonMix[0] = 0.; // 0.5 Uzhi Dec. 2017
vectorMesonMix[1] = 0.375;
vectorMesonMix[2] = 0.0;
vectorMesonMix[3] = 0.375; // 0.5 Uzhi Dec. 2017
vectorMesonMix[4] = 1.0;
vectorMesonMix[5] = 1.0;
SetVectorMesonMixings(vectorMesonMix); // Uzhi Dec. 2017
}
G4QGSMFragmentation::~G4QGSMFragmentation()
{
}
{
}
//----------------------------------------------------------------------------------------------------------
G4KineticTrackVector* G4QGSMFragmentation::FragmentString(const G4ExcitedString& theString)
{
#ifdef debug_QGSMfragmentation
G4cout<<G4endl<<"QGSM StringFragm: String Mass " <<theString.Get4Momentum().mag()<<" Pz "
<<theString.Get4Momentum().pz()
<<"------------------------------------"<<G4endl;
#ifdef debug_QGSMfragmentation
G4cout<<G4endl<<"QGSM StringFragm: String Mass "
<<theString.Get4Momentum().mag()<<" Pz "
<<theString.Get4Momentum().pz()
<<"------------------------------------"<<G4endl;
G4cout<<"String ends Direct "<<theString.GetLeftParton()->GetPDGcode()<<" "
<<theString.GetRightParton()->GetPDGcode()<<" "
<<theString.GetDirection()<< G4endl;
G4cout<<"Left mom "<<theString.GetLeftParton()->Get4Momentum()<<G4endl;
G4cout<<"Right mom "<<theString.GetRightParton()->Get4Momentum()<<G4endl;
G4cout<<"Check for Fragmentation "<<G4endl;
#endif
#endif
// Can no longer modify Parameters for Fragmentation.
PastInitPhase=true;
// Can no longer modify Parameters for Fragmentation.
PastInitPhase=true;
// check if string has enough mass to fragment...
// check if string has enough mass to fragment...
G4KineticTrackVector * LeftVector=LightFragmentationTest(&theString);
G4KineticTrackVector * LeftVector=LightFragmentationTest(&theString);
#ifdef debug_QGSMfragmentation
#ifdef debug_QGSMfragmentation
if ( LeftVector != 0 ) G4cout<<"Non fragmentable - the string is converted to one hadron "<<G4endl;
#endif
#endif
if ( LeftVector != 0 ) return LeftVector;
if ( LeftVector != 0 ) return LeftVector;
#ifdef debug_QGSMfragmentation
#ifdef debug_QGSMfragmentation
G4cout<<"The string will be fragmented. "<<G4endl;
#endif
#endif
LeftVector = new G4KineticTrackVector;
G4KineticTrackVector * RightVector=new G4KineticTrackVector;
LeftVector = new G4KineticTrackVector;
G4KineticTrackVector * RightVector=new G4KineticTrackVector;
// this should work but its only a semi deep copy. %GF G4ExcitedString theStringInCMS(theString);
G4ExcitedString *theStringInCMS=CPExcited(theString);
G4LorentzRotation toCms=theStringInCMS->TransformToAlignedCms();
// this should work but its only a semi deep copy. %GF G4ExcitedString theStringInCMS(theString);
G4ExcitedString *theStringInCMS=CopyExcited(theString);
G4LorentzRotation toCms=theStringInCMS->TransformToAlignedCms();
G4bool success=false, inner_sucess=true;
G4int attempt=0;
while ( !success && attempt++ < StringLoopInterrupt ) /* Loop checking, 07.08.2015, A.Ribon */
{
#ifdef debug_QGSMfragmentation
G4cout<<"Loop_toFrag "<<theStringInCMS->GetLeftParton()->GetPDGcode()<<" "
<<theStringInCMS->GetRightParton()->GetPDGcode()<<" "
<<theStringInCMS->GetDirection()<< G4endl;
#endif
G4bool success=false, inner_sucess=true;
G4int attempt=0;
while ( !success && attempt++ < StringLoopInterrupt ) /* Loop checking, 07.08.2015, A.Ribon */
{
#ifdef debug_QGSMfragmentation
G4cout<<"Loop_toFrag "<<theStringInCMS->GetLeftParton()->GetPDGcode()<<" "
<<theStringInCMS->GetRightParton()->GetPDGcode()<<" "
<<theStringInCMS->GetDirection()<< G4endl;
#endif
G4FragmentingString *currentString=new G4FragmentingString(*theStringInCMS);
G4FragmentingString *currentString=new G4FragmentingString(*theStringInCMS);
std::for_each(LeftVector->begin(), LeftVector->end(), DeleteKineticTrack());
LeftVector->clear();
std::for_each(RightVector->begin(), RightVector->end(), DeleteKineticTrack());
RightVector->clear();
std::for_each(LeftVector->begin(), LeftVector->end(), DeleteKineticTrack());
LeftVector->clear();
std::for_each(RightVector->begin(), RightVector->end(), DeleteKineticTrack());
RightVector->clear();
inner_sucess=true; // set false on failure..
const G4int maxNumberOfLoops = 1000;
G4int loopCounter = -1;
while (! StopFragmenting(currentString) && ++loopCounter < maxNumberOfLoops ) /* Loop checking, 07.08.2015, A.Ribon */
{ // Split current string into hadron + new string
inner_sucess=true; // set false on failure..
const G4int maxNumberOfLoops = 1000;
G4int loopCounter = -1;
while (! StopFragmenting(currentString) && ++loopCounter < maxNumberOfLoops ) /* Loop checking, 07.08.2015, A.Ribon */
{ // Split current string into hadron + new string
#ifdef debug_QGSMfragmentation
G4cout<<"The string can fragment. "<<G4endl;;
#endif
#ifdef debug_QGSMfragmentation
G4cout<<"The string can fragment. "<<G4endl;;
#endif
G4FragmentingString *newString=0; // used as output from SplitUp...
G4KineticTrack * Hadron=Splitup(currentString,newString);
G4FragmentingString *newString=0; // used as output from SplitUp...
G4KineticTrack * Hadron=Splitup(currentString,newString);
if ( Hadron != 0 )
{
#ifdef debug_QGSMfragmentation
G4cout<<"Hadron prod at fragm. "<<Hadron->GetDefinition()->GetParticleName()<<G4endl;
#endif
if ( currentString->GetDecayDirection() > 0 )
LeftVector->push_back(Hadron);
else
RightVector->push_back(Hadron);
if ( Hadron != 0 ) // && IsFragmentable(newString))
{
#ifdef debug_QGSMfragmentation
G4cout<<"Hadron prod at fragm. "<<Hadron->GetDefinition()->GetParticleName()<<G4endl;
#endif
delete currentString;
currentString=newString;
if ( currentString->GetDecayDirection() > 0 ) LeftVector->push_back(Hadron);
else RightVector->push_back(Hadron);
} else {
delete currentString;
currentString=newString;
#ifdef debug_QGSMfragmentation
G4cout<<"abandon ... start from the beginning ---------------"<<G4endl;
#endif
} else {
// abandon ... start from the beginning
if (newString) delete newString;
inner_sucess=false;
break;
}
}
if ( loopCounter >= maxNumberOfLoops ) {
inner_sucess=false;
}
#ifdef debug_QGSMfragmentation
G4cout<<"abandon ... start from the beginning ---------------"<<G4endl;
#endif
// Split current string into 2 final Hadrons
#ifdef debug_QGSMfragmentation
G4cout<<"Split remaining string into 2 final hadrons."<<G4endl;
#endif
// abandon ... start from the beginning
if (newString) delete newString;
inner_sucess=false;
break;
}
}
if ( loopCounter >= maxNumberOfLoops ) inner_sucess=false;
// Split current string into 2 final Hadrons
#ifdef debug_QGSMfragmentation
G4cout<<"Split remaining string into 2 final hadrons."<<G4endl;
#endif
if ( inner_sucess && SplitLast(currentString,LeftVector, RightVector) )
{
success=true;
}
delete currentString;
} // End of while loop
if ( inner_sucess &&
SplitLast(currentString,LeftVector, RightVector) )
{
success=true;
}
delete currentString;
}
delete theStringInCMS;
delete theStringInCMS;
if ( ! success )
{
std::for_each(LeftVector->begin(), LeftVector->end(), DeleteKineticTrack());
LeftVector->clear();
std::for_each(RightVector->begin(), RightVector->end(), DeleteKineticTrack());
delete RightVector;
return LeftVector;
}
if ( ! success )
{
std::for_each(LeftVector->begin(), LeftVector->end(), DeleteKineticTrack());
LeftVector->clear();
std::for_each(RightVector->begin(), RightVector->end(), DeleteKineticTrack());
delete RightVector;
return LeftVector;
}
// Join Left- and RightVector into LeftVector in correct order.
while(!RightVector->empty()) /* Loop checking, 07.08.2015, A.Ribon */
{
LeftVector->push_back(RightVector->back());
RightVector->erase(RightVector->end()-1);
}
delete RightVector;
// Join Left- and RightVector into LeftVector in correct order.
while(!RightVector->empty()) /* Loop checking, 07.08.2015, A.Ribon */
{
LeftVector->push_back(RightVector->back());
RightVector->erase(RightVector->end()-1);
}
delete RightVector;
CalculateHadronTimePosition(theString.Get4Momentum().mag(), LeftVector);
CalculateHadronTimePosition(theString.Get4Momentum().mag(), LeftVector);
G4LorentzRotation toObserverFrame(toCms.inverse());
for(size_t C1 = 0; C1 < LeftVector->size(); C1++)
{
G4KineticTrack* Hadron = LeftVector->operator[](C1);
G4LorentzVector Momentum = Hadron->Get4Momentum();
Momentum = toObserverFrame*Momentum;
Hadron->Set4Momentum(Momentum);
G4LorentzVector Coordinate(Hadron->GetPosition(), Hadron->GetFormationTime());
Momentum = toObserverFrame*Coordinate;
Hadron->SetFormationTime(Momentum.e());
G4ThreeVector aPosition(Momentum.vect());
Hadron->SetPosition(theString.GetPosition()+aPosition);
}
return LeftVector;
G4LorentzRotation toObserverFrame(toCms.inverse());
for(size_t C1 = 0; C1 < LeftVector->size(); C1++)
{
G4KineticTrack* Hadron = LeftVector->operator[](C1);
G4LorentzVector Momentum = Hadron->Get4Momentum();
Momentum = toObserverFrame*Momentum;
Hadron->Set4Momentum(Momentum);
G4LorentzVector Coordinate(Hadron->GetPosition(), Hadron->GetFormationTime());
Momentum = toObserverFrame*Coordinate;
Hadron->SetFormationTime(Momentum.e());
G4ThreeVector aPosition(Momentum.vect());
Hadron->SetPosition(theString.GetPosition()+aPosition);
}
return LeftVector;
}
//----------------------------------------------------------------------------------------------------------
@@ -209,10 +232,9 @@ G4KineticTrackVector* G4QGSMFragmentation::FragmentString(const G4ExcitedString&
G4double G4QGSMFragmentation::GetLightConeZ(G4double zmin, G4double zmax, G4int PartonEncoding,
G4ParticleDefinition* pHadron, G4double , G4double )
{
#ifdef debug_QGSMfragmentation
#ifdef debug_QGSMfragmentation
G4cout<<"GetLightConeZ zmin zmax Parton pHadron "<<zmin<<" "<<zmax<<" "<<PartonEncoding<<" "<<pHadron->GetParticleName()<<G4endl;
#endif
#endif
G4double z;
G4double d1, d2, yf;
G4double invD1(0.),invD2(0.), r1(0.),r2(0.),r12(0.);
@@ -246,9 +268,9 @@ G4double G4QGSMFragmentation::GetLightConeZ(G4double zmin, G4double zmax, G4int
} else throw G4HadronicException(__FILE__, __LINE__, "Unknown PDGencoding in G4QGSMFragmentation::G4LightConeZ");
#ifdef debug_QGSMfragmentation
G4cout<<"d1 d2 "<<d1<<" "<<d2<<G4endl;
#endif
#ifdef debug_QGSMfragmentation
G4cout<<"d1 d2 "<<d1<<" "<<d2<<G4endl;
#endif
d1+=1.0; d2+=1.0;
@@ -258,10 +280,10 @@ G4double G4QGSMFragmentation::GetLightConeZ(G4double zmin, G4double zmax, G4int
G4int loopCounter = 0;
do
{
r1=G4Pow::GetInstance()->powA(G4UniformRand(),invD1);
r2=G4Pow::GetInstance()->powA(G4UniformRand(),invD2);
r12=r1+r2;
z=r1/r12;
r1=G4Pow::GetInstance()->powA(G4UniformRand(),invD1);
r2=G4Pow::GetInstance()->powA(G4UniformRand(),invD2);
r12=r1+r2;
z=r1/r12;
} while( ( (r12 > 1.0) || !((zmin <= z)&&(z <= zmax))) && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 07.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
z = 0.5*(zmin + zmax); // Just a value between zmin and zmax, no physics considerations at all!
@@ -274,41 +296,43 @@ G4double G4QGSMFragmentation::GetLightConeZ(G4double zmin, G4double zmax, G4int
if(absCode == 1103 || absCode == 2101 ||
absCode == 2203 || absCode == 2103)
{
if(absHadronCode < 1000) // Meson production
{
if(absHadronCode < 1000) // Meson production
{
if( !StrangeHadron ) {d1=1.0; d2= arho - 2.0*an + alft;}
else {d1=1.0; d2 = 2.*arho - 2.0*an - aphi + alft;}
} else { // Baryon production
} else // Baryon production
{
if( !StrangeHadron ) {d1=2.0*(arho - an); d2= -arho + alft;}
else {d1=2.0*(arho - an); d2 =-aphi + alft;}
}
}
#ifdef debug_QGSMfragmentation
G4cout<<"d1 d2 "<<d1<<" "<<d2<<G4endl;
#endif
#ifdef debug_QGSMfragmentation
G4cout<<"d1 d2 "<<d1<<" "<<d2<<G4endl;
#endif
d1+=1.0; d2+=1.0;
invD1=1./d1; invD2=1./d2;
d1+=1.0; d2+=1.0;
invD1=1./d1; invD2=1./d2;
const G4int maxNumberOfLoops = 10000;
G4int loopCounter = 0;
do
{
r1=G4Pow::GetInstance()->powA(G4UniformRand(),invD1);
r2=G4Pow::GetInstance()->powA(G4UniformRand(),invD2);
r12=r1+r2;
z=r1/r12;
} while( ( (r12 > 1.0) || !((zmin <= z)&&(z <= zmax))) && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 07.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
z = 0.5*(zmin + zmax); // Just a value between zmin and zmax, no physics considerations at all!
}
const G4int maxNumberOfLoops = 10000;
G4int loopCounter = 0;
do
{
r1=G4Pow::GetInstance()->powA(G4UniformRand(),invD1);
r2=G4Pow::GetInstance()->powA(G4UniformRand(),invD2);
r12=r1+r2;
z=r1/r12;
} while( ( (r12 > 1.0) || !((zmin <= z)&&(z <= zmax))) && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 07.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
z = 0.5*(zmin + zmax); // Just a value between zmin and zmax, no physics considerations at all!
}
return z;
return z;
}
else if(absCode == 3101 || absCode == 3103 || // For strange d-quarks
absCode == 3201 || absCode == 3203)
{
d2 = (alft - (2.*ala - arho));
}
else
{
@@ -328,290 +352,386 @@ G4double G4QGSMFragmentation::GetLightConeZ(G4double zmin, G4double zmax, G4int
return z;
}
//-----------------------------------------------------------------------------------------
G4LorentzVector * G4QGSMFragmentation::SplitEandP(G4ParticleDefinition * pHadron,
G4FragmentingString * string,
G4FragmentingString * string,
G4FragmentingString * NewString)
{
G4double HadronMass = pHadron->GetPDGMass();
G4double HadronMass = pHadron->GetPDGMass();
//G4double MinimalStringMass= FragmentationMass(NewString,&G4HadronBuilder::BuildHighSpin);
G4double MinimalStringMass= FragmentationMass(NewString,&G4HadronBuilder::Build);
//FragmentationMass(NewString,&G4HadronBuilder::BuildLowSpin); // Uzhi 03.06.2015
// Uzhi 03.06.2015 It would be well to sample randomly HighSpin
// G4double MinimalStringMass= FragmentationMass(NewString,&G4HadronBuilder::BuildHighSpin);
G4double MinimalStringMass=
FragmentationMass(NewString,&G4HadronBuilder::Build);
// FragmentationMass(NewString,&G4HadronBuilder::BuildLowSpin); // Uzhi 03.06.2015
#ifdef debug_QGSMfragmentation
#ifdef debug_QGSMfragmentation
G4cout<<"G4QGSMFragmentation::SplitEandP "<<pHadron->GetParticleName()<<G4endl;
G4cout<<"String 4 mom, String M "<<string->Get4Momentum()<<" "<<string->Mass()<<G4endl;
G4cout<<"HadM MinimalStringMassLeft StringM hM+sM "<<HadronMass<<" "<<MinimalStringMass<<" "
<<string->Mass()<<" "<<HadronMass+MinimalStringMass<<G4endl;
#endif
#endif
if(HadronMass + MinimalStringMass > string->Mass())
{
#ifdef debug_QGSMfragmentation
G4cout<<"Mass of the string is not sufficient to produce the hadron!"<<G4endl;
#endif
return 0;
} // have to start all over!
if(HadronMass + MinimalStringMass > string->Mass())
{
#ifdef debug_QGSMfragmentation
G4cout<<"Mass of the string is not sufficient to produce the hadron!"<<G4endl;
#endif
return 0;
}// have to start all over!
// calculate and assign hadron transverse momentum component HadronPx andHadronPy
G4double StringMT2 = string->MassT2();
G4double StringMT = std::sqrt(StringMT2);
// calculate and assign hadron transverse momentum component HadronPx andHadronPy
G4double StringMT2 = string->MassT2();
G4double StringMT = std::sqrt(StringMT2);
G4LorentzVector String4Momentum = string->Get4Momentum();
String4Momentum.setPz(0.);
G4ThreeVector StringPt = String4Momentum.vect();
G4LorentzVector String4Momentum = string->Get4Momentum();
String4Momentum.setPz(0.);
G4ThreeVector StringPt = String4Momentum.vect();
G4ThreeVector HadronPt , RemSysPt;
G4double HadronMassT2, ResidualMassT2;
G4ThreeVector HadronPt , RemSysPt;
G4double HadronMassT2, ResidualMassT2;
//... sample Pt of the hadron
G4int attempt=0;
do
{
attempt++; if(attempt > StringLoopInterrupt) return 0;
//... sample Pt of the hadron
G4int attempt=0;
do
{
attempt++; if(attempt > StringLoopInterrupt) return 0;
HadronPt =SampleQuarkPt() + string->DecayPt();
HadronPt.setZ(0);
RemSysPt = StringPt - HadronPt;
HadronPt =SampleQuarkPt() + string->DecayPt();
HadronPt.setZ(0);
RemSysPt = StringPt - HadronPt;
HadronMassT2 = sqr(HadronMass) + HadronPt.mag2();
ResidualMassT2=sqr(MinimalStringMass) + RemSysPt.mag2();
HadronMassT2 = sqr(HadronMass) + HadronPt.mag2();
ResidualMassT2=sqr(MinimalStringMass) + RemSysPt.mag2();
} while(std::sqrt(HadronMassT2) + std::sqrt(ResidualMassT2) > StringMT); /* Loop checking, 07.08.2015, A.Ribon */
} while(std::sqrt(HadronMassT2) + std::sqrt(ResidualMassT2) > StringMT); /* Loop checking, 07.08.2015, A.Ribon */
//... sample z to define hadron longitudinal momentum and energy
//... but first check the available phase space
//... sample z to define hadron longitudinal momentum and energy
//... but first check the available phase space
G4double Pz2 = (sqr(StringMT2 - HadronMassT2 - ResidualMassT2) -
4*HadronMassT2 * ResidualMassT2)/4./StringMT2;
G4double Pz2 = (sqr(StringMT2 - HadronMassT2 - ResidualMassT2) -
4*HadronMassT2 * ResidualMassT2)/4./StringMT2;
if(Pz2 < 0 ) {return 0;} // have to start all over!
if(Pz2 < 0 ) {return 0;} // have to start all over!
//... then compute allowed z region z_min <= z <= z_max
//... then compute allowed z region z_min <= z <= z_max
G4double Pz = std::sqrt(Pz2);
G4double zMin = (std::sqrt(HadronMassT2+Pz2) - Pz)/std::sqrt(StringMT2);
G4double zMax = (std::sqrt(HadronMassT2+Pz2) + Pz)/std::sqrt(StringMT2);
G4double Pz = std::sqrt(Pz2);
G4double zMin = (std::sqrt(HadronMassT2+Pz2) - Pz)/std::sqrt(StringMT2);
G4double zMax = (std::sqrt(HadronMassT2+Pz2) + Pz)/std::sqrt(StringMT2);
/*
G4double DecayQuarkMass2 = sqr(string->GetDecayParton()->GetPDGMass());
G4double HadronMass2T = sqr(HadronMass) + HadronPt.mag2();
if (DecayQuarkMass2 + HadronMass2T >= SmoothParam*(string->Mass2()) )
return 0; // have to start all over!
//... then compute allowed z region z_min <= z <= z_max
//G4double zMin = HadronMass2T/(string->Mass2());
//G4double zMax = 1. - DecayQuarkMass2/(string->Mass2());
*/
if (zMin >= zMax) return 0; // have to start all over!
if (zMin >= zMax) return 0; // have to start all over!
G4double z = GetLightConeZ(zMin, zMax, string->GetDecayParton()->GetPDGEncoding(),
pHadron, HadronPt.x(), HadronPt.y());
G4double z = GetLightConeZ(zMin, zMax,
string->GetDecayParton()->GetPDGEncoding(), pHadron,
HadronPt.x(), HadronPt.y());
//... now compute hadron longitudinal momentum and energy
// longitudinal hadron momentum component HadronPz
//... now compute hadron longitudinal momentum and energy
// longitudinal hadron momentum component HadronPz
HadronPt.setZ(0.5* string->GetDecayDirection() * (z * string->LightConeDecay() -
HadronMassT2/(z * string->LightConeDecay())));
G4double HadronE = 0.5* (z * string->LightConeDecay() +
HadronMassT2/(z * string->LightConeDecay()));
HadronPt.setZ(0.5* string->GetDecayDirection() *
(z * string->LightConeDecay() -
HadronMassT2/(z * string->LightConeDecay())));
G4double HadronE = 0.5* (z * string->LightConeDecay() +
HadronMassT2/(z * string->LightConeDecay()));
G4LorentzVector * a4Momentum= new G4LorentzVector(HadronPt,HadronE);
G4LorentzVector * a4Momentum= new G4LorentzVector(HadronPt,HadronE);
#ifdef debug_QGSMfragmentation
#ifdef debug_QGSMfragmentation
G4cout<<"string->GetDecayDirection() string->LightConeDecay() "
<<string->GetDecayDirection()<<" "<<string->LightConeDecay()<<G4endl;
G4cout<<"HadronPt,HadronE "<<HadronPt<<" "<<HadronE<<G4endl;
//G4cout<<"String4Momentum "<<String4Momentum<<G4endl;
//G4int Uzhi; G4cin>>Uzhi;
G4cout<<"Out of QGSM SplitEandP "<<G4endl;
#endif
#endif
return a4Momentum;
return a4Momentum;
}
//-----------------------------------------------------------------------------------------
G4bool G4QGSMFragmentation::SplitLast(G4FragmentingString * string,
G4KineticTrackVector * LeftVector,
G4KineticTrackVector * RightVector)
G4KineticTrackVector * LeftVector,
G4KineticTrackVector * RightVector)
{
//... perform last cluster decay
//... perform last cluster decay
G4ThreeVector ClusterVel =string->Get4Momentum().boostVector();
G4double ResidualMass =string->Mass();
G4ThreeVector ClusterVel =string->Get4Momentum().boostVector();
G4double ResidualMass =string->Mass();
#ifdef debug_QGSMfragmentation
#ifdef debug_QGSMfragmentation
G4cout<<"Split last-----------------------------------------"<<G4endl;
G4cout<<"StrMass "<<ResidualMass<<" q's "
<<string->GetLeftParton()->GetParticleName()<<" "
<<string->GetRightParton()->GetParticleName()<<G4endl;
#endif
#endif
G4double ClusterMassCut = ClusterMass; // Taken from G4VLongitudinalStringDecay
G4int cClusterInterrupt = 0;
G4ParticleDefinition * LeftHadron, * RightHadron;
const G4int maxNumberOfLoops = 1000;
G4int loopCounter = 0;
do
{
if (cClusterInterrupt++ >= ClusterLoopInterrupt)
G4double ClusterMassCut = ClusterMass; // Taken from G4VLongitudinalStringDecay
G4int cClusterInterrupt = 0;
G4ParticleDefinition * LeftHadron, * RightHadron;
const G4int maxNumberOfLoops = 1000;
G4int loopCounter = 0;
do
{
if (cClusterInterrupt++ >= ClusterLoopInterrupt)
{
return false;
}
G4ParticleDefinition * quark = NULL;
string->SetLeftPartonStable(); // to query quark contents..
if (string->DecayIsQuark() && string->StableIsQuark() )
{
//... there are quarks on cluster ends
LeftHadron= QuarkSplitup(string->GetLeftParton(), quark);
} else {
//... there is a Diquark on cluster ends
G4int IsParticle;
if ( string->StableIsQuark() ) {
IsParticle=(string->GetLeftParton()->GetPDGEncoding()>0) ? -1 : +1;
} else {
IsParticle=(string->GetLeftParton()->GetPDGEncoding()>0) ? +1 : -1;
}
//G4double ProbSaS = 1.0 - 2.0 * GetStrangeSuppress();
//G4double ActualProb = ProbSaS * 1.4;
//SetStrangenessSuppression((1.0-ActualProb)/2.0);
pDefPair QuarkPair = CreatePartonPair(IsParticle,false); // no diquarks wanted
//SetStrangenessSuppression((1.0-ProbSaS)/2.0);
quark = QuarkPair.second;
LeftHadron=hadronizer->Build(QuarkPair.first, string->GetLeftParton());
}
RightHadron = hadronizer->Build(string->GetRightParton(), quark);
//... repeat procedure, if mass of cluster is too low to produce hadrons
//... ClusterMassCut = 0.15*GeV model parameter
if ( quark->GetParticleSubType()== "quark" ) {ClusterMassCut = 0.;}
else {ClusterMassCut = ClusterMass;}
}
while ( (ResidualMass <= LeftHadron->GetPDGMass() + RightHadron->GetPDGMass() + ClusterMassCut)
&& ++loopCounter < maxNumberOfLoops ); /* Loop checking, 07.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
return false;
}
G4ParticleDefinition * quark = NULL;
string->SetLeftPartonStable(); // to query quark contents..
//... compute hadron momenta and energies
G4LorentzVector LeftMom, RightMom;
G4ThreeVector Pos;
Sample4Momentum(&LeftMom , LeftHadron->GetPDGMass() ,
&RightMom, RightHadron->GetPDGMass(), ResidualMass);
LeftMom.boost(ClusterVel);
RightMom.boost(ClusterVel);
if (string->DecayIsQuark() && string->StableIsQuark() )
{
//... there are quarks on cluster ends
LeftHadron= QuarkSplitup(string->GetLeftParton(), quark);
} else {
//... there is a Diquark on cluster ends
G4int IsParticle;
if ( string->StableIsQuark() ) {
IsParticle=(string->GetLeftParton()->GetPDGEncoding()>0) ? -1 : +1;
} else {
IsParticle=(string->GetLeftParton()->GetPDGEncoding()>0) ? +1 : -1;
}
pDefPair QuarkPair = CreatePartonPair(IsParticle,false); // no diquarks wanted
quark = QuarkPair.second;
LeftHadron=hadronizer->Build(QuarkPair.first, string->GetLeftParton());
}
RightHadron = hadronizer->Build(string->GetRightParton(), quark);
//... repeat procedure, if mass of cluster is too low to produce hadrons
//... ClusterMassCut = 0.15*GeV model parameter
if ( quark->GetParticleSubType()== "quark" ) {ClusterMassCut = 0.;}
else {ClusterMassCut = ClusterMass;}
} while ( (ResidualMass <= LeftHadron->GetPDGMass() + RightHadron->GetPDGMass() + ClusterMassCut)
&& ++loopCounter < maxNumberOfLoops ); /* Loop checking, 07.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
return false;
}
//... compute hadron momenta and energies
G4LorentzVector LeftMom, RightMom;
G4ThreeVector Pos;
Sample4Momentum(&LeftMom , LeftHadron->GetPDGMass() ,
&RightMom, RightHadron->GetPDGMass(), ResidualMass);
LeftMom.boost(ClusterVel);
RightMom.boost(ClusterVel);
#ifdef debug_QGSMfragmentation
#ifdef debug_QGSMfragmentation
G4cout<<LeftHadron->GetParticleName()<<" "<<RightHadron->GetParticleName()<<G4endl;
G4cout<<"Left Hadrom P M "<<LeftMom<<" "<<LeftMom.mag()<<G4endl;
G4cout<<"Right Hadrom P M "<<RightMom<<" "<<RightMom.mag()<<G4endl;
#endif
#endif
LeftVector->push_back(new G4KineticTrack(LeftHadron, 0, Pos, LeftMom));
RightVector->push_back(new G4KineticTrack(RightHadron, 0, Pos, RightMom));
LeftVector->push_back(new G4KineticTrack(LeftHadron, 0, Pos, LeftMom));
RightVector->push_back(new G4KineticTrack(RightHadron, 0, Pos, RightMom));
return true;
return true;
}
//----------------------------------------------------------------------------------------------------------
G4bool G4QGSMFragmentation::IsFragmentable(const G4FragmentingString * const string)
{
return sqr(FragmentationMass(string)+MassCut) < string->Mass2();
return sqr(FragmentationMass(string)+MassCut) <
string->Mass2();
}
//----------------------------------------------------------------------------------------------------------
G4bool G4QGSMFragmentation::StopFragmenting(const G4FragmentingString * const string)
{
return sqr(FragmentationMass(string,&G4HadronBuilder::BuildHighSpin)+MassCut) >
return
sqr(FragmentationMass(string,&G4HadronBuilder::BuildHighSpin)+MassCut) >
string->Get4Momentum().mag2();
}
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
void G4QGSMFragmentation::Sample4Momentum(G4LorentzVector* Mom , G4double Mass ,
G4LorentzVector* AntiMom, G4double AntiMass, G4double InitialMass)
{
G4double r_val = sqr(InitialMass*InitialMass - Mass*Mass - AntiMass*AntiMass) - sqr(2.*Mass*AntiMass);
G4double Pabs = (r_val > 0.)? std::sqrt(r_val)/(2.*InitialMass) : 0;
//... sample unit vector
G4double pz = 1. - 2.*G4UniformRand();
G4double st = std::sqrt(1. - pz * pz)*Pabs;
G4double phi = 2.*pi*G4UniformRand();
G4double px = st*std::cos(phi);
G4double py = st*std::sin(phi);
pz *= Pabs;
Mom->setPx(px); Mom->setPy(py); Mom->setPz(pz);
Mom->setE(std::sqrt(Pabs*Pabs + Mass*Mass));
AntiMom->setPx(-px); AntiMom->setPy(-py); AntiMom->setPz(-pz);
AntiMom->setE (std::sqrt(Pabs*Pabs + AntiMass*AntiMass));
}
//*********************************************************************************************
// Uzhi June 2014 Insert from G4ExcitedStringDecay.cc
//-----------------------------------------------------------------------------
G4ParticleDefinition *G4QGSMFragmentation::DiQuarkSplitup(G4ParticleDefinition* decay,
G4ParticleDefinition *&created)
{
//... can Diquark break or not?
if (G4UniformRand() < DiquarkBreakProb ){
//... Diquark break
G4int stableQuarkEncoding = decay->GetPDGEncoding()/1000;
G4int decayQuarkEncoding = (decay->GetPDGEncoding()/100)%10;
if (G4UniformRand() < 0.5)
{
G4int Swap = stableQuarkEncoding;
stableQuarkEncoding = decayQuarkEncoding;
decayQuarkEncoding = Swap;
G4double r_val = sqr(InitialMass*InitialMass - Mass*Mass - AntiMass*AntiMass) - sqr(2.*Mass*AntiMass);
G4double Pabs = (r_val > 0.)? std::sqrt(r_val)/(2.*InitialMass) : 0;
//... sample unit vector
G4double pz = 1. - 2.*G4UniformRand();
G4double st = std::sqrt(1. - pz * pz)*Pabs;
G4double phi = 2.*pi*G4UniformRand();
G4double px = st*std::cos(phi);
G4double py = st*std::sin(phi);
pz *= Pabs;
Mom->setPx(px); Mom->setPy(py); Mom->setPz(pz);
Mom->setE(std::sqrt(Pabs*Pabs + Mass*Mass));
AntiMom->setPx(-px); AntiMom->setPy(-py); AntiMom->setPz(-pz);
AntiMom->setE (std::sqrt(Pabs*Pabs + AntiMass*AntiMass));
}
G4int IsParticle=(decayQuarkEncoding>0) ? -1 : +1; // if we have a quark, we need antiquark)
//-----------------------------------------------------------------------------
G4double StrSup=GetStrangeSuppress(); // for changing s-sbar production
StrangeSuppress=0.41; // was 0.47
pDefPair QuarkPair = CreatePartonPair(IsParticle,false); // no diquarks wanted
StrangeSuppress=StrSup;
G4ParticleDefinition *G4QGSMFragmentation::DiQuarkSplitup(
G4ParticleDefinition* decay,
G4ParticleDefinition *&created)
{
//... can Diquark break or not?
if (G4UniformRand() < DiquarkBreakProb ){
//... Diquark break
//... Build new Diquark
G4int QuarkEncoding=QuarkPair.second->GetPDGEncoding();
G4int i10 = std::max(std::abs(QuarkEncoding), std::abs(stableQuarkEncoding));
G4int i20 = std::min(std::abs(QuarkEncoding), std::abs(stableQuarkEncoding));
G4int spin = (i10 != i20 && G4UniformRand() <= 0.5)? 1 : 3;
G4int NewDecayEncoding = -1*IsParticle*(i10 * 1000 + i20 * 100 + spin);
created = FindParticle(NewDecayEncoding);
G4ParticleDefinition * decayQuark=FindParticle(decayQuarkEncoding);
G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decayQuark);
G4int stableQuarkEncoding = decay->GetPDGEncoding()/1000;
G4int decayQuarkEncoding = (decay->GetPDGEncoding()/100)%10;
return had;
//return hadronizer->Build(QuarkPair.first, decayQuark);
if (G4UniformRand() < 0.5)
{
G4int Swap = stableQuarkEncoding;
stableQuarkEncoding = decayQuarkEncoding;
decayQuarkEncoding = Swap;
}
} else {
//... Diquark does not break
G4int IsParticle=(decayQuarkEncoding>0) ? -1 : +1;
// if we have a quark, we need antiquark)
G4int IsParticle=(decay->GetPDGEncoding()>0) ? +1 : -1; // if we have a diquark, we need quark)
G4double StrSup=GetStrangeSuppress(); // for changing s-sbar production
StrangeSuppress=0.41; //0.41; 0.47
pDefPair QuarkPair = CreatePartonPair(IsParticle,false); // no diquarks wanted
StrangeSuppress=StrSup;
G4double StrSup=GetStrangeSuppress();
StrangeSuppress=0.41; // was 0.47 Uzhi Dec. 2017
pDefPair QuarkPair = CreatePartonPair(IsParticle,false); // no diquarks wanted
StrangeSuppress=StrSup;
created = QuarkPair.second;
//... Build new Diquark
G4int QuarkEncoding=QuarkPair.second->GetPDGEncoding();
G4int i10 = std::max(std::abs(QuarkEncoding), std::abs(stableQuarkEncoding));
G4int i20 = std::min(std::abs(QuarkEncoding), std::abs(stableQuarkEncoding));
G4int spin = (i10 != i20 && G4UniformRand() <= 0.5)? 1 : 3;
G4int NewDecayEncoding = -1*IsParticle*(i10 * 1000 + i20 * 100 + spin);
created = FindParticle(NewDecayEncoding);
G4ParticleDefinition * decayQuark=FindParticle(decayQuarkEncoding);
G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decayQuark);
G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decay);
return had;
//return G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decay);
}
return had;
// return hadronizer->Build(QuarkPair.first, decayQuark);
} else {
//... Diquark does not break
G4int IsParticle=(decay->GetPDGEncoding()>0) ? +1 : -1;
// if we have a diquark, we need quark)
G4double StrSup=GetStrangeSuppress(); // for changing s-sbar production, Uzhi Oct. 2014
StrangeSuppress=0.41; //0.41; 0.47
pDefPair QuarkPair = CreatePartonPair(IsParticle,false); // no diquarks wanted
StrangeSuppress=StrSup;
created = QuarkPair.second;
G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decay);
return had;
// return G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decay);
}
}
//-----------------------------------------------------------------------------
G4KineticTrack * G4QGSMFragmentation::Splitup(
G4FragmentingString *string,
G4FragmentingString *&newString)
{
#ifdef debug_QGSMfragmentation
G4cout<<G4endl;
G4cout<<"Start SplitUP (G4VLongitudinalStringDecay) ========================="<<G4endl;
G4cout<<"String partons: " <<string->GetLeftParton()->GetPDGEncoding()<<" "
<<string->GetRightParton()->GetPDGEncoding()<<" "
<<"Direction " <<string->GetDecayDirection()<<G4endl;
#endif
//... random choice of string end to use for creating the hadron (decay)
G4int SideOfDecay = (G4UniformRand() < 0.5)? 1: -1;
if (SideOfDecay < 0)
{
string->SetLeftPartonStable();
} else
{
string->SetRightPartonStable();
}
G4ParticleDefinition *newStringEnd;
G4ParticleDefinition * HadronDefinition;
if (string->DecayIsQuark())
{
// Uzhi Dec. 2017, Start
G4double ProbDqADq = GetDiquarkSuppress();
G4int NumberOfpossibleBaryons = 2;
if(string->GetLeftParton()->GetParticleSubType() != "quark") NumberOfpossibleBaryons++;
if(string->GetRightParton()->GetParticleSubType() != "quark") NumberOfpossibleBaryons++;
G4double ActualProb = ProbDqADq ;
ActualProb *= (1.0-G4Exp(2.0*(1.0 - string->Mass()/(NumberOfpossibleBaryons*1400.0))));
SetDiquarkSuppression(ActualProb);
// Uzhi Dec. 2017, End
HadronDefinition= QuarkSplitup(string->GetDecayParton(), newStringEnd);
SetDiquarkSuppression(ProbDqADq); // Uzhi Dec. 2017
} else {
HadronDefinition= DiQuarkSplitup(string->GetDecayParton(), newStringEnd);
}
#ifdef debug_QGSMfragmentation
G4cout<<"The parton "<<string->GetDecayParton()->GetPDGEncoding()<<" "
<<" produces hadron "<<HadronDefinition->GetParticleName()
<<" and is transformed to "<<newStringEnd->GetPDGEncoding()<<G4endl;
G4cout<<"The side of the string decay Left/Right (1/-1) "<<SideOfDecay<<G4endl;
#endif
// create new String from old, ie. keep Left and Right order, but replace decay
newString=new G4FragmentingString(*string,newStringEnd); // To store possible
// quark containt of new string
#ifdef debug_QGSMfragmentation
G4cout<<"An attempt to determine its energy (SplitEandP)"<<G4endl;
#endif
G4LorentzVector* HadronMomentum=SplitEandP(HadronDefinition, string, newString);
delete newString; newString=0;
G4KineticTrack * Hadron =0;
if ( HadronMomentum != 0 ) {
#ifdef debug_QGSMfragmentation
G4cout<<"The attempt was successful"<<G4endl;
#endif
G4ThreeVector Pos;
Hadron = new G4KineticTrack(HadronDefinition, 0,Pos, *HadronMomentum);
newString=new G4FragmentingString(*string,newStringEnd,
HadronMomentum);
delete HadronMomentum;
}
else
{
#ifdef debug_QGSMfragmentation
G4cout<<"The attempt was not successful !!!"<<G4endl;
#endif
}
#ifdef debug_VStringDecay
G4cout<<"End SplitUP (G4VLongitudinalStringDecay) ====================="<<G4endl;
#endif
return Hadron;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VKinkyStringDecay.cc 106967 2017-10-31 08:41:49Z gcosmo $
// $Id: G4VKinkyStringDecay.cc 107869 2017-12-07 14:46:39Z gcosmo $
// Maxim Komogorov
//
// -----------------------------------------------------------------------------
@@ -41,14 +41,14 @@
//*****************************************************************************************************
G4VKinkyStringDecay::G4VKinkyStringDecay(G4VLongitudinalStringDecay* theModal)
{
this->SetLongitudinalStringDecay(theModal);
}
{
this->SetLongitudinalStringDecay(theModal);
}
//*****************************************************************************************************
G4double G4VKinkyStringDecay::GetLightConeGluonZ(G4double zmin, G4double zmax)
{
{
G4double z, yf;
do {
z = zmin + G4UniformRand()*(zmax-zmin);
@@ -56,12 +56,12 @@ G4double G4VKinkyStringDecay::GetLightConeGluonZ(G4double zmin, G4double zmax)
}
while (G4UniformRand() > yf); /* Loop checking, 07.08.2015, A.Ribon */
return z;
}
}
//*****************************************************************************************************
G4KineticTrackVector* G4VKinkyStringDecay::FragmentString(const G4ExcitedString& String)
{
{
G4LorentzVector Mom = String.GetGluon()->Get4Momentum();
G4ThreeVector Pos = String.GetGluon()->GetPosition();
G4int QuarkEncoding = theLongitudinalStringDecay->SampleQuarkFlavor();
@@ -97,7 +97,20 @@ G4KineticTrackVector* G4VKinkyStringDecay::FragmentString(const G4ExcitedString&
KTV1->erase(KTV1->end()-1);
}
return KTV1;
}
}
//*****************************************************************************************************
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VLongitudinalStringDecay.cc 106967 2017-10-31 08:41:49Z gcosmo $
// $Id: G4VLongitudinalStringDecay.cc 108179 2018-01-18 08:53:39Z gcosmo $
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
@@ -64,55 +64,58 @@
G4VLongitudinalStringDecay::G4VLongitudinalStringDecay()
{
MassCut = 0.35*GeV;
ClusterMass = 0.15*GeV;
MassCut = 0.35*GeV;
ClusterMass = 0.15*GeV;
SmoothParam = 0.9;
StringLoopInterrupt = 1000;
ClusterLoopInterrupt = 500;
SmoothParam = 0.9;
StringLoopInterrupt = 1000;
ClusterLoopInterrupt = 500;
// Changable Parameters below.
SigmaQT = 0.5 * GeV; // 0.5 0.1
// Changable Parameters below.
SigmaQT = 0.5 * GeV;
StrangeSuppress = 0.44; // 27 % strange quarks produced, ie. u:d:s=1:1:0.27
DiquarkSuppress = 0.07;
DiquarkBreakProb = 0.1;
StrangeSuppress = 0.44; // 27 % strange quarks produced, ie. u:d:s=1:1:0.27
DiquarkSuppress = 0.07;
DiquarkBreakProb = 0.1;
//... pspin_meson is probability to create pseudo-scalar meson
pspin_meson = 0.5;
//... pspin_meson is probability to create pseudo-scalar meson
pspin_meson = 0.5;// 0.62 0.3 Uzhi Dec. 2017
//... pspin_barion is probability to create 1/2 barion
pspin_barion = 0.5;
//... pspin_barion is probability to create 1/2 barion
pspin_barion = 0.5;
//... vectorMesonMix[] is quark mixing parameters for vector mesons (Variable spin = 3)
vectorMesonMix.resize(6);
vectorMesonMix[0] = 0.0; //AR-20Oct2014 : it was 0.5
vectorMesonMix[1] = 0.0;
vectorMesonMix[2] = 0.0; //AR-20Oct2014 : it was 0.5
vectorMesonMix[3] = 0.0;
vectorMesonMix[4] = 1.0;
vectorMesonMix[5] = 1.0;
//... vectorMesonMix[] is quark mixing parameters for vector mesons (Variable spin = 3)
vectorMesonMix.resize(6);
vectorMesonMix[0] = 0.; // Uzhi May 2016 //AR-20Oct2014 : it was 0.5 0.5 Uzhi Dec. 2017
vectorMesonMix[1] = 0.375;
vectorMesonMix[2] = 0.0; // Uzhi May 2016 //AR-20Oct2014 : it was 0.5 0.5 Uzhi Dec. 2017
vectorMesonMix[3] = 0.375;
vectorMesonMix[4] = 1.0;
vectorMesonMix[5] = 1.0;
//... scalarMesonMix[] is quark mixing parameters for scalar mesons (Variable spin=1)
scalarMesonMix.resize(6);
scalarMesonMix[0] = 0.5;
scalarMesonMix[1] = 0.25;
scalarMesonMix[2] = 0.5;
scalarMesonMix[3] = 0.25;
scalarMesonMix[4] = 1.0;
scalarMesonMix[5] = 0.5;
// Parameters may be changed until the first fragmentation starts
PastInitPhase=false;
hadronizer = new G4HadronBuilder(pspin_meson,pspin_barion,
scalarMesonMix,vectorMesonMix);
Kappa = 1.0 * GeV/fermi;
//... scalarMesonMix[] is quark mixing parameters for scalar mesons (Variable spin=1)
scalarMesonMix.resize(6);
scalarMesonMix[0] = 0.5;
scalarMesonMix[1] = 0.25;
scalarMesonMix[2] = 0.5;
scalarMesonMix[3] = 0.25;
scalarMesonMix[4] = 1.0;
scalarMesonMix[5] = 0.5;
// Parameters may be changed until the first fragmentation starts
PastInitPhase=false;
hadronizer = new G4HadronBuilder(pspin_meson,pspin_barion,scalarMesonMix,vectorMesonMix);
Kappa = 1.0 * GeV/fermi;
}
G4VLongitudinalStringDecay::~G4VLongitudinalStringDecay()
{
delete hadronizer;
}
{
delete hadronizer;
}
//=============================================================================
@@ -121,154 +124,151 @@ G4VLongitudinalStringDecay::~G4VLongitudinalStringDecay()
//-----------------------------------------------------------------------------
int G4VLongitudinalStringDecay::operator==(const G4VLongitudinalStringDecay &) const
{
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::operator== forbidden");
return false;
}
{
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::operator== forbidden");
return false;
}
//-------------------------------------------------------------------------------------
int G4VLongitudinalStringDecay::operator!=(const G4VLongitudinalStringDecay &) const
{
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::operator!= forbidden");
return true;
}
{
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::operator!= forbidden");
return true;
}
//***********************************************************************************
// For changing Mass Cut used for selection of very small mass strings
void G4VLongitudinalStringDecay::SetMassCut(G4double aValue){MassCut=aValue;}
void G4VLongitudinalStringDecay::SetMassCut(G4double aValue){MassCut=aValue;}
G4double G4VLongitudinalStringDecay::GetMassCut(){return MassCut;}
//-----------------------------------------------------------------------------
// For handling a string with very low mass
G4KineticTrackVector* G4VLongitudinalStringDecay::
LightFragmentationTest(const G4ExcitedString * const string)
G4KineticTrackVector* G4VLongitudinalStringDecay::LightFragmentationTest(const
G4ExcitedString * const string)
{
// Check string decay threshold
G4KineticTrackVector * result=0; // return 0 when string exceeds the mass cut
// Check string decay threshold
G4KineticTrackVector * result=0; // return 0 when string exceeds the mass cut
pDefPair hadrons((G4ParticleDefinition *)0,(G4ParticleDefinition *)0);
pDefPair hadrons((G4ParticleDefinition *)0,(G4ParticleDefinition *)0);
G4FragmentingString aString(*string);
if ( sqr(FragmentationMass(&aString,0,&hadrons)+MassCut) < aString.Mass2()) {
return 0;
}
G4FragmentingString aString(*string);
if ( sqr(FragmentationMass(&aString,0,&hadrons)+MassCut) < aString.Mass2()) {
return 0;
}
// The string mass is very low ---------------------------
// The string mass is very low ---------------------------
result=new G4KineticTrackVector;
result=new G4KineticTrackVector;
if ( hadrons.second ==0 ) {
// Substitute string by light hadron, Note that Energy is not conserved here!
if ( hadrons.second ==0 )
{
// Substitute string by light hadron, Note that Energy is not conserved here!
#ifdef debug_VStringDecay
G4cout << "VlongSF Warning replacing string by single hadron (G4VLongitudinalStringDecay)" <<G4endl;
G4cout << hadrons.first->GetParticleName()<<G4endl
<< "string .. " << string->Get4Momentum() << " "
<< string->Get4Momentum().m() << G4endl;
#endif
#ifdef debug_VStringDecay
G4cout << "VlongSF Warning replacing string by single hadron (G4VLongitudinalStringDecay)" <<G4endl;
G4cout << hadrons.first->GetParticleName()<<G4endl
<< "string .. " << string->Get4Momentum() << " "
<< string->Get4Momentum().m() << G4endl;
#endif
G4ThreeVector Mom3 = string->Get4Momentum().vect();
G4LorentzVector Mom(Mom3, std::sqrt(Mom3.mag2() + sqr(hadrons.first->GetPDGMass())));
result->push_back(new G4KineticTrack(hadrons.first, 0, string->GetPosition(), Mom));
} else {
//... string was qq--qqbar type: Build two stable hadrons,
G4ThreeVector Mom3 = string->Get4Momentum().vect();
G4LorentzVector Mom(Mom3,
std::sqrt(Mom3.mag2() +
sqr(hadrons.first->GetPDGMass())));
result->push_back(new G4KineticTrack(hadrons.first, 0,
string->GetPosition(),
Mom));
} else
{
//... string was qq--qqbar type: Build two stable hadrons,
#ifdef debug_VStringDecay
G4cout << "VlongSF Warning replacing qq-qqbar string by TWO hadrons (G4VLongitudinalStringDecay)"
<< hadrons.first->GetParticleName() << " / "
<< hadrons.second->GetParticleName()
<< "string .. " << string->Get4Momentum() << " "
<< string->Get4Momentum().m() << G4endl;
#endif
#ifdef debug_VStringDecay
G4cout << "VlongSF Warning replacing qq-qqbar string by TWO hadrons (G4VLongitudinalStringDecay)"
<< hadrons.first->GetParticleName() << " / "
<< hadrons.second->GetParticleName()
<< "string .. " << string->Get4Momentum() << " "
<< string->Get4Momentum().m() << G4endl;
#endif
G4LorentzVector Mom1, Mom2;
Sample4Momentum(&Mom1, hadrons.first->GetPDGMass(), &Mom2,hadrons.second->GetPDGMass(),
string->Get4Momentum().mag());
G4LorentzVector Mom1, Mom2;
Sample4Momentum(&Mom1, hadrons.first->GetPDGMass(),
&Mom2,hadrons.second->GetPDGMass(),
string->Get4Momentum().mag());
result->push_back(new G4KineticTrack(hadrons.first, 0, string->GetPosition(), Mom1));
result->push_back(new G4KineticTrack(hadrons.second, 0, string->GetPosition(), Mom2));
result->push_back(new G4KineticTrack(hadrons.first, 0,
string->GetPosition(),
Mom1));
result->push_back(new G4KineticTrack(hadrons.second, 0,
string->GetPosition(),
Mom2));
G4ThreeVector Velocity = string->Get4Momentum().boostVector();
result->Boost(Velocity);
}
G4ThreeVector Velocity = string->Get4Momentum().boostVector();
result->Boost(Velocity);
}
return result;
return result;
}
//----------------------------------------------------------------------------------------
G4double G4VLongitudinalStringDecay::
FragmentationMass( const G4FragmentingString * const string, Pcreate build, pDefPair * pdefs )
G4double G4VLongitudinalStringDecay::FragmentationMass(
const G4FragmentingString * const string,
Pcreate build, pDefPair * pdefs )
{
G4double mass;
static G4ThreadLocal G4bool NeedInit(true);
static G4ThreadLocal std::vector<double> *nomix_G4MT_TLS_ = 0 ;
if (!nomix_G4MT_TLS_) nomix_G4MT_TLS_ = new std::vector<double>;
std::vector<double> &nomix = *nomix_G4MT_TLS_;
static G4ThreadLocal G4HadronBuilder * minMassHadronizer;
if ( NeedInit )
{
NeedInit = false;
nomix.resize(6);
for ( G4int i=0; i<6 ; i++ ) nomix[i]=0;
G4double mass;
//minMassHadronizer=new G4HadronBuilder(pspin_meson,pspin_barion,nomix,nomix);
minMassHadronizer=hadronizer;
}
if ( build==0 ) build=&G4HadronBuilder::BuildLowSpin;
if ( build==0 ) build=&G4HadronBuilder::BuildLowSpin;
G4ParticleDefinition *Hadron1, *Hadron2=0;
G4ParticleDefinition *Hadron1, *Hadron2=0;
if (!string->FourQuarkString() )
{
// spin 0 meson or spin 1/2 barion will be built
if (!string->FourQuarkString() )
{
// spin 0 meson or spin 1/2 barion will be built
Hadron1 = (hadronizer->*build)(string->GetLeftParton(), string->GetRightParton());
#ifdef debug_VStringDecay
G4cout<<"Quarks at the string ends "<<string->GetLeftParton()->GetParticleName()<<" "<<string->GetRightParton()->GetParticleName()<<G4endl;
G4cout<<"(G4VLongitudinalStringDecay) Hadron "<<Hadron1->GetParticleName()<<" "<<Hadron1->GetPDGMass()<<G4endl;
#endif
mass= (Hadron1)->GetPDGMass();
} else
{
//... string is qq--qqbar: Build two stable hadrons,
//... with extra uubar or ddbar quark pair
G4int iflc = (G4UniformRand() < 0.5)? 1 : 2;
if (string->GetLeftParton()->GetPDGEncoding() < 0) iflc = -iflc;
Hadron1 = (minMassHadronizer->*build)(string->GetLeftParton(), string->GetRightParton());
#ifdef debug_VStringDecay
G4cout<<"Quarks at the string ends "<<string->GetLeftParton()->GetParticleName()
<<" "<<string->GetRightParton()->GetParticleName()<<G4endl;
G4cout<<"(G4VLongitudinalStringDecay) Hadron "<<Hadron1->GetParticleName()<<" "<<Hadron1->GetPDGMass()<<G4endl;
#endif
mass= (Hadron1)->GetPDGMass();
} else {
//... string is qq--qqbar: Build two stable hadrons,
//... with extra uubar or ddbar quark pair
G4int iflc = (G4UniformRand() < 0.5)? 1 : 2;
if (string->GetLeftParton()->GetPDGEncoding() < 0) iflc = -iflc;
//... theSpin = 4; spin 3/2 baryons will be built
Hadron1 = (minMassHadronizer->*build)(string->GetLeftParton(), FindParticle(iflc));
Hadron2 = (minMassHadronizer->*build)(string->GetRightParton(), FindParticle(-iflc));
mass = (Hadron1)->GetPDGMass() + (Hadron2)->GetPDGMass();
}
//... theSpin = 4; spin 3/2 baryons will be built
Hadron1 = (hadronizer->*build)(string->GetLeftParton(), FindParticle(iflc));
Hadron2 = (hadronizer->*build)(string->GetRightParton(), FindParticle(-iflc));
mass = (Hadron1)->GetPDGMass() + (Hadron2)->GetPDGMass();
}
if ( pdefs != 0 )
{ // need to return hadrons as well....
pdefs->first = Hadron1;
pdefs->second = Hadron2;
}
if ( pdefs != 0 )
{ // need to return hadrons as well....
pdefs->first = Hadron1;
pdefs->second = Hadron2;
}
return mass;
return mass;
}
//----------------------------------------------------------------------------
G4ParticleDefinition* G4VLongitudinalStringDecay::FindParticle(G4int Encoding)
{
G4ParticleDefinition* ptr = G4ParticleTable::GetParticleTable()->FindParticle(Encoding);
if (ptr == NULL)
{
G4cout << "Particle with encoding "<<Encoding<<" does not exist!!!"<<G4endl;
throw G4HadronicException(__FILE__, __LINE__, "Check your particle table");
}
return ptr;
}
{
G4ParticleDefinition* ptr = G4ParticleTable::GetParticleTable()->FindParticle(Encoding);
if (ptr == NULL)
{
G4cout << "Particle with encoding "<<Encoding<<" does not exist!!!"<<G4endl;
throw G4HadronicException(__FILE__, __LINE__, "Check your particle table");
}
return ptr;
}
//*********************************************************************************
// For decision on continue or stop string fragmentation
@@ -281,358 +281,227 @@ G4ParticleDefinition* G4VLongitudinalStringDecay::FindParticle(G4int Encoding)
// G4KineticTrackVector * RightVector)=0;
//-----------------------------------------------------------------------------
//
// If a string fragments, do the following
// If a string can fragment, do the following
//
// For transver of a string to its CMS frame
//-----------------------------------------------------------------------------
G4ExcitedString *G4VLongitudinalStringDecay::CPExcited(const G4ExcitedString & in)
G4ExcitedString *G4VLongitudinalStringDecay::CopyExcited(const G4ExcitedString & in)
{
G4Parton *Left=new G4Parton(*in.GetLeftParton());
G4Parton *Right=new G4Parton(*in.GetRightParton());
return new G4ExcitedString(Left,Right,in.GetDirection());
G4Parton *Left=new G4Parton(*in.GetLeftParton());
G4Parton *Right=new G4Parton(*in.GetRightParton());
return new G4ExcitedString(Left,Right,in.GetDirection());
}
//-----------------------------------------------------------------------------
G4KineticTrack * G4VLongitudinalStringDecay::
Splitup( G4FragmentingString *string, G4FragmentingString *&newString)
G4ParticleDefinition *
G4VLongitudinalStringDecay::QuarkSplitup(G4ParticleDefinition*
decay, G4ParticleDefinition *&created)
{
#ifdef debug_VStringDecay
G4cout<<G4endl;
G4cout<<"Start SplitUP (G4VLongitudinalStringDecay) ========================="<<G4endl;
G4cout<<"String partons: " <<string->GetLeftParton()->GetPDGEncoding()<<" "
<<string->GetRightParton()->GetPDGEncoding()<<" "
<<"Direction " <<string->GetDecayDirection()<<G4endl;
#endif
//... random choice of string end to use for creating the hadron (decay)
G4int SideOfDecay = (G4UniformRand() < 0.5)? 1: -1;
if (SideOfDecay < 0)
{
string->SetLeftPartonStable();
} else {
string->SetRightPartonStable();
}
G4ParticleDefinition *newStringEnd;
G4ParticleDefinition * HadronDefinition;
if (string->DecayIsQuark())
{
HadronDefinition= QuarkSplitup(string->GetDecayParton(), newStringEnd);
} else {
HadronDefinition= DiQuarkSplitup(string->GetDecayParton(), newStringEnd);
}
#ifdef debug_VStringDecay
G4cout<<"The parton "<<string->GetDecayParton()->GetPDGEncoding()<<" "
<<" produces hadron "<<HadronDefinition->GetParticleName()
<<" and is transformed to "<<newStringEnd->GetPDGEncoding()<<G4endl;
G4cout<<"The side of the string decay Left/Right (1/-1) "<<SideOfDecay<<G4endl;
#endif
// create new String from old, ie. keep Left and Right order, but replace decay
newString=new G4FragmentingString(*string,newStringEnd); // To store possible quark containt of new string
#ifdef debug_VStringDecay
G4cout<<"An attempt to determine its energy (SplitEandP)"<<G4endl;
#endif
G4LorentzVector* HadronMomentum=SplitEandP(HadronDefinition, string, newString);
delete newString; newString=0;
G4KineticTrack * Hadron =0;
if ( HadronMomentum != 0 ) {
#ifdef debug_VStringDecay
G4cout<<"The attempt was successful"<<G4endl;
#endif
G4ThreeVector Pos;
Hadron = new G4KineticTrack(HadronDefinition, 0,Pos, *HadronMomentum);
newString=new G4FragmentingString(*string,newStringEnd,HadronMomentum);
delete HadronMomentum;
} else {
#ifdef debug_VStringDecay
G4cout<<"The attempt was not successful !!!"<<G4endl;
#endif
}
#ifdef debug_VStringDecay
G4cout<<"End SplitUP (G4VLongitudinalStringDecay) ====================="<<G4endl;
#endif
return Hadron;
}
//--------------------------------------------------------------------------------------
G4ParticleDefinition * G4VLongitudinalStringDecay::
QuarkSplitup(G4ParticleDefinition* decay, G4ParticleDefinition *&created)
{
// if we have a quark, we need antiquark (or diquark)
G4int IsParticle=(decay->GetPDGEncoding()>0) ? -1 : +1;
pDefPair QuarkPair = CreatePartonPair(IsParticle);
created = QuarkPair.second;
return hadronizer->Build(QuarkPair.first, decay);
}
/* Uzhi June 2014
//-----------------------------------------------------------------------------
G4ParticleDefinition *G4VLongitudinalStringDecay::
DiQuarkSplitup(G4ParticleDefinition* decay, G4ParticleDefinition *&created)
{
//... can Diquark break or not?
if (G4UniformRand() < DiquarkBreakProb ){
//... Diquark break
G4int stableQuarkEncoding = decay->GetPDGEncoding()/1000;
G4int decayQuarkEncoding = (decay->GetPDGEncoding()/100)%10;
if (G4UniformRand() < 0.5)
{
G4int Swap = stableQuarkEncoding;
stableQuarkEncoding = decayQuarkEncoding;
decayQuarkEncoding = Swap;
}
G4int IsParticle=(decayQuarkEncoding>0) ? -1 : +1; // if we have a quark, we need antiquark
pDefPair QuarkPair = CreatePartonPair(IsParticle,false); // no diquarks wanted
//... Build new Diquark
G4int QuarkEncoding=QuarkPair.second->GetPDGEncoding();
G4int i10 = std::max(std::abs(QuarkEncoding), std::abs(stableQuarkEncoding));
G4int i20 = std::min(std::abs(QuarkEncoding), std::abs(stableQuarkEncoding));
G4int spin = (i10 != i20 && G4UniformRand() <= 0.5)? 1 : 3;
G4int NewDecayEncoding = -1*IsParticle*(i10 * 1000 + i20 * 100 + spin);
created = FindParticle(NewDecayEncoding);
G4ParticleDefinition * decayQuark=FindParticle(decayQuarkEncoding);
G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decayQuark);
return had;
//return hadronizer->Build(QuarkPair.first, decayQuark);
} else {
//... Diquark does not break
G4int IsParticle=(decay->GetPDGEncoding()>0) ? +1 : -1; // if we have a diquark, we need quark
pDefPair QuarkPair = CreatePartonPair(IsParticle,false); // no diquarks wanted
G4int IsParticle=(decay->GetPDGEncoding()>0) ? -1 : +1; // if we have a quark,
// we need antiquark
// (or diquark)
pDefPair QuarkPair = CreatePartonPair(IsParticle);
created = QuarkPair.second;
return hadronizer->Build(QuarkPair.first, decay);
G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decay);
return had;
//return G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decay);
}
}
*/ // Uzhi June 2014
//-----------------------------------------------------------------------------
G4int G4VLongitudinalStringDecay::SampleQuarkFlavor(void)
{
return (1 + (int)(G4UniformRand()/StrangeSuppress));
}
{
return (1 + (int)(G4UniformRand()/StrangeSuppress));
}
//-----------------------------------------------------------------------------
G4VLongitudinalStringDecay::pDefPair G4VLongitudinalStringDecay::
CreatePartonPair(G4int NeedParticle,G4bool AllowDiquarks)
G4VLongitudinalStringDecay::pDefPair G4VLongitudinalStringDecay::CreatePartonPair(G4int NeedParticle,G4bool AllowDiquarks)
{
// NeedParticle = +1 for Particle, -1 for Antiparticle
// NeedParticle = +1 for Particle, -1 for Antiparticle
if ( AllowDiquarks && G4UniformRand() < DiquarkSuppress )
{
// Create a Diquark - AntiDiquark pair , first in pair is anti to IsParticle
G4int q1 = SampleQuarkFlavor();
G4int q2 = SampleQuarkFlavor();
G4int spin = (q1 != q2 && G4UniformRand() <= 0.5)? 1 : 3;
// convention: quark with higher PDG number is first
G4int PDGcode = (std::max(q1,q2) * 1000 + std::min(q1,q2) * 100 + spin) * NeedParticle;
return pDefPair (FindParticle(-PDGcode),FindParticle(PDGcode));
if ( AllowDiquarks && G4UniformRand() < DiquarkSuppress )
{
// Create a Diquark - AntiDiquark pair , first in pair is anti to IsParticle
G4int q1 = SampleQuarkFlavor();
G4int q2 = SampleQuarkFlavor();
G4int spin = (q1 != q2 && G4UniformRand() <= 0.5)? 1 : 3;
// Convention: quark with higher PDG number is first
G4int PDGcode = (std::max(q1,q2) * 1000 + std::min(q1,q2) * 100 + spin) * NeedParticle;
return pDefPair (FindParticle(-PDGcode),FindParticle(PDGcode));
} else {
// Create a Quark - AntiQuark pair, first in pair IsParticle
G4int PDGcode=SampleQuarkFlavor()*NeedParticle;
return pDefPair (FindParticle(PDGcode),FindParticle(-PDGcode));
}
} else {
// Create a Quark - AntiQuark pair, first in pair IsParticle
G4int PDGcode=SampleQuarkFlavor()*NeedParticle;
return pDefPair (FindParticle(PDGcode),FindParticle(-PDGcode));
}
}
//-----------------------------------------------------------------------------
G4ThreeVector G4VLongitudinalStringDecay::SampleQuarkPt(G4double ptMax)
{
G4double Pt;
if ( ptMax < 0 ) {
// sample full gaussian
Pt = -G4Log(G4UniformRand());
} else {
// sample in limited range
Pt = -G4Log(G4RandFlat::shoot(G4Exp(-sqr(ptMax)/sqr(SigmaQT)), 1.));
}
Pt = SigmaQT * std::sqrt(Pt);
G4double phi = 2.*pi*G4UniformRand();
return G4ThreeVector(Pt * std::cos(phi),Pt * std::sin(phi),0);
}
{
G4double Pt;
if ( ptMax < 0 ) {
// sample full gaussian
Pt = -G4Log(G4UniformRand());
} else {
// sample in limited range
Pt = -G4Log(G4RandFlat::shoot(G4Exp(-sqr(ptMax)/sqr(SigmaQT)), 1.));
}
Pt = SigmaQT * std::sqrt(Pt);
G4double phi = 2.*pi*G4UniformRand();
return G4ThreeVector(Pt * std::cos(phi),Pt * std::sin(phi),0);
}
//******************************************************************************
void G4VLongitudinalStringDecay::
CalculateHadronTimePosition(G4double theInitialStringMass, G4KineticTrackVector* Hadrons)
{
// 'yo-yo' formation time
//const G4double kappa = 1.0 * GeV/fermi/4.;
G4double kappa = GetStringTensionParameter();
for(size_t c1 = 0; c1 < Hadrons->size(); c1++)
{
G4double SumPz = 0;
G4double SumE = 0;
for(size_t c2 = 0; c2 < c1; c2++)
{
SumPz += Hadrons->operator[](c2)->Get4Momentum().pz();
SumE += Hadrons->operator[](c2)->Get4Momentum().e();
}
G4double HadronE = Hadrons->operator[](c1)->Get4Momentum().e();
G4double HadronPz = Hadrons->operator[](c1)->Get4Momentum().pz();
Hadrons->operator[](c1)->SetFormationTime(
(theInitialStringMass - 2.*SumPz + HadronE - HadronPz)/(2.*kappa)/c_light );
void G4VLongitudinalStringDecay::CalculateHadronTimePosition(G4double theInitialStringMass, G4KineticTrackVector* Hadrons)
{
G4ThreeVector aPosition(0, 0, (theInitialStringMass - 2.*SumE - HadronE + HadronPz)/(2.*kappa));
Hadrons->operator[](c1)->SetPosition(aPosition);
// `yo-yo` formation time
// const G4double kappa = 1.0 * GeV/fermi/4.;
G4double kappa = GetStringTensionParameter();
for(size_t c1 = 0; c1 < Hadrons->size(); c1++)
{
G4double SumPz = 0;
G4double SumE = 0;
for(size_t c2 = 0; c2 < c1; c2++)
{
SumPz += Hadrons->operator[](c2)->Get4Momentum().pz();
SumE += Hadrons->operator[](c2)->Get4Momentum().e();
}
G4double HadronE = Hadrons->operator[](c1)->Get4Momentum().e();
G4double HadronPz = Hadrons->operator[](c1)->Get4Momentum().pz();
Hadrons->operator[](c1)->SetFormationTime(
(theInitialStringMass - 2.*SumPz + HadronE - HadronPz)/(2.*kappa)/c_light);
}
}
G4ThreeVector aPosition(0, 0,
(theInitialStringMass - 2.*SumE - HadronE + HadronPz)/(2.*kappa));
Hadrons->operator[](c1)->SetPosition(aPosition);
}
}
//-----------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetSigmaTransverseMomentum(G4double aValue)
{
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__,
"4VLongitudinalStringDecay::SetSigmaTransverseMomentum after FragmentString() not allowed");
} else {
SigmaQT = aValue;
}
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__, "4VLongitudinalStringDecay::SetSigmaTransverseMomentum after FragmentString() not allowed");
} else {
SigmaQT = aValue;
}
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetStrangenessSuppression(G4double aValue)
{
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__,
"4VLongitudinalStringDecay::SetStrangenessSuppression after FragmentString() not allowed");
} else {
StrangeSuppress = aValue;
}
// if ( PastInitPhase ) { // Uzhi Oct. 2017
// throw G4HadronicException(__FILE__, __LINE__, "4VLongitudinalStringDecay::SetStrangenessSuppression after FragmentString() not allowed");
// } else {
StrangeSuppress = aValue;
// }
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetDiquarkSuppression(G4double aValue)
{
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__,
"4VLongitudinalStringDecay::SetDiquarkSuppression after FragmentString() not allowed");
} else {
DiquarkSuppress = aValue;
}
// if ( PastInitPhase ) { // Uzhi Oct. 2017
// throw G4HadronicException(__FILE__, __LINE__, "4VLongitudinalStringDecay::SetDiquarkSuppression after FragmentString() not allowed");
// } else {
DiquarkSuppress = aValue;
// }
}
//----------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetDiquarkBreakProbability(G4double aValue)
{
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__,
"4VLongitudinalStringDecay::SetDiquarkBreakProbability after FragmentString() not allowed");
} else {
DiquarkBreakProb = aValue;
}
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__, "4VLongitudinalStringDecay::SetDiquarkBreakProbability after FragmentString() not allowed");
} else {
DiquarkBreakProb = aValue;
}
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetVectorMesonProbability(G4double aValue)
{
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__,
"G4VLongitudinalStringDecay::SetVectorMesonProbability after FragmentString() not allowed");
} else {
pspin_meson = aValue;
delete hadronizer;
hadronizer = new G4HadronBuilder(pspin_meson,pspin_barion,scalarMesonMix,vectorMesonMix);
}
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::SetVectorMesonProbability after FragmentString() not allowed");
} else {
pspin_meson = aValue;
delete hadronizer;
hadronizer = new G4HadronBuilder(pspin_meson,pspin_barion,
scalarMesonMix,vectorMesonMix);
}
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetSpinThreeHalfBarionProbability(G4double aValue)
{
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__,
"G4VLongitudinalStringDecay::SetSpinThreeHalfBarionProbability after FragmentString() not allowed");
} else {
pspin_barion = aValue;
delete hadronizer;
hadronizer = new G4HadronBuilder(pspin_meson,pspin_barion,scalarMesonMix,vectorMesonMix);
}
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::SetSpinThreeHalfBarionProbability after FragmentString() not allowed");
} else {
pspin_barion = aValue;
delete hadronizer;
hadronizer = new G4HadronBuilder(pspin_meson,pspin_barion,
scalarMesonMix,vectorMesonMix);
}
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetScalarMesonMixings(std::vector<G4double> aVector)
{
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__,
"G4VLongitudinalStringDecay::SetScalarMesonMixings after FragmentString() not allowed");
} else {
if ( aVector.size() < 6 )
throw G4HadronicException(__FILE__, __LINE__,
"G4VLongitudinalStringDecay::SetScalarMesonMixings( argument Vector too small");
scalarMesonMix[0] = aVector[0];
scalarMesonMix[1] = aVector[1];
scalarMesonMix[2] = aVector[2];
scalarMesonMix[3] = aVector[3];
scalarMesonMix[4] = aVector[4];
scalarMesonMix[5] = aVector[5];
delete hadronizer;
hadronizer = new G4HadronBuilder(pspin_meson,pspin_barion,scalarMesonMix,vectorMesonMix);
}
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::SetScalarMesonMixings after FragmentString() not allowed");
} else {
if ( aVector.size() < 6 )
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::SetScalarMesonMixings( argument Vector too small");
scalarMesonMix[0] = aVector[0];
scalarMesonMix[1] = aVector[1];
scalarMesonMix[2] = aVector[2];
scalarMesonMix[3] = aVector[3];
scalarMesonMix[4] = aVector[4];
scalarMesonMix[5] = aVector[5];
delete hadronizer;
hadronizer = new G4HadronBuilder(pspin_meson,pspin_barion,
scalarMesonMix,vectorMesonMix);
}
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetVectorMesonMixings(std::vector<G4double> aVector)
{
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__,
"G4VLongitudinalStringDecay::SetVectorMesonMixings after FragmentString() not allowed");
} else {
if ( aVector.size() < 6 )
throw G4HadronicException(__FILE__, __LINE__,
"G4VLongitudinalStringDecay::SetVectorMesonMixings( argument Vector too small");
vectorMesonMix[0] = aVector[0];
vectorMesonMix[1] = aVector[1];
vectorMesonMix[2] = aVector[2];
vectorMesonMix[3] = aVector[3];
vectorMesonMix[4] = aVector[4];
vectorMesonMix[5] = aVector[5];
delete hadronizer;
hadronizer = new G4HadronBuilder(pspin_meson,pspin_barion,scalarMesonMix,vectorMesonMix);
}
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::SetVectorMesonMixings after FragmentString() not allowed");
} else {
if ( aVector.size() < 6 )
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::SetVectorMesonMixings( argument Vector too small");
vectorMesonMix[0] = aVector[0];
vectorMesonMix[1] = aVector[1];
vectorMesonMix[2] = aVector[2];
vectorMesonMix[3] = aVector[3];
vectorMesonMix[4] = aVector[4];
vectorMesonMix[5] = aVector[5];
delete hadronizer;
hadronizer = new G4HadronBuilder(pspin_meson,pspin_barion,
scalarMesonMix,vectorMesonMix);
}
}
//-------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetStringTensionParameter(G4double aValue)
{
Kappa = aValue * GeV/fermi;
Kappa = aValue * GeV/fermi;
}
//**************************************************************************************