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 | // |
---|
27 | // $Id: G4QCHIPSWorld.cc,v 1.33 2009/02/23 09:49:24 mkossov Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $ |
---|
29 | // |
---|
30 | // ---------------- G4QCHIPSWorld ---------------- |
---|
31 | // by Mikhail Kossov, Sept 1999. |
---|
32 | // class for the CHIPS World definition in CHIPS Model |
---|
33 | // ------------------------------------------------------------------- |
---|
34 | // Short description: The CHIPS World is a world of elementary particles |
---|
35 | // and nuclear fragments. This class is a singletone, but without fixed |
---|
36 | // limits. E.g. the nuclear fragments as possible G4Candidates can be |
---|
37 | // initialized in the CHIPS World only up to Be8 od C12 or other bigger |
---|
38 | // nuclear fragment. If one need the heavy fragment production then the |
---|
39 | // the CHIPS World must be initialized up to these fragments (see the |
---|
40 | // CHIPS Manual), but the price in performans will be big, because in |
---|
41 | // each act of the fragmentation competition these numerous candidates |
---|
42 | // take place in the competition and the hadronization probability is |
---|
43 | // calculated each time for each of them, so the Be8 limit (Be8->alpha+ |
---|
44 | // alpha decays very fast and contribute to the alpha-spectrum) is the |
---|
45 | // most optimal. |
---|
46 | // ------------------------------------------------------------------- |
---|
47 | |
---|
48 | //#define debug |
---|
49 | //#define pdebug |
---|
50 | |
---|
51 | #include "G4QCHIPSWorld.hh" |
---|
52 | |
---|
53 | // Initialization of the CHIPSWorld Pointer |
---|
54 | // G4QCHIPSWorld* G4QCHIPSWorld::aWorld =0; |
---|
55 | // G4QParticleVector G4QCHIPSWorld::qWorld; |
---|
56 | |
---|
57 | // Constructor |
---|
58 | G4QCHIPSWorld::G4QCHIPSWorld() |
---|
59 | { |
---|
60 | } |
---|
61 | |
---|
62 | G4QCHIPSWorld::~G4QCHIPSWorld() // The CHIPS World is destructed only in the EndOfJob |
---|
63 | { |
---|
64 | //G4int nP=GetQWorld().size(); |
---|
65 | //G4cout<<"G4QCHIPSWorld::Destructor: Before nP="<<nP<<","<<GetQWorld()[0]<<G4endl; //TMP |
---|
66 | //if(nP) std::for_each(GetQWorld().begin(),GetQWorld().end(),DeleteQParticle()); |
---|
67 | //G4cout<<"G4QCHIPSWorld::Destructor: After"<<G4endl; // TMP |
---|
68 | //GetQWorld().clear(); |
---|
69 | } |
---|
70 | |
---|
71 | // Standard output for CHIPS World |
---|
72 | std::ostream& operator<<(std::ostream& lhs, G4QCHIPSWorld& rhs) |
---|
73 | // ============================================ |
---|
74 | { |
---|
75 | // @@ Later make a list of activated particles and clusters |
---|
76 | lhs << "[ Currently a#of particles in the CHIPS World = " << rhs.GetQPEntries() << "]"; |
---|
77 | return lhs; |
---|
78 | } |
---|
79 | |
---|
80 | // Returns Pointer to the CHIPS World |
---|
81 | G4QCHIPSWorld* G4QCHIPSWorld::Get() |
---|
82 | // ==================== |
---|
83 | { |
---|
84 | static G4QCHIPSWorld theWorld; // *** Static body of the CHIPS World *** |
---|
85 | // Returns Pointer to the CHIPS World |
---|
86 | // if(!aWorld) aWorld=&theWorld; // Init the static pointer to CHIPS World |
---|
87 | // return aWorld; |
---|
88 | return &theWorld; |
---|
89 | } |
---|
90 | |
---|
91 | G4QParticleVector & G4QCHIPSWorld::GetQWorld() |
---|
92 | { |
---|
93 | static G4QParticleVector theWorld; |
---|
94 | return theWorld; |
---|
95 | } |
---|
96 | |
---|
97 | // Return pointer to Particles of the CHIPS World |
---|
98 | G4QParticleVector* G4QCHIPSWorld::GetParticles(G4int nOfParts) |
---|
99 | // =========================================== |
---|
100 | { |
---|
101 | //static const G4int mnofParts = 486; // max number of particles (up to A=80) |
---|
102 | static const G4int mnofParts = 494; // max number of particles (up to A=80) IN |
---|
103 | static const G4bool cf = true; // verbose=true G4QPDG construction flag |
---|
104 | #ifdef debug |
---|
105 | G4cout<<"G4QCHIPSWorld::GetParticles: n="<<nOfParts<<" particles"<<G4endl; |
---|
106 | #endif |
---|
107 | //if(GetQWorld().size())G4cout<<"G4QCHIPSWorld::GetPts:***Pt#0="<<GetQWorld()[0]<<G4endl; |
---|
108 | if(nOfParts>0) |
---|
109 | { |
---|
110 | #ifdef debug |
---|
111 | G4cout<<"G4QCHIPSWorld::GetParticles: Creating CHIPS World of nP="<<nOfParts<<G4endl; |
---|
112 | #endif |
---|
113 | G4int curNP=GetQWorld().size(); |
---|
114 | //G4cout<<"G4QCHIPSWorld::GetParticles: Creating CHIPS World of curNP="<<curNP<<G4endl; |
---|
115 | if(nOfParts>curNP) // Initialization for increasing CHIPS World |
---|
116 | { |
---|
117 | if (nOfParts>mnofParts) |
---|
118 | { |
---|
119 | G4cerr<<"***G4QCHIPSWorld::GetPartics:nOfParts="<<nOfParts<<">"<<mnofParts<<G4endl; |
---|
120 | nOfParts=mnofParts; |
---|
121 | } |
---|
122 | if (nOfParts<10) nOfParts=10; // Minimal number of particles for Vacuum(?) |
---|
123 | #ifdef debug |
---|
124 | G4cout<<"G4QCHIPSWorld::GetParticles: n="<<nOfParts<<",c="<<curNP<<G4endl; |
---|
125 | #endif |
---|
126 | for (G4int i=curNP; i<nOfParts; i++) |
---|
127 | { |
---|
128 | #ifdef debug |
---|
129 | G4cout<<"G4QCHIPSWorld::GetParticles: Create particle QCode="<<i<<G4endl; |
---|
130 | #endif |
---|
131 | G4QParticle* curPart = new G4QParticle(cf,i); // Created with QCode=i |
---|
132 | #ifdef debug |
---|
133 | G4cout<<"G4QCHIPSWorld::GetParticles: Particle QCode="<<i<<" is created."<<G4endl; |
---|
134 | #endif |
---|
135 | //curPart->InitQParticle(i); // |
---|
136 | //if(!i) G4cout<<"G4QCHIPSWorld::GetParticles:Pt#0="<<curPart<<G4endl; |
---|
137 | GetQWorld().push_back(curPart); // Filled (forever but only once) |
---|
138 | #ifdef debug |
---|
139 | G4cout<<"G4QCHIPSWorld::GetParticles: Pt#"<<i<<"("<<nOfParts<<") is done"<<G4endl; |
---|
140 | #endif |
---|
141 | } |
---|
142 | } |
---|
143 | //else init--;//Recover theReInitializationCounter, if nothingWasAdded to theCHIPSWorld |
---|
144 | } |
---|
145 | #ifdef debug |
---|
146 | G4cout<<"G4QCHIPSWorld::GetParticles: TotalPt#"<<GetQWorld().size()<<G4endl; |
---|
147 | #endif |
---|
148 | return &GetQWorld(); |
---|
149 | } |
---|