Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4HadPhaseSpaceKopylov Class Reference

#include <G4HadPhaseSpaceKopylov.hh>

Inheritance diagram for G4HadPhaseSpaceKopylov:
Collaboration diagram for G4HadPhaseSpaceKopylov:

Public Member Functions

 G4HadPhaseSpaceKopylov (G4int verbose=0)
 
virtual ~G4HadPhaseSpaceKopylov ()
 
- Public Member Functions inherited from G4VHadPhaseSpaceAlgorithm
 G4VHadPhaseSpaceAlgorithm (const G4String &algName, G4int verbose=0)
 
virtual ~G4VHadPhaseSpaceAlgorithm ()
 
- Public Member Functions inherited from G4VHadDecayAlgorithm
 G4VHadDecayAlgorithm (const G4String &algName, G4int verbose=0)
 
virtual ~G4VHadDecayAlgorithm ()
 
void Generate (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
virtual void SetVerboseLevel (G4int verbose)
 
G4int GetVerboseLevel () const
 
const G4StringGetName () const
 

Protected Member Functions

virtual void GenerateMultiBody (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
G4double BetaKopylov (G4int K) const
 
- Protected Member Functions inherited from G4VHadPhaseSpaceAlgorithm
virtual void GenerateTwoBody (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
G4ThreeVector UniformVector (G4double mag=1.) const
 
- Protected Member Functions inherited from G4VHadDecayAlgorithm
virtual G4bool IsDecayAllowed (G4double initialMass, const std::vector< G4double > &masses) const
 
G4double TwoBodyMomentum (G4double M0, G4double M1, G4double M2) const
 
G4double UniformTheta () const
 
G4double UniformPhi () const
 
void PrintVector (const std::vector< G4double > &v, const G4String &name, std::ostream &os) const
 

Detailed Description

Definition at line 38 of file G4HadPhaseSpaceKopylov.hh.

Constructor & Destructor Documentation

G4HadPhaseSpaceKopylov::G4HadPhaseSpaceKopylov ( G4int  verbose = 0)
inline

Definition at line 40 of file G4HadPhaseSpaceKopylov.hh.

41  : G4VHadPhaseSpaceAlgorithm("G4HadPhaseSpaceKopylov",verbose) {;}
G4VHadPhaseSpaceAlgorithm(const G4String &algName, G4int verbose=0)
virtual G4HadPhaseSpaceKopylov::~G4HadPhaseSpaceKopylov ( )
inlinevirtual

Definition at line 42 of file G4HadPhaseSpaceKopylov.hh.

42 {;}

Member Function Documentation

G4double G4HadPhaseSpaceKopylov::BetaKopylov ( G4int  K) const
protected

Definition at line 93 of file G4HadPhaseSpaceKopylov.cc.

93  {
94  G4Pow* g4pow = G4Pow::GetInstance();
95 
96  G4int N = 3*K - 5;
97  G4double xN = G4double(N);
98  G4double Fmax = std::sqrt(g4pow->powN(xN/(xN+1.),N)/(xN+1.));
99 
100  G4double F, chi;
101  const G4int maxNumberOfLoops = 10000;
102  G4int loopCounter = 0;
103  do {
104  chi = G4UniformRand();
105  F = std::sqrt(g4pow->powN(chi,N)*(1.-chi));
106  } while ( ( Fmax*G4UniformRand() > F ) && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 02.11.2015, A.Ribon */
107  if ( loopCounter >= maxNumberOfLoops ) {
109  ed << " Failed sampling after maxNumberOfLoops attempts : forced exit" << G4endl;
110  G4Exception( " G4HadPhaseSpaceKopylov::BetaKopylov ", "HAD_KOPYLOV_001", JustWarning, ed );
111  }
112 
113  return chi;
114 }
static G4Pow * GetInstance()
Definition: G4Pow.cc:55
G4double powN(G4double x, G4int n) const
Definition: G4Pow.cc:128
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
Definition: G4Pow.hh:56
int G4int
Definition: G4Types.hh:78
#define G4UniformRand()
Definition: Randomize.hh:97
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
**D E S C R I P T I O N
Definition: HEPEvtcom.cc:77
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

void G4HadPhaseSpaceKopylov::GenerateMultiBody ( G4double  initialMass,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)
protectedvirtual

Implements G4VHadDecayAlgorithm.

Definition at line 45 of file G4HadPhaseSpaceKopylov.cc.

47  {
48  if (GetVerboseLevel()) G4cout << GetName() << "::GenerateMultiBody" << G4endl;
49 
50  finalState.clear();
51 
52  size_t N = masses.size();
53  finalState.resize(N);
54 
55  G4double mtot = std::accumulate(masses.begin(), masses.end(), 0.0);
56  G4double mu = mtot;
57  G4double PFragMagCM = 0.0;
58  G4double Mass = initialMass;
59  G4double T = Mass-mtot;
60  G4LorentzVector PFragCM(0.0,0.0,0.0,0.0);
61  G4LorentzVector PRestCM(0.0,0.0,0.0,0.0);
62  G4LorentzVector PRestLab(0.0,0.0,0.0,Mass);
63 
64  for (size_t k=N-1; k>0; --k) {
65  mu -= masses[k];
66  T *= (k>1) ? BetaKopylov(k) : 0.;
67 
68  G4double RestMass = mu + T;
69 
70  PFragMagCM = TwoBodyMomentum(Mass,masses[k],RestMass);
71 
72  // Create a unit vector with a random direction isotropically distributed
73  G4ThreeVector RandVector = UniformVector(PFragMagCM);
74 
75  PFragCM.setVectM(RandVector,masses[k]);
76  PRestCM.setVectM(-RandVector,RestMass);
77 
78  G4ThreeVector BoostV = PRestLab.boostVector();
79 
80  PFragCM.boost(BoostV);
81  PRestCM.boost(BoostV);
82  PRestLab = PRestCM;
83  Mass = RestMass;
84  finalState[k] = PFragCM;
85  }
86 
87  finalState[0] = PRestLab;
88 }
G4int GetVerboseLevel() const
G4GLOB_DLL std::ostream G4cout
G4double BetaKopylov(G4int K) const
const G4String & GetName() const
G4double TwoBodyMomentum(G4double M0, G4double M1, G4double M2) const
#define G4endl
Definition: G4ios.hh:61
**D E S C R I P T I O N
Definition: HEPEvtcom.cc:77
double G4double
Definition: G4Types.hh:76
G4ThreeVector UniformVector(G4double mag=1.) const

Here is the call graph for this function:


The documentation for this class was generated from the following files: