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 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/inclxx/incl_physics/include/G4INCLInteractionAvatar.hh (Version 11.3.0) and /processes/hadronic/models/inclxx/incl_physics/include/G4INCLInteractionAvatar.hh (Version 9.5)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // INCL++ intra-nuclear cascade model              26 // INCL++ intra-nuclear cascade model
 27 // Alain Boudard, CEA-Saclay, France           <<  27 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
 28 // Joseph Cugnon, University of Liege, Belgium <<  28 // Davide Mancusi, CEA
 29 // Jean-Christophe David, CEA-Saclay, France   <<  29 // Alain Boudard, CEA
 30 // Pekka Kaitaniemi, CEA-Saclay, France, and H <<  30 // Sylvie Leray, CEA
 31 // Sylvie Leray, CEA-Saclay, France            <<  31 // Joseph Cugnon, University of Liege
 32 // Davide Mancusi, CEA-Saclay, France          <<  32 //
                                                   >>  33 // INCL++ revision: v5.0_rc3
 33 //                                                 34 //
 34 #define INCLXX_IN_GEANT4_MODE 1                    35 #define INCLXX_IN_GEANT4_MODE 1
 35                                                    36 
 36 #include "globals.hh"                              37 #include "globals.hh"
 37                                                    38 
 38 /* \file G4INCLInteractionAvatar.hh                39 /* \file G4INCLInteractionAvatar.hh
 39  * \brief Virtual class for interaction avatar <<  40  * \brief Virtual class for G4interaction avatars.
 40  *                                                 41  *
 41  * This class is inherited by decay and collis     42  * This class is inherited by decay and collision avatars. The goal is to
 42  * provide a uniform treatment of common physi     43  * provide a uniform treatment of common physics, such as Pauli blocking,
 43  * enforcement of energy conservation, etc.        44  * enforcement of energy conservation, etc.
 44  *                                                 45  *
 45  *  \date Mar 1st, 2011                        <<  46  *  Created on: Mar 1st, 2011
 46  * \author Davide Mancusi                      <<  47  *      Author: Davide Mancusi
 47  */                                                48  */
 48                                                    49 
 49 #ifndef G4INCLINTERACTIONAVATAR_HH_                50 #ifndef G4INCLINTERACTIONAVATAR_HH_
 50 #define G4INCLINTERACTIONAVATAR_HH_                51 #define G4INCLINTERACTIONAVATAR_HH_
 51                                                    52 
 52 #include "G4INCLIAvatar.hh"                        53 #include "G4INCLIAvatar.hh"
 53 #include "G4INCLNucleus.hh"                        54 #include "G4INCLNucleus.hh"
 54 #include "G4INCLFinalState.hh"                     55 #include "G4INCLFinalState.hh"
 55 #include "G4INCLRootFinder.hh"                     56 #include "G4INCLRootFinder.hh"
 56 #include "G4INCLKinematicsUtils.hh"                57 #include "G4INCLKinematicsUtils.hh"
 57 #include "G4INCLAllocationPool.hh"             << 
 58                                                    58 
 59 namespace G4INCL {                                 59 namespace G4INCL {
 60                                                    60 
 61   class InteractionAvatar : public G4INCL::IAv     61   class InteractionAvatar : public G4INCL::IAvatar {
 62     public:                                        62     public:
 63       InteractionAvatar(G4double, G4INCL::Nucl     63       InteractionAvatar(G4double, G4INCL::Nucleus*, G4INCL::Particle*);
 64       InteractionAvatar(G4double, G4INCL::Nucl     64       InteractionAvatar(G4double, G4INCL::Nucleus*, G4INCL::Particle*, G4INCL::Particle*);
 65       virtual ~InteractionAvatar();                65       virtual ~InteractionAvatar();
 66                                                    66 
 67       /// \brief Target accuracy in the determ     67       /// \brief Target accuracy in the determination of the local-energy Q-value
 68       static const G4double locEAccuracy;          68       static const G4double locEAccuracy;
 69       /// \brief Max number of iterations for      69       /// \brief Max number of iterations for the determination of the local-energy Q-value
 70       static const G4int maxIterLocE;              70       static const G4int maxIterLocE;
 71                                                    71 
 72       /// \brief Release the memory allocated  << 
 73       static void deleteBackupParticles();     << 
 74                                                << 
 75     protected:                                     72     protected:
 76       virtual G4INCL::IChannel* getChannel() = <<  73       virtual G4INCL::IChannel* getChannel() const = 0;
 77                                                    74 
 78       G4bool bringParticleInside(Particle * co     75       G4bool bringParticleInside(Particle * const p);
 79                                                    76 
 80       /** \brief Apply local-energy transforma     77       /** \brief Apply local-energy transformation, if appropriate
 81        *                                           78        *
 82        * \param p particle to apply the transf     79        * \param p particle to apply the transformation to
 83        */                                          80        */
 84       void preInteractionLocalEnergy(Particle      81       void preInteractionLocalEnergy(Particle * const p);
 85                                                    82 
 86       /** \brief Store the state of the partic <<  83       /** \brief Store the state of the particles before the G4interaction
 87        *                                           84        *
 88        * If the interaction cannot be realised <<  85        * If the G4interaction cannot be realised for any reason, we will need to
 89        * restore the particle state as it was      86        * restore the particle state as it was before. This is done by calling
 90        * the restoreParticles() method.            87        * the restoreParticles() method.
 91        */                                          88        */
 92       void preInteractionBlocking();               89       void preInteractionBlocking();
 93                                                    90 
 94       void preInteraction();                       91       void preInteraction();
 95       void postInteraction(FinalState *);      <<  92       FinalState *postInteraction(FinalState *);
 96                                                    93 
 97       /** \brief Restore the state of both par     94       /** \brief Restore the state of both particles.
 98        *                                           95        *
 99        * The state must first be stored by cal     96        * The state must first be stored by calling preInteractionBlocking().
100        */                                          97        */
101       void restoreParticles() const;               98       void restoreParticles() const;
102                                                    99 
103       /// \brief true if the given avatar shou    100       /// \brief true if the given avatar should use local energy
104       G4bool shouldUseLocalEnergy() const;     << 101       G4bool shouldUseLocalEnergy() const {
                                                   >> 102         if(!theNucleus) return false;
                                                   >> 103         LocalEnergyType theLocalEnergyType;
                                                   >> 104         if(getType()==DecayAvatarType || isPiN)
                                                   >> 105           theLocalEnergyType = theNucleus->getStore()->getConfig()->getLocalEnergyPiType();
                                                   >> 106         else
                                                   >> 107           theLocalEnergyType = theNucleus->getStore()->getConfig()->getLocalEnergyBBType();
                                                   >> 108 
                                                   >> 109         const G4bool firstAvatar = (theNucleus->getStore()->getBook()->getAcceptedCollisions() == 0);
                                                   >> 110         return ((theLocalEnergyType == FirstCollisionLocalEnergy && firstAvatar) ||
                                                   >> 111             theLocalEnergyType == AlwaysLocalEnergy);
                                                   >> 112       }
105                                                   113 
106       Nucleus *theNucleus;                     << 114       G4INCL::Nucleus *theNucleus;
107       Particle *particle1, *particle2;         << 115       G4INCL::Particle *particle1, *particle2;
108       static G4ThreadLocal Particle *backupPar << 
109       ThreeVector boostVector;                    116       ThreeVector boostVector;
110       G4double oldTotalEnergy, oldXSec;        << 117       ParticleType oldParticle1Type, oldParticle2Type;
                                                   >> 118       G4double oldParticle1Energy, oldParticle2Energy, oldTotalEnergy, oldXSec;
                                                   >> 119       G4double oldParticle1Potential, oldParticle2Potential;
                                                   >> 120       G4double oldParticle1Mass, oldParticle2Mass;
                                                   >> 121       G4double oldParticle1Helicity, oldParticle2Helicity;
                                                   >> 122       ThreeVector oldParticle1Momentum, oldParticle2Momentum;
                                                   >> 123       ThreeVector oldParticle1Position, oldParticle2Position;
111       G4bool isPiN;                               124       G4bool isPiN;
112       G4double weight;                         << 
113                                                   125 
114     private:                                      126     private:
115       /// \brief RootFunctor-derived object fo    127       /// \brief RootFunctor-derived object for enforcing energy conservation in N-N.
116       class ViolationEMomentumFunctor : public    128       class ViolationEMomentumFunctor : public RootFunctor {
117         public:                                   129         public:
118           /** \brief Prepare for calling the (    130           /** \brief Prepare for calling the () operator and scaleParticleMomenta
119            *                                      131            *
120            * The constructor sets the private     132            * The constructor sets the private class members.
121            */                                     133            */
122           ViolationEMomentumFunctor(Nucleus *  << 134           ViolationEMomentumFunctor(Nucleus * const nucleus, FinalState const * const finalState, ThreeVector const * const boost, const G4bool localE);
123           virtual ~ViolationEMomentumFunctor() << 135           virtual ~ViolationEMomentumFunctor() { particleMomenta.clear(); }
124                                                   136 
125           /** \brief Compute the energy-conser    137           /** \brief Compute the energy-conservation violation.
126            *                                      138            *
127            * \param x scale factor for the par << 139            * \param alpha scale factor for the particle momenta
128            * \return the energy-conservation v    140            * \return the energy-conservation violation
129            */                                     141            */
130           G4double operator()(const G4double x    142           G4double operator()(const G4double x) const;
131                                                   143 
132           /// \brief Clean up after root findi    144           /// \brief Clean up after root finding
133           void cleanUp(const G4bool success) c    145           void cleanUp(const G4bool success) const;
134                                                   146 
135         private:                                  147         private:
136           /// \brief List of final-state parti    148           /// \brief List of final-state particles.
137           ParticleList finalParticles;            149           ParticleList finalParticles;
138           /// \brief CM particle momenta, as d    150           /// \brief CM particle momenta, as determined by the channel.
139           std::vector<ThreeVector> particleMom << 151           std::list<ThreeVector> particleMomenta;
140           /// \brief Total energy before the i << 152           /// \brief Total energy before the G4interaction.
141           G4double initialEnergy;                 153           G4double initialEnergy;
142           /// \brief Pointer to the nucleus    << 154           /// \brief PoG4inter to the nucleus
143           Nucleus *theNucleus;                    155           Nucleus *theNucleus;
144           /// \brief Pointer to the boost vect << 156           /// \brief PoG4inter to the boost vector
145           ThreeVector const &boostVector;      << 157           ThreeVector const *boostVector;
                                                   >> 158           /// \brief true if we must apply local energy to nucleons
                                                   >> 159           G4bool hasLocalEnergy;
                                                   >> 160           /// \brief true if we must apply local energy to deltas
                                                   >> 161           G4bool hasLocalEnergyDelta;
146                                                   162 
147           /// \brief True if we should use loc    163           /// \brief True if we should use local energy
148           const G4bool shouldUseLocalEnergy;      164           const G4bool shouldUseLocalEnergy;
149                                                   165 
150           /** \brief Scale the momenta of the     166           /** \brief Scale the momenta of the modified and created particles.
151            *                                      167            *
152            * Set the momenta of the modified a    168            * Set the momenta of the modified and created particles to alpha times
153            * their original momenta (stored in    169            * their original momenta (stored in particleMomenta). You must call
154            * init() before using this method.     170            * init() before using this method.
155            *                                   << 171            * 
156            * \param alpha scale factor            172            * \param alpha scale factor
157            */                                     173            */
158           void scaleParticleMomenta(const G4do    174           void scaleParticleMomenta(const G4double alpha) const;
159                                                   175 
160       };                                          176       };
161                                                   177 
162       /// \brief RootFunctor-derived object fo << 178       /// \brief RootFunctor-derived object for enforcing energy conservation in pi-N.
163       class ViolationEEnergyFunctor : public R    179       class ViolationEEnergyFunctor : public RootFunctor {
164         public:                                   180         public:
165           /** \brief Prepare for calling the ( << 181           /** \brief Prepare for calling the () operator and scaleParticleMomenta
166            *                                      182            *
167            * The constructor sets the private     183            * The constructor sets the private class members.
168            */                                     184            */
169           ViolationEEnergyFunctor(Nucleus * co << 185           ViolationEEnergyFunctor(Nucleus * const nucleus, FinalState const * const finalState);
170           virtual ~ViolationEEnergyFunctor() {    186           virtual ~ViolationEEnergyFunctor() {}
171                                                   187 
172           /** \brief Compute the energy-conser    188           /** \brief Compute the energy-conservation violation.
173            *                                      189            *
174            * \param x scale factor for the par << 190            * \param alpha scale factor for the particle momenta
175            * \return the energy-conservation v    191            * \return the energy-conservation violation
176            */                                     192            */
177           G4double operator()(const G4double x    193           G4double operator()(const G4double x) const;
178                                                   194 
179           /// \brief Clean up after root findi    195           /// \brief Clean up after root finding
180           void cleanUp(const G4bool success) c    196           void cleanUp(const G4bool success) const;
181                                                   197 
182           /** \brief Set the energy of the par    198           /** \brief Set the energy of the particle.
183            *                                      199            *
184            * \param energy                        200            * \param energy
185            */                                     201            */
186           void setParticleEnergy(const G4doubl    202           void setParticleEnergy(const G4double energy) const;
187                                                   203 
188         private:                                  204         private:
189           /// \brief Total energy before the i << 205           /// \brief Total energy before the G4interaction.
190           G4double initialEnergy;                 206           G4double initialEnergy;
191           /// \brief Pointer to the nucleus.   << 207           /// \brief PoG4inter to the nucleus.
192           Nucleus *theNucleus;                    208           Nucleus *theNucleus;
193           /// \brief The final-state particle.    209           /// \brief The final-state particle.
194           Particle *theParticle;                  210           Particle *theParticle;
195           /// \brief The initial energy of the    211           /// \brief The initial energy of the particle.
196           G4double theEnergy;                     212           G4double theEnergy;
197           /// \brief The initial momentum of t    213           /// \brief The initial momentum of the particle.
198           ThreeVector theMomentum;                214           ThreeVector theMomentum;
199           /** \brief Threshold for the energy     215           /** \brief Threshold for the energy of the particle
200            *                                      216            *
201            * The particle (a delta) cannot hav    217            * The particle (a delta) cannot have less than this energy.
202            */                                     218            */
203           G4double energyThreshold;               219           G4double energyThreshold;
204           /// \brief Whether we should use loc << 
205           const G4bool shouldUseLocalEnergy;   << 
206       };                                          220       };
207                                                   221 
208       RootFunctor *violationEFunctor;             222       RootFunctor *violationEFunctor;
209                                                   223 
210     protected:                                    224     protected:
211       /** \brief Enforce energy conservation.     225       /** \brief Enforce energy conservation.
212        *                                          226        *
213        * Final states generated by the channel    227        * Final states generated by the channels might violate energy conservation
214        * because of different reasons (energy-    228        * because of different reasons (energy-dependent potentials, local
215        * energy...). This conservation law mus    229        * energy...). This conservation law must therefore be enforced by hand. We
216        * do so by rescaling the momenta of the    230        * do so by rescaling the momenta of the final-state particles in the CM
217        * frame. If this turns out to be imposs    231        * frame. If this turns out to be impossible, this method returns false.
218        *                                          232        *
219        * \return true if the algorithm succeed    233        * \return true if the algorithm succeeded
220        */                                         234        */
221       G4bool enforceEnergyConservation(FinalSt    235       G4bool enforceEnergyConservation(FinalState * const fs);
222                                                   236 
223       ParticleList modified, created, modified << 
224                                                << 
225       INCL_DECLARE_ALLOCATION_POOL(Interaction << 
226   };                                              237   };
227                                                   238 
228 }                                                 239 }
229                                                   240 
230 #endif /* G4INCLINTERACTIONAVATAR_HH_ */          241 #endif /* G4INCLINTERACTIONAVATAR_HH_ */
231                                                   242