Import Geant4 6.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:41:53 +02:00
parent 4aea781e80
commit 96686e0c8f
6560 changed files with 153347 additions and 238155 deletions
@@ -0,0 +1,39 @@
# $Id: GNUmakefile,v 1.2 2003/10/08 16:42:21 hpw Exp $
# -----------------------------------------------------------
# GNUmakefile for hadronic library. Gabriele Cosmo, 18/9/96.
# -----------------------------------------------------------
name := G4had_string_frag
ifndef G4INSTALL
G4INSTALL = ../../../../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/hadronic/management/include/ \
-I$(G4BASE)/processes/hadronic/util/include \
-I$(G4BASE)/processes/hadronic/processes/include \
-I$(G4BASE)/processes/hadronic/cross_sections/include \
-I$(G4BASE)/processes/hadronic/models/management/include \
-I$(G4BASE)/processes/hadronic/models/util/include \
-I$(G4BASE)/processes/hadronic/models/parton_string/management/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/particles/shortlived/include \
-I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,123 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ExcitedStringDecay.hh,v 1.1 2003/10/07 11:25:40 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
#ifndef G4ExcitedStringDecay_h
#define G4ExcitedStringDecay_h 1
#include "globals.hh"
#include "G4VStringFragmentation.hh"
#include "G4ExcitedStringVector.hh"
#include "G4KineticTrackVector.hh"
#include "G4LundStringFragmentation.hh"
class G4ExcitedStringDecay: public G4VStringFragmentation
{
public:
G4ExcitedStringDecay();
G4ExcitedStringDecay(G4VLongitudinalStringDecay * aStringDecay);
~G4ExcitedStringDecay();
private:
G4ExcitedStringDecay(const G4ExcitedStringDecay &right);
const G4ExcitedStringDecay & operator=(const G4ExcitedStringDecay &right);
int operator==(const G4ExcitedStringDecay &right) const;
int operator!=(const G4ExcitedStringDecay &right) const;
public:
virtual G4KineticTrackVector * FragmentStrings(const G4ExcitedStringVector * theStrings);
private:
G4KineticTrackVector * FragmentString(const G4ExcitedString &theString);
G4bool EnergyAndMomentumCorrector(G4KineticTrackVector* Output, G4LorentzVector& TotalCollisionMom);
G4VLongitudinalStringDecay * theStringDecay;
};
inline
G4KineticTrackVector *G4ExcitedStringDecay::
FragmentString(const G4ExcitedString &theString)
{
if ( theStringDecay == NULL )
theStringDecay=new G4LundStringFragmentation();
return theStringDecay->FragmentString(theString);
}
inline
G4KineticTrackVector *G4ExcitedStringDecay::
FragmentStrings(const G4ExcitedStringVector * theStrings)
{
G4KineticTrackVector * theResult = new G4KineticTrackVector;
G4LorentzVector KTsum;
G4bool NeedEnergyCorrector=false;
for ( unsigned int astring=0; astring < theStrings->size(); astring++)
{
KTsum+= theStrings->operator[](astring)->Get4Momentum();
G4KineticTrackVector * generatedKineticTracks = NULL;
if ( theStrings->operator[](astring)->IsExcited() )
{
generatedKineticTracks=FragmentString(*theStrings->operator[](astring));
} else {
generatedKineticTracks = new G4KineticTrackVector;
generatedKineticTracks->push_back(theStrings->operator[](astring)->GetKineticTrack());
}
if (generatedKineticTracks == NULL)
{
G4cerr << "G4VPartonStringModel:No KineticTracks produced" << G4endl;
continue;
}
G4LorentzVector KTsum1;
for ( unsigned int aTrack=0; aTrack<generatedKineticTracks->size();aTrack++)
{
theResult->push_back(generatedKineticTracks->operator[](aTrack));
KTsum1+= (*generatedKineticTracks)[aTrack]->Get4Momentum();
}
if ( abs((KTsum1.e()-theStrings->operator[](astring)->Get4Momentum().e()) / KTsum1.e()) > perMillion )
{
NeedEnergyCorrector=true;
}
// clean up
delete generatedKineticTracks;
}
// G4cout << "String total energy and 4 momentum" <<KTsum.t()<<" "<< KTsum << endl;
if ( NeedEnergyCorrector ) EnergyAndMomentumCorrector(theResult, KTsum);
return theResult;
}
#endif
@@ -0,0 +1,147 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4FragmentingString.hh,v 1.1 2003/10/07 11:25:40 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
#ifndef G4FragmentingString_h
#define G4FragmentingString_h 1
// ------------------------------------------------------------
// GEANT 4 class header file
//
// ---------------- G4FragmentingString ----------------
// by Gunter Folger, September 2001.
// class for an excited string used in Fragmention
// ------------------------------------------------------------
#include "G4ios.hh"
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4LorentzVector.hh"
#include "G4ParticleDefinition.hh"
class G4ExcitedString;
class G4FragmentingString
{
public:
G4FragmentingString(const G4FragmentingString &right);
G4FragmentingString(const G4ExcitedString &excited);
G4FragmentingString(const G4FragmentingString &old,
G4ParticleDefinition * newdecay,
const G4LorentzVector *momentum);
~G4FragmentingString();
int operator==(const G4FragmentingString &right) const;
int operator!=(const G4FragmentingString &right) const;
G4LorentzVector Get4Momentum() const;
G4ThreeVector StablePt();
G4ThreeVector DecayPt();
G4double LightConePlus();
G4double LightConeMinus();
G4double LightConeDecay();
G4double Mass() const;
G4double Mass2() const;
G4ParticleDefinition* GetLeftParton(void) const;
G4ParticleDefinition* GetRightParton(void) const;
G4ParticleDefinition* GetStableParton() const; // stable at the moment
G4ParticleDefinition* GetDecayParton() const; // currently involved in fragmentation
void SetLeftPartonStable();
void SetRightPartonStable();
G4int GetDecayDirection() const;
G4bool DecayIsQuark();
G4bool StableIsQuark();
G4bool FourQuarkString(void) const;
private:
G4ParticleDefinition *LeftParton, *RightParton;
G4ThreeVector Ptleft,Ptright; // Pt (px,py) for partons (pz ignored!)
G4double Pplus, Pminus; // p-, p+ of string, Plus ass. to Left!
G4ParticleDefinition * theStableParton, * theDecayParton;
enum DecaySide { None, Left, Right };
DecaySide decaying;
};
inline
int G4FragmentingString::operator==(const G4FragmentingString &right) const
{
return this == &right;
}
inline
int G4FragmentingString::operator!=(const G4FragmentingString &right) const
{
return this != &right;
}
inline
G4ParticleDefinition * G4FragmentingString::GetStableParton() const
{
return theStableParton;
}
inline
G4ParticleDefinition * G4FragmentingString::GetDecayParton() const
{
return theDecayParton;
}
inline
G4ParticleDefinition* G4FragmentingString::GetLeftParton(void) const
{
return LeftParton;
}
inline
G4ParticleDefinition* G4FragmentingString::GetRightParton(void) const
{
return RightParton;
}
#endif
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4HadronBuilder.hh,v 1.1 2003/10/07 11:25:40 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
// -----------------------------------------------------------------------------
// GEANT 4 class header file
//
// History:
// Gunter Folger, August/September 2001
// Create class;
// -----------------------------------------------------------------------------
//
#ifndef G4HadronBuilder_h
#define G4HadronBuilder_h 1
#include "globals.hh"
#include <vector>
#include "G4ParticleDefinition.hh"
#include "G4ParticleDefinition.hh"
class G4HadronBuilder
{
public:
G4ParticleDefinition * Build(G4ParticleDefinition * black, G4ParticleDefinition * white);
G4ParticleDefinition * BuildLowSpin(G4ParticleDefinition * black, G4ParticleDefinition * white);
G4ParticleDefinition * BuildHighSpin(G4ParticleDefinition * black, G4ParticleDefinition * white);
// ctor
G4HadronBuilder(G4double mesonMix, G4double barionMix,
std::vector<double> scalarMesonMix,
std::vector<double> vectorMesonMix);
private:
G4HadronBuilder(); // no default ctor
enum Spin { SpinZero=1, SpinHalf=2, SpinOne=3, SpinThreeHalf=4 };
G4ParticleDefinition * Meson(G4ParticleDefinition * black, G4ParticleDefinition * white, Spin spin);
G4ParticleDefinition * Barion(G4ParticleDefinition * black, G4ParticleDefinition * white, Spin spin);
G4double mesonSpinMix;
G4double barionSpinMix;
std::vector<double> scalarMesonMixings;
std::vector<double> vectorMesonMixings;
};
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4LundStringFragmentation.hh,v 1.1 2003/10/07 11:25:40 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $ Maxim Komogorov
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, Maxim Komogorov, 10-Jul-1998
// -----------------------------------------------------------------------------
#ifndef G4LundStringFragmentation_h
#define G4LundStringFragmentation_h 1
#include "G4VLongitudinalStringDecay.hh"
//**************************************************************************************************************
class G4LundStringFragmentation: public G4VLongitudinalStringDecay
{
public:
G4LundStringFragmentation();
// G4LundStringFragmentation(G4double sigmaPt);
G4LundStringFragmentation(const G4LundStringFragmentation &right);
virtual ~G4LundStringFragmentation();
public:
const G4LundStringFragmentation & operator=(const G4LundStringFragmentation &right);
int operator==(const G4LundStringFragmentation &right) const;
int operator!=(const G4LundStringFragmentation &right) const;
private:
virtual G4double GetLightConeZ(G4double zmin, G4double zmax, G4int PartonEncoding, G4ParticleDefinition* pHadron, G4double Px, G4double Py);
};
//**************************************************************************************************************
// Class G4LundStringFragmentation
#endif
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4QGSMFragmentation.hh,v 1.1 2003/10/07 11:25:40 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, Maxim Komogorov, 10-Jul-1998
// -----------------------------------------------------------------------------
#ifndef G4QGSMFragmentation_h
#define G4QGSMFragmentation_h 1
#include "G4VLongitudinalStringDecay.hh"
//******************************************************************************
class G4QGSMFragmentation:public G4VLongitudinalStringDecay
{
public:
G4QGSMFragmentation();
~G4QGSMFragmentation();
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);
G4QGSMFragmentation(const G4QGSMFragmentation &right);
private:
// model parameters
const G4double arho;
const G4double aphi;
const G4double an;
const G4double ala;
const G4double aksi;
const G4double alft;
};
// Class G4QGSMFragmentation
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VKinkyStringDecay.hh,v 1.1 2003/10/07 11:25:40 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
// Maxim Komogorov
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, Maxim Komogorov, 10-Oct-1998
// -----------------------------------------------------------------------------
#ifndef G4VKinkyStringDecay_h
#define G4VKinkyStringDecay_h 1
#include "G4VLongitudinalStringDecay.hh"
//***********************************************************************************************
class G4VKinkyStringDecay
{
// Constructors
public:
G4VKinkyStringDecay(G4VLongitudinalStringDecay* theModal);
virtual ~G4VKinkyStringDecay() {};
//
public:
G4KineticTrackVector* FragmentString(const G4ExcitedString& String);
virtual G4double GetLightConeGluonZ(G4double zmin, G4double zmax);
void SetLongitudinalStringDecay(G4VLongitudinalStringDecay*);
private:
G4VLongitudinalStringDecay* theLongitudinalStringDecay;
};
//*****************************************************************************************
inline void G4VKinkyStringDecay::SetLongitudinalStringDecay(G4VLongitudinalStringDecay* theModal)
{
theLongitudinalStringDecay = theModal;
}
//*****************************************************************************************************
#endif
@@ -0,0 +1,149 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VLongitudinalStringDecay.hh,v 1.1 2003/10/07 11:25:40 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
// Maxim Komogorov
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, Maxim Komogorov, 1-Jul-1998
// -----------------------------------------------------------------------------
#ifndef G4VLongitudinalStringDecay_h
#define G4VLongitudinalStringDecay_h 1
#include "G4VStringFragmentation.hh"
#include "G4DynamicParticle.hh"
#include "G4KineticTrack.hh"
#include "G4KineticTrackVector.hh"
#include "G4HadronBuilder.hh"
class G4FragmentingString;
//**********************************************************************************************
class G4VLongitudinalStringDecay
{
public:
G4VLongitudinalStringDecay();
virtual ~G4VLongitudinalStringDecay();
private:
// G4VLongitudinalStringDecay(const G4VLongitudinalStringDecay &right);
// const G4VLongitudinalStringDecay & operator=(const G4VLongitudinalStringDecay &right);
int operator==(const G4VLongitudinalStringDecay &right) const;
int operator!=(const G4VLongitudinalStringDecay &right) const;
public:
G4KineticTrackVector* FragmentString(const G4ExcitedString& theString);
G4KineticTrackVector* DecayResonans (G4KineticTrackVector* aHadrons);
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 SetScalarMesonMixings( std::vector<G4double> aVector);
void SetVectorMesonMixings( std::vector<G4double> aVector);
// used by G4VKinkyStringDecy..
G4int SampleQuarkFlavor(void);
G4ThreeVector SampleQuarkPt();
private:
G4double GetDiquarkSuppress() {return DiquarkSuppress;};
G4double GetDiquarkBreakProb() {return DiquarkBreakProb;};
G4double GetStrangeSuppress() {return StrangeSuppress;};
G4double GetClusterMass() {return ClusterMass;};
G4int GetClusterLoopInterrupt() {return ClusterLoopInterrupt;};
G4ParticleDefinition* CreateHadron(G4int id1, G4int id2, G4bool theGivenSpin, G4int theSpin);
void Sample4Momentum(G4LorentzVector* Mom, G4double Mass, G4LorentzVector* AntiMom, G4double AntiMass, G4double InitialMass);
protected:
// Additional protected declarations
virtual G4double GetLightConeZ(G4double zmin, G4double zmax, G4int PartonEncoding, G4ParticleDefinition* pHadron, G4double Px, G4double Py) = 0;
private:
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;
G4int SideOfDecay;
G4HadronBuilder *hadronizer;
void ConstructParticle();
G4double pspin_meson;
G4double pspin_barion;
std::vector<G4double> vectorMesonMix;
std::vector<G4double> scalarMesonMix;
G4bool PastInitPhase;
G4KineticTrackVector * LightFragmentationTest(const G4ExcitedString * const theString);
G4bool StopFragmenting(const G4FragmentingString * const string);
G4bool IsFragmentable(const G4FragmentingString * const string);
// G4double MinFragmentationMass(G4ExcitedString * theString,
// G4ParticleDefinition*& Hadron1,
// G4ParticleDefinition*& Hadron2);
typedef std::pair<G4ParticleDefinition*, G4ParticleDefinition*> pDefPair;
typedef G4ParticleDefinition * (G4HadronBuilder::*Pcreate)
(G4ParticleDefinition*, G4ParticleDefinition*);
G4double FragmentationMass(
const G4FragmentingString * const string,
Pcreate build=0,
pDefPair * pdefs=0);
G4KineticTrack * Splitup(G4FragmentingString *string, G4FragmentingString *&newString);
G4LorentzVector * SplitEandP(G4ParticleDefinition * pHadron, G4FragmentingString * string);
G4bool SplitLast(G4FragmentingString * string,
G4KineticTrackVector * LeftVector,
G4KineticTrackVector * RightVector);
void CalculateHadronTimePosition(G4double theInitialStringMass, G4KineticTrackVector *);
G4ExcitedString *CPExcited(const G4ExcitedString& string);
G4ParticleDefinition* FindParticle(G4int Encoding);
// Additional Implementation Declarations
G4ParticleDefinition * QuarkSplitup(G4ParticleDefinition* decay,
G4ParticleDefinition *&created);
G4ParticleDefinition * DiQuarkSplitup(G4ParticleDefinition* decay,
G4ParticleDefinition *&created);
pDefPair CreatePartonPair(G4int NeedParticle, G4bool AllowDiquarks=true);
};
//**********************************************************************************************
// Class G4VLongitudinalStringDecay
#endif
@@ -0,0 +1,125 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Historic fragment from M.Komogorov; clean-up still necessary @@@
#include "G4ExcitedStringDecay.hh"
G4ExcitedStringDecay::G4ExcitedStringDecay()
{
theStringDecay=NULL;
}
G4ExcitedStringDecay::G4ExcitedStringDecay(G4VLongitudinalStringDecay * aStringDecay)
: theStringDecay(aStringDecay)
{}
G4ExcitedStringDecay::G4ExcitedStringDecay(const G4ExcitedStringDecay &) : G4VStringFragmentation()
{
}
G4ExcitedStringDecay::~G4ExcitedStringDecay()
{
}
const G4ExcitedStringDecay & G4ExcitedStringDecay::operator=(const G4ExcitedStringDecay &)
{
throw G4HadronicException(__FILE__, __LINE__, "G4ExcitedStringDecay::operator= meant to not be accessable");
return *this;
}
int G4ExcitedStringDecay::operator==(const G4ExcitedStringDecay &) const
{
return 0;
}
int G4ExcitedStringDecay::operator!=(const G4ExcitedStringDecay &) const
{
return 1;
}
G4bool G4ExcitedStringDecay::
EnergyAndMomentumCorrector(G4KineticTrackVector* Output, G4LorentzVector& TotalCollisionMom)
{
const int nAttemptScale = 500;
const double ErrLimit = 1.E-5;
if (Output->empty())
return TRUE;
G4LorentzVector SumMom;
G4double SumMass = 0;
G4double TotalCollisionMass = TotalCollisionMom.m();
// 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();
}
if (SumMass > TotalCollisionMass) return FALSE;
SumMass = SumMom.m2();
if (SumMass < 0) return FALSE;
SumMass = sqrt(SumMass);
// Compute c.m.s. hadron velocity and boost KTV to hadron c.m.s.
G4ThreeVector Beta = -SumMom.boostVector();
Output->Boost(Beta);
// Scale total c.m.s. hadron energy (hadron system mass).
// It should be equal interaction mass
G4double Scale = 1;
G4int cAttempt = 0;
G4double Sum = 0;
G4bool success = false;
for(cAttempt = 0; cAttempt < nAttemptScale; cAttempt++)
{
Sum = 0;
for(cHadron = 0; cHadron < Output->size(); cHadron++)
{
G4LorentzVector HadronMom = Output->operator[](cHadron)->Get4Momentum();
HadronMom.setVect(Scale*HadronMom.vect());
G4double E = sqrt(HadronMom.vect().mag2() + sqr(Output->operator[](cHadron)->GetDefinition()->GetPDGMass()));
HadronMom.setE(E);
Output->operator[](cHadron)->Set4Momentum(HadronMom);
Sum += E;
}
Scale = TotalCollisionMass/Sum;
if (Scale - 1 <= ErrLimit)
{
success = true;
break;
}
}
if(!success)
{
G4cout << "G4ExcitedStringDecay::EnergyAndMomentumCorrector - Warning"<<G4endl;
G4cout << " Scale not unity at end of iteration loop: "<<TotalCollisionMass<<" "<<Sum<<" "<<Scale<<G4endl;
G4cout << " Increase number of attempts or increase ERRLIMIT"<<G4endl;
}
// Compute c.m.s. interaction velocity and KTV back boost
Beta = TotalCollisionMom.boostVector();
Output->Boost(Beta);
return TRUE;
}
@@ -0,0 +1,213 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// ---------------- G4FragmentingString ----------------
// by Gunter Folger, September 2001.
// class for an excited string used in Fragmention
// ------------------------------------------------------------
// G4FragmentingString
#include "G4FragmentingString.hh"
#include "G4ExcitedString.hh"
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
G4FragmentingString::G4FragmentingString(const G4FragmentingString &old)
{
LeftParton=old.LeftParton;
RightParton=old.RightParton;
Ptleft=old.Ptleft;
Ptright=old.Ptright;
Pplus=old.Pplus;
Pminus=old.Pminus;
decaying=old.decaying;
}
//---------------------------------------------------------------------------------
G4FragmentingString::G4FragmentingString(const G4ExcitedString &excited)
{
LeftParton=excited.GetLeftParton()->GetDefinition();
RightParton=excited.GetRightParton()->GetDefinition();
Ptleft=excited.GetLeftParton()->Get4Momentum().vect();
Ptleft.setZ(0.);
Ptright=excited.GetRightParton()->Get4Momentum().vect();
Ptright.setZ(0.);
G4LorentzVector P=excited.Get4Momentum();
Pplus =P.e() + P.pz();
Pminus=P.e() - P.pz();
decaying=None;
}
//---------------------------------------------------------------------------------
G4FragmentingString::G4FragmentingString(const G4FragmentingString &old,
G4ParticleDefinition * newdecay,
const G4LorentzVector *momentum)
{
decaying=None;
if ( old.decaying == Left )
{
RightParton= old.RightParton;
Ptright = old.Ptright;
LeftParton = newdecay;
Ptleft = old.Ptleft - momentum->vect();
Ptleft.setZ(0.);
} else if ( old.decaying == Right )
{
RightParton = newdecay;
Ptright = old.Ptright - momentum->vect();
Ptright.setZ(0.);
LeftParton = old.LeftParton;
Ptleft = old.Ptleft;
} else
{
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);
}
//---------------------------------------------------------------------------------
G4FragmentingString::~G4FragmentingString()
{}
//---------------------------------------------------------------------------------
void G4FragmentingString::SetLeftPartonStable()
{
theStableParton=GetLeftParton();
theDecayParton=GetRightParton();
decaying=Right;
}
//---------------------------------------------------------------------------------
void G4FragmentingString::SetRightPartonStable()
{
theStableParton=GetRightParton();
theDecayParton=GetLeftParton();
decaying=Left;
}
//---------------------------------------------------------------------------------
G4int G4FragmentingString::GetDecayDirection() const
{
if (decaying == Left ) return +1;
else if (decaying == Right) return -1;
else throw G4HadronicException(__FILE__, __LINE__, "G4FragmentingString::GetDecayDirection: decay side UNdefined!");
return 0;
}
//---------------------------------------------------------------------------------
G4bool G4FragmentingString::FourQuarkString() const
{
return LeftParton->GetParticleSubType()== "di_quark"
&& RightParton->GetParticleSubType()== "di_quark";
}
//---------------------------------------------------------------------------------
G4bool G4FragmentingString::DecayIsQuark()
{
return theDecayParton->GetParticleSubType()== "quark";
}
G4bool G4FragmentingString::StableIsQuark()
{
return theStableParton->GetParticleSubType()== "quark";
}
//---------------------------------------------------------------------------------
G4ThreeVector G4FragmentingString::StablePt()
{
if (decaying == Left ) return Ptright;
else if (decaying == Right ) return Ptleft;
else throw G4HadronicException(__FILE__, __LINE__, "G4FragmentingString::DecayPt: decay side UNdefined!");
return G4ThreeVector();
}
G4ThreeVector G4FragmentingString::DecayPt()
{
if (decaying == Left ) return Ptleft;
else if (decaying == Right ) return Ptright;
else throw G4HadronicException(__FILE__, __LINE__, "G4FragmentingString::DecayPt: decay side UNdefined!");
return G4ThreeVector();
}
//---------------------------------------------------------------------------------
G4double G4FragmentingString::LightConePlus()
{
return Pplus;
}
G4double G4FragmentingString::LightConeMinus()
{
return Pminus;
}
G4double G4FragmentingString::LightConeDecay()
{
if (decaying == Left ) return Pplus;
else if (decaying == Right ) return Pminus;
else throw G4HadronicException(__FILE__, __LINE__, "G4FragmentingString::DecayPt: decay side UNdefined!");
return 0;
}
//---------------------------------------------------------------------------------
G4LorentzVector G4FragmentingString::Get4Momentum() const
{
G4LorentzVector momentum(Ptleft+Ptright,0);
momentum.setPz(0.5*(Pplus-Pminus));
momentum.setE(0.5*(Pplus+Pminus));
return momentum;
}
G4double G4FragmentingString::Mass2() const
{
return Pplus*Pminus - (Ptleft+Ptright).mag2();
}
G4double G4FragmentingString::Mass() const
{
return sqrt(this->Mass2());
}
@@ -0,0 +1,274 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4HadronBuilder.cc,v 1.2 2003/11/03 17:54:53 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
//
// History:
// Gunter Folger, August/September 2001
// Create class; algorithm previously in G4VLongitudinalStringDecay.
// -----------------------------------------------------------------------------
#include "G4HadronBuilder.hh"
#include "G4HadronicException.hh"
#include "Randomize.hh"
#include "G4ParticleTable.hh"
G4HadronBuilder::G4HadronBuilder(G4double mesonMix, G4double barionMix,
std::vector<double> scalarMesonMix,
std::vector<double> vectorMesonMix)
{
mesonSpinMix=mesonMix;
barionSpinMix=barionMix;
scalarMesonMixings=scalarMesonMix;
vectorMesonMixings=vectorMesonMix;
}
G4ParticleDefinition * G4HadronBuilder::Build(G4ParticleDefinition * black, G4ParticleDefinition * white)
{
if (black->GetParticleSubType()== "di_quark" || white->GetParticleSubType()== "di_quark" ) {
// Barion
Spin spin = (G4UniformRand() < barionSpinMix) ? SpinHalf : SpinThreeHalf;
return Barion(black,white,spin);
} else {
// Meson
Spin spin = (G4UniformRand() < mesonSpinMix) ? SpinZero : SpinOne;
return Meson(black,white,spin);
}
}
//-------------------------------------------------------------------------
G4ParticleDefinition * G4HadronBuilder::BuildLowSpin(G4ParticleDefinition * black, G4ParticleDefinition * white)
{
if ( black->GetParticleSubType()== "quark" && white->GetParticleSubType()== "quark" ) {
return Meson(black,white, SpinZero);
} else {
// will return a SpinThreeHalf Barion if all quarks the same
return Barion(black,white, SpinHalf);
}
}
//-------------------------------------------------------------------------
G4ParticleDefinition * G4HadronBuilder::BuildHighSpin(G4ParticleDefinition * black, G4ParticleDefinition * white)
{
if ( black->GetParticleSubType()== "quark" && white->GetParticleSubType()== "quark" ) {
return Meson(black,white, SpinOne);
} else {
return Barion(black,white,SpinThreeHalf);
}
}
//-------------------------------------------------------------------------
G4ParticleDefinition * G4HadronBuilder::Meson(G4ParticleDefinition * black,
G4ParticleDefinition * white, Spin theSpin)
{
#ifdef G4VERBOSE
// Verify Input Charge
G4double charge = black->GetPDGCharge()
+ white->GetPDGCharge();
if (abs(charge) > 2 || abs(3.*charge - 3*G4int(charge)) > perCent )
{
G4cerr << " G4HadronBuilder::Build()" << G4endl;
G4cerr << " Invalid total charge found for on input: "
<< charge<< G4endl;
G4cerr << " PGDcode input quark1/quark2 : " <<
black->GetPDGEncoding() << " / "<<
white->GetPDGEncoding() << G4endl;
G4cerr << G4endl;
}
#endif
G4int id1= black->GetPDGEncoding();
G4int id2= white->GetPDGEncoding();
// G4int ifl1= std::max(abs(id1), abs(id2));
if ( abs(id1) < abs(id2) )
{
G4int xchg = id1;
id1 = id2;
id2 = xchg;
}
if (abs(id1) > 3 )
throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Meson : Illegal Quark content as input");
G4int PDGEncoding=0;
if (id1 + id2 == 0) {
G4double rmix = G4UniformRand();
G4int imix = 2*abs(id1) - 1;
if(theSpin == SpinZero) {
PDGEncoding = 110*(1 + (G4int)(rmix + scalarMesonMixings[imix - 1])
+ (G4int)(rmix + scalarMesonMixings[imix])
) + theSpin;
} else {
PDGEncoding = 110*(1 + (G4int)(rmix + vectorMesonMixings[imix - 1])
+ (G4int)(rmix + vectorMesonMixings[imix])
) + theSpin;
}
} else {
PDGEncoding = 100 * abs(id1) + 10 * abs(id2) + theSpin;
G4bool IsUp = (abs(id1)&1) == 0; // quark 1 up type quark (u or c)
G4bool IsAnti = id1 < 0; // quark 1 is antiquark?
if( (IsUp && IsAnti ) || (!IsUp && !IsAnti ) )
PDGEncoding = - PDGEncoding;
}
G4ParticleDefinition * MesonDef=
G4ParticleTable::GetParticleTable()->FindParticle(PDGEncoding);
#ifdef G4VERBOSE
if (MesonDef == 0 ) {
G4cerr << " G4HadronBuilder - Warning: No particle for PDGcode= "
<< PDGEncoding << G4endl;
}
if ( ( black->GetPDGCharge()
+ white->GetPDGCharge()
- MesonDef->GetPDGCharge() ) > perCent ) {
G4cerr << " G4HadronBuilder - Warning: Incorrect Charge : "
<< " Quark1/2 = "
<< black->GetParticleName() << " / "
<< white->GetParticleName()
<< " resulting Hadron " << MesonDef->GetParticleName()
<< G4endl;
}
#endif
return MesonDef;
}
G4ParticleDefinition * G4HadronBuilder::Barion(G4ParticleDefinition * black,
G4ParticleDefinition * white,Spin theSpin)
{
#ifdef G4VERBOSE
// Verify Input Charge
G4double charge = black->GetPDGCharge()
+ white->GetPDGCharge();
if (abs(charge) > 2 || abs(3.*charge - 3*G4int(charge)) > perCent )
{
G4cerr << " G4HadronBuilder::Build()" << G4endl;
G4cerr << " Invalid total charge found for on input: "
<< charge<< G4endl;
G4cerr << " PGDcode input quark1/quark2 : " <<
black->GetPDGEncoding() << " / "<<
white->GetPDGEncoding() << G4endl;
G4cerr << G4endl;
}
#endif
G4int id1= black->GetPDGEncoding();
G4int id2= white->GetPDGEncoding();
if ( abs(id1) < abs(id2) )
{
G4int xchg = id1;
id1 = id2;
id2 = xchg;
}
if (abs(id1) < 1000 || abs(id2) > 3 )
throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Barion: Illegal quark content as input");
G4int ifl1= abs(id1)/1000;
G4int ifl2 = (abs(id1) - ifl1 * 1000)/100;
G4int diquarkSpin = abs(id1)%10;
G4int ifl3 = id2;
if (id1 < 0)
{
ifl1 = - ifl1;
ifl2 = - ifl2;
}
//... Construct barion, distinguish Lambda and Sigma barions.
G4int kfla = abs(ifl1);
G4int kflb = abs(ifl2);
G4int kflc = abs(ifl3);
G4int kfld = std::max(kfla,kflb);
kfld = std::max(kfld,kflc);
G4int kflf = std::min(kfla,kflb);
kflf = std::min(kflf,kflc);
G4int kfle = kfla + kflb + kflc - kfld - kflf;
//... barion with content uuu or ddd or sss has always spin = 3/2
theSpin = (kfla == kflb && kflb == kflc)? SpinThreeHalf : theSpin;
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
if(diquarkSpin == 1 ) {
if ( kfla == kfld) { // heaviest quark in diquark
kfll = 1;
} else {
kfll = (G4int)(0.25 + G4UniformRand());
}
}
if(diquarkSpin == 3 && kfla != kfld)
kfll = (G4int)(0.75 + G4UniformRand());
}
G4int PDGEncoding;
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;
G4ParticleDefinition * BarionDef=
G4ParticleTable::GetParticleTable()->FindParticle(PDGEncoding);
#ifdef G4VERBOSE
if (BarionDef == 0 ) {
G4cerr << " G4HadronBuilder - Warning: No particle for PDGcode= "
<< PDGEncoding << G4endl;
}
if ( ( black->GetPDGCharge()
+ white->GetPDGCharge()
- BarionDef->GetPDGCharge() ) > perCent ) {
G4cerr << " G4HadronBuilder - Warning: Incorrect Charge : "
<< " DiQuark/Quark = "
<< black->GetParticleName() << " / "
<< white->GetParticleName()
<< " resulting Hadron " << BarionDef->GetParticleName()
<< G4endl;
}
#endif
return BarionDef;
}
@@ -0,0 +1,99 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4LundStringFragmentation.cc,v 1.2 2003/11/03 17:54:53 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, Maxim Komogorov, 10-Jul-1998
// -----------------------------------------------------------------------------
#include "G4LundStringFragmentation.hh"
#include "Randomize.hh"
// Class G4LundStringFragmentation
//****************************************************************************************
G4LundStringFragmentation::G4LundStringFragmentation()
{
}
// G4LundStringFragmentation::G4LundStringFragmentation(G4double sigmaPt)
// : G4VLongitudinalStringDecay(sigmaPt)
// {
// }
G4LundStringFragmentation::G4LundStringFragmentation(const G4LundStringFragmentation &) : G4VLongitudinalStringDecay()
{
}
G4LundStringFragmentation::~G4LundStringFragmentation()
{
}
//****************************************************************************************
const G4LundStringFragmentation & G4LundStringFragmentation::operator=(const G4LundStringFragmentation &)
{
throw G4HadronicException(__FILE__, __LINE__, "G4LundStringFragmentation::operator= meant to not be accessable");
return *this;
}
int G4LundStringFragmentation::operator==(const G4LundStringFragmentation &right) const
{
return !memcmp(this, &right, sizeof(G4LundStringFragmentation));
}
int G4LundStringFragmentation::operator!=(const G4LundStringFragmentation &right) const
{
return memcmp(this, &right, sizeof(G4LundStringFragmentation));
}
//****************************************************************************************
G4double G4LundStringFragmentation::GetLightConeZ(G4double zmin, G4double zmax, G4int , G4ParticleDefinition* pHadron, G4double Px, G4double Py)
{
const G4double alund = 0.7/GeV/GeV;
// If blund get restored, you MUST adapt the calculation of zOfMaxyf.
// const G4double blund = 1;
G4double z, yf;
G4double Mass = pHadron->GetPDGMass();
G4double Mt2 = Px*Px + Py*Py + Mass*Mass;
G4double zOfMaxyf=alund*Mt2/(alund*Mt2 + 1.);
G4double maxYf=(1-zOfMaxyf)/zOfMaxyf * exp(-alund*Mt2/zOfMaxyf);
do
{
z = zmin + G4UniformRand()*(zmax-zmin);
// yf = pow(1. - z, blund)/z*exp(-alund*Mt2/z);
yf = (1-z)/z * exp(-alund*Mt2/z);
}
while (G4UniformRand()*maxYf > yf);
return z;
}
//****************************************************************************************
@@ -0,0 +1,121 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4QGSMFragmentation.cc,v 1.2 2003/11/03 17:54:53 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, Maxim Komogorov, 10-Jul-1998
// -----------------------------------------------------------------------------
#include "G4QGSMFragmentation.hh"
#include "Randomize.hh"
#include "G4ios.hh"
// Class G4QGSMFragmentation
//****************************************************************************************
G4QGSMFragmentation::G4QGSMFragmentation() :
arho(0.5), aphi(0.), an(-0.5), ala(-0.75), aksi(-1.), alft(0.5)
{
}
G4QGSMFragmentation::G4QGSMFragmentation(const G4QGSMFragmentation &) : G4VLongitudinalStringDecay(),
arho(0.5), aphi(0.), an(-0.5), ala(-0.75), aksi(-1.), alft(0.5)
{
}
G4QGSMFragmentation::~G4QGSMFragmentation()
{
}
//****************************************************************************************
const G4QGSMFragmentation & G4QGSMFragmentation::operator=(const G4QGSMFragmentation &)
{
throw G4HadronicException(__FILE__, __LINE__, "G4QGSMFragmentation::operator= meant to not be accessable");
return *this;
}
int G4QGSMFragmentation::operator==(const G4QGSMFragmentation &right) const
{
return !memcmp(this, &right, sizeof(G4QGSMFragmentation));
}
int G4QGSMFragmentation::operator!=(const G4QGSMFragmentation &right) const
{
return memcmp(this, &right, sizeof(G4QGSMFragmentation));
}
//****************************************************************************************
G4double G4QGSMFragmentation::GetLightConeZ(G4double zmin, G4double zmax, G4int PartonEncoding, G4ParticleDefinition* , G4double , G4double )
{
G4double z;
G4double theA(0), d1, d2, yf;
G4int absCode = abs( PartonEncoding );
if (absCode < 10)
{
if(absCode == 1 || absCode == 2) theA = arho;
else if(absCode == 3) theA = aphi;
else throw G4HadronicException(__FILE__, __LINE__, "Unknown PDGencoding in G4QGSMFragmentation::G4LightConeZ");
do
{
z = zmin + G4UniformRand() * (zmax - zmin);
d1 = (1. - z);
d2 = (alft - theA);
yf = pow(d1, d2);
}
while (G4UniformRand() > yf);
}
else
{
if(absCode == 1103 || absCode == 2101 ||
absCode == 2203 || absCode == 2103)
{
d2 = (alft - (2.*an - arho));
}
else if(absCode == 3101 || absCode == 3103 ||
absCode == 3201 || absCode == 3203)
{
d2 = (alft - (2.*ala - arho));
}
else
{
d2 = (alft - (2.*aksi - arho));
}
do
{
z = zmin + G4UniformRand() * (zmax - zmin);
d1 = (1. - z);
yf = pow(d1, d2);
}
while (G4UniformRand() > yf);
}
return z;
}
//*********************************************************************************************
@@ -0,0 +1,114 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VKinkyStringDecay.cc,v 1.1 2003/10/07 11:25:41 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
// Maxim Komogorov
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, Maxim Komogorov, 10-Oct-1998
// -----------------------------------------------------------------------------
#include "G4VKinkyStringDecay.hh"
#include "G4KineticTrackVector.hh"
#include "G4KineticTrack.hh"
#include "Randomize.hh"
//*****************************************************************************************************
G4VKinkyStringDecay::G4VKinkyStringDecay(G4VLongitudinalStringDecay* theModal)
{
this->SetLongitudinalStringDecay(theModal);
}
//*****************************************************************************************************
G4double G4VKinkyStringDecay::GetLightConeGluonZ(G4double zmin, G4double zmax)
{
G4double z, yf;
do {
z = zmin + G4UniformRand()*(zmax-zmin);
yf = z*z +sqr(1 - z);
}
while (G4UniformRand() > yf);
return z;
}
//*****************************************************************************************************
G4KineticTrackVector* G4VKinkyStringDecay::FragmentString(const G4ExcitedString& String)
{
G4LorentzVector Mom = String.GetGluon()->Get4Momentum();
G4ThreeVector Pos = String.GetGluon()->GetPosition();
G4int QuarkEncoding = theLongitudinalStringDecay->SampleQuarkFlavor();
G4ThreeVector Pquark=theLongitudinalStringDecay->SampleQuarkPt();
G4double Pt2 = Pquark.mag2();
G4double z = GetLightConeGluonZ(0, 1);
G4double w = Mom.e() + Mom.pz();
//... now compute quark longitudinal momentum and energy
Pquark.setZ( (z*w - Pt2/(z*w))*0.5);
G4double E = (z*w + Pt2/(z*w))*0.5;
G4Parton* AntiColor = new G4Parton(-QuarkEncoding);
AntiColor->SetPosition(Pos);
G4LorentzVector AntiColorMom(-Pquark, E);
AntiColor->Set4Momentum(AntiColorMom);
G4Parton* Color = new G4Parton(*String.GetColorParton());
G4ExcitedString Str1(Color, AntiColor, String.GetDirection());
G4KineticTrackVector* KTV1 = theLongitudinalStringDecay->FragmentString(Str1);
Color = new G4Parton(QuarkEncoding);
Color->SetPosition(Pos);
G4LorentzVector ColorMom(Pquark, E);
Color->Set4Momentum(ColorMom);
AntiColor = new G4Parton(*String.GetAntiColorParton());
G4ExcitedString Str2(Color, AntiColor, String.GetDirection());
G4KineticTrackVector* KTV2 = theLongitudinalStringDecay->FragmentString(Str2);
if (KTV1 && KTV2)
while(!KTV2->empty())
{
KTV1->push_back(KTV2->back());
KTV1->erase(KTV1->end()-1);
}
return KTV1;
}
//*****************************************************************************************************
@@ -0,0 +1,783 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VLongitudinalStringDecay.cc,v 1.2 2003/11/03 17:54:53 hpw Exp $
// GEANT4 tag $Name: geant4-06-00 $
//
// -----------------------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, Maxim Komogorov, 1-Jul-1998
// redesign Gunter Folger, August/September 2001
// -----------------------------------------------------------------------------
#include "G4ios.hh"
#include "Randomize.hh"
#include "G4VLongitudinalStringDecay.hh"
#include "G4FragmentingString.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleChange.hh"
#include "G4VShortLivedParticle.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4ParticleTable.hh"
#include "G4ShortLivedTable.hh"
#include "G4PhaseSpaceDecayChannel.hh"
#include "G4VDecayChannel.hh"
#include "G4DecayTable.hh"
#include "G4DiQuarks.hh"
#include "G4Quarks.hh"
#include "G4Gluons.hh"
//********************************************************************************
// Constructors
G4VLongitudinalStringDecay::G4VLongitudinalStringDecay()
{
MassCut = 0.35*GeV;
ClusterMass = 0.15*GeV;
SmoothParam = 0.9;
StringLoopInterrupt = 1000;
ClusterLoopInterrupt = 500;
// Changable Parameters below.
SigmaQT = 0.5 * GeV;
StrangeSuppress = 0.44; // 27 % strange quarks produced, ie. u:d:s=1:1:0.27
DiquarkSuppress = 0.1;
DiquarkBreakProb = 0.1;
//... pspin_meson is probability to create vector meson
pspin_meson = 0.5;
//... pspin_barion is probability to create 3/2 barion
pspin_barion = 0.5;
//... vectorMesonMix[] is quark mixing parameters for vector mesons (Variable spin = 3)
vectorMesonMix.resize(6);
vectorMesonMix[0] = 0.5;
vectorMesonMix[1] = 0.0;
vectorMesonMix[2] = 0.5;
vectorMesonMix[3] = 0.0;
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);
}
G4VLongitudinalStringDecay::~G4VLongitudinalStringDecay()
{
delete hadronizer;
}
//=============================================================================================-------------
// Operators
//const & G4VLongitudinalStringDecay::operator=(const G4VLongitudinalStringDecay &)
// {
// }
//----------------------------------------------------------------------------------------------------------
int G4VLongitudinalStringDecay::operator==(const G4VLongitudinalStringDecay &) const
{
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::operator== forbidden");
return false;
}
//----------------------------------------------------------------------------------------------------------
int G4VLongitudinalStringDecay::operator!=(const G4VLongitudinalStringDecay &) const
{
throw G4HadronicException(__FILE__, __LINE__, "G4VLongitudinalStringDecay::operator!= forbidden");
return true;
}
//==========================================================================================================
G4int G4VLongitudinalStringDecay::SampleQuarkFlavor(void)
{
return (1 + (int)(G4UniformRand()/StrangeSuppress));
}
//----------------------------------------------------------------------------------------------------------
G4VLongitudinalStringDecay::pDefPair G4VLongitudinalStringDecay::CreatePartonPair(G4int NeedParticle,G4bool AllowDiquarks)
{
// 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));
} else {
// Create a Quark - AntiQuark pair, first in pair IsParticle
G4int PDGcode=SampleQuarkFlavor()*NeedParticle;
return pDefPair (FindParticle(PDGcode),FindParticle(-PDGcode));
}
}
//----------------------------------------------------------------------------------------------------------
G4ThreeVector G4VLongitudinalStringDecay::SampleQuarkPt()
{
G4double Pt = -log(G4UniformRand());
Pt = SigmaQT * sqrt(Pt);
G4double phi = 2.*pi*G4UniformRand();
return G4ThreeVector(Pt * cos(phi),Pt * sin(phi),0);
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::CalculateHadronTimePosition(G4double theInitialStringMass, G4KineticTrackVector* Hadrons)
{
// `yo-yo` formation time
const G4double kappa = 1.0 * GeV/fermi;
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));
G4ThreeVector aPosition(0, 0, (theInitialStringMass - 2.*SumE - HadronE + HadronPz)/(2.*kappa));
Hadrons->operator[](c1)->SetPosition(aPosition);
}
}
//----------------------------------------------------------------------------------------------------------
/*
void G4VLongitudinalStringDecay::CalculateHadronTimePosition(G4double theInitialStringMass, G4KineticTrackVector* Hadrons)
{
// 'constituent' formation time
const G4double kappa = 1.0 * GeV/fermi;
for(G4int c1 = 0; c1 < Hadrons->length(); c1++)
{
G4double SumPz = 0;
G4double SumE = 0;
for(G4int c2 = 0; c2 <= c1; c2++)
{
SumPz += Hadrons->at(c2)->Get4Momentum().pz();
SumE += Hadrons->at(c2)->Get4Momentum().e();
}
Hadrons->at(c1)->SetFormationTime((theInitialStringMass - 2.*SumPz)/(2.*kappa));
G4ThreeVector aPosition(0, 0, (theInitialStringMass - 2.*SumE)/(2.*kappa));
Hadrons->at(c1)->SetPosition(aPosition);
}
c1 = Hadrons->length()-1;
Hadrons->at(c1)->SetFormationTime(Hadrons->at(c1-1)->GetFormationTime());
Hadrons->at(c1)->SetPosition(Hadrons->at(c1-1)->GetPosition());
}
*/
//----------------------------------------------------------------------------------------------------------
G4ParticleDefinition *
G4VLongitudinalStringDecay::QuarkSplitup(G4ParticleDefinition*
decay, G4ParticleDefinition *&created)
{
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 *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(abs(QuarkEncoding), abs(stableQuarkEncoding));
G4int i20 = std::min(abs(QuarkEncoding), 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);
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
created = QuarkPair.second;
return hadronizer->Build(QuarkPair.first, decay);
}
}
//-----------------------------------------------------------------------------------------
G4KineticTrack * G4VLongitudinalStringDecay::Splitup(
G4FragmentingString *string,
G4FragmentingString *&newString)
{
//... random choice of string end to use for creating the hadron (decay)
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);
}
// create new String from old, ie. keep Left and Right order, but replace decay
G4LorentzVector* HadronMomentum=SplitEandP(HadronDefinition, string);
G4KineticTrack * Hadron =0;
if ( HadronMomentum != 0 ) {
G4ThreeVector Pos;
Hadron = new G4KineticTrack(HadronDefinition, 0,Pos, *HadronMomentum);
newString=new G4FragmentingString(*string,newStringEnd,
HadronMomentum);
delete HadronMomentum;
}
return Hadron;
}
//-----------------------------------------------------------------------------------------
G4LorentzVector * G4VLongitudinalStringDecay::SplitEandP(G4ParticleDefinition * pHadron,
G4FragmentingString * string)
{
G4double HadronMass = pHadron->GetPDGMass();
// calculate and assign hadron transverse momentum component HadronPx andHadronPy
G4ThreeVector thePt;
thePt=SampleQuarkPt();
G4ThreeVector HadronPt = thePt +string->DecayPt();
HadronPt.setZ(0);
//... sample z to define hadron longitudinal momentum and energy
//... but first check the available phase space
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!
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
HadronPt.setZ(0.5* string->GetDecayDirection() *
(z * string->LightConeDecay() -
HadronMass2T/(z * string->LightConeDecay())));
G4double HadronE = 0.5* (z * string->LightConeDecay() +
HadronMass2T/(z * string->LightConeDecay()));
G4LorentzVector * a4Momentum= new G4LorentzVector(HadronPt,HadronE);
return a4Momentum;
}
//-----------------------------------------------------------------------------------------
G4bool G4VLongitudinalStringDecay::SplitLast(G4FragmentingString * string,
G4KineticTrackVector * LeftVector,
G4KineticTrackVector * RightVector)
{
//... perform last cluster decay
G4ThreeVector ClusterVel =string->Get4Momentum().boostVector();
G4double ResidualMass =string->Mass();
G4double ClusterMassCut = ClusterMass;
G4int cClusterInterrupt = 0;
G4ParticleDefinition * LeftHadron, * RightHadron;
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;
}
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);
//... compute hadron momenta and energies
G4LorentzVector LeftMom, RightMom;
G4ThreeVector Pos;
Sample4Momentum(&LeftMom, LeftHadron->GetPDGMass(), &RightMom, RightHadron->GetPDGMass(), ResidualMass);
LeftMom.boost(ClusterVel);
RightMom.boost(ClusterVel);
LeftVector->push_back(new G4KineticTrack(LeftHadron, 0, Pos, LeftMom));
RightVector->push_back(new G4KineticTrack(RightHadron, 0, Pos, RightMom));
return true;
}
//----------------------------------------------------------------------------------------------------------
G4KineticTrackVector* G4VLongitudinalStringDecay::FragmentString(const G4ExcitedString& theString)
{
// Can no longer modify Parameters for Fragmentation.
PastInitPhase=true;
// check if string has enough mass to fragment...
G4KineticTrackVector * LeftVector=LightFragmentationTest(&theString);
if ( LeftVector != 0 ) return LeftVector;
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();
G4bool success=false, inner_sucess=true;
G4int attempt=0;
while ( !success && attempt++ < StringLoopInterrupt )
{
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();
inner_sucess=true; // set false on failure..
while (! StopFragmenting(currentString) )
{ // Split current string into hadron + new string
G4FragmentingString *newString=0; // used as output from SplitUp...
G4KineticTrack * Hadron=Splitup(currentString,newString);
if ( Hadron != 0 && IsFragmentable(newString))
{
if ( currentString->GetDecayDirection() > 0 )
LeftVector->push_back(Hadron);
else
RightVector->push_back(Hadron);
delete currentString;
currentString=newString;
} else {
// abandon ... start from the beginning
if (newString) delete newString;
if (Hadron) delete Hadron;
inner_sucess=false;
break;
}
}
// Split current string into 2 final Hadrons
if ( inner_sucess &&
SplitLast(currentString,LeftVector, RightVector) )
{
success=true;
}
delete currentString;
}
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;
}
// Join Left- and RightVector into LeftVector in correct order.
while(!RightVector->empty())
{
LeftVector->push_back(RightVector->back());
RightVector->erase(RightVector->end()-1);
}
delete RightVector;
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;
}
//----------------------------------------------------------------------------------------------------------
G4ExcitedString *G4VLongitudinalStringDecay::CPExcited(const G4ExcitedString & in)
{
G4Parton *Left=new G4Parton(*in.GetLeftParton());
G4Parton *Right=new G4Parton(*in.GetRightParton());
return new G4ExcitedString(Left,Right,in.GetDirection());
}
G4double G4VLongitudinalStringDecay::FragmentationMass(
const G4FragmentingString *
const string,
Pcreate build,
pDefPair * pdefs)
{
G4double mass;
if ( build==0 ) build=&G4HadronBuilder::BuildLowSpin;
G4ParticleDefinition *Hadron1, *Hadron2=0;
if (!string->FourQuarkString() )
{
// spin 0 meson or spin 1/2 barion will be built
Hadron1 = (hadronizer->*build)(string->GetLeftParton(),
string->GetRightParton());
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 = (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;
}
return mass;
}
//----------------------------------------------------------------------------------------------------------
G4bool G4VLongitudinalStringDecay::IsFragmentable(const G4FragmentingString * const string)
{
return sqr(FragmentationMass(string)+MassCut) <
string->Mass2();
}
//----------------------------------------------------------------------------------------------------------
G4bool G4VLongitudinalStringDecay::StopFragmenting(const G4FragmentingString * const string)
{
return
sqr(FragmentationMass(string,&G4HadronBuilder::BuildHighSpin)+MassCut) >
string->Get4Momentum().mag2();
}
//----------------------------------------------------------------------------------------------------------
G4KineticTrackVector* G4VLongitudinalStringDecay::LightFragmentationTest(const
G4ExcitedString * const string)
{
// Check string decay threshold
G4KineticTrackVector * result=0; // return 0 when string exceeds the mass cut
pDefPair hadrons((G4ParticleDefinition *)0,(G4ParticleDefinition *)0);
G4FragmentingString aString(*string);
if ( sqr(FragmentationMass(&aString,0,&hadrons)+MassCut) < aString.Mass2()) {
return 0;
}
result=new G4KineticTrackVector;
if ( hadrons.second ==0 )
{
// Substitute string by light hadron, Note that Energy is not conserved here!
G4ThreeVector Mom3 = string->Get4Momentum().vect();
G4LorentzVector Mom(Mom3,
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,
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));
G4ThreeVector Velocity = string->Get4Momentum().boostVector();
result->Boost(Velocity);
}
return result;
}
//----------------------------------------------------------------------------------------------------------
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;
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::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.)? sqrt(r_val)/(2.*InitialMass) : 0;
//... sample unit vector
G4double pz = 1. - 2.*G4UniformRand();
G4double st = sqrt(1. - pz * pz)*Pabs;
G4double phi = 2.*pi*G4UniformRand();
G4double px = st*cos(phi);
G4double py = st*sin(phi);
pz *= Pabs;
Mom->setPx(px); Mom->setPy(py); Mom->setPz(pz);
Mom->setE(sqrt(Pabs*Pabs + Mass*Mass));
AntiMom->setPx(-px); AntiMom->setPy(-py); AntiMom->setPz(-pz);
AntiMom->setE (sqrt(Pabs*Pabs + AntiMass*AntiMass));
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetSigmaTransverseMomentum(G4double 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;
}
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetDiquarkSuppression(G4double aValue)
{
if ( PastInitPhase ) {
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;
}
}
//----------------------------------------------------------------------------------------------------------
void G4VLongitudinalStringDecay::SetVectorMesonProbability(G4double aValue)
{
if ( PastInitPhase ) {
throw G4HadronicException(__FILE__, __LINE__, "4VLongitudinalStringDecay::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__, "4VLongitudinalStringDecay::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__, "4VLongitudinalStringDecay::SetScalarMesonMixings after FragmentString() not allowed");
} else {
if ( aVector.size() < 6 )
throw G4HadronicException(__FILE__, __LINE__, "4VLongitudinalStringDecay::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__, "4VLongitudinalStringDecay::SetVectorMesonMixings after FragmentString() not allowed");
} else {
if ( aVector.size() < 6 )
throw G4HadronicException(__FILE__, __LINE__, "4VLongitudinalStringDecay::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);
}
}
//*******************************************************************************************************