Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4INCLStore.hh
이 파일의 문서화 페이지로 가기
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 // INCL++ intra-nuclear cascade model
27 // Alain Boudard, CEA-Saclay, France
28 // Joseph Cugnon, University of Liege, Belgium
29 // Jean-Christophe David, CEA-Saclay, France
30 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31 // Sylvie Leray, CEA-Saclay, France
32 // Davide Mancusi, CEA-Saclay, France
33 //
34 #define INCLXX_IN_GEANT4_MODE 1
35 
36 #include "globals.hh"
37 
38 #ifndef G4INCLParticleStore_hh
39 #define G4INCLParticleStore_hh 1
40 
41 #include <map>
42 #include <set>
43 #include <list>
44 #include <string>
45 #include <algorithm>
46 
47 #include "G4INCLParticle.hh"
48 #include "G4INCLIAvatar.hh"
49 #include "G4INCLBook.hh"
50 #include "G4INCLConfig.hh"
51 
52 #ifdef INCLXX_IN_GEANT4_MODE
53 #define INCL_AVATAR_SEARCH_MinElement 1
54 #endif // INCLXX_IN_GEANT4_MODE
55 
56 #if !defined(NDEBUG) && !defined(INCLXX_IN_GEANT4_MODE)
57 // Force instantiation of all the std::multimap<Particle*,IAvatar*> methods for
58 // debugging purposes
59 namespace G4INCL {
60  class Particle;
61  class IAvatar;
62 }
63 template class std::multimap<G4INCL::Particle*, G4INCL::IAvatar*>;
64 #endif
65 
66 namespace G4INCL {
67 
73  class Store {
74  public:
78  Store(Config const * const config);
79 
83  ~Store();
84 
93  void add(Particle *p);
94 
99  void add(ParticleList const &pL);
100 
102  void addParticleEntryAvatar(IAvatar *a);
103 
105  void addParticleEntryAvatars(IAvatarList const &al);
106 
121  void add(IAvatar *a);
122 
126  IAvatarList const &getAvatars() const {
127  return avatarList;
128  }
129 
135  void addIncomingParticle(Particle * const p);
136 
142  void removeFromIncoming(Particle * const p) { incoming.remove(p); }
143 
145  inline void clearIncoming() {
146  incoming.clear();
147  }
148 
150  inline void deleteIncoming() {
151  for(ParticleIter iter=incoming.begin(), e=incoming.end(); iter!=e; ++iter) {
152  delete (*iter);
153  }
154  clearIncoming();
155  }
156 
163  void particleHasBeenUpdated(Particle * const);
164 
166  void removeScheduledAvatars();
167 
171  IAvatar* findSmallestTime();
172 
177  void timeStep(G4double step);
178 
184  void particleHasBeenEjected(Particle * const);
185 
190  void addToOutgoing(Particle *p) { outgoing.push_back(p); }
191 
196  void addToOutgoing(ParticleList const &pl) {
197  for(ParticleIter p=pl.begin(), e=pl.end(); p!=e; ++p)
198  addToOutgoing(*p);
199  }
200 
205  void particleHasBeenDestroyed(Particle * const);
206 
211  void particleHasEntered(Particle * const particle);
212 
217  ParticleList const & getIncomingParticles() const { return incoming; }
218 
223  ParticleList const & getOutgoingParticles() const { return outgoing; }
224 
233  ParticleList spectators;
234  for(ParticleIter p=outgoing.begin(), e=outgoing.end(); p!=e; ++p) {
235  if((*p)->isProjectileSpectator()) {
236 // assert((*p)->isNucleon());
237  spectators.push_back(*p); // add them to the list we will return
238  }
239  }
240 
241  // Now erase them from outgoing
242  for(ParticleIter i=spectators.begin(); i!=spectators.end(); ++i) {
243  outgoing.remove(*i);
244  }
245 
246  return spectators;
247  }
248 
253  ParticleList const & getParticles() const { return inside; }
254 
259  Book &getBook() { return theBook; };
260 
262  G4int n=0;
263  for(ParticleIter i=inside.begin(), e=inside.end(); i!=e; ++i) {
264  if(!(*i)->isTargetSpectator())
265  ++n;
266  }
267  return n;
268  }
269 
273  Config const * getConfig() { return theConfig; };
274 
280  void clear();
281 
287  void clearInside();
288 
294  void clearOutgoing();
295 
299  void clearAvatars();
300 
305  void loadParticles(std::string const &filename);
306 
311  G4int getLoadedA() { return loadedA; };
312 
317  G4int getLoadedZ() { return loadedZ; };
318 
323  G4double getLoadedStoppingTime() { return loadedStoppingTime; };
324 
328  std::string printParticleConfiguration();
329 
333  void writeParticles(std::string const &filename);
334 
338  std::string printAvatars();
339 
340  G4bool containsCollisions() const;
341 
342 #if defined(INCL_AVATAR_SEARCH_FullSort) || defined(INCL_AVATAR_SEARCH_MinElement)
343 
353  return (lhs->getTime() < rhs->getTime());
354  }
355 #endif
356 
357  private:
359  Store(const Store &rhs);
360 
362  Store &operator=(Store const &rhs);
363 
364 
373  void connectAvatarToParticle(IAvatar * const a, Particle * const p);
374 
384  void disconnectAvatarFromParticle(IAvatar * const a, Particle * const p);
385 
393  void removeAvatar(IAvatar * const a);
394 
395  private:
399  std::multimap<Particle*, IAvatar*> particleAvatarConnections;
400  typedef std::multimap<Particle*, IAvatar*>::value_type PAPair;
401  typedef std::multimap<Particle*, IAvatar*>::iterator PAIter;
402  typedef std::pair<PAIter, PAIter> PAIterPair;
403 
405  std::set<IAvatar*> avatarsToBeRemoved;
406  typedef std::set<IAvatar*>::const_iterator ASIter;
407 
408  private:
413 
418 
423 
428 
433 
438 
443 
448 
453 
458 
462  Config const * theConfig;
463 
464  };
465 }
466 
467 #endif
ParticleList::const_iterator ParticleIter
G4int getLoadedZ()
Definition: G4INCLStore.hh:317
ParticleList const & getParticles() const
Definition: G4INCLStore.hh:253
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
Config const * theConfig
Definition: G4INCLStore.hh:462
IAvatarList avatarList
Definition: G4INCLStore.hh:412
std::pair< PAIter, PAIter > PAIterPair
Definition: G4INCLStore.hh:402
void removeFromIncoming(Particle *const p)
Definition: G4INCLStore.hh:142
ParticleList outgoing
Definition: G4INCLStore.hh:427
const char * p
Definition: xmltok.h:285
Book & getBook()
Definition: G4INCLStore.hh:259
std::set< IAvatar * >::const_iterator ASIter
Definition: G4INCLStore.hh:406
ParticleList incoming
Definition: G4INCLStore.hh:417
std::multimap< Particle *, IAvatar * >::value_type PAPair
Definition: G4INCLStore.hh:400
ParticleList const & getIncomingParticles() const
Definition: G4INCLStore.hh:217
ParticleList geomSpectators
Definition: G4INCLStore.hh:432
std::set< IAvatar * > avatarsToBeRemoved
Set of avatars to be removed.
Definition: G4INCLStore.hh:405
G4double currentTime
Definition: G4INCLStore.hh:437
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4double getTime() const
static G4bool avatarComparisonPredicate(IAvatar *lhs, IAvatar *rhs)
Comparison predicate for avatars.
Definition: G4INCLStore.hh:352
G4double getLoadedStoppingTime()
Definition: G4INCLStore.hh:323
ParticleList inside
Definition: G4INCLStore.hh:422
void clearIncoming()
Clear the incoming list.
Definition: G4INCLStore.hh:145
G4int getLoadedA()
Definition: G4INCLStore.hh:311
std::multimap< Particle *, IAvatar * > particleAvatarConnections
Definition: G4INCLStore.hh:399
G4int countCascading()
Definition: G4INCLStore.hh:261
std::multimap< Particle *, IAvatar * >::iterator PAIter
Definition: G4INCLStore.hh:401
void addToOutgoing(ParticleList const &pl)
Add a list of particles to the outgoing particle list.
Definition: G4INCLStore.hh:196
IAvatarList const & getAvatars() const
Definition: G4INCLStore.hh:126
int G4int
Definition: G4Types.hh:78
void deleteIncoming()
Clear the incoming list and delete the particles.
Definition: G4INCLStore.hh:150
Config const * getConfig()
Definition: G4INCLStore.hh:273
void addToOutgoing(Particle *p)
add the particle to the outgoing particle list.
Definition: G4INCLStore.hh:190
G4double loadedStoppingTime
Definition: G4INCLStore.hh:457
Char_t n[5]
ParticleList const & getOutgoingParticles() const
Definition: G4INCLStore.hh:223
ParticleList extractDynamicalSpectators()
Returns a list of dynamical spectators.
Definition: G4INCLStore.hh:232
vec_iX clear()