G4QCHIPSWorld.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 //      ---------------- G4QCHIPSWorld ----------------
00030 //             by Mikhail Kossov, Sept 1999.
00031 //      class for the CHIPS World definition in CHIPS Model
00032 // -------------------------------------------------------------------
00033 // Short description: The CHIPS World is a world of elementary particles
00034 // and nuclear fragments. This class is a singletone, but without fixed
00035 // limits. E.g. the nuclear fragments as possible G4Candidates can be
00036 // initialized in the CHIPS World only up to Be8 od C12 or other bigger
00037 // nuclear fragment. If one need the heavy fragment production then the
00038 // the CHIPS World must be initialized up to these fragments (see the
00039 // CHIPS Manual), but the price in performans will be big, because in
00040 // each act of the fragmentation competition these numerous candidates
00041 // take place in the competition and the hadronization probability is
00042 // calculated each time for each of them, so the Be8 limit (Be8->alpha+
00043 // alpha decays very fast and contribute to the alpha-spectrum) is the
00044 // most optimal.
00045 // -------------------------------------------------------------------
00046 
00047 //#define debug
00048 //#define pdebug
00049 
00050 #include "G4QCHIPSWorld.hh"
00051 
00052 // Initialization of the CHIPSWorld Pointer
00053 // G4QCHIPSWorld* G4QCHIPSWorld::aWorld =0;
00054 // G4QParticleVector G4QCHIPSWorld::qWorld;
00055 
00056 // Constructor
00057 G4QCHIPSWorld::G4QCHIPSWorld()
00058 {
00059 }
00060 
00061 G4QCHIPSWorld::~G4QCHIPSWorld()      // The CHIPS World is destructed only in the EndOfJob
00062 {
00063   //G4int nP=GetQWorld().size();
00064   //G4cout<<"G4QCHIPSWorld::Destructor: Before nP="<<nP<<","<<GetQWorld()[0]<<G4endl; //TMP
00065   //if(nP) std::for_each(GetQWorld().begin(),GetQWorld().end(),DeleteQParticle());
00066   //G4cout<<"G4QCHIPSWorld::Destructor: After"<<G4endl; // TMP
00067   //GetQWorld().clear();
00068 }
00069 
00070 // Standard output for CHIPS World
00071 std::ostream& operator<<(std::ostream& lhs, G4QCHIPSWorld& rhs)
00072 {
00073   // @@ Later make a list of activated particles and clusters
00074   lhs << "[ Currently a#of particles in the CHIPS World = " << rhs.GetQPEntries() << "]";
00075   return lhs;
00076 }
00077 
00078 // Returns Pointer to the CHIPS World
00079 G4QCHIPSWorld* G4QCHIPSWorld::Get()
00080 {
00081   static G4QCHIPSWorld theWorld;                // *** Static body of the CHIPS World *** 
00082 // Returns Pointer to the CHIPS World
00083 //  if(!aWorld) aWorld=&theWorld;                 // Init the static pointer to CHIPS World
00084 //  return aWorld;
00085   return &theWorld;
00086 }
00087 
00088 G4QParticleVector & G4QCHIPSWorld::GetQWorld()
00089 {
00090   static G4QParticleVector theWorld;
00091   return theWorld;
00092 }
00093 
00094 // Return pointer to Particles of the CHIPS World
00095 G4QParticleVector* G4QCHIPSWorld::GetParticles(G4int nOfParts)
00096 {
00097   //static const G4int mnofParts = 486;           // max number of particles (up to A=80)
00098   //static const G4int mnofParts = 494;           // max number of particles (up to A=80)
00099   static const G4int mnofParts = 512; // max#of particles,A<57,G4QParticle::InitDecayVector
00100   static const G4bool cf = true;                // verbose=true G4QPDG construction flag
00101 #ifdef debug
00102   G4cout<<"G4QCHIPSWorld::GetParticles: n="<<nOfParts<<" particles"<<G4endl;
00103 #endif
00104   //if(GetQWorld().size())G4cout<<"G4QCHIPSWorld::GetPts:***Pt#0="<<GetQWorld()[0]<<G4endl;
00105   if(nOfParts>0)
00106   {
00107 #ifdef debug
00108     G4cout<<"G4QCHIPSWorld::GetParticles: Creating CHIPS World of nP="<<nOfParts<<G4endl;
00109 #endif
00110     G4int curNP=GetQWorld().size();
00111     //G4cout<<"G4QCHIPSWorld::GetParticles: Creating CHIPS World of curNP="<<curNP<<G4endl;
00112     if(nOfParts>curNP)                         // Initialization for increasing CHIPS World
00113     {
00114       if (nOfParts>mnofParts)
00115       {
00116         G4cerr<<"***G4QCHIPSWorld::GetPartics:nOfParts="<<nOfParts<<">"<<mnofParts<<G4endl;
00117         nOfParts=mnofParts;
00118       }
00119       if (nOfParts<10) nOfParts=10;            // Minimal number of particles for Vacuum(?)
00120 #ifdef debug
00121       G4cout<<"G4QCHIPSWorld::GetParticles: n="<<nOfParts<<",c="<<curNP<<G4endl;
00122 #endif
00123       for (G4int i=curNP; i<nOfParts; i++) 
00124       {
00125 #ifdef debug
00126         G4cout<<"G4QCHIPSWorld::GetParticles: Create particle QCode="<<i<<G4endl;
00127 #endif
00128         G4QParticle* curPart = new G4QParticle(cf,i); // Created with QCode=i
00129 #ifdef debug
00130         G4cout<<"G4QCHIPSWorld::GetParticles: Particle QCode="<<i<<" is created."<<G4endl;
00131 #endif
00132         //curPart->InitQParticle(i);             //
00133         //if(!i) G4cout<<"G4QCHIPSWorld::GetParticles:Pt#0="<<curPart<<G4endl;
00134         GetQWorld().push_back(curPart);           // Filled (forever but only once)
00135 #ifdef debug
00136         G4cout<<"G4QCHIPSWorld::GetParticles: Pt#"<<i<<"("<<nOfParts<<") is done"<<G4endl;
00137 #endif
00138       }
00139     }
00140     //else init--;//Recover theReInitializationCounter, if nothingWasAdded to theCHIPSWorld
00141   }
00142 #ifdef debug
00143   G4cout<<"G4QCHIPSWorld::GetParticles: TotalPt#"<<GetQWorld().size()<<G4endl;
00144 #endif
00145   return &GetQWorld();
00146 }

Generated on Mon May 27 17:49:31 2013 for Geant4 by  doxygen 1.4.7