Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4INCLCascadeAction.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 // INCL++ intra-nuclear cascade model
27 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28 // Davide Mancusi, CEA
29 // Alain Boudard, CEA
30 // Sylvie Leray, CEA
31 // Joseph Cugnon, University of Liege
32 //
33 #define INCLXX_IN_GEANT4_MODE 1
34 
35 #include "globals.hh"
36 
37 #include "G4INCLCascadeAction.hh"
38 #include "G4INCLLogger.hh"
39 #include "G4INCLRandom.hh"
40 
41 namespace G4INCL {
42 
44  stepCounter(0)
45  {}
46 
48  {}
49 
50  void CascadeAction::beforeRunAction(Config const *config) {
51  beforeRunDefaultAction(config);
52  beforeRunUserAction(config);
53  }
54 
55  void CascadeAction::beforeCascadeAction(IPropagationModel *pm) {
56  beforeCascadeDefaultAction(pm);
58  }
59 
60  void CascadeAction::beforePropagationAction(IPropagationModel *pm) {
61  beforePropagationDefaultAction(pm);
63  }
64 
65  void CascadeAction::beforeAvatarAction(IAvatar *a, Nucleus *n) {
66  beforeAvatarDefaultAction(a, n);
68  }
69 
70  void CascadeAction::afterAvatarAction(IAvatar *a, Nucleus *n, FinalState *fs) {
71  afterAvatarDefaultAction(a, n, fs);
72  afterAvatarUserAction(a, n, fs);
73  }
74 
75  void CascadeAction::afterPropagationAction(IPropagationModel *pm, IAvatar *avatar) {
76  afterPropagationDefaultAction(pm, avatar);
77  afterPropagationUserAction(pm, avatar);
78  }
79 
80  void CascadeAction::afterCascadeAction(Nucleus *n) {
81  afterCascadeDefaultAction(n);
83  }
84 
85  void CascadeAction::afterRunAction() {
86  afterRunDefaultAction();
88  }
89 
90 
91 
92  void CascadeAction::beforeRunDefaultAction(Config const * /*pm*/) {}
93 
94  void CascadeAction::beforeCascadeDefaultAction(IPropagationModel * /*pm*/) {}
95 
96  void CascadeAction::beforePropagationDefaultAction(IPropagationModel * /*pm*/) {
97  // assert(pm->getNucleus()->getStore()->getBook().getCascading() == pm->getNucleus()->getStore()->countCascading());
98  }
99 
100  void CascadeAction::beforeAvatarDefaultAction(IAvatar *a, Nucleus *n) {
101  n->getStore()->getBook().incrementAvatars(a->getType());
102  INCL_DEBUG("Random seeds before avatar " << a->getID() << ": "
103  << G4INCL::Random::getSeeds() << std::endl);
104  INCL_DEBUG("Next avatar:" << std::endl << a->dump() << std::endl);
105  }
106 
107  void CascadeAction::afterAvatarDefaultAction(IAvatar *a, Nucleus * /*n*/, FinalState *fs) {
108 
109  if(!fs) // do nothing if there is no final state
110  return;
111 
112  INCL_DEBUG("Random seeds after avatar " << a->getID() << ": "
113  << G4INCL::Random::getSeeds() << std::endl);
114 
115  ParticleList modified = fs->getModifiedParticles();
116  for(ParticleIter p=modified.begin(), e=modified.end(); p!=e; ++p )
117  if(a->isACollision())
118  (*p)->incrementNumberOfCollisions();
119  else if(a->isADecay())
120  (*p)->incrementNumberOfDecays();
121 
122  ParticleList created = fs->getCreatedParticles();
123  for(ParticleIter p=created.begin(), e=created.end(); p!=e; ++p )
124  if(a->isACollision())
125  (*p)->incrementNumberOfCollisions();
126  else if(a->isADecay())
127  (*p)->incrementNumberOfDecays();
128 
129  }
130 
131  void CascadeAction::afterPropagationDefaultAction(IPropagationModel * /* pm */,
132  IAvatar * /*avatar */) {
133  ++stepCounter; // Increment the step counter
134 
135 #ifdef INCL_DEBUG_LOG
136  // INCL_DATABLOCK(pm->getNucleus()->getStore()->printParticleConfiguration());
137 #endif
138  }
139 
140  void CascadeAction::afterCascadeDefaultAction(Nucleus * /*pm*/) {}
141 
142  void CascadeAction::afterRunDefaultAction() {}
143 
144 }
virtual void beforeAvatarUserAction(IAvatar *, Nucleus *)
const char * p
Definition: xmltok.h:285
Class containing default actions to be performed at intermediate cascade steps.
virtual void beforeCascadeUserAction(IPropagationModel *)
SeedVector getSeeds()
Definition: G4INCLRandom.cc:70
UnorderedVector< Particle * > ParticleList
virtual void afterRunUserAction()
const G4int n
virtual void afterPropagationUserAction(IPropagationModel *, IAvatar *)
virtual void afterAvatarUserAction(IAvatar *, Nucleus *, FinalState *)
virtual void beforePropagationUserAction(IPropagationModel *)
virtual void beforeRunUserAction(Config const *)
#define INCL_DEBUG(x)
virtual void afterCascadeUserAction(Nucleus *)
ParticleList::const_iterator ParticleIter