Geant4-11
G4MultiBodyMomentumDist.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// Author: Michael Kelsey (SLAC)
27// Date: 7 March 2013
28//
29// Description: Singleton class to evaluate multi-body momentum distribution
30// functions based on initial state codes and multiplicity.
31//
32// 20130308 Use envvar to enable/disable use of 3-body generators.
33// 20130619 Change singleton instance to be thread-local, to avoid collisions.
34// 20141121 Use G4AutoDelete to avoid end-of-thread memory leaks
35
37#include "G4AutoDelete.hh"
44using namespace G4InuclParticleNames;
45
46
47// Singleton is created at first invocation
48
50
52 if (!theInstance) {
55 }
56
57 return theInstance;
58}
59
60// Constructor and destructor
61
63 : nn3BodyDst(new G4NuclNucl3BodyMomDst),
64 nn4BodyDst(new G4NuclNucl4BodyMomDst),
65 hn3BodyDst(new G4HadNucl3BodyMomDst),
66 hn4BodyDst(new G4HadNucl4BodyMomDst) {;}
67
69 delete nn3BodyDst;
70 delete nn4BodyDst;
71 delete hn3BodyDst;
72 delete hn4BodyDst;
73}
74
75
76// Set verbosity for all generators (const-cast required)
77
79 const_cast<G4MultiBodyMomentumDist*>(GetInstance())->passVerbose(verbose);
80}
81
87}
88
89
90// Return appropriate distribution generator for specified interaction
91
94 if (is == pro*pro || is == pro*neu || is == neu*neu) {
95 //***** REMOVED BY VLADIMIR UZHINSKY 18 JULY 2011
96 if (G4CascadeParameters::use3BodyMom() && mult==3) return nn3BodyDst;
97 return nn4BodyDst;
98 }
99
100 else { // FIXME: All other initial states use pi-N scattering
101 //***** REMOVED BY VLADIMIR UZHINSKY 18 JULY 2011
102 if (G4CascadeParameters::use3BodyMom() && mult==3) return hn3BodyDst;
103 return hn4BodyDst;
104 }
105
106 // Invalid interaction
107 return 0;
108}
int G4int
Definition: G4Types.hh:85
static G4bool use3BodyMom()
G4HadNucl3BodyMomDst * hn3BodyDst
static void setVerboseLevel(G4int vb=0)
G4HadNucl4BodyMomDst * hn4BodyDst
const G4VMultiBodyMomDst * ChooseDist(G4int is, G4int mult) const
static G4ThreadLocal G4MultiBodyMomentumDist * theInstance
static const G4MultiBodyMomentumDist * GetInstance()
G4NuclNucl3BodyMomDst * nn3BodyDst
G4NuclNucl4BodyMomDst * nn4BodyDst
virtual void setVerboseLevel(G4int verbose=0)
void Register(T *inst)
Definition: G4AutoDelete.hh:65
#define G4ThreadLocal
Definition: tls.hh:77