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.6.p3)


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