Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:47

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file biasing/ReverseMC01/src/G4AdjointPhysicsList.cc
0027 /// \brief Implementation of the G4AdjointPhysicsList class
0028 //
0029 //
0030 //////////////////////////////////////////////////////////////
0031 //  Class Name:        G4AdjointPhysicsList
0032 //        Author:               L. Desorgher
0033 //         Organisation:         SpaceIT GmbH
0034 //        Contract:        ESA contract 21435/08/NL/AT
0035 //         Customer:             ESA/ESTEC
0036 //////////////////////////////////////////////////////////////
0037 
0038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0039 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0040 
0041 #include "G4AdjointPhysicsList.hh"
0042 
0043 #include "G4AdjointPhysicsMessenger.hh"
0044 #include "G4ParticleTypes.hh"
0045 #include "G4ProcessManager.hh"
0046 #include "G4SystemOfUnits.hh"
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 
0050 G4AdjointPhysicsList::G4AdjointPhysicsList()
0051   : G4VUserPhysicsList(),
0052     fEminusIonisation(0),
0053     fPIonisation(0),
0054     fUse_forced_interaction(true),
0055     fUse_eionisation(true),
0056     fUse_pionisation(true),
0057     fUse_brem(true),
0058     fUse_compton(true),
0059     fUse_ms(true),
0060     fUse_egain_fluctuation(true),
0061     fUse_peeffect(true),
0062     fEmin_adj_models(1. * keV),
0063     fEmax_adj_models(1. * MeV),
0064     fCS_biasing_factor_compton(1.),
0065     fCS_biasing_factor_brem(1.),
0066     fCS_biasing_factor_ionisation(1.),
0067     fCS_biasing_factor_PEeffect(1.)
0068 {
0069   defaultCutValue = 1.0 * mm;
0070   SetVerboseLevel(1);
0071   fPhysicsMessenger = new G4AdjointPhysicsMessenger(this);
0072 }
0073 
0074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0075 
0076 G4AdjointPhysicsList::~G4AdjointPhysicsList() {}
0077 void G4AdjointPhysicsList::ConstructParticle()
0078 {
0079   // In this method, static member functions should be called
0080   // for all particles which you want to use.
0081   // This ensures that objects of these particle types will be
0082   // created in the program.
0083   ConstructBosons();
0084   ConstructLeptons();
0085   ConstructMesons();
0086   ConstructBaryons();
0087   ConstructAdjointParticles();
0088 }
0089 
0090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0091 
0092 void G4AdjointPhysicsList::SetLossFluctuationFlag(bool aBool)
0093 {
0094   if (fEminusIonisation) fEminusIonisation->SetLossFluctuations(aBool);
0095 }
0096 
0097 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0098 
0099 void G4AdjointPhysicsList::ConstructBosons()
0100 {
0101   // pseudo-particles
0102   G4Geantino::GeantinoDefinition();
0103   G4ChargedGeantino::ChargedGeantinoDefinition();
0104 
0105   // gamma
0106   G4Gamma::GammaDefinition();
0107 
0108   // optical photon
0109   G4OpticalPhoton::OpticalPhotonDefinition();
0110 }
0111 
0112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0113 
0114 void G4AdjointPhysicsList::ConstructLeptons()
0115 {
0116   // leptons
0117   G4Electron::ElectronDefinition();
0118   G4Positron::PositronDefinition();
0119   G4MuonPlus::MuonPlusDefinition();
0120   G4MuonMinus::MuonMinusDefinition();
0121 
0122   G4NeutrinoE::NeutrinoEDefinition();
0123   G4AntiNeutrinoE::AntiNeutrinoEDefinition();
0124   G4NeutrinoMu::NeutrinoMuDefinition();
0125   G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
0126 }
0127 
0128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0129 
0130 void G4AdjointPhysicsList::ConstructMesons()
0131 {
0132   //  mesons
0133   G4PionPlus::PionPlusDefinition();
0134   G4PionMinus::PionMinusDefinition();
0135   G4PionZero::PionZeroDefinition();
0136   G4Eta::EtaDefinition();
0137   G4EtaPrime::EtaPrimeDefinition();
0138   G4KaonPlus::KaonPlusDefinition();
0139   G4KaonMinus::KaonMinusDefinition();
0140   G4KaonZero::KaonZeroDefinition();
0141   G4AntiKaonZero::AntiKaonZeroDefinition();
0142   G4KaonZeroLong::KaonZeroLongDefinition();
0143   G4KaonZeroShort::KaonZeroShortDefinition();
0144 }
0145 
0146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0147 
0148 void G4AdjointPhysicsList::ConstructBaryons()
0149 {
0150   //  barions
0151   G4Proton::ProtonDefinition();
0152   G4AntiProton::AntiProtonDefinition();
0153   G4Neutron::NeutronDefinition();
0154   G4AntiNeutron::AntiNeutronDefinition();
0155 }
0156 
0157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0158 
0159 #include "G4AdjointElectron.hh"
0160 #include "G4AdjointGamma.hh"
0161 #include "G4AdjointProton.hh"
0162 void G4AdjointPhysicsList::ConstructAdjointParticles()
0163 {
0164   // adjoint_gammma
0165   G4AdjointGamma::AdjointGammaDefinition();
0166 
0167   // adjoint_electron
0168   G4AdjointElectron::AdjointElectronDefinition();
0169 
0170   // adjoint_proton
0171   G4AdjointProton::AdjointProtonDefinition();
0172 }
0173 
0174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0175 
0176 void G4AdjointPhysicsList::ConstructProcess()
0177 {
0178   AddTransportation();
0179   ConstructEM();
0180   ConstructGeneral();
0181 }
0182 
0183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0184 
0185 // #include "G4PEEffectFluoModel.hh"
0186 #include "G4ComptonScattering.hh"
0187 #include "G4GammaConversion.hh"
0188 #include "G4PhotoElectricEffect.hh"
0189 #include "G4eAdjointMultipleScattering.hh"
0190 #include "G4eBremsstrahlung.hh"
0191 #include "G4eIonisation.hh"
0192 #include "G4eMultipleScattering.hh"
0193 #include "G4eplusAnnihilation.hh"
0194 #include "G4hIonisation.hh"
0195 #include "G4hMultipleScattering.hh"
0196 #include "G4ionIonisation.hh"
0197 // #include "G4IonParametrisedLossModel.hh"
0198 
0199 #include "G4AdjointAlongStepWeightCorrection.hh"
0200 #include "G4AdjointBremsstrahlungModel.hh"
0201 #include "G4AdjointCSManager.hh"
0202 #include "G4AdjointComptonModel.hh"
0203 #include "G4AdjointForcedInteractionForGamma.hh"
0204 #include "G4AdjointIonIonisationModel.hh"
0205 #include "G4AdjointPhotoElectricModel.hh"
0206 #include "G4AdjointProcessEquivalentToDirectProcess.hh"
0207 #include "G4AdjointSimManager.hh"
0208 #include "G4AdjointeIonisationModel.hh"
0209 #include "G4AdjointhIonisationModel.hh"
0210 #include "G4AdjointhMultipleScattering.hh"
0211 #include "G4ContinuousGainOfEnergy.hh"
0212 #include "G4InversePEEffect.hh"
0213 #include "G4IonInverseIonisation.hh"
0214 #include "G4PhysicalConstants.hh"
0215 #include "G4SystemOfUnits.hh"
0216 #include "G4UrbanAdjointMscModel.hh"
0217 #include "G4UrbanMscModel.hh"
0218 #include "G4eBremsstrahlung.hh"
0219 #include "G4eInverseBremsstrahlung.hh"
0220 #include "G4eInverseCompton.hh"
0221 #include "G4eInverseIonisation.hh"
0222 #include "G4hInverseIonisation.hh"
0223 
0224 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0225 
0226 void G4AdjointPhysicsList::ConstructEM()
0227 {
0228   G4AdjointCSManager* theCSManager = G4AdjointCSManager::GetAdjointCSManager();
0229   G4AdjointSimManager* theAdjointSimManager = G4AdjointSimManager::GetInstance();
0230 
0231   theCSManager->RegisterAdjointParticle(G4AdjointElectron::AdjointElectron());
0232 
0233   if (fUse_brem || fUse_peeffect || fUse_compton)
0234     theCSManager->RegisterAdjointParticle(G4AdjointGamma::AdjointGamma());
0235 
0236   if (fUse_eionisation) {
0237     if (!fEminusIonisation) fEminusIonisation = new G4eIonisation();
0238     fEminusIonisation->SetLossFluctuations(fUse_egain_fluctuation);
0239   }
0240   if (fUse_pionisation) {
0241     if (!fPIonisation) fPIonisation = new G4hIonisation();
0242     fPIonisation->SetLossFluctuations(fUse_egain_fluctuation);
0243     theCSManager->RegisterAdjointParticle(G4AdjointProton::AdjointProton());
0244   }
0245 
0246   G4eBremsstrahlung* theeminusBremsstrahlung = 0;
0247   if (fUse_brem && fUse_eionisation) theeminusBremsstrahlung = new G4eBremsstrahlung();
0248 
0249   G4ComptonScattering* theComptonScattering = 0;
0250   if (fUse_compton) theComptonScattering = new G4ComptonScattering();
0251 
0252   G4PhotoElectricEffect* thePEEffect = 0;
0253   if (fUse_peeffect) thePEEffect = new G4PhotoElectricEffect();
0254 
0255   G4eMultipleScattering* theeminusMS = 0;
0256   G4hMultipleScattering* thepMS = 0;
0257   G4eAdjointMultipleScattering* theeminusAdjointMS = 0;
0258   if (fUse_ms) {
0259     theeminusMS = new G4eMultipleScattering();
0260     G4UrbanMscModel* msc1 = new G4UrbanMscModel();
0261     theeminusMS->SetEmModel(msc1);
0262     theeminusAdjointMS = new G4eAdjointMultipleScattering();
0263     G4UrbanAdjointMscModel* msc2 = new G4UrbanAdjointMscModel();
0264     theeminusAdjointMS->SetEmModel(msc2);
0265     thepMS = new G4hMultipleScattering();
0266   }
0267 
0268   G4VProcess* theGammaConversion = 0;
0269   if (fUse_gamma_conversion) theGammaConversion = new G4GammaConversion();
0270   // Define adjoint e- ionisation
0271   //-------------------
0272   G4AdjointeIonisationModel* theeInverseIonisationModel = 0;
0273   G4eInverseIonisation* theeInverseIonisationProjToProjCase = 0;
0274   G4eInverseIonisation* theeInverseIonisationProdToProjCase = 0;
0275   if (fUse_eionisation) {
0276     theeInverseIonisationModel = new G4AdjointeIonisationModel();
0277     theeInverseIonisationModel->SetHighEnergyLimit(fEmax_adj_models);
0278     theeInverseIonisationModel->SetLowEnergyLimit(fEmin_adj_models);
0279     theeInverseIonisationModel->SetCSBiasingFactor(fCS_biasing_factor_ionisation);
0280     theeInverseIonisationProjToProjCase =
0281       new G4eInverseIonisation(true, "Inv_eIon", theeInverseIonisationModel);
0282     theeInverseIonisationProdToProjCase =
0283       new G4eInverseIonisation(false, "Inv_eIon1", theeInverseIonisationModel);
0284     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
0285   }
0286 
0287   // Define  adjoint Bremsstrahlung
0288   //-------------------------------
0289   G4AdjointBremsstrahlungModel* theeInverseBremsstrahlungModel = 0;
0290   G4eInverseBremsstrahlung* theeInverseBremsstrahlungProjToProjCase = 0;
0291   G4eInverseBremsstrahlung* theeInverseBremsstrahlungProdToProjCase = 0;
0292   G4AdjointForcedInteractionForGamma* theForcedInteractionForGamma = 0;
0293   if (fUse_brem && fUse_eionisation) {
0294     theeInverseBremsstrahlungModel = new G4AdjointBremsstrahlungModel();
0295     theeInverseBremsstrahlungModel->SetHighEnergyLimit(fEmax_adj_models * 1.01);
0296     theeInverseBremsstrahlungModel->SetLowEnergyLimit(fEmin_adj_models);
0297     theeInverseBremsstrahlungModel->SetCSBiasingFactor(fCS_biasing_factor_brem);
0298     theeInverseBremsstrahlungProjToProjCase =
0299       new G4eInverseBremsstrahlung(true, "Inv_eBrem", theeInverseBremsstrahlungModel);
0300     theeInverseBremsstrahlungProdToProjCase =
0301       new G4eInverseBremsstrahlung(false, "Inv_eBrem1", theeInverseBremsstrahlungModel);
0302     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
0303     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
0304 
0305     if (!fUse_forced_interaction)
0306       theeInverseBremsstrahlungProdToProjCase =
0307         new G4eInverseBremsstrahlung(false, G4String("Inv_eBrem1"), theeInverseBremsstrahlungModel);
0308     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
0309     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
0310     if (fUse_forced_interaction) {
0311       theForcedInteractionForGamma =
0312         new G4AdjointForcedInteractionForGamma("ReverseGammaForcedInteraction");
0313       theForcedInteractionForGamma->RegisterAdjointBremModel(theeInverseBremsstrahlungModel);
0314     }
0315   }
0316 
0317   // Define  adjoint Compton
0318   //---------------------
0319 
0320   G4AdjointComptonModel* theeInverseComptonModel = 0;
0321   G4eInverseCompton* theeInverseComptonProjToProjCase = 0;
0322   G4eInverseCompton* theeInverseComptonProdToProjCase = 0;
0323 
0324   if (fUse_compton) {
0325     theeInverseComptonModel = new G4AdjointComptonModel();
0326     theeInverseComptonModel->SetHighEnergyLimit(fEmax_adj_models);
0327     theeInverseComptonModel->SetLowEnergyLimit(fEmin_adj_models);
0328     theeInverseComptonModel->SetDirectProcess(theComptonScattering);
0329     theeInverseComptonModel->SetUseMatrix(false);
0330 
0331     theeInverseComptonModel->SetCSBiasingFactor(fCS_biasing_factor_compton);
0332     if (!fUse_forced_interaction)
0333       theeInverseComptonProjToProjCase =
0334         new G4eInverseCompton(true, "Inv_Compt", theeInverseComptonModel);
0335     theeInverseComptonProdToProjCase =
0336       new G4eInverseCompton(false, "Inv_Compt1", theeInverseComptonModel);
0337     if (fUse_forced_interaction) {
0338       if (!theForcedInteractionForGamma)
0339         theForcedInteractionForGamma =
0340           new G4AdjointForcedInteractionForGamma("ReverseGammaForcedInteraction");
0341       theForcedInteractionForGamma->RegisterAdjointComptonModel(theeInverseComptonModel);
0342     }
0343     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
0344     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
0345   }
0346 
0347   // Define  adjoint PEEffect
0348   //---------------------
0349   G4AdjointPhotoElectricModel* theInversePhotoElectricModel = 0;
0350   G4InversePEEffect* theInversePhotoElectricProcess = 0;
0351 
0352   if (fUse_peeffect) {
0353     theInversePhotoElectricModel = new G4AdjointPhotoElectricModel();
0354     theInversePhotoElectricModel->SetHighEnergyLimit(fEmax_adj_models);
0355     theInversePhotoElectricModel->SetLowEnergyLimit(fEmin_adj_models);
0356     theInversePhotoElectricModel->SetCSBiasingFactor(fCS_biasing_factor_PEeffect);
0357     theInversePhotoElectricProcess =
0358       new G4InversePEEffect("Inv_PEEffect", theInversePhotoElectricModel);
0359     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
0360     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
0361   }
0362 
0363   // Define  adjoint ionisation for protons
0364   //---------------------
0365   G4AdjointhIonisationModel* thepInverseIonisationModel = 0;
0366   G4hInverseIonisation* thepInverseIonisationProjToProjCase = 0;
0367   G4hInverseIonisation* thepInverseIonisationProdToProjCase = 0;
0368   if (fUse_pionisation) {
0369     thepInverseIonisationModel = new G4AdjointhIonisationModel(G4Proton::Proton());
0370     thepInverseIonisationModel->SetHighEnergyLimit(fEmax_adj_models);
0371     thepInverseIonisationModel->SetLowEnergyLimit(fEmin_adj_models);
0372     thepInverseIonisationModel->SetUseMatrix(false);
0373     thepInverseIonisationProjToProjCase =
0374       new G4hInverseIonisation(true, "Inv_pIon", thepInverseIonisationModel);
0375     thepInverseIonisationProdToProjCase =
0376       new G4hInverseIonisation(false, "Inv_pIon1", thepInverseIonisationModel);
0377     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
0378     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("proton"));
0379   }
0380 
0381   // Declare the processes active for the different particles
0382   //--------------------------------------------------------
0383   auto particleIterator = GetParticleIterator();
0384   particleIterator->reset();
0385   while ((*particleIterator)()) {
0386     G4ParticleDefinition* particle = particleIterator->value();
0387     G4ProcessManager* pmanager = particle->GetProcessManager();
0388     if (!pmanager) {
0389       pmanager = new G4ProcessManager(particle);
0390       particle->SetProcessManager(pmanager);
0391     }
0392 
0393     G4String particleName = particle->GetParticleName();
0394     if (particleName == "e-") {
0395       if (fUse_ms && fUse_eionisation) pmanager->AddProcess(theeminusMS);
0396       if (fUse_eionisation) {
0397         pmanager->AddProcess(fEminusIonisation);
0398         G4AdjointCSManager::GetAdjointCSManager()->RegisterEnergyLossProcess(fEminusIonisation,
0399                                                                              particle);
0400       }
0401       if (fUse_brem && fUse_eionisation) {
0402         pmanager->AddProcess(theeminusBremsstrahlung);
0403         G4AdjointCSManager::GetAdjointCSManager()->RegisterEnergyLossProcess(
0404           theeminusBremsstrahlung, particle);
0405       }
0406       G4int n_order = 0;
0407       if (fUse_ms && fUse_eionisation) {
0408         n_order++;
0409         pmanager->SetProcessOrdering(theeminusMS, idxAlongStep, n_order);
0410       }
0411       if (fUse_eionisation) {
0412         n_order++;
0413         pmanager->SetProcessOrdering(fEminusIonisation, idxAlongStep, n_order);
0414       }
0415       if (fUse_brem && fUse_eionisation) {
0416         n_order++;
0417         pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxAlongStep, n_order);
0418       }
0419       n_order = 0;
0420       if (fUse_ms && fUse_eionisation) {
0421         n_order++;
0422         pmanager->SetProcessOrdering(theeminusMS, idxPostStep, n_order);
0423       }
0424       if (fUse_eionisation) {
0425         n_order++;
0426         pmanager->SetProcessOrdering(fEminusIonisation, idxPostStep, n_order);
0427       }
0428       if (fUse_brem && fUse_eionisation) {
0429         n_order++;
0430         pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, n_order);
0431       }
0432     }
0433 
0434     if (particleName == "adj_e-") {
0435       G4ContinuousGainOfEnergy* theContinuousGainOfEnergy = 0;
0436       if (fUse_eionisation) {
0437         theContinuousGainOfEnergy = new G4ContinuousGainOfEnergy();
0438         theContinuousGainOfEnergy->SetLossFluctuations(fUse_egain_fluctuation);
0439         theContinuousGainOfEnergy->SetDirectEnergyLossProcess(fEminusIonisation);
0440         theContinuousGainOfEnergy->SetDirectParticle(G4Electron::Electron());
0441         pmanager->AddProcess(theContinuousGainOfEnergy);
0442       }
0443       G4int n_order = 0;
0444       if (fUse_ms) {
0445         n_order++;
0446         pmanager->AddProcess(theeminusAdjointMS);
0447         pmanager->SetProcessOrdering(theeminusAdjointMS, idxAlongStep, n_order);
0448       }
0449       n_order++;
0450       pmanager->SetProcessOrdering(theContinuousGainOfEnergy, idxAlongStep, n_order);
0451 
0452       n_order++;
0453       G4AdjointAlongStepWeightCorrection* theAlongStepWeightCorrection =
0454         new G4AdjointAlongStepWeightCorrection();
0455       pmanager->AddProcess(theAlongStepWeightCorrection);
0456       pmanager->SetProcessOrdering(theAlongStepWeightCorrection, idxAlongStep, n_order);
0457       n_order = 0;
0458       if (fUse_eionisation) {
0459         pmanager->AddProcess(theeInverseIonisationProjToProjCase);
0460         pmanager->AddProcess(theeInverseIonisationProdToProjCase);
0461         n_order++;
0462         pmanager->SetProcessOrdering(theeInverseIonisationProjToProjCase, idxPostStep, n_order);
0463         n_order++;
0464         pmanager->SetProcessOrdering(theeInverseIonisationProdToProjCase, idxPostStep, n_order);
0465       }
0466       if (fUse_brem && fUse_eionisation) {
0467         pmanager->AddProcess(theeInverseBremsstrahlungProjToProjCase);
0468         n_order++;
0469         pmanager->SetProcessOrdering(theeInverseBremsstrahlungProjToProjCase, idxPostStep, n_order);
0470       }
0471 
0472       if (fUse_compton) {
0473         pmanager->AddProcess(theeInverseComptonProdToProjCase);
0474         n_order++;
0475         pmanager->SetProcessOrdering(theeInverseComptonProdToProjCase, idxPostStep, n_order);
0476       }
0477       if (fUse_peeffect) {
0478         pmanager->AddDiscreteProcess(theInversePhotoElectricProcess);
0479         n_order++;
0480         pmanager->SetProcessOrdering(theInversePhotoElectricProcess, idxPostStep, n_order);
0481       }
0482       if (fUse_pionisation) {
0483         pmanager->AddProcess(thepInverseIonisationProdToProjCase);
0484         n_order++;
0485         pmanager->SetProcessOrdering(thepInverseIonisationProdToProjCase, idxPostStep, n_order);
0486       }
0487       if (fUse_ms && fUse_eionisation) {
0488         n_order++;
0489         pmanager->SetProcessOrdering(theeminusAdjointMS, idxPostStep, n_order);
0490       }
0491     }
0492 
0493     if (particleName == "adj_gamma") {
0494       G4int n_order = 0;
0495       if (!fUse_forced_interaction) {
0496         G4AdjointAlongStepWeightCorrection* theAlongStepWeightCorrection =
0497           new G4AdjointAlongStepWeightCorrection();
0498         pmanager->AddProcess(theAlongStepWeightCorrection);
0499         pmanager->SetProcessOrdering(theAlongStepWeightCorrection, idxAlongStep, 1);
0500 
0501         if (fUse_brem && fUse_eionisation) {
0502           pmanager->AddProcess(theeInverseBremsstrahlungProdToProjCase);
0503           n_order++;
0504           pmanager->SetProcessOrdering(theeInverseBremsstrahlungProdToProjCase, idxPostStep,
0505                                        n_order);
0506         }
0507         if (fUse_compton) {
0508           pmanager->AddDiscreteProcess(theeInverseComptonProjToProjCase);
0509           n_order++;
0510           pmanager->SetProcessOrdering(theeInverseComptonProjToProjCase, idxPostStep, n_order);
0511         }
0512       }
0513       else {
0514         if (theForcedInteractionForGamma) {
0515           pmanager->AddProcess(theForcedInteractionForGamma);
0516           n_order++;
0517           pmanager->SetProcessOrdering(theForcedInteractionForGamma, idxPostStep, n_order);
0518           pmanager->SetProcessOrdering(theForcedInteractionForGamma, idxAlongStep, n_order);
0519         }
0520       }
0521     }
0522 
0523     if (particleName == "gamma") {
0524       if (fUse_compton) {
0525         pmanager->AddDiscreteProcess(theComptonScattering);
0526         G4AdjointCSManager::GetAdjointCSManager()->RegisterEmProcess(theComptonScattering,
0527                                                                      particle);
0528       }
0529       if (fUse_peeffect) {
0530         pmanager->AddDiscreteProcess(thePEEffect);
0531         G4AdjointCSManager::GetAdjointCSManager()->RegisterEmProcess(thePEEffect, particle);
0532       }
0533       if (fUse_gamma_conversion) {
0534         pmanager->AddDiscreteProcess(theGammaConversion);
0535       }
0536     }
0537 
0538     if (particleName == "e+" && fUse_gamma_conversion) {  // positron
0539       G4VProcess* theeplusMultipleScattering = new G4eMultipleScattering();
0540       G4VProcess* theeplusIonisation = new G4eIonisation();
0541       G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
0542       G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
0543 
0544       // add processes
0545       pmanager->AddProcess(theeplusMultipleScattering);
0546       pmanager->AddProcess(theeplusIonisation);
0547       pmanager->AddProcess(theeplusBremsstrahlung);
0548       pmanager->AddProcess(theeplusAnnihilation);
0549 
0550       // set ordering for AtRestDoIt
0551       pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
0552 
0553       // set ordering for AlongStepDoIt
0554       pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep, 1);
0555       pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep, 2);
0556       pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxAlongStep, 3);
0557 
0558       // set ordering for PostStepDoIt
0559       pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1);
0560       pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2);
0561       pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3);
0562       pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4);
0563     }
0564     if (particleName == "proton" && fUse_pionisation) {
0565       if (fUse_ms && fUse_pionisation) pmanager->AddProcess(thepMS);
0566 
0567       if (fUse_pionisation) {
0568         pmanager->AddProcess(fPIonisation);
0569         G4AdjointCSManager::GetAdjointCSManager()->RegisterEnergyLossProcess(fPIonisation,
0570                                                                              particle);
0571       }
0572 
0573       G4int n_order = 0;
0574       if (fUse_ms && fUse_pionisation) {
0575         n_order++;
0576         pmanager->SetProcessOrdering(thepMS, idxAlongStep, n_order);
0577       }
0578 
0579       if (fUse_pionisation) {
0580         n_order++;
0581         pmanager->SetProcessOrdering(fPIonisation, idxAlongStep, n_order);
0582       }
0583 
0584       n_order = 0;
0585       if (fUse_ms && fUse_pionisation) {
0586         n_order++;
0587         pmanager->SetProcessOrdering(thepMS, idxPostStep, n_order);
0588       }
0589 
0590       if (fUse_pionisation) {
0591         n_order++;
0592         pmanager->SetProcessOrdering(fPIonisation, idxPostStep, n_order);
0593       }
0594     }
0595 
0596     if (particleName == "adj_proton" && fUse_pionisation) {
0597       G4ContinuousGainOfEnergy* theContinuousGainOfEnergy = 0;
0598       if (fUse_pionisation) {
0599         theContinuousGainOfEnergy = new G4ContinuousGainOfEnergy();
0600         theContinuousGainOfEnergy->SetLossFluctuations(fUse_egain_fluctuation);
0601         theContinuousGainOfEnergy->SetDirectEnergyLossProcess(fPIonisation);
0602         theContinuousGainOfEnergy->SetDirectParticle(G4Proton::Proton());
0603         pmanager->AddProcess(theContinuousGainOfEnergy);
0604       }
0605 
0606       G4int n_order = 0;
0607       if (fUse_ms) {
0608         n_order++;
0609         pmanager->AddProcess(thepMS);
0610         pmanager->SetProcessOrdering(thepMS, idxAlongStep, n_order);
0611       }
0612 
0613       n_order++;
0614       pmanager->SetProcessOrdering(theContinuousGainOfEnergy, idxAlongStep, n_order);
0615 
0616       n_order++;
0617       G4AdjointAlongStepWeightCorrection* theAlongStepWeightCorrection =
0618         new G4AdjointAlongStepWeightCorrection();
0619       pmanager->AddProcess(theAlongStepWeightCorrection);
0620       pmanager->SetProcessOrdering(theAlongStepWeightCorrection, idxAlongStep, n_order);
0621       n_order = 0;
0622       if (fUse_pionisation) {
0623         pmanager->AddProcess(thepInverseIonisationProjToProjCase);
0624         n_order++;
0625         pmanager->SetProcessOrdering(thepInverseIonisationProjToProjCase, idxPostStep, n_order);
0626       }
0627 
0628       if (fUse_ms && fUse_pionisation) {
0629         n_order++;
0630         pmanager->SetProcessOrdering(thepMS, idxPostStep, n_order);
0631       }
0632     }
0633   }
0634 }
0635 
0636 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0637 
0638 #include "G4Decay.hh"
0639 void G4AdjointPhysicsList::ConstructGeneral()
0640 {
0641   // Add Decay Process
0642   G4Decay* theDecayProcess = new G4Decay();
0643   auto particleIterator = GetParticleIterator();
0644   particleIterator->reset();
0645   while ((*particleIterator)()) {
0646     G4ParticleDefinition* particle = particleIterator->value();
0647     G4ProcessManager* pmanager = particle->GetProcessManager();
0648     if (theDecayProcess->IsApplicable(*particle)) {
0649       pmanager->AddProcess(theDecayProcess);
0650       // set ordering for PostStepDoIt and AtRestDoIt
0651       pmanager->SetProcessOrdering(theDecayProcess, idxPostStep);
0652       pmanager->SetProcessOrdering(theDecayProcess, idxAtRest);
0653     }
0654   }
0655 }
0656 
0657 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0658 
0659 void G4AdjointPhysicsList::SetCuts()
0660 {
0661   if (verboseLevel > 0) {
0662     G4cout << "G4AdjointPhysicsList::SetCuts:";
0663     G4cout << "CutLength : " << G4BestUnit(defaultCutValue, "Length") << G4endl;
0664   }
0665 
0666   // set cut values for gamma at first and for e- second and next for e+,
0667   // because some processes for e+/e- need cut values for gamma
0668   //
0669   SetCutValue(defaultCutValue, "gamma");
0670   SetCutValue(defaultCutValue, "e-");
0671   SetCutValue(defaultCutValue, "e+");
0672 
0673   if (verboseLevel > 0) DumpCutValuesTable();
0674 }
0675 
0676 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......