[819] | 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 | // |
---|
[1340] | 27 | // $Id: G4QCHIPSWorld.cc,v 1.34 2010/06/23 13:56:30 mkossov Exp $ |
---|
| 28 | // GEANT4 tag $Name: hadr-chips-V09-03-08 $ |
---|
[819] | 29 | // |
---|
| 30 | // ---------------- G4QCHIPSWorld ---------------- |
---|
| 31 | // by Mikhail Kossov, Sept 1999. |
---|
| 32 | // class for the CHIPS World definition in CHIPS Model |
---|
| 33 | // ------------------------------------------------------------------- |
---|
[1055] | 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 | // ------------------------------------------------------------------- |
---|
[819] | 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) |
---|
[1340] | 102 | //static const G4int mnofParts = 494; // max number of particles (up to A=80) |
---|
| 103 | static const G4int mnofParts = 512; // max#of particles,A<57,G4QParticle::InitDecayVector |
---|
[819] | 104 | static const G4bool cf = true; // verbose=true G4QPDG construction flag |
---|
| 105 | #ifdef debug |
---|
| 106 | G4cout<<"G4QCHIPSWorld::GetParticles: n="<<nOfParts<<" particles"<<G4endl; |
---|
| 107 | #endif |
---|
| 108 | //if(GetQWorld().size())G4cout<<"G4QCHIPSWorld::GetPts:***Pt#0="<<GetQWorld()[0]<<G4endl; |
---|
| 109 | if(nOfParts>0) |
---|
| 110 | { |
---|
| 111 | #ifdef debug |
---|
| 112 | G4cout<<"G4QCHIPSWorld::GetParticles: Creating CHIPS World of nP="<<nOfParts<<G4endl; |
---|
| 113 | #endif |
---|
| 114 | G4int curNP=GetQWorld().size(); |
---|
| 115 | //G4cout<<"G4QCHIPSWorld::GetParticles: Creating CHIPS World of curNP="<<curNP<<G4endl; |
---|
| 116 | if(nOfParts>curNP) // Initialization for increasing CHIPS World |
---|
| 117 | { |
---|
| 118 | if (nOfParts>mnofParts) |
---|
| 119 | { |
---|
| 120 | G4cerr<<"***G4QCHIPSWorld::GetPartics:nOfParts="<<nOfParts<<">"<<mnofParts<<G4endl; |
---|
| 121 | nOfParts=mnofParts; |
---|
| 122 | } |
---|
| 123 | if (nOfParts<10) nOfParts=10; // Minimal number of particles for Vacuum(?) |
---|
| 124 | #ifdef debug |
---|
| 125 | G4cout<<"G4QCHIPSWorld::GetParticles: n="<<nOfParts<<",c="<<curNP<<G4endl; |
---|
| 126 | #endif |
---|
| 127 | for (G4int i=curNP; i<nOfParts; i++) |
---|
| 128 | { |
---|
| 129 | #ifdef debug |
---|
[1055] | 130 | G4cout<<"G4QCHIPSWorld::GetParticles: Create particle QCode="<<i<<G4endl; |
---|
[819] | 131 | #endif |
---|
| 132 | G4QParticle* curPart = new G4QParticle(cf,i); // Created with QCode=i |
---|
| 133 | #ifdef debug |
---|
[1055] | 134 | G4cout<<"G4QCHIPSWorld::GetParticles: Particle QCode="<<i<<" is created."<<G4endl; |
---|
[819] | 135 | #endif |
---|
| 136 | //curPart->InitQParticle(i); // |
---|
| 137 | //if(!i) G4cout<<"G4QCHIPSWorld::GetParticles:Pt#0="<<curPart<<G4endl; |
---|
| 138 | GetQWorld().push_back(curPart); // Filled (forever but only once) |
---|
| 139 | #ifdef debug |
---|
| 140 | G4cout<<"G4QCHIPSWorld::GetParticles: Pt#"<<i<<"("<<nOfParts<<") is done"<<G4endl; |
---|
| 141 | #endif |
---|
| 142 | } |
---|
| 143 | } |
---|
| 144 | //else init--;//Recover theReInitializationCounter, if nothingWasAdded to theCHIPSWorld |
---|
| 145 | } |
---|
| 146 | #ifdef debug |
---|
| 147 | G4cout<<"G4QCHIPSWorld::GetParticles: TotalPt#"<<GetQWorld().size()<<G4endl; |
---|
| 148 | #endif |
---|
| 149 | return &GetQWorld(); |
---|
| 150 | } |
---|