Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/biasing/ReverseMC01/src/G4AdjointPhysicsList.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 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 /examples/extended/biasing/ReverseMC01/src/G4AdjointPhysicsList.cc (Version 11.3.0) and /examples/extended/biasing/ReverseMC01/src/G4AdjointPhysicsList.cc (Version 9.5.p2)


  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 /// \file biasing/ReverseMC01/src/G4AdjointPhy <<  26 // $Id: G4AdjointPhysicsList.cc,v 1.3 2010-11-11 14:39:42 ldesorgh Exp $
 27 /// \brief Implementation of the G4AdjointPhys <<  27 // GEANT4 tag $Name: not supported by cvs2svn $
 28 //                                             << 
 29 //                                                 28 //
 30 //////////////////////////////////////////////     29 //////////////////////////////////////////////////////////////
 31 //  Class Name:        G4AdjointPhysicsList    <<  30 //      Class Name: G4AdjointPhysicsList
 32 //        Author:               L. Desorgher   <<  31 //  Author:         L. Desorgher
 33 //         Organisation:         SpaceIT GmbH  <<  32 //  Organisation:   SpaceIT GmbH
 34 //        Contract:        ESA contract 21435/ <<  33 //  Contract: ESA contract 21435/08/NL/AT
 35 //         Customer:             ESA/ESTEC     <<  34 //  Customer:       ESA/ESTEC
 36 //////////////////////////////////////////////     35 //////////////////////////////////////////////////////////////
 37                                                << 
 38 //....oooOO0OOooo........oooOO0OOooo........oo << 
 39 //....oooOO0OOooo........oooOO0OOooo........oo << 
 40                                                << 
 41 #include "G4AdjointPhysicsList.hh"                 36 #include "G4AdjointPhysicsList.hh"
 42                                                << 
 43 #include "G4AdjointPhysicsMessenger.hh"        << 
 44 #include "G4ParticleTypes.hh"                  << 
 45 #include "G4ProcessManager.hh"                     37 #include "G4ProcessManager.hh"
 46 #include "G4SystemOfUnits.hh"                  <<  38 #include "G4ParticleTypes.hh"
 47                                                <<  39 #include "G4AdjointPhysicsMessenger.hh"
 48 //....oooOO0OOooo........oooOO0OOooo........oo << 
 49                                                    40 
 50 G4AdjointPhysicsList::G4AdjointPhysicsList()   <<  41 ////////////////////////////////////////////////////////////////////////////////
 51   : G4VUserPhysicsList(),                      <<  42 //
 52     fEminusIonisation(0),                      <<  43 G4AdjointPhysicsList::G4AdjointPhysicsList():  G4VUserPhysicsList()
 53     fPIonisation(0),                           << 
 54     fUse_forced_interaction(true),             << 
 55     fUse_eionisation(true),                    << 
 56     fUse_pionisation(true),                    << 
 57     fUse_brem(true),                           << 
 58     fUse_compton(true),                        << 
 59     fUse_ms(true),                             << 
 60     fUse_egain_fluctuation(true),              << 
 61     fUse_peeffect(true),                       << 
 62     fEmin_adj_models(1. * keV),                << 
 63     fEmax_adj_models(1. * MeV),                << 
 64     fCS_biasing_factor_compton(1.),            << 
 65     fCS_biasing_factor_brem(1.),               << 
 66     fCS_biasing_factor_ionisation(1.),         << 
 67     fCS_biasing_factor_PEeffect(1.)            << 
 68 {                                                  44 {
 69   defaultCutValue = 1.0 * mm;                  <<  45  defaultCutValue = 1.0*mm;
 70   SetVerboseLevel(1);                          <<  46  SetVerboseLevel(1);
 71   fPhysicsMessenger = new G4AdjointPhysicsMess <<  47  theeminusIonisation =0;
                                                   >>  48  thepIonisation =0;
                                                   >>  49  
                                                   >>  50  use_eionisation = true;
                                                   >>  51  use_pionisation = false;
                                                   >>  52  use_brem = true;
                                                   >>  53  use_compton = true; 
                                                   >>  54  use_ms = true; 
                                                   >>  55  use_egain_fluctuation = true;
                                                   >>  56  use_peeffect = true;
                                                   >>  57  
                                                   >>  58  
                                                   >>  59  emin_adj_models = 1.*keV;
                                                   >>  60  emax_adj_models = 1.*MeV;
                                                   >>  61  
                                                   >>  62  CS_biasing_factor_compton =1.;
                                                   >>  63  CS_biasing_factor_brem =1.;
                                                   >>  64  CS_biasing_factor_ionisation =1.;
                                                   >>  65  CS_biasing_factor_PEeffect =1.;
                                                   >>  66  
                                                   >>  67  
                                                   >>  68  thePhysicsMessenger = new G4AdjointPhysicsMessenger(this);
                                                   >>  69  
                                                   >>  70  
 72 }                                                  71 }
 73                                                <<  72 ////////////////////////////////////////////////////////////////////////////////
 74 //....oooOO0OOooo........oooOO0OOooo........oo <<  73 //
 75                                                <<  74 G4AdjointPhysicsList::~G4AdjointPhysicsList()
 76 G4AdjointPhysicsList::~G4AdjointPhysicsList()  <<  75 {}
 77 void G4AdjointPhysicsList::ConstructParticle()     76 void G4AdjointPhysicsList::ConstructParticle()
 78 {                                                  77 {
 79   // In this method, static member functions s     78   // In this method, static member functions should be called
 80   // for all particles which you want to use.      79   // for all particles which you want to use.
 81   // This ensures that objects of these partic     80   // This ensures that objects of these particle types will be
 82   // created in the program.                   <<  81   // created in the program. 
                                                   >>  82 
 83   ConstructBosons();                               83   ConstructBosons();
 84   ConstructLeptons();                              84   ConstructLeptons();
 85   ConstructMesons();                               85   ConstructMesons();
 86   ConstructBaryons();                              86   ConstructBaryons();
 87   ConstructAdjointParticles();                     87   ConstructAdjointParticles();
                                                   >>  88   
 88 }                                                  89 }
 89                                                    90 
 90 //....oooOO0OOooo........oooOO0OOooo........oo <<  91 ////////////////////////////////////////////////////////////////////////////////
 91                                                <<  92 //
 92 void G4AdjointPhysicsList::SetLossFluctuationF     93 void G4AdjointPhysicsList::SetLossFluctuationFlag(bool aBool)
 93 {                                              <<  94 {if (theeminusIonisation) theeminusIonisation->SetLossFluctuations(aBool);
 94   if (fEminusIonisation) fEminusIonisation->Se << 
 95 }                                                  95 }
 96                                                <<  96 ////////////////////////////////////////////////////////////////////////////////
 97 //....oooOO0OOooo........oooOO0OOooo........oo <<  97 //
 98                                                << 
 99 void G4AdjointPhysicsList::ConstructBosons()       98 void G4AdjointPhysicsList::ConstructBosons()
100 {                                                  99 {
101   // pseudo-particles                             100   // pseudo-particles
102   G4Geantino::GeantinoDefinition();               101   G4Geantino::GeantinoDefinition();
103   G4ChargedGeantino::ChargedGeantinoDefinition    102   G4ChargedGeantino::ChargedGeantinoDefinition();
104                                                   103 
105   // gamma                                        104   // gamma
106   G4Gamma::GammaDefinition();                     105   G4Gamma::GammaDefinition();
107                                                << 106   
                                                   >> 107   
                                                   >> 108  
                                                   >> 109    
108   // optical photon                               110   // optical photon
109   G4OpticalPhoton::OpticalPhotonDefinition();     111   G4OpticalPhoton::OpticalPhotonDefinition();
110 }                                                 112 }
111                                                << 113 ////////////////////////////////////////////////////////////////////////////////
112 //....oooOO0OOooo........oooOO0OOooo........oo << 114 //
113                                                << 
114 void G4AdjointPhysicsList::ConstructLeptons()     115 void G4AdjointPhysicsList::ConstructLeptons()
115 {                                                 116 {
116   // leptons                                      117   // leptons
117   G4Electron::ElectronDefinition();               118   G4Electron::ElectronDefinition();
118   G4Positron::PositronDefinition();               119   G4Positron::PositronDefinition();
119   G4MuonPlus::MuonPlusDefinition();               120   G4MuonPlus::MuonPlusDefinition();
120   G4MuonMinus::MuonMinusDefinition();             121   G4MuonMinus::MuonMinusDefinition();
121                                                   122 
122   G4NeutrinoE::NeutrinoEDefinition();             123   G4NeutrinoE::NeutrinoEDefinition();
123   G4AntiNeutrinoE::AntiNeutrinoEDefinition();     124   G4AntiNeutrinoE::AntiNeutrinoEDefinition();
124   G4NeutrinoMu::NeutrinoMuDefinition();           125   G4NeutrinoMu::NeutrinoMuDefinition();
125   G4AntiNeutrinoMu::AntiNeutrinoMuDefinition()    126   G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
126 }                                                 127 }
127                                                   128 
128 //....oooOO0OOooo........oooOO0OOooo........oo << 129 ////////////////////////////////////////////////////////////////////////////////
129                                                << 130 //
130 void G4AdjointPhysicsList::ConstructMesons()      131 void G4AdjointPhysicsList::ConstructMesons()
131 {                                                 132 {
132   //  mesons                                   << 133  //  mesons
133   G4PionPlus::PionPlusDefinition();               134   G4PionPlus::PionPlusDefinition();
134   G4PionMinus::PionMinusDefinition();             135   G4PionMinus::PionMinusDefinition();
135   G4PionZero::PionZeroDefinition();               136   G4PionZero::PionZeroDefinition();
136   G4Eta::EtaDefinition();                         137   G4Eta::EtaDefinition();
137   G4EtaPrime::EtaPrimeDefinition();               138   G4EtaPrime::EtaPrimeDefinition();
138   G4KaonPlus::KaonPlusDefinition();               139   G4KaonPlus::KaonPlusDefinition();
139   G4KaonMinus::KaonMinusDefinition();             140   G4KaonMinus::KaonMinusDefinition();
140   G4KaonZero::KaonZeroDefinition();               141   G4KaonZero::KaonZeroDefinition();
141   G4AntiKaonZero::AntiKaonZeroDefinition();       142   G4AntiKaonZero::AntiKaonZeroDefinition();
142   G4KaonZeroLong::KaonZeroLongDefinition();       143   G4KaonZeroLong::KaonZeroLongDefinition();
143   G4KaonZeroShort::KaonZeroShortDefinition();     144   G4KaonZeroShort::KaonZeroShortDefinition();
144 }                                                 145 }
145                                                << 146 ////////////////////////////////////////////////////////////////////////////////
146 //....oooOO0OOooo........oooOO0OOooo........oo << 147 //
147                                                << 
148 void G4AdjointPhysicsList::ConstructBaryons()     148 void G4AdjointPhysicsList::ConstructBaryons()
149 {                                                 149 {
150   //  barions                                  << 150 //  barions
151   G4Proton::ProtonDefinition();                   151   G4Proton::ProtonDefinition();
152   G4AntiProton::AntiProtonDefinition();           152   G4AntiProton::AntiProtonDefinition();
153   G4Neutron::NeutronDefinition();                 153   G4Neutron::NeutronDefinition();
154   G4AntiNeutron::AntiNeutronDefinition();         154   G4AntiNeutron::AntiNeutronDefinition();
                                                   >> 155   
155 }                                                 156 }
                                                   >> 157 ////////////////////////////////////////////////////////////////////////////////
                                                   >> 158 //
                                                   >> 159 #include"G4AdjointGamma.hh"
                                                   >> 160 #include"G4AdjointElectron.hh"
                                                   >> 161 #include"G4AdjointProton.hh"
156                                                   162 
157 //....oooOO0OOooo........oooOO0OOooo........oo << 
158                                                   163 
159 #include "G4AdjointElectron.hh"                << 
160 #include "G4AdjointGamma.hh"                   << 
161 #include "G4AdjointProton.hh"                  << 
162 void G4AdjointPhysicsList::ConstructAdjointPar    164 void G4AdjointPhysicsList::ConstructAdjointParticles()
163 {                                                 165 {
164   // adjoint_gammma                            << 166 // adjoint_gammma
165   G4AdjointGamma::AdjointGammaDefinition();       167   G4AdjointGamma::AdjointGammaDefinition();
166                                                   168 
167   // adjoint_electron                          << 169 // adjoint_electron
168   G4AdjointElectron::AdjointElectronDefinition    170   G4AdjointElectron::AdjointElectronDefinition();
169                                                << 171   
170   // adjoint_proton                            << 172   
                                                   >> 173 // adjoint_proton
171   G4AdjointProton::AdjointProtonDefinition();     174   G4AdjointProton::AdjointProtonDefinition();
                                                   >> 175   
172 }                                                 176 }
173                                                   177 
174 //....oooOO0OOooo........oooOO0OOooo........oo << 178 ////////////////////////////////////////////////////////////////////////////////
175                                                << 179 //
176 void G4AdjointPhysicsList::ConstructProcess()     180 void G4AdjointPhysicsList::ConstructProcess()
177 {                                                 181 {
178   AddTransportation();                            182   AddTransportation();
179   ConstructEM();                                  183   ConstructEM();
180   ConstructGeneral();                             184   ConstructGeneral();
181 }                                                 185 }
182                                                   186 
183 //....oooOO0OOooo........oooOO0OOooo........oo << 
184                                                   187 
185 // #include "G4PEEffectFluoModel.hh"           << 188 #include "G4PEEffectModel.hh"
186 #include "G4ComptonScattering.hh"                 189 #include "G4ComptonScattering.hh"
187 #include "G4GammaConversion.hh"                   190 #include "G4GammaConversion.hh"
188 #include "G4PhotoElectricEffect.hh"               191 #include "G4PhotoElectricEffect.hh"
189 #include "G4eAdjointMultipleScattering.hh"     << 
190 #include "G4eBremsstrahlung.hh"                << 
191 #include "G4eIonisation.hh"                    << 
192 #include "G4eMultipleScattering.hh"               192 #include "G4eMultipleScattering.hh"
                                                   >> 193 #include "G4hMultipleScattering.hh"
                                                   >> 194 #include "G4eIonisation.hh"
                                                   >> 195 #include "G4eBremsstrahlung.hh"
193 #include "G4eplusAnnihilation.hh"                 196 #include "G4eplusAnnihilation.hh"
194 #include "G4hIonisation.hh"                       197 #include "G4hIonisation.hh"
195 #include "G4hMultipleScattering.hh"            << 
196 #include "G4ionIonisation.hh"                     198 #include "G4ionIonisation.hh"
197 // #include "G4IonParametrisedLossModel.hh"    << 199 #include "G4IonParametrisedLossModel.hh"
198                                                   200 
199 #include "G4AdjointAlongStepWeightCorrection.h << 201 
200 #include "G4AdjointBremsstrahlungModel.hh"     << 202 #include "G4ContinuousGainOfEnergy.hh"
                                                   >> 203 #include "G4eInverseIonisation.hh"
                                                   >> 204 #include "G4AdjointeIonisationModel.hh"
201 #include "G4AdjointCSManager.hh"                  205 #include "G4AdjointCSManager.hh"
                                                   >> 206 #include "G4AdjointBremsstrahlungModel.hh"
                                                   >> 207 #include "G4eInverseBremsstrahlung.hh"
202 #include "G4AdjointComptonModel.hh"               208 #include "G4AdjointComptonModel.hh"
203 #include "G4AdjointForcedInteractionForGamma.h << 209 #include "G4eInverseCompton.hh"
204 #include "G4AdjointIonIonisationModel.hh"      << 210 #include "G4InversePEEffect.hh"
205 #include "G4AdjointPhotoElectricModel.hh"         211 #include "G4AdjointPhotoElectricModel.hh"
206 #include "G4AdjointProcessEquivalentToDirectPr << 212 #include "G4AdjointAlongStepWeightCorrection.hh"
207 #include "G4AdjointSimManager.hh"              << 213 #include "G4hInverseIonisation.hh"
208 #include "G4AdjointeIonisationModel.hh"        << 
209 #include "G4AdjointhIonisationModel.hh"           214 #include "G4AdjointhIonisationModel.hh"
210 #include "G4AdjointhMultipleScattering.hh"        215 #include "G4AdjointhMultipleScattering.hh"
211 #include "G4ContinuousGainOfEnergy.hh"         << 
212 #include "G4InversePEEffect.hh"                << 
213 #include "G4IonInverseIonisation.hh"              216 #include "G4IonInverseIonisation.hh"
214 #include "G4PhysicalConstants.hh"              << 217 #include "G4AdjointIonIonisationModel.hh"
215 #include "G4SystemOfUnits.hh"                  << 
216 #include "G4UrbanAdjointMscModel.hh"           << 
217 #include "G4UrbanMscModel.hh"                  << 
218 #include "G4eBremsstrahlung.hh"                << 
219 #include "G4eInverseBremsstrahlung.hh"         << 
220 #include "G4eInverseCompton.hh"                << 
221 #include "G4eInverseIonisation.hh"             << 
222 #include "G4hInverseIonisation.hh"             << 
223                                                << 
224 //....oooOO0OOooo........oooOO0OOooo........oo << 
225                                                   218 
                                                   >> 219 #include "G4AdjointSimManager.hh"
                                                   >> 220 #include "G4AdjointProcessEquivalentToDirectProcess.hh"
                                                   >> 221 ////////////////////////////////////////////////////////////////////////////////
                                                   >> 222 //
226 void G4AdjointPhysicsList::ConstructEM()          223 void G4AdjointPhysicsList::ConstructEM()
227 {                                              << 224 { G4AdjointCSManager* theCSManager = G4AdjointCSManager::GetAdjointCSManager();
228   G4AdjointCSManager* theCSManager = G4Adjoint << 225   
229   G4AdjointSimManager* theAdjointSimManager =     226   G4AdjointSimManager* theAdjointSimManager = G4AdjointSimManager::GetInstance();
230                                                << 227   
231   theCSManager->RegisterAdjointParticle(G4Adjo    228   theCSManager->RegisterAdjointParticle(G4AdjointElectron::AdjointElectron());
232                                                << 229   
233   if (fUse_brem || fUse_peeffect || fUse_compt << 230   
234     theCSManager->RegisterAdjointParticle(G4Ad << 231   if (use_brem || use_peeffect ||use_compton) theCSManager->RegisterAdjointParticle(G4AdjointGamma::AdjointGamma()); 
235                                                << 232   if (use_eionisation) {
236   if (fUse_eionisation) {                      << 233     if (!theeminusIonisation) theeminusIonisation  = new G4eIonisation();
237     if (!fEminusIonisation) fEminusIonisation  << 234   theeminusIonisation->SetLossFluctuations(use_egain_fluctuation);
238     fEminusIonisation->SetLossFluctuations(fUs << 235   }
239   }                                            << 236   if (use_pionisation) {
240   if (fUse_pionisation) {                      << 237     if (!thepIonisation) thepIonisation  = new G4hIonisation();
241     if (!fPIonisation) fPIonisation = new G4hI << 238   thepIonisation->SetLossFluctuations(use_egain_fluctuation);
242     fPIonisation->SetLossFluctuations(fUse_ega << 239   theCSManager->RegisterAdjointParticle(G4AdjointProton::AdjointProton());
243     theCSManager->RegisterAdjointParticle(G4Ad << 240   } 
244   }                                            << 241   
245                                                << 242   
246   G4eBremsstrahlung* theeminusBremsstrahlung =    243   G4eBremsstrahlung* theeminusBremsstrahlung = 0;
247   if (fUse_brem && fUse_eionisation) theeminus << 244   if (use_brem && use_eionisation) {
248                                                << 245     theeminusBremsstrahlung = new G4eBremsstrahlung();
249   G4ComptonScattering* theComptonScattering =  << 246   
250   if (fUse_compton) theComptonScattering = new << 247   } 
251                                                << 248   
252   G4PhotoElectricEffect* thePEEffect = 0;      << 249   G4ComptonScattering* theComptonScattering =0;
253   if (fUse_peeffect) thePEEffect = new G4Photo << 250   if (use_compton) theComptonScattering = new G4ComptonScattering();
254                                                << 251   
                                                   >> 252   G4PhotoElectricEffect* thePEEffect =0;
                                                   >> 253   if (use_peeffect) thePEEffect = new G4PhotoElectricEffect();
                                                   >> 254   
                                                   >> 255   
255   G4eMultipleScattering* theeminusMS = 0;         256   G4eMultipleScattering* theeminusMS = 0;
256   G4hMultipleScattering* thepMS = 0;           << 257   G4hMultipleScattering* thepMS= 0;
257   G4eAdjointMultipleScattering* theeminusAdjoi << 258   if (use_ms) {
258   if (fUse_ms) {                               << 259     theeminusMS = new G4eMultipleScattering();
259     theeminusMS = new G4eMultipleScattering(); << 260     thepMS = new G4hMultipleScattering();
260     G4UrbanMscModel* msc1 = new G4UrbanMscMode << 261   } 
261     theeminusMS->SetEmModel(msc1);             << 262   
262     theeminusAdjointMS = new G4eAdjointMultipl << 263   
263     G4UrbanAdjointMscModel* msc2 = new G4Urban << 264   
264     theeminusAdjointMS->SetEmModel(msc2);      << 265     
265     thepMS = new G4hMultipleScattering();      << 266   
266   }                                            << 267   G4VProcess*  theGammaConversion =0;
                                                   >> 268   if (use_gamma_conversion) theGammaConversion = new G4GammaConversion();         
                                                   >> 269   
                                                   >> 270   
                                                   >> 271   
                                                   >> 272   
                                                   >> 273  
267                                                   274 
268   G4VProcess* theGammaConversion = 0;          << 275   //Define adjoint e- ionisation
269   if (fUse_gamma_conversion) theGammaConversio << 
270   // Define adjoint e- ionisation              << 
271   //-------------------                           276   //-------------------
272   G4AdjointeIonisationModel* theeInverseIonisa    277   G4AdjointeIonisationModel* theeInverseIonisationModel = 0;
273   G4eInverseIonisation* theeInverseIonisationP << 278   G4eInverseIonisation* theeInverseIonisationProjToProjCase = 0 ;
274   G4eInverseIonisation* theeInverseIonisationP    279   G4eInverseIonisation* theeInverseIonisationProdToProjCase = 0;
275   if (fUse_eionisation) {                      << 280   if (use_eionisation) {
276     theeInverseIonisationModel = new G4Adjoint << 281     theeInverseIonisationModel = new G4AdjointeIonisationModel();
277     theeInverseIonisationModel->SetHighEnergyL << 282     theeInverseIonisationModel->SetHighEnergyLimit(emax_adj_models);
278     theeInverseIonisationModel->SetLowEnergyLi << 283     theeInverseIonisationModel->SetLowEnergyLimit(emin_adj_models);
279     theeInverseIonisationModel->SetCSBiasingFa << 284   theeInverseIonisationModel->SetCSBiasingFactor(CS_biasing_factor_ionisation);
280     theeInverseIonisationProjToProjCase =      << 285     theeInverseIonisationProjToProjCase = new G4eInverseIonisation(true,"Inv_eIon",theeInverseIonisationModel);
281       new G4eInverseIonisation(true, "Inv_eIon << 286     theeInverseIonisationProdToProjCase = new G4eInverseIonisation(false,"Inv_eIon1",theeInverseIonisationModel);
282     theeInverseIonisationProdToProjCase =      << 287   theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
283       new G4eInverseIonisation(false, "Inv_eIo << 288   } 
284     theAdjointSimManager->ConsiderParticleAsPr << 289   
285   }                                            << 290   
286                                                << 291   //Define  adjoint Bremsstrahlung
287   // Define  adjoint Bremsstrahlung            << 
288   //-------------------------------               292   //-------------------------------
                                                   >> 293   
289   G4AdjointBremsstrahlungModel* theeInverseBre    294   G4AdjointBremsstrahlungModel* theeInverseBremsstrahlungModel = 0;
                                                   >> 295   
290   G4eInverseBremsstrahlung* theeInverseBremsst    296   G4eInverseBremsstrahlung* theeInverseBremsstrahlungProjToProjCase = 0;
291   G4eInverseBremsstrahlung* theeInverseBremsst << 297   G4eInverseBremsstrahlung* theeInverseBremsstrahlungProdToProjCase = 0; 
292   G4AdjointForcedInteractionForGamma* theForce << 298   if (use_brem && use_eionisation) {
293   if (fUse_brem && fUse_eionisation) {         << 299     theeInverseBremsstrahlungModel = new G4AdjointBremsstrahlungModel();
294     theeInverseBremsstrahlungModel = new G4Adj << 300     theeInverseBremsstrahlungModel->SetHighEnergyLimit(emax_adj_models);
295     theeInverseBremsstrahlungModel->SetHighEne << 301     theeInverseBremsstrahlungModel->SetLowEnergyLimit(emin_adj_models);
296     theeInverseBremsstrahlungModel->SetLowEner << 302   theeInverseBremsstrahlungModel->SetCSBiasingFactor( CS_biasing_factor_brem);
297     theeInverseBremsstrahlungModel->SetCSBiasi << 303   theeInverseBremsstrahlungProjToProjCase = new G4eInverseBremsstrahlung(true,"Inv_eBrem",theeInverseBremsstrahlungModel);
298     theeInverseBremsstrahlungProjToProjCase =  << 304     theeInverseBremsstrahlungProdToProjCase = new G4eInverseBremsstrahlung(false,"Inv_eBrem1",theeInverseBremsstrahlungModel);
299       new G4eInverseBremsstrahlung(true, "Inv_ << 305   theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
300     theeInverseBremsstrahlungProdToProjCase =  << 306   theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
301       new G4eInverseBremsstrahlung(false, "Inv << 307   }
302     theAdjointSimManager->ConsiderParticleAsPr << 308   
303     theAdjointSimManager->ConsiderParticleAsPr << 309   
304                                                << 310   //Define  adjoint Compton
305     if (!fUse_forced_interaction)              << 
306       theeInverseBremsstrahlungProdToProjCase  << 
307         new G4eInverseBremsstrahlung(false, G4 << 
308     theAdjointSimManager->ConsiderParticleAsPr << 
309     theAdjointSimManager->ConsiderParticleAsPr << 
310     if (fUse_forced_interaction) {             << 
311       theForcedInteractionForGamma =           << 
312         new G4AdjointForcedInteractionForGamma << 
313       theForcedInteractionForGamma->RegisterAd << 
314     }                                          << 
315   }                                            << 
316                                                << 
317   // Define  adjoint Compton                   << 
318   //---------------------                         311   //---------------------
319                                                << 312   
320   G4AdjointComptonModel* theeInverseComptonMod    313   G4AdjointComptonModel* theeInverseComptonModel = 0;
321   G4eInverseCompton* theeInverseComptonProjToP    314   G4eInverseCompton* theeInverseComptonProjToProjCase = 0;
322   G4eInverseCompton* theeInverseComptonProdToP    315   G4eInverseCompton* theeInverseComptonProdToProjCase = 0;
323                                                << 316   if (use_compton) { 
324   if (fUse_compton) {                          << 317     theeInverseComptonModel = new G4AdjointComptonModel();
325     theeInverseComptonModel = new G4AdjointCom << 318   theeInverseComptonModel->SetHighEnergyLimit(emax_adj_models);
326     theeInverseComptonModel->SetHighEnergyLimi << 319     theeInverseComptonModel->SetLowEnergyLimit(emin_adj_models);
327     theeInverseComptonModel->SetLowEnergyLimit << 320   theeInverseComptonModel->SetDirectProcess(theComptonScattering);
328     theeInverseComptonModel->SetDirectProcess( << 321   theeInverseComptonModel->SetUseMatrix(false);
329     theeInverseComptonModel->SetUseMatrix(fals << 322   theeInverseComptonModel->SetCSBiasingFactor( CS_biasing_factor_compton);
330                                                << 323     theeInverseComptonProjToProjCase = new G4eInverseCompton(true,"Inv_Compt",theeInverseComptonModel);
331     theeInverseComptonModel->SetCSBiasingFacto << 324   theeInverseComptonProdToProjCase = new G4eInverseCompton(false,"Inv_Compt1",theeInverseComptonModel);
332     if (!fUse_forced_interaction)              << 325   theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
333       theeInverseComptonProjToProjCase =       << 326   theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
334         new G4eInverseCompton(true, "Inv_Compt << 327   
335     theeInverseComptonProdToProjCase =         << 
336       new G4eInverseCompton(false, "Inv_Compt1 << 
337     if (fUse_forced_interaction) {             << 
338       if (!theForcedInteractionForGamma)       << 
339         theForcedInteractionForGamma =         << 
340           new G4AdjointForcedInteractionForGam << 
341       theForcedInteractionForGamma->RegisterAd << 
342     }                                          << 
343     theAdjointSimManager->ConsiderParticleAsPr << 
344     theAdjointSimManager->ConsiderParticleAsPr << 
345   }                                               328   }
346                                                << 329   //Define  adjoint PEEffect
347   // Define  adjoint PEEffect                  << 
348   //---------------------                         330   //---------------------
                                                   >> 331   
349   G4AdjointPhotoElectricModel* theInversePhoto    332   G4AdjointPhotoElectricModel* theInversePhotoElectricModel = 0;
350   G4InversePEEffect* theInversePhotoElectricPr    333   G4InversePEEffect* theInversePhotoElectricProcess = 0;
351                                                << 334   
352   if (fUse_peeffect) {                         << 335   if (use_peeffect) { 
353     theInversePhotoElectricModel = new G4Adjoi << 336     theInversePhotoElectricModel = new G4AdjointPhotoElectricModel();
354     theInversePhotoElectricModel->SetHighEnerg << 337     theInversePhotoElectricModel->SetHighEnergyLimit(emax_adj_models);
355     theInversePhotoElectricModel->SetLowEnergy << 338     theInversePhotoElectricModel->SetLowEnergyLimit(emin_adj_models);
356     theInversePhotoElectricModel->SetCSBiasing << 339   theInversePhotoElectricModel->SetCSBiasingFactor(CS_biasing_factor_PEeffect);
357     theInversePhotoElectricProcess =           << 340   theInversePhotoElectricProcess = new G4InversePEEffect("Inv_PEEffect",theInversePhotoElectricModel);
358       new G4InversePEEffect("Inv_PEEffect", th << 341   theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
359     theAdjointSimManager->ConsiderParticleAsPr << 342   theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
360     theAdjointSimManager->ConsiderParticleAsPr << 343   
361   }                                               344   }
362                                                << 345   
363   // Define  adjoint ionisation for protons    << 346   //Define  adjoint ionisation for protons
364   //---------------------                         347   //---------------------
365   G4AdjointhIonisationModel* thepInverseIonisa << 348    G4AdjointhIonisationModel* thepInverseIonisationModel = 0;
366   G4hInverseIonisation* thepInverseIonisationP << 349    G4hInverseIonisation* thepInverseIonisationProjToProjCase = 0 ;
367   G4hInverseIonisation* thepInverseIonisationP << 350    G4hInverseIonisation* thepInverseIonisationProdToProjCase = 0;
368   if (fUse_pionisation) {                      << 351    if (use_pionisation) {
369     thepInverseIonisationModel = new G4Adjoint << 352     thepInverseIonisationModel = new G4AdjointhIonisationModel(G4Proton::Proton());
370     thepInverseIonisationModel->SetHighEnergyL << 353   thepInverseIonisationModel->SetHighEnergyLimit(emax_adj_models);
371     thepInverseIonisationModel->SetLowEnergyLi << 354     thepInverseIonisationModel->SetLowEnergyLimit(emin_adj_models);
372     thepInverseIonisationModel->SetUseMatrix(f << 355   thepInverseIonisationModel->SetUseMatrix(false);
373     thepInverseIonisationProjToProjCase =      << 356     thepInverseIonisationProjToProjCase = new G4hInverseIonisation(true,"Inv_pIon",thepInverseIonisationModel);
374       new G4hInverseIonisation(true, "Inv_pIon << 357     thepInverseIonisationProdToProjCase = new G4hInverseIonisation(false,"Inv_pIon1",thepInverseIonisationModel);
375     thepInverseIonisationProdToProjCase =      << 358   theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
376       new G4hInverseIonisation(false, "Inv_pIo << 359   theAdjointSimManager->ConsiderParticleAsPrimary(G4String("proton"));
377     theAdjointSimManager->ConsiderParticleAsPr << 360   }
378     theAdjointSimManager->ConsiderParticleAsPr << 361   ; 
379   }                                            << 362   
380                                                << 363   
381   // Declare the processes active for the diff << 364   //Declare the processes active for the different particles
382   //------------------------------------------    365   //--------------------------------------------------------
383   auto particleIterator = GetParticleIterator( << 366   theParticleIterator->reset();
384   particleIterator->reset();                   << 367   while( (*theParticleIterator)() ){
385   while ((*particleIterator)()) {              << 368       G4ParticleDefinition* particle = theParticleIterator->value();
386     G4ParticleDefinition* particle = particleI << 369       G4ProcessManager* pmanager = particle->GetProcessManager();
387     G4ProcessManager* pmanager = particle->Get << 370   if (!pmanager) {
388     if (!pmanager) {                           << 371     pmanager = new G4ProcessManager(particle);
389       pmanager = new G4ProcessManager(particle << 372     particle->SetProcessManager(pmanager);
390       particle->SetProcessManager(pmanager);   << 373   } 
391     }                                          << 374   
392                                                << 375   
393     G4String particleName = particle->GetParti << 376       G4String particleName = particle->GetParticleName();
394     if (particleName == "e-") {                << 377   //G4cout<<particleName<<std::endl;
395       if (fUse_ms && fUse_eionisation) pmanage << 378       
396       if (fUse_eionisation) {                  << 379       if (particleName == "e-") {
397         pmanager->AddProcess(fEminusIonisation << 380           if (use_ms && use_eionisation) { 
398         G4AdjointCSManager::GetAdjointCSManage << 381             pmanager->AddProcess(theeminusMS);
399                                                << 382     } 
400       }                                        << 383     if (use_eionisation){
401       if (fUse_brem && fUse_eionisation) {     << 384       pmanager->AddProcess(theeminusIonisation); 
402         pmanager->AddProcess(theeminusBremsstr << 385       G4AdjointCSManager::GetAdjointCSManager()->RegisterEnergyLossProcess(theeminusIonisation,particle);
403         G4AdjointCSManager::GetAdjointCSManage << 386      
404           theeminusBremsstrahlung, particle);  << 387     }  
405       }                                        << 388     if (use_brem && use_eionisation) {
406       G4int n_order = 0;                       << 389       pmanager->AddProcess(theeminusBremsstrahlung);
407       if (fUse_ms && fUse_eionisation) {       << 390       G4AdjointCSManager::GetAdjointCSManager()->RegisterEnergyLossProcess(theeminusBremsstrahlung,particle);
408         n_order++;                             << 391     } 
409         pmanager->SetProcessOrdering(theeminus << 392   
410       }                                        << 393   
411       if (fUse_eionisation) {                  << 394     G4int n_order=0;
412         n_order++;                             << 395     if (use_ms && use_eionisation) {
413         pmanager->SetProcessOrdering(fEminusIo << 396       n_order++;
414       }                                        << 397       pmanager->SetProcessOrdering(theeminusMS, idxAlongStep,n_order);
415       if (fUse_brem && fUse_eionisation) {     << 398     } 
416         n_order++;                             << 399     if (use_eionisation) {
417         pmanager->SetProcessOrdering(theeminus << 400       n_order++;
418       }                                        << 401       pmanager->SetProcessOrdering(theeminusIonisation,idxAlongStep,n_order);
419       n_order = 0;                             << 402     }
420       if (fUse_ms && fUse_eionisation) {       << 403     if (use_brem && use_eionisation) {
421         n_order++;                             << 404       n_order++;
422         pmanager->SetProcessOrdering(theeminus << 405       pmanager->SetProcessOrdering(theeminusBremsstrahlung,idxAlongStep,n_order);
423       }                                        << 406     }
424       if (fUse_eionisation) {                  << 407   
425         n_order++;                             << 408     n_order=0;
426         pmanager->SetProcessOrdering(fEminusIo << 409     if (use_ms && use_eionisation) {
427       }                                        << 410       n_order++;
428       if (fUse_brem && fUse_eionisation) {     << 411       pmanager->SetProcessOrdering(theeminusMS,         idxPostStep,n_order);
429         n_order++;                             << 412     }
430         pmanager->SetProcessOrdering(theeminus << 413     if (use_eionisation) {
431       }                                        << 414       n_order++;
432     }                                          << 415       pmanager->SetProcessOrdering(theeminusIonisation,idxPostStep,n_order);
433                                                << 416     }
434     if (particleName == "adj_e-") {            << 417     if (use_brem && use_eionisation) {
435       G4ContinuousGainOfEnergy* theContinuousG << 418       n_order++;
436       if (fUse_eionisation) {                  << 419       pmanager->SetProcessOrdering(theeminusBremsstrahlung,idxPostStep,n_order);
437         theContinuousGainOfEnergy = new G4Cont << 420     }
438         theContinuousGainOfEnergy->SetLossFluc << 421   
439         theContinuousGainOfEnergy->SetDirectEn << 422     
440         theContinuousGainOfEnergy->SetDirectPa << 423   
441         pmanager->AddProcess(theContinuousGain << 424   
442       }                                        << 425 
443       G4int n_order = 0;                       << 426       }
444       if (fUse_ms) {                           << 427     
445         n_order++;                             << 428       if (particleName == "adj_e-") {
446         pmanager->AddProcess(theeminusAdjointM << 429           G4ContinuousGainOfEnergy* theContinuousGainOfEnergy =0;
447         pmanager->SetProcessOrdering(theeminus << 430       if (use_eionisation ) {
448       }                                        << 431       theContinuousGainOfEnergy= new G4ContinuousGainOfEnergy();
449       n_order++;                               << 432       theContinuousGainOfEnergy->SetLossFluctuations(use_egain_fluctuation);
450       pmanager->SetProcessOrdering(theContinuo << 433       theContinuousGainOfEnergy->SetDirectEnergyLossProcess(theeminusIonisation);
451                                                << 434       theContinuousGainOfEnergy->SetDirectParticle(G4Electron::Electron());
452       n_order++;                               << 435       pmanager->AddProcess(theContinuousGainOfEnergy);
453       G4AdjointAlongStepWeightCorrection* theA << 436     } 
454         new G4AdjointAlongStepWeightCorrection << 437     G4int n_order=0;
455       pmanager->AddProcess(theAlongStepWeightC << 438 
456       pmanager->SetProcessOrdering(theAlongSte << 439     //G4AdjointProcessEquivalentToDirectProcess* the_eminus_adjMS=0;
457       n_order = 0;                             << 440 
458       if (fUse_eionisation) {                  << 441     
459         pmanager->AddProcess(theeInverseIonisa << 442     if (use_ms) {
460         pmanager->AddProcess(theeInverseIonisa << 443       n_order++;
461         n_order++;                             << 444       /*the_eminus_adjMS =  
462         pmanager->SetProcessOrdering(theeInver << 445       new G4AdjointProcessEquivalentToDirectProcess(G4String("adjoint_e-_MS"),theeminusMS,G4Electron::Electron());
463         n_order++;                             << 446       pmanager->AddProcess(the_eminus_adjMS);
464         pmanager->SetProcessOrdering(theeInver << 447       pmanager->SetProcessOrdering(the_eminus_adjMS, idxAlongStep,n_order);*/
465       }                                        << 448       pmanager->AddProcess(theeminusMS);
466       if (fUse_brem && fUse_eionisation) {     << 449       pmanager->SetProcessOrdering(theeminusMS, idxAlongStep,n_order);
467         pmanager->AddProcess(theeInverseBremss << 450     }
468         n_order++;                             << 451     n_order++;
469         pmanager->SetProcessOrdering(theeInver << 452     pmanager->SetProcessOrdering(theContinuousGainOfEnergy,         idxAlongStep,n_order);
470       }                                        << 453     
471                                                << 454     n_order++;
472       if (fUse_compton) {                      << 455     G4AdjointAlongStepWeightCorrection* theAlongStepWeightCorrection = new G4AdjointAlongStepWeightCorrection();
473         pmanager->AddProcess(theeInverseCompto << 456     pmanager->AddProcess(theAlongStepWeightCorrection);
474         n_order++;                             << 457     pmanager->SetProcessOrdering(theAlongStepWeightCorrection,idxAlongStep,n_order);
475         pmanager->SetProcessOrdering(theeInver << 458     
476       }                                        << 459     
477       if (fUse_peeffect) {                     << 460     n_order=0;
478         pmanager->AddDiscreteProcess(theInvers << 461     if (use_eionisation) {
479         n_order++;                             << 462       pmanager->AddProcess(theeInverseIonisationProjToProjCase);
480         pmanager->SetProcessOrdering(theInvers << 463       pmanager->AddProcess(theeInverseIonisationProdToProjCase);
481       }                                        << 464       n_order++;
482       if (fUse_pionisation) {                  << 465       pmanager->SetProcessOrdering(theeInverseIonisationProjToProjCase, idxPostStep,n_order);
483         pmanager->AddProcess(thepInverseIonisa << 466       n_order++;
484         n_order++;                             << 467       pmanager->SetProcessOrdering(theeInverseIonisationProdToProjCase, idxPostStep,n_order);
485         pmanager->SetProcessOrdering(thepInver << 468     
486       }                                        << 469     }
487       if (fUse_ms && fUse_eionisation) {       << 470     if (use_brem && use_eionisation) {
488         n_order++;                             << 471   
489         pmanager->SetProcessOrdering(theeminus << 472       pmanager->AddProcess(theeInverseBremsstrahlungProjToProjCase);
490       }                                        << 473       n_order++;
491     }                                          << 474       pmanager->SetProcessOrdering(theeInverseBremsstrahlungProjToProjCase, idxPostStep,n_order);
492                                                << 475     
493     if (particleName == "adj_gamma") {         << 476   
494       G4int n_order = 0;                       << 477     }
495       if (!fUse_forced_interaction) {          << 478     if (use_compton) {
496         G4AdjointAlongStepWeightCorrection* th << 479   
497           new G4AdjointAlongStepWeightCorrecti << 480       pmanager->AddProcess(theeInverseComptonProdToProjCase);
498         pmanager->AddProcess(theAlongStepWeigh << 481       n_order++;
499         pmanager->SetProcessOrdering(theAlongS << 482       pmanager->SetProcessOrdering(theeInverseComptonProdToProjCase, idxPostStep,n_order);
500                                                << 483     
501         if (fUse_brem && fUse_eionisation) {   << 484   
502           pmanager->AddProcess(theeInverseBrem << 485     }
503           n_order++;                           << 486     if (use_peeffect) {
504           pmanager->SetProcessOrdering(theeInv << 487             pmanager->AddDiscreteProcess(theInversePhotoElectricProcess);
505                                        n_order << 488       n_order++;
506         }                                      << 489       pmanager->SetProcessOrdering(theInversePhotoElectricProcess, idxPostStep,n_order);
507         if (fUse_compton) {                    << 490     }
508           pmanager->AddDiscreteProcess(theeInv << 491     if (use_pionisation) {
509           n_order++;                           << 492     
510           pmanager->SetProcessOrdering(theeInv << 493       pmanager->AddProcess(thepInverseIonisationProdToProjCase);
511         }                                      << 494       n_order++;
512       }                                        << 495       pmanager->SetProcessOrdering(thepInverseIonisationProdToProjCase, idxPostStep,n_order);
513       else {                                   << 496     
514         if (theForcedInteractionForGamma) {    << 497     
515           pmanager->AddProcess(theForcedIntera << 498     }
516           n_order++;                           << 499     /*if (use_ion) {
517           pmanager->SetProcessOrdering(theForc << 500     
518           pmanager->SetProcessOrdering(theForc << 501       pmanager->AddProcess(theIonInverseIonisationProdToProjCase);
519         }                                      << 502       n_order++;
520       }                                        << 503       pmanager->SetProcessOrdering(theIonInverseIonisationProdToProjCase, idxPostStep,n_order);
521     }                                          << 504     
522                                                << 505     }
523     if (particleName == "gamma") {             << 506     */
524       if (fUse_compton) {                      << 507     
525         pmanager->AddDiscreteProcess(theCompto << 508     
526         G4AdjointCSManager::GetAdjointCSManage << 509     if (use_ms && use_eionisation) {
527                                                << 510       n_order++;
528       }                                        << 511       //pmanager->SetProcessOrdering(the_eminus_adjMS,idxPostStep,n_order);
529       if (fUse_peeffect) {                     << 512       pmanager->SetProcessOrdering(theeminusMS,idxPostStep,n_order);
530         pmanager->AddDiscreteProcess(thePEEffe << 513     }
531         G4AdjointCSManager::GetAdjointCSManage << 514     
532       }                                        << 515     
533       if (fUse_gamma_conversion) {             << 516     
534         pmanager->AddDiscreteProcess(theGammaC << 517     
535       }                                        << 518     
536     }                                          << 519       
537                                                << 520   
538     if (particleName == "e+" && fUse_gamma_con << 521   
539       G4VProcess* theeplusMultipleScattering = << 522   
540       G4VProcess* theeplusIonisation = new G4e << 523   
541       G4VProcess* theeplusBremsstrahlung = new << 524     }
542       G4VProcess* theeplusAnnihilation = new G << 525   
543                                                << 526     
544       // add processes                         << 527   if (particleName == "adj_gamma") {
545       pmanager->AddProcess(theeplusMultipleSca << 528     G4int n_order=0;
546       pmanager->AddProcess(theeplusIonisation) << 529     G4AdjointAlongStepWeightCorrection* theAlongStepWeightCorrection = new G4AdjointAlongStepWeightCorrection();
547       pmanager->AddProcess(theeplusBremsstrahl << 530     pmanager->AddProcess(theAlongStepWeightCorrection);
548       pmanager->AddProcess(theeplusAnnihilatio << 531     pmanager->SetProcessOrdering(theAlongStepWeightCorrection,idxAlongStep,1);
549                                                << 532     
550       // set ordering for AtRestDoIt           << 533     if (use_brem && use_eionisation) {
551       pmanager->SetProcessOrderingToFirst(thee << 534       pmanager->AddProcess(theeInverseBremsstrahlungProdToProjCase);
552                                                << 535       n_order++;
553       // set ordering for AlongStepDoIt        << 536       pmanager->SetProcessOrdering(theeInverseBremsstrahlungProdToProjCase, idxPostStep,n_order);
554       pmanager->SetProcessOrdering(theeplusMul << 537       }
555       pmanager->SetProcessOrdering(theeplusIon << 538     if (use_compton) {
556       pmanager->SetProcessOrdering(theeplusBre << 539             pmanager->AddDiscreteProcess(theeInverseComptonProjToProjCase);
557                                                << 540       n_order++;
558       // set ordering for PostStepDoIt         << 541       pmanager->SetProcessOrdering(theeInverseComptonProjToProjCase, idxPostStep,n_order);
559       pmanager->SetProcessOrdering(theeplusMul << 542     }
560       pmanager->SetProcessOrdering(theeplusIon << 543   } 
561       pmanager->SetProcessOrdering(theeplusBre << 544    
562       pmanager->SetProcessOrdering(theeplusAnn << 545     if (particleName == "gamma") {
563     }                                          << 546   
564     if (particleName == "proton" && fUse_pioni << 547   
565       if (fUse_ms && fUse_pionisation) pmanage << 548     if (use_compton) {
566                                                << 549       pmanager->AddDiscreteProcess(theComptonScattering);
567       if (fUse_pionisation) {                  << 550       G4AdjointCSManager::GetAdjointCSManager()->RegisterEmProcess(theComptonScattering,particle);  
568         pmanager->AddProcess(fPIonisation);    << 551     }
569         G4AdjointCSManager::GetAdjointCSManage << 552     if (use_peeffect) {
570                                                << 553       pmanager->AddDiscreteProcess(thePEEffect);
571       }                                        << 554       G4AdjointCSManager::GetAdjointCSManager()->RegisterEmProcess(thePEEffect,particle);   
572                                                << 555     }
573       G4int n_order = 0;                       << 556     if (use_gamma_conversion) {
574       if (fUse_ms && fUse_pionisation) {       << 557       pmanager->AddDiscreteProcess(theGammaConversion);
575         n_order++;                             << 558       //G4AdjointCSManager::GetAdjointCSManager()->RegisterEmProcess(theGammaConversion,particle);
576         pmanager->SetProcessOrdering(thepMS, i << 559     }
577       }                                        << 560     
578                                                << 561     
579       if (fUse_pionisation) {                  << 562     
580         n_order++;                             << 563 
581         pmanager->SetProcessOrdering(fPIonisat << 564       }
582       }                                        << 565   
583                                                << 566   if (particleName == "e+" && use_gamma_conversion) {//positron
584       n_order = 0;                             << 567     G4VProcess* theeplusMultipleScattering = new G4eMultipleScattering();
585       if (fUse_ms && fUse_pionisation) {       << 568           G4VProcess* theeplusIonisation         = new G4eIonisation();
586         n_order++;                             << 569           G4VProcess* theeplusBremsstrahlung     = new G4eBremsstrahlung();
587         pmanager->SetProcessOrdering(thepMS, i << 570           G4VProcess* theeplusAnnihilation       = new G4eplusAnnihilation();
588       }                                        << 571           //
589                                                << 572           // add processes
590       if (fUse_pionisation) {                  << 573           pmanager->AddProcess(theeplusMultipleScattering);
591         n_order++;                             << 574           pmanager->AddProcess(theeplusIonisation);
592         pmanager->SetProcessOrdering(fPIonisat << 575           pmanager->AddProcess(theeplusBremsstrahlung);
593       }                                        << 576           pmanager->AddProcess(theeplusAnnihilation);
594     }                                          << 577           //
595                                                << 578           // set ordering for AtRestDoIt
596     if (particleName == "adj_proton" && fUse_p << 579           pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
597       G4ContinuousGainOfEnergy* theContinuousG << 580           //
598       if (fUse_pionisation) {                  << 581           // set ordering for AlongStepDoIt
599         theContinuousGainOfEnergy = new G4Cont << 582           pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,1);
600         theContinuousGainOfEnergy->SetLossFluc << 583           pmanager->SetProcessOrdering(theeplusIonisation,         idxAlongStep,2);
601         theContinuousGainOfEnergy->SetDirectEn << 584           pmanager->SetProcessOrdering(theeplusBremsstrahlung,     idxAlongStep,3);      
602         theContinuousGainOfEnergy->SetDirectPa << 585           //
603         pmanager->AddProcess(theContinuousGain << 586           // set ordering for PostStepDoIt
604       }                                        << 587           pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep,1);
605                                                << 588           pmanager->SetProcessOrdering(theeplusIonisation,         idxPostStep,2);
606       G4int n_order = 0;                       << 589           pmanager->SetProcessOrdering(theeplusBremsstrahlung,     idxPostStep,3);
607       if (fUse_ms) {                           << 590           pmanager->SetProcessOrdering(theeplusAnnihilation,       idxPostStep,4);
608         n_order++;                             << 591   }
609         pmanager->AddProcess(thepMS);          << 592   if (particleName == "proton" && use_pionisation) {
610         pmanager->SetProcessOrdering(thepMS, i << 593     if (use_ms && use_pionisation) { 
611       }                                        << 594             pmanager->AddProcess(thepMS);
612                                                << 595     } 
613       n_order++;                               << 596     if (use_pionisation){
614       pmanager->SetProcessOrdering(theContinuo << 597       pmanager->AddProcess(thepIonisation); 
615                                                << 598       G4AdjointCSManager::GetAdjointCSManager()->RegisterEnergyLossProcess(thepIonisation,particle);
616       n_order++;                               << 599      
617       G4AdjointAlongStepWeightCorrection* theA << 600     }  
618         new G4AdjointAlongStepWeightCorrection << 601     
619       pmanager->AddProcess(theAlongStepWeightC << 602   
620       pmanager->SetProcessOrdering(theAlongSte << 603     G4int n_order=0;
621       n_order = 0;                             << 604     if (use_ms && use_pionisation) {
622       if (fUse_pionisation) {                  << 605       n_order++;
623         pmanager->AddProcess(thepInverseIonisa << 606       pmanager->SetProcessOrdering(thepMS, idxAlongStep,n_order);
624         n_order++;                             << 607     } 
625         pmanager->SetProcessOrdering(thepInver << 608     if (use_pionisation) {
626       }                                        << 609       n_order++;
627                                                << 610       pmanager->SetProcessOrdering(thepIonisation,idxAlongStep,n_order);
628       if (fUse_ms && fUse_pionisation) {       << 611     }
629         n_order++;                             << 612     n_order=0;
630         pmanager->SetProcessOrdering(thepMS, i << 613     if (use_ms && use_pionisation) {
631       }                                        << 614       n_order++;
632     }                                          << 615       pmanager->SetProcessOrdering(thepMS, idxPostStep,n_order);
633   }                                            << 616     }
                                                   >> 617     if (use_pionisation) {
                                                   >> 618       n_order++;
                                                   >> 619       pmanager->SetProcessOrdering(thepIonisation,idxPostStep,n_order);
                                                   >> 620     }
                                                   >> 621   
                                                   >> 622   }
                                                   >> 623   if (particleName == "adj_proton" && use_pionisation) {
                                                   >> 624     
                                                   >> 625     
                                                   >> 626     
                                                   >> 627     G4ContinuousGainOfEnergy* theContinuousGainOfEnergy =0;
                                                   >> 628       if (use_pionisation ) {
                                                   >> 629       theContinuousGainOfEnergy= new G4ContinuousGainOfEnergy();
                                                   >> 630       theContinuousGainOfEnergy->SetLossFluctuations(use_egain_fluctuation);
                                                   >> 631       theContinuousGainOfEnergy->SetDirectEnergyLossProcess(thepIonisation);
                                                   >> 632       theContinuousGainOfEnergy->SetDirectParticle(G4Proton::Proton());
                                                   >> 633       //theContinuousGainOfEnergy->SetCorrectWeightAfterEnergyGain(correct_weight_after_energy_gain);
                                                   >> 634       pmanager->AddProcess(theContinuousGainOfEnergy);
                                                   >> 635     } 
                                                   >> 636     G4int n_order=0;
                                                   >> 637     if (use_ms) {
                                                   >> 638       n_order++;
                                                   >> 639       pmanager->AddProcess(thepMS);
                                                   >> 640       pmanager->SetProcessOrdering(thepMS, idxAlongStep,n_order);
                                                   >> 641     }
                                                   >> 642     n_order++;
                                                   >> 643     pmanager->SetProcessOrdering(theContinuousGainOfEnergy,         idxAlongStep,n_order);
                                                   >> 644     
                                                   >> 645     n_order++;
                                                   >> 646     G4AdjointAlongStepWeightCorrection* theAlongStepWeightCorrection = new G4AdjointAlongStepWeightCorrection();
                                                   >> 647     pmanager->AddProcess(theAlongStepWeightCorrection);
                                                   >> 648     pmanager->SetProcessOrdering(theAlongStepWeightCorrection,idxAlongStep,n_order);
                                                   >> 649     
                                                   >> 650     
                                                   >> 651     n_order=0;
                                                   >> 652     if (use_pionisation) {
                                                   >> 653       pmanager->AddProcess(thepInverseIonisationProjToProjCase);
                                                   >> 654       n_order++;
                                                   >> 655       pmanager->SetProcessOrdering(thepInverseIonisationProjToProjCase, idxPostStep,n_order);
                                                   >> 656         
                                                   >> 657     }
                                                   >> 658   
                                                   >> 659     if (use_ms && use_pionisation) {
                                                   >> 660       n_order++;
                                                   >> 661       pmanager->SetProcessOrdering(thepMS,idxPostStep,n_order);
                                                   >> 662     }
                                                   >> 663 
                                                   >> 664      
                                                   >> 665     
                                                   >> 666   
                                                   >> 667   }
                                                   >> 668     } 
634 }                                                 669 }
635                                                   670 
636 //....oooOO0OOooo........oooOO0OOooo........oo << 671 ////////////////////////////////////////////////////////////////////////////////
637                                                << 672 //
638 #include "G4Decay.hh"                             673 #include "G4Decay.hh"
639 void G4AdjointPhysicsList::ConstructGeneral()     674 void G4AdjointPhysicsList::ConstructGeneral()
640 {                                                 675 {
641   // Add Decay Process                            676   // Add Decay Process
642   G4Decay* theDecayProcess = new G4Decay();    << 677    G4Decay* theDecayProcess = new G4Decay();
643   auto particleIterator = GetParticleIterator( << 678   theParticleIterator->reset();
644   particleIterator->reset();                   << 679   while( (*theParticleIterator)() ){
645   while ((*particleIterator)()) {              << 680     G4ParticleDefinition* particle = theParticleIterator->value();
646     G4ParticleDefinition* particle = particleI << 
647     G4ProcessManager* pmanager = particle->Get    681     G4ProcessManager* pmanager = particle->GetProcessManager();
648     if (theDecayProcess->IsApplicable(*particl << 682     if (theDecayProcess->IsApplicable(*particle)) { 
649       pmanager->AddProcess(theDecayProcess);   << 683       pmanager ->AddProcess(theDecayProcess);
650       // set ordering for PostStepDoIt and AtR    684       // set ordering for PostStepDoIt and AtRestDoIt
651       pmanager->SetProcessOrdering(theDecayPro << 685       pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
652       pmanager->SetProcessOrdering(theDecayPro << 686       pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
653     }                                             687     }
654   }                                               688   }
655 }                                                 689 }
656                                                << 690 ////////////////////////////////////////////////////////////////////////////////
657 //....oooOO0OOooo........oooOO0OOooo........oo << 691 //
658                                                << 
659 void G4AdjointPhysicsList::SetCuts()              692 void G4AdjointPhysicsList::SetCuts()
660 {                                                 693 {
661   if (verboseLevel > 0) {                      << 694   if (verboseLevel >0){
662     G4cout << "G4AdjointPhysicsList::SetCuts:"    695     G4cout << "G4AdjointPhysicsList::SetCuts:";
663     G4cout << "CutLength : " << G4BestUnit(def << 696     G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
664   }                                               697   }
665                                                   698 
666   // set cut values for gamma at first and for    699   // set cut values for gamma at first and for e- second and next for e+,
667   // because some processes for e+/e- need cut    700   // because some processes for e+/e- need cut values for gamma
668   //                                              701   //
669   SetCutValue(defaultCutValue, "gamma");          702   SetCutValue(defaultCutValue, "gamma");
670   SetCutValue(defaultCutValue, "e-");             703   SetCutValue(defaultCutValue, "e-");
671   SetCutValue(defaultCutValue, "e+");             704   SetCutValue(defaultCutValue, "e+");
672                                                   705 
673   if (verboseLevel > 0) DumpCutValuesTable();  << 706   if (verboseLevel>0) DumpCutValuesTable();
674 }                                                 707 }
675                                                << 
676 //....oooOO0OOooo........oooOO0OOooo........oo << 
677                                                   708