Warning, file /include/Geant4/G4INCLCascade.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #define INCLXX_IN_GEANT4_MODE 1
0035
0036 #include "globals.hh"
0037
0038 #ifndef G4INCLCascade_hh
0039 #define G4INCLCascade_hh 1
0040
0041 #include "G4INCLParticle.hh"
0042 #include "G4INCLNucleus.hh"
0043 #include "G4INCLIPropagationModel.hh"
0044 #include "G4INCLCascadeAction.hh"
0045 #include "G4INCLEventInfo.hh"
0046 #include "G4INCLGlobalInfo.hh"
0047 #include "G4INCLLogger.hh"
0048 #include "G4INCLConfig.hh"
0049 #include "G4INCLRootFinder.hh"
0050 #ifndef INCLXX_IN_GEANT4_MODE
0051 #include "G4INCLGeant4Compat.hh"
0052 #endif
0053
0054
0055 namespace G4INCL {
0056 class INCL {
0057 public:
0058 INCL(Config const * const config);
0059
0060 ~INCL();
0061
0062
0063 INCL(const INCL &rhs);
0064
0065
0066 INCL &operator=(const INCL &rhs);
0067
0068 G4bool prepareReaction(const ParticleSpecies &projectileSpecies, const G4double kineticEnergy, const G4int A, const G4int Z, const G4int S);
0069
0070 G4bool initializeTarget(const G4int A, const G4int Z, const G4int S, AnnihilationType theAType);
0071 G4double initUniverseRadiusForAntiprotonAtRest(const G4int A, const G4int Z);
0072 inline const EventInfo &processEvent() {
0073 return processEvent(
0074 theConfig->getProjectileSpecies(),
0075 theConfig->getProjectileKineticEnergy(),
0076 theConfig->getTargetA(),
0077 theConfig->getTargetZ(),
0078 theConfig->getTargetS()
0079 );
0080 }
0081 const EventInfo &processEvent(
0082 ParticleSpecies const &projectileSpecies,
0083 const G4double kineticEnergy,
0084 const G4int targetA,
0085 const G4int targetZ,
0086 const G4int targetS
0087 );
0088
0089 void finalizeGlobalInfo(Random::SeedVector const &initialSeeds);
0090 const GlobalInfo &getGlobalInfo() const { return theGlobalInfo; }
0091
0092
0093 private:
0094 IPropagationModel *propagationModel;
0095 G4int theA, theZ, theS;
0096 G4bool targetInitSuccess;
0097 G4double maxImpactParameter;
0098 G4double maxUniverseRadius;
0099 G4double maxInteractionDistance;
0100 G4double fixedImpactParameter;
0101 CascadeAction *cascadeAction;
0102 Config const * const theConfig;
0103 Nucleus *nucleus;
0104 G4bool forceTransparent;
0105
0106 EventInfo theEventInfo;
0107 GlobalInfo theGlobalInfo;
0108
0109
0110 G4int minRemnantSize;
0111
0112
0113 class RecoilFunctor : public RootFunctor {
0114 public:
0115
0116
0117
0118
0119 RecoilFunctor(Nucleus * const n, const EventInfo &ei) :
0120 RootFunctor(0., 1E6),
0121 nucleus(n),
0122 outgoingParticles(n->getStore()->getOutgoingParticles()),
0123 theEventInfo(ei) {
0124 for(ParticleIter p=outgoingParticles.begin(), e=outgoingParticles.end(); p!=e; ++p) {
0125 particleMomenta.push_back((*p)->getMomentum());
0126 particleKineticEnergies.push_back((*p)->getKineticEnergy());
0127 }
0128 ProjectileRemnant * const aPR = n->getProjectileRemnant();
0129 if(aPR && aPR->getA()>0) {
0130 particleMomenta.push_back(aPR->getMomentum());
0131 particleKineticEnergies.push_back(aPR->getKineticEnergy());
0132 outgoingParticles.push_back(aPR);
0133 }
0134 }
0135 virtual ~RecoilFunctor() {}
0136
0137
0138
0139
0140
0141
0142 G4double operator()(const G4double x) const {
0143 scaleParticleEnergies(x);
0144 return nucleus->getConservationBalance(theEventInfo,true).energy;
0145 }
0146
0147
0148 void cleanUp(const G4bool success) const {
0149 if(!success)
0150 scaleParticleEnergies(1.);
0151 }
0152
0153 private:
0154
0155 Nucleus *nucleus;
0156
0157 ParticleList outgoingParticles;
0158
0159 EventInfo const &theEventInfo;
0160
0161 std::list<ThreeVector> particleMomenta;
0162
0163 std::list<G4double> particleKineticEnergies;
0164
0165
0166
0167
0168
0169 void scaleParticleEnergies(const G4double rescale) const {
0170
0171 ThreeVector pBalance = nucleus->getIncomingMomentum();
0172 std::list<ThreeVector>::const_iterator iP = particleMomenta.begin();
0173 std::list<G4double>::const_iterator iE = particleKineticEnergies.begin();
0174 for( ParticleIter i = outgoingParticles.begin(), e = outgoingParticles.end(); i!=e; ++i, ++iP, ++iE)
0175 {
0176 const G4double mass = (*i)->getMass();
0177 const G4double newKineticEnergy = (*iE) * rescale;
0178
0179 (*i)->setMomentum(*iP);
0180 (*i)->setEnergy(mass + newKineticEnergy);
0181 (*i)->adjustMomentumFromEnergy();
0182
0183 pBalance -= (*i)->getMomentum();
0184 }
0185
0186 nucleus->setMomentum(pBalance);
0187 const G4double remnantMass = ParticleTable::getTableMass(nucleus->getA(),nucleus->getZ(),nucleus->getS()) + nucleus->getExcitationEnergy();
0188 const G4double pRem2 = pBalance.mag2();
0189 const G4double recoilEnergy = pRem2/
0190 (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
0191 nucleus->setEnergy(remnantMass + recoilEnergy);
0192 }
0193 };
0194
0195
0196 class RecoilCMFunctor : public RootFunctor {
0197 public:
0198
0199
0200
0201
0202 RecoilCMFunctor(Nucleus * const n, const EventInfo &ei) :
0203 RootFunctor(0., 1E6),
0204 nucleus(n),
0205 theIncomingMomentum(nucleus->getIncomingMomentum()),
0206 outgoingParticles(n->getStore()->getOutgoingParticles()),
0207 theEventInfo(ei) {
0208 if(theIncomingMomentum.mag() == 0.){
0209 thePTBoostVector = {0., 0., 0.};
0210
0211 }
0212 else{
0213 thePTBoostVector = nucleus->getIncomingMomentum()/(nucleus->getInitialEnergy());
0214
0215 }
0216 for(ParticleIter p=outgoingParticles.begin(), e=outgoingParticles.end(); p!=e; ++p) {
0217 (*p)->boost(thePTBoostVector);
0218 particleCMMomenta.push_back((*p)->getMomentum());
0219 }
0220 ProjectileRemnant * const aPR = n->getProjectileRemnant();
0221 if(aPR && aPR->getA()>0) {
0222 aPR->boost(thePTBoostVector);
0223 particleCMMomenta.push_back(aPR->getMomentum());
0224 outgoingParticles.push_back(aPR);
0225 }
0226 }
0227 virtual ~RecoilCMFunctor() {}
0228
0229
0230
0231
0232
0233
0234 G4double operator()(const G4double x) const {
0235 scaleParticleCMMomenta(x);
0236 return nucleus->getConservationBalance(theEventInfo,true).energy;
0237 }
0238
0239
0240 void cleanUp(const G4bool success) const {
0241 if(!success)
0242 scaleParticleCMMomenta(1.);
0243 }
0244
0245 private:
0246
0247 Nucleus *nucleus;
0248
0249 ThreeVector thePTBoostVector;
0250
0251 ThreeVector theIncomingMomentum;
0252
0253 ParticleList outgoingParticles;
0254
0255 EventInfo const &theEventInfo;
0256
0257 std::list<ThreeVector> particleCMMomenta;
0258
0259
0260
0261
0262
0263 void scaleParticleCMMomenta(const G4double rescale) const {
0264
0265 ThreeVector remnantMomentum = theIncomingMomentum;
0266 std::list<ThreeVector>::const_iterator iP = particleCMMomenta.begin();
0267 for( ParticleIter i = outgoingParticles.begin(), e = outgoingParticles.end(); i!=e; ++i, ++iP)
0268 {
0269 (*i)->setMomentum(*iP * rescale);
0270 (*i)->adjustEnergyFromMomentum();
0271 (*i)->boost(-thePTBoostVector);
0272
0273 remnantMomentum -= (*i)->getMomentum();
0274 }
0275
0276 nucleus->setMomentum(remnantMomentum);
0277 const G4double remnantMass = ParticleTable::getTableMass(nucleus->getA(),nucleus->getZ(),nucleus->getS()) + nucleus->getExcitationEnergy();
0278 const G4double pRem2 = remnantMomentum.mag2();
0279 const G4double recoilEnergy = pRem2/
0280 (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
0281 nucleus->setEnergy(remnantMass + recoilEnergy);
0282 }
0283 };
0284
0285
0286
0287
0288
0289
0290 void rescaleOutgoingForRecoil();
0291
0292 #ifndef INCLXX_IN_GEANT4_MODE
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302 void globalConservationChecks(G4bool afterRecoil);
0303 #endif
0304
0305
0306
0307
0308
0309
0310 G4bool continueCascade();
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329 G4int makeProjectileRemnant();
0330
0331
0332
0333
0334
0335
0336
0337
0338 void makeCompoundNucleus();
0339
0340
0341 G4bool preCascade(ParticleSpecies const &projectileSpecies, const G4double kineticEnergy);
0342
0343
0344 void cascade();
0345
0346
0347 void postCascade(const ParticleSpecies &projectileSpecies, const G4double kineticEnergy);
0348
0349
0350
0351
0352
0353 void initMaxInteractionDistance(ParticleSpecies const &p, const G4double kineticEnergy);
0354
0355
0356
0357
0358
0359
0360 void initUniverseRadius(ParticleSpecies const &p, const G4double kineticEnergy, const G4int A, const G4int Z);
0361
0362
0363 void updateGlobalInfo();
0364
0365
0366 G4double read_file(std::string filename, std::vector<G4double>& probabilities,
0367 std::vector<std::vector<G4String>>& particle_types);
0368
0369
0370 G4int findStringNumber(G4double rdm, std::vector<G4double> yields);
0371
0372
0373 void preCascade_pbarH1(ParticleSpecies const &projectileSpecies, const G4double kineticEnergy);
0374
0375
0376 void preCascade_pbarH2(ParticleSpecies const &projectileSpecies, const G4double kineticEnergy);
0377
0378
0379 void postCascade_pbarH1(ParticleList const &outgoingParticles);
0380
0381
0382 void postCascade_pbarH2(ParticleList const &outgoingParticles, ParticleList const &H2Particles);
0383 };
0384 }
0385
0386 #endif