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 11.0.p4)


  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 //                                                 29 //
 30 //////////////////////////////////////////////     30 //////////////////////////////////////////////////////////////
 31 //  Class Name:        G4AdjointPhysicsList        31 //  Class Name:        G4AdjointPhysicsList
 32 //        Author:               L. Desorgher       32 //        Author:               L. Desorgher
 33 //         Organisation:         SpaceIT GmbH      33 //         Organisation:         SpaceIT GmbH
 34 //        Contract:        ESA contract 21435/     34 //        Contract:        ESA contract 21435/08/NL/AT
 35 //         Customer:             ESA/ESTEC         35 //         Customer:             ESA/ESTEC
 36 //////////////////////////////////////////////     36 //////////////////////////////////////////////////////////////
 37                                                    37 
 38 //....oooOO0OOooo........oooOO0OOooo........oo     38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 39 //....oooOO0OOooo........oooOO0OOooo........oo     39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 40                                                    40 
 41 #include "G4AdjointPhysicsList.hh"                 41 #include "G4AdjointPhysicsList.hh"
 42                                                << 
 43 #include "G4AdjointPhysicsMessenger.hh"        << 
 44 #include "G4ParticleTypes.hh"                  << 
 45 #include "G4ProcessManager.hh"                     42 #include "G4ProcessManager.hh"
                                                   >>  43 #include "G4ParticleTypes.hh"
                                                   >>  44 #include "G4AdjointPhysicsMessenger.hh"
 46 #include "G4SystemOfUnits.hh"                      45 #include "G4SystemOfUnits.hh"
 47                                                    46 
 48 //....oooOO0OOooo........oooOO0OOooo........oo     47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 49                                                    48 
 50 G4AdjointPhysicsList::G4AdjointPhysicsList()       49 G4AdjointPhysicsList::G4AdjointPhysicsList()
 51   : G4VUserPhysicsList(),                      <<  50  :G4VUserPhysicsList(),
 52     fEminusIonisation(0),                      <<  51   fEminusIonisation(0),fPIonisation(0),
 53     fPIonisation(0),                           <<  52   fUse_forced_interaction(true),
 54     fUse_forced_interaction(true),             <<  53   fUse_eionisation(true),fUse_pionisation(true),
 55     fUse_eionisation(true),                    <<  54   fUse_brem(true),fUse_compton(true),fUse_ms(true),
 56     fUse_pionisation(true),                    <<  55   fUse_egain_fluctuation(true),fUse_peeffect(true),
 57     fUse_brem(true),                           <<  56   fEmin_adj_models(1.*keV), fEmax_adj_models(1.*MeV),
 58     fUse_compton(true),                        <<  57   fCS_biasing_factor_compton(1.),fCS_biasing_factor_brem(1.),
 59     fUse_ms(true),                             <<  58   fCS_biasing_factor_ionisation(1.),fCS_biasing_factor_PEeffect(1.)
 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 "G4PEEffectFluoModel.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"
                                                   >> 182 #include "G4eMultipleScattering.hh"
189 #include "G4eAdjointMultipleScattering.hh"        183 #include "G4eAdjointMultipleScattering.hh"
190 #include "G4eBremsstrahlung.hh"                << 184 #include "G4hMultipleScattering.hh"
191 #include "G4eIonisation.hh"                       185 #include "G4eIonisation.hh"
192 #include "G4eMultipleScattering.hh"            << 186 #include "G4eBremsstrahlung.hh"
193 #include "G4eplusAnnihilation.hh"                 187 #include "G4eplusAnnihilation.hh"
194 #include "G4hIonisation.hh"                       188 #include "G4hIonisation.hh"
195 #include "G4hMultipleScattering.hh"            << 
196 #include "G4ionIonisation.hh"                     189 #include "G4ionIonisation.hh"
197 // #include "G4IonParametrisedLossModel.hh"    << 190 //#include "G4IonParametrisedLossModel.hh"
198                                                   191 
199 #include "G4AdjointAlongStepWeightCorrection.h << 192 #include "G4eBremsstrahlung.hh"
200 #include "G4AdjointBremsstrahlungModel.hh"     << 193 #include "G4ContinuousGainOfEnergy.hh"
                                                   >> 194 #include "G4eInverseIonisation.hh"
                                                   >> 195 #include "G4AdjointeIonisationModel.hh"
201 #include "G4AdjointCSManager.hh"                  196 #include "G4AdjointCSManager.hh"
                                                   >> 197 #include "G4AdjointBremsstrahlungModel.hh"
                                                   >> 198 #include "G4eInverseBremsstrahlung.hh"
202 #include "G4AdjointComptonModel.hh"               199 #include "G4AdjointComptonModel.hh"
203 #include "G4AdjointForcedInteractionForGamma.h << 200 #include "G4eInverseCompton.hh"
204 #include "G4AdjointIonIonisationModel.hh"      << 201 #include "G4InversePEEffect.hh"
205 #include "G4AdjointPhotoElectricModel.hh"         202 #include "G4AdjointPhotoElectricModel.hh"
206 #include "G4AdjointProcessEquivalentToDirectPr << 203 #include "G4AdjointAlongStepWeightCorrection.hh"
207 #include "G4AdjointSimManager.hh"              << 204 #include "G4hInverseIonisation.hh"
208 #include "G4AdjointeIonisationModel.hh"        << 
209 #include "G4AdjointhIonisationModel.hh"           205 #include "G4AdjointhIonisationModel.hh"
210 #include "G4AdjointhMultipleScattering.hh"        206 #include "G4AdjointhMultipleScattering.hh"
211 #include "G4ContinuousGainOfEnergy.hh"         << 
212 #include "G4InversePEEffect.hh"                << 
213 #include "G4IonInverseIonisation.hh"              207 #include "G4IonInverseIonisation.hh"
214 #include "G4PhysicalConstants.hh"              << 208 #include "G4AdjointIonIonisationModel.hh"
                                                   >> 209 
                                                   >> 210 #include "G4AdjointSimManager.hh"
                                                   >> 211 #include "G4AdjointProcessEquivalentToDirectProcess.hh"
                                                   >> 212 
215 #include "G4SystemOfUnits.hh"                     213 #include "G4SystemOfUnits.hh"
216 #include "G4UrbanAdjointMscModel.hh"           << 214 #include "G4PhysicalConstants.hh"
217 #include "G4UrbanMscModel.hh"                     215 #include "G4UrbanMscModel.hh"
218 #include "G4eBremsstrahlung.hh"                << 216 #include "G4UrbanAdjointMscModel.hh"
219 #include "G4eInverseBremsstrahlung.hh"         << 217 #include "G4UrbanAdjointMscModel.hh"
220 #include "G4eInverseCompton.hh"                << 218 #include "G4AdjointForcedInteractionForGamma.hh"
221 #include "G4eInverseIonisation.hh"             << 
222 #include "G4hInverseIonisation.hh"             << 
223                                                   219 
224 //....oooOO0OOooo........oooOO0OOooo........oo    220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
225                                                   221 
226 void G4AdjointPhysicsList::ConstructEM()          222 void G4AdjointPhysicsList::ConstructEM()
227 {                                                 223 {
228   G4AdjointCSManager* theCSManager = G4Adjoint << 224   G4AdjointCSManager* theCSManager =
229   G4AdjointSimManager* theAdjointSimManager =  << 225        G4AdjointCSManager::GetAdjointCSManager();
230                                                << 226   G4AdjointSimManager* theAdjointSimManager =
231   theCSManager->RegisterAdjointParticle(G4Adjo << 227               G4AdjointSimManager::GetInstance();
232                                                << 228   
233   if (fUse_brem || fUse_peeffect || fUse_compt << 229   theCSManager->RegisterAdjointParticle(
234     theCSManager->RegisterAdjointParticle(G4Ad << 230             G4AdjointElectron::AdjointElectron());
                                                   >> 231   
                                                   >> 232   if (fUse_brem || fUse_peeffect ||fUse_compton)
                                                   >> 233               theCSManager->RegisterAdjointParticle(
                                                   >> 234                   G4AdjointGamma::AdjointGamma());
235                                                   235 
236   if (fUse_eionisation) {                         236   if (fUse_eionisation) {
237     if (!fEminusIonisation) fEminusIonisation  << 237           if (!fEminusIonisation) fEminusIonisation  =
238     fEminusIonisation->SetLossFluctuations(fUs << 238                          new G4eIonisation();
                                                   >> 239         fEminusIonisation->SetLossFluctuations(fUse_egain_fluctuation);
239   }                                               240   }
240   if (fUse_pionisation) {                         241   if (fUse_pionisation) {
241     if (!fPIonisation) fPIonisation = new G4hI << 242           if (!fPIonisation) fPIonisation  = new G4hIonisation();
242     fPIonisation->SetLossFluctuations(fUse_ega << 243         fPIonisation->SetLossFluctuations(fUse_egain_fluctuation);
243     theCSManager->RegisterAdjointParticle(G4Ad << 244         theCSManager->RegisterAdjointParticle(
244   }                                            << 245                 G4AdjointProton::AdjointProton());
245                                                << 246   }        
                                                   >> 247   
246   G4eBremsstrahlung* theeminusBremsstrahlung =    248   G4eBremsstrahlung* theeminusBremsstrahlung = 0;
247   if (fUse_brem && fUse_eionisation) theeminus << 249   if (fUse_brem && fUse_eionisation)
248                                                << 250                   theeminusBremsstrahlung = new G4eBremsstrahlung();
249   G4ComptonScattering* theComptonScattering =  << 251   
                                                   >> 252   G4ComptonScattering* theComptonScattering =0;
250   if (fUse_compton) theComptonScattering = new    253   if (fUse_compton) theComptonScattering = new G4ComptonScattering();
251                                                << 254   
252   G4PhotoElectricEffect* thePEEffect = 0;      << 255   G4PhotoElectricEffect* thePEEffect =0;
253   if (fUse_peeffect) thePEEffect = new G4Photo    256   if (fUse_peeffect) thePEEffect = new G4PhotoElectricEffect();
254                                                << 257   
255   G4eMultipleScattering* theeminusMS = 0;         258   G4eMultipleScattering* theeminusMS = 0;
256   G4hMultipleScattering* thepMS = 0;           << 259   G4hMultipleScattering* thepMS= 0;
257   G4eAdjointMultipleScattering* theeminusAdjoi    260   G4eAdjointMultipleScattering* theeminusAdjointMS = 0;
258   if (fUse_ms) {                                  261   if (fUse_ms) {
259     theeminusMS = new G4eMultipleScattering(); << 262          theeminusMS = new G4eMultipleScattering();
260     G4UrbanMscModel* msc1 = new G4UrbanMscMode << 263          G4UrbanMscModel* msc1 = new G4UrbanMscModel();
261     theeminusMS->SetEmModel(msc1);             << 264          theeminusMS->SetEmModel(msc1);
262     theeminusAdjointMS = new G4eAdjointMultipl << 265          theeminusAdjointMS = new G4eAdjointMultipleScattering();
263     G4UrbanAdjointMscModel* msc2 = new G4Urban << 266          G4UrbanAdjointMscModel* msc2 = new G4UrbanAdjointMscModel();
264     theeminusAdjointMS->SetEmModel(msc2);      << 267          theeminusAdjointMS->SetEmModel(msc2);
265     thepMS = new G4hMultipleScattering();      << 268          thepMS = new G4hMultipleScattering();
266   }                                            << 269   }        
267                                                << 270   
268   G4VProcess* theGammaConversion = 0;          << 271   G4VProcess*  theGammaConversion =0;
269   if (fUse_gamma_conversion) theGammaConversio    272   if (fUse_gamma_conversion) theGammaConversion = new G4GammaConversion();
270   // Define adjoint e- ionisation              << 273   //Define adjoint e- ionisation
271   //-------------------                           274   //-------------------
272   G4AdjointeIonisationModel* theeInverseIonisa    275   G4AdjointeIonisationModel* theeInverseIonisationModel = 0;
273   G4eInverseIonisation* theeInverseIonisationP << 276   G4eInverseIonisation* theeInverseIonisationProjToProjCase = 0 ;
274   G4eInverseIonisation* theeInverseIonisationP    277   G4eInverseIonisation* theeInverseIonisationProdToProjCase = 0;
275   if (fUse_eionisation) {                         278   if (fUse_eionisation) {
276     theeInverseIonisationModel = new G4Adjoint    279     theeInverseIonisationModel = new G4AdjointeIonisationModel();
277     theeInverseIonisationModel->SetHighEnergyL << 280     theeInverseIonisationModel->SetHighEnergyLimit(
278     theeInverseIonisationModel->SetLowEnergyLi << 281                                       fEmax_adj_models);
279     theeInverseIonisationModel->SetCSBiasingFa << 282     theeInverseIonisationModel->SetLowEnergyLimit(
                                                   >> 283                                        fEmin_adj_models);
                                                   >> 284     theeInverseIonisationModel->SetCSBiasingFactor(
                                                   >> 285                                     fCS_biasing_factor_ionisation);
280     theeInverseIonisationProjToProjCase =         286     theeInverseIonisationProjToProjCase =
281       new G4eInverseIonisation(true, "Inv_eIon << 287                    new G4eInverseIonisation(true,"Inv_eIon",
                                                   >> 288                       theeInverseIonisationModel);
282     theeInverseIonisationProdToProjCase =         289     theeInverseIonisationProdToProjCase =
283       new G4eInverseIonisation(false, "Inv_eIo << 290               new G4eInverseIonisation(false,"Inv_eIon1",
                                                   >> 291                           theeInverseIonisationModel);
284     theAdjointSimManager->ConsiderParticleAsPr    292     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
285   }                                            << 293   }        
286                                                   294 
287   // Define  adjoint Bremsstrahlung            << 295   //Define  adjoint Bremsstrahlung
288   //-------------------------------               296   //-------------------------------
289   G4AdjointBremsstrahlungModel* theeInverseBre    297   G4AdjointBremsstrahlungModel* theeInverseBremsstrahlungModel = 0;
290   G4eInverseBremsstrahlung* theeInverseBremsst    298   G4eInverseBremsstrahlung* theeInverseBremsstrahlungProjToProjCase = 0;
291   G4eInverseBremsstrahlung* theeInverseBremsst << 299   G4eInverseBremsstrahlung* theeInverseBremsstrahlungProdToProjCase = 0; 
292   G4AdjointForcedInteractionForGamma* theForce    300   G4AdjointForcedInteractionForGamma* theForcedInteractionForGamma = 0;
293   if (fUse_brem && fUse_eionisation) {            301   if (fUse_brem && fUse_eionisation) {
294     theeInverseBremsstrahlungModel = new G4Adj    302     theeInverseBremsstrahlungModel = new G4AdjointBremsstrahlungModel();
295     theeInverseBremsstrahlungModel->SetHighEne << 303     theeInverseBremsstrahlungModel->SetHighEnergyLimit(fEmax_adj_models*1.01);
296     theeInverseBremsstrahlungModel->SetLowEner    304     theeInverseBremsstrahlungModel->SetLowEnergyLimit(fEmin_adj_models);
297     theeInverseBremsstrahlungModel->SetCSBiasi << 305     theeInverseBremsstrahlungModel->SetCSBiasingFactor(
298     theeInverseBremsstrahlungProjToProjCase =  << 306                                      fCS_biasing_factor_brem);
299       new G4eInverseBremsstrahlung(true, "Inv_ << 307     theeInverseBremsstrahlungProjToProjCase = new G4eInverseBremsstrahlung(
300     theeInverseBremsstrahlungProdToProjCase =  << 308                              true,"Inv_eBrem",theeInverseBremsstrahlungModel);
301       new G4eInverseBremsstrahlung(false, "Inv << 309     theeInverseBremsstrahlungProdToProjCase = new G4eInverseBremsstrahlung(
                                                   >> 310         false,"Inv_eBrem1",theeInverseBremsstrahlungModel);
302     theAdjointSimManager->ConsiderParticleAsPr    311     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
303     theAdjointSimManager->ConsiderParticleAsPr    312     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
304                                                   313 
305     if (!fUse_forced_interaction)              << 314     if (!fUse_forced_interaction) theeInverseBremsstrahlungProdToProjCase
306       theeInverseBremsstrahlungProdToProjCase  << 315        = new G4eInverseBremsstrahlung(false,G4String("Inv_eBrem1"),
307         new G4eInverseBremsstrahlung(false, G4 << 316                                         theeInverseBremsstrahlungModel);
308     theAdjointSimManager->ConsiderParticleAsPr    317     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
309     theAdjointSimManager->ConsiderParticleAsPr    318     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
310     if (fUse_forced_interaction) {             << 319     if (fUse_forced_interaction){
311       theForcedInteractionForGamma =           << 320        theForcedInteractionForGamma =
312         new G4AdjointForcedInteractionForGamma    321         new G4AdjointForcedInteractionForGamma("ReverseGammaForcedInteraction");
313       theForcedInteractionForGamma->RegisterAd << 322        theForcedInteractionForGamma->RegisterAdjointBremModel(
                                                   >> 323                                         theeInverseBremsstrahlungModel);
314     }                                             324     }
315   }                                               325   }
316                                                   326 
317   // Define  adjoint Compton                   << 327   
                                                   >> 328   //Define  adjoint Compton
318   //---------------------                         329   //---------------------
319                                                << 330   
320   G4AdjointComptonModel* theeInverseComptonMod    331   G4AdjointComptonModel* theeInverseComptonModel = 0;
321   G4eInverseCompton* theeInverseComptonProjToP    332   G4eInverseCompton* theeInverseComptonProjToProjCase = 0;
322   G4eInverseCompton* theeInverseComptonProdToP    333   G4eInverseCompton* theeInverseComptonProdToProjCase = 0;
323                                                   334 
324   if (fUse_compton) {                          << 335   if (fUse_compton) { 
325     theeInverseComptonModel = new G4AdjointCom    336     theeInverseComptonModel = new G4AdjointComptonModel();
326     theeInverseComptonModel->SetHighEnergyLimi    337     theeInverseComptonModel->SetHighEnergyLimit(fEmax_adj_models);
327     theeInverseComptonModel->SetLowEnergyLimit    338     theeInverseComptonModel->SetLowEnergyLimit(fEmin_adj_models);
328     theeInverseComptonModel->SetDirectProcess(    339     theeInverseComptonModel->SetDirectProcess(theComptonScattering);
329     theeInverseComptonModel->SetUseMatrix(fals    340     theeInverseComptonModel->SetUseMatrix(false);
330                                                   341 
331     theeInverseComptonModel->SetCSBiasingFacto << 342     theeInverseComptonModel->SetCSBiasingFactor( fCS_biasing_factor_compton);
332     if (!fUse_forced_interaction)              << 343     if (!fUse_forced_interaction) theeInverseComptonProjToProjCase =
333       theeInverseComptonProjToProjCase =       << 344               new G4eInverseCompton(true,"Inv_Compt",theeInverseComptonModel);
334         new G4eInverseCompton(true, "Inv_Compt << 345     theeInverseComptonProdToProjCase = new G4eInverseCompton(false,"Inv_Compt1",
335     theeInverseComptonProdToProjCase =         << 346                                           theeInverseComptonModel);
336       new G4eInverseCompton(false, "Inv_Compt1 << 347     if (fUse_forced_interaction){
337     if (fUse_forced_interaction) {             << 348       if (!theForcedInteractionForGamma )  theForcedInteractionForGamma =
338       if (!theForcedInteractionForGamma)       << 349         new G4AdjointForcedInteractionForGamma("ReverseGammaForcedInteraction");
339         theForcedInteractionForGamma =         << 350       theForcedInteractionForGamma->
340           new G4AdjointForcedInteractionForGam << 351                      RegisterAdjointComptonModel(theeInverseComptonModel);
341       theForcedInteractionForGamma->RegisterAd << 
342     }                                             352     }
343     theAdjointSimManager->ConsiderParticleAsPr    353     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
344     theAdjointSimManager->ConsiderParticleAsPr    354     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
345   }                                               355   }
346                                                   356 
347   // Define  adjoint PEEffect                  << 357   //Define  adjoint PEEffect
348   //---------------------                         358   //---------------------
349   G4AdjointPhotoElectricModel* theInversePhoto    359   G4AdjointPhotoElectricModel* theInversePhotoElectricModel = 0;
350   G4InversePEEffect* theInversePhotoElectricPr    360   G4InversePEEffect* theInversePhotoElectricProcess = 0;
351                                                << 361   
352   if (fUse_peeffect) {                         << 362   if (fUse_peeffect) { 
353     theInversePhotoElectricModel = new G4Adjoi    363     theInversePhotoElectricModel = new G4AdjointPhotoElectricModel();
354     theInversePhotoElectricModel->SetHighEnerg    364     theInversePhotoElectricModel->SetHighEnergyLimit(fEmax_adj_models);
355     theInversePhotoElectricModel->SetLowEnergy    365     theInversePhotoElectricModel->SetLowEnergyLimit(fEmin_adj_models);
356     theInversePhotoElectricModel->SetCSBiasing << 366     theInversePhotoElectricModel->SetCSBiasingFactor(
357     theInversePhotoElectricProcess =           << 367                                   fCS_biasing_factor_PEeffect);
358       new G4InversePEEffect("Inv_PEEffect", th << 368     theInversePhotoElectricProcess = new G4InversePEEffect("Inv_PEEffect",
                                                   >> 369                                        theInversePhotoElectricModel);
359     theAdjointSimManager->ConsiderParticleAsPr    370     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
360     theAdjointSimManager->ConsiderParticleAsPr    371     theAdjointSimManager->ConsiderParticleAsPrimary(G4String("gamma"));
361   }                                               372   }
                                                   >> 373   
362                                                   374 
363   // Define  adjoint ionisation for protons    << 375   //Define  adjoint ionisation for protons
364   //---------------------                         376   //---------------------
365   G4AdjointhIonisationModel* thepInverseIonisa << 377    G4AdjointhIonisationModel* thepInverseIonisationModel = 0;
366   G4hInverseIonisation* thepInverseIonisationP << 378    G4hInverseIonisation* thepInverseIonisationProjToProjCase = 0 ;
367   G4hInverseIonisation* thepInverseIonisationP << 379    G4hInverseIonisation* thepInverseIonisationProdToProjCase = 0;
368   if (fUse_pionisation) {                      << 380    if (fUse_pionisation) {
369     thepInverseIonisationModel = new G4Adjoint << 381      thepInverseIonisationModel = new G4AdjointhIonisationModel(
370     thepInverseIonisationModel->SetHighEnergyL << 382                                            G4Proton::Proton());
371     thepInverseIonisationModel->SetLowEnergyLi << 383      thepInverseIonisationModel->SetHighEnergyLimit(fEmax_adj_models);
372     thepInverseIonisationModel->SetUseMatrix(f << 384      thepInverseIonisationModel->SetLowEnergyLimit(fEmin_adj_models);
373     thepInverseIonisationProjToProjCase =      << 385      thepInverseIonisationModel->SetUseMatrix(false);
374       new G4hInverseIonisation(true, "Inv_pIon << 386      thepInverseIonisationProjToProjCase = new G4hInverseIonisation(true,
375     thepInverseIonisationProdToProjCase =      << 387                                      "Inv_pIon",thepInverseIonisationModel);
376       new G4hInverseIonisation(false, "Inv_pIo << 388      thepInverseIonisationProdToProjCase = new G4hInverseIonisation(false,
377     theAdjointSimManager->ConsiderParticleAsPr << 389                                     "Inv_pIon1",thepInverseIonisationModel);
378     theAdjointSimManager->ConsiderParticleAsPr << 390      theAdjointSimManager->ConsiderParticleAsPrimary(G4String("e-"));
                                                   >> 391      theAdjointSimManager->ConsiderParticleAsPrimary(G4String("proton"));
379   }                                               392   }
380                                                   393 
381   // Declare the processes active for the diff << 394   //Declare the processes active for the different particles
382   //------------------------------------------    395   //--------------------------------------------------------
383   auto particleIterator = GetParticleIterator( << 396   auto particleIterator=GetParticleIterator();
384   particleIterator->reset();                      397   particleIterator->reset();
385   while ((*particleIterator)()) {              << 398   while( (*particleIterator)() ){
386     G4ParticleDefinition* particle = particleI    399     G4ParticleDefinition* particle = particleIterator->value();
387     G4ProcessManager* pmanager = particle->Get    400     G4ProcessManager* pmanager = particle->GetProcessManager();
388     if (!pmanager) {                              401     if (!pmanager) {
389       pmanager = new G4ProcessManager(particle << 402      pmanager = new G4ProcessManager(particle);
390       particle->SetProcessManager(pmanager);   << 403      particle->SetProcessManager(pmanager);
391     }                                             404     }
392                                                << 405         
393     G4String particleName = particle->GetParti    406     G4String particleName = particle->GetParticleName();
394     if (particleName == "e-") {                   407     if (particleName == "e-") {
395       if (fUse_ms && fUse_eionisation) pmanage    408       if (fUse_ms && fUse_eionisation) pmanager->AddProcess(theeminusMS);
396       if (fUse_eionisation) {                  << 409       if (fUse_eionisation){
397         pmanager->AddProcess(fEminusIonisation    410         pmanager->AddProcess(fEminusIonisation);
398         G4AdjointCSManager::GetAdjointCSManage << 411         G4AdjointCSManager::GetAdjointCSManager()->
399                                                << 412                     RegisterEnergyLossProcess(fEminusIonisation,particle);
400       }                                           413       }
401       if (fUse_brem && fUse_eionisation) {        414       if (fUse_brem && fUse_eionisation) {
402         pmanager->AddProcess(theeminusBremsstr    415         pmanager->AddProcess(theeminusBremsstrahlung);
403         G4AdjointCSManager::GetAdjointCSManage << 416         G4AdjointCSManager::GetAdjointCSManager()->
404           theeminusBremsstrahlung, particle);  << 417                    RegisterEnergyLossProcess(theeminusBremsstrahlung,particle);
405       }                                           418       }
406       G4int n_order = 0;                       << 419       G4int n_order=0;
407       if (fUse_ms && fUse_eionisation) {          420       if (fUse_ms && fUse_eionisation) {
408         n_order++;                                421         n_order++;
409         pmanager->SetProcessOrdering(theeminus << 422         pmanager->SetProcessOrdering(theeminusMS, idxAlongStep,n_order);
410       }                                           423       }
411       if (fUse_eionisation) {                     424       if (fUse_eionisation) {
412         n_order++;                                425         n_order++;
413         pmanager->SetProcessOrdering(fEminusIo << 426         pmanager->SetProcessOrdering(fEminusIonisation,idxAlongStep,n_order);
414       }                                           427       }
415       if (fUse_brem && fUse_eionisation) {        428       if (fUse_brem && fUse_eionisation) {
416         n_order++;                                429         n_order++;
417         pmanager->SetProcessOrdering(theeminus << 430         pmanager->SetProcessOrdering(theeminusBremsstrahlung,
                                                   >> 431                                            idxAlongStep,n_order);
418       }                                           432       }
419       n_order = 0;                             << 433       n_order=0;
420       if (fUse_ms && fUse_eionisation) {          434       if (fUse_ms && fUse_eionisation) {
421         n_order++;                                435         n_order++;
422         pmanager->SetProcessOrdering(theeminus << 436         pmanager->SetProcessOrdering(theeminusMS,idxPostStep,n_order);
423       }                                           437       }
424       if (fUse_eionisation) {                     438       if (fUse_eionisation) {
425         n_order++;                                439         n_order++;
426         pmanager->SetProcessOrdering(fEminusIo << 440         pmanager->SetProcessOrdering(fEminusIonisation,idxPostStep,n_order);
427       }                                           441       }
428       if (fUse_brem && fUse_eionisation) {        442       if (fUse_brem && fUse_eionisation) {
429         n_order++;                                443         n_order++;
430         pmanager->SetProcessOrdering(theeminus << 444         pmanager->SetProcessOrdering(theeminusBremsstrahlung,idxPostStep,
431       }                                        << 445                                                                      n_order);
432     }                                          << 446           }
433                                                << 447       }
434     if (particleName == "adj_e-") {            << 448 
435       G4ContinuousGainOfEnergy* theContinuousG << 449       if (particleName == "adj_e-") {
436       if (fUse_eionisation) {                  << 450         G4ContinuousGainOfEnergy* theContinuousGainOfEnergy =0;
437         theContinuousGainOfEnergy = new G4Cont << 451         if (fUse_eionisation ) {
438         theContinuousGainOfEnergy->SetLossFluc << 452           theContinuousGainOfEnergy= new G4ContinuousGainOfEnergy();
439         theContinuousGainOfEnergy->SetDirectEn << 453           theContinuousGainOfEnergy->SetLossFluctuations(
440         theContinuousGainOfEnergy->SetDirectPa << 454                                    fUse_egain_fluctuation);
441         pmanager->AddProcess(theContinuousGain << 455           theContinuousGainOfEnergy->SetDirectEnergyLossProcess(
442       }                                        << 456                                               fEminusIonisation);
443       G4int n_order = 0;                       << 457           theContinuousGainOfEnergy->SetDirectParticle(G4Electron::Electron());
444       if (fUse_ms) {                           << 458           pmanager->AddProcess(theContinuousGainOfEnergy);
445         n_order++;                             << 459           }
446         pmanager->AddProcess(theeminusAdjointM << 460           G4int n_order=0;
447         pmanager->SetProcessOrdering(theeminus << 461           if (fUse_ms) {
448       }                                        << 462             n_order++;
449       n_order++;                               << 463             pmanager->AddProcess(theeminusAdjointMS);
450       pmanager->SetProcessOrdering(theContinuo << 464             pmanager->SetProcessOrdering(theeminusAdjointMS,
451                                                << 465                                                 idxAlongStep,n_order);
452       n_order++;                               << 466           }
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++;                              467           n_order++;
504           pmanager->SetProcessOrdering(theeInv << 468           pmanager->SetProcessOrdering(theContinuousGainOfEnergy,idxAlongStep,
505                                        n_order << 469                                                                     n_order);
506         }                                      << 470 
507         if (fUse_compton) {                    << 
508           pmanager->AddDiscreteProcess(theeInv << 
509           n_order++;                           << 
510           pmanager->SetProcessOrdering(theeInv << 
511         }                                      << 
512       }                                        << 
513       else {                                   << 
514         if (theForcedInteractionForGamma) {    << 
515           pmanager->AddProcess(theForcedIntera << 
516           n_order++;                              471           n_order++;
517           pmanager->SetProcessOrdering(theForc << 472           G4AdjointAlongStepWeightCorrection* theAlongStepWeightCorrection =
518           pmanager->SetProcessOrdering(theForc << 473                                       new G4AdjointAlongStepWeightCorrection();
                                                   >> 474           pmanager->AddProcess(theAlongStepWeightCorrection);
                                                   >> 475           pmanager->SetProcessOrdering(theAlongStepWeightCorrection,
                                                   >> 476                                                             idxAlongStep,
                                                   >> 477                                                                  n_order);
                                                   >> 478           n_order=0;
                                                   >> 479           if (fUse_eionisation) {
                                                   >> 480             pmanager->AddProcess(theeInverseIonisationProjToProjCase);
                                                   >> 481             pmanager->AddProcess(theeInverseIonisationProdToProjCase);
                                                   >> 482             n_order++;
                                                   >> 483             pmanager->SetProcessOrdering(theeInverseIonisationProjToProjCase,
                                                   >> 484                                                           idxPostStep,n_order);
                                                   >> 485             n_order++;
                                                   >> 486             pmanager->SetProcessOrdering(theeInverseIonisationProdToProjCase,
                                                   >> 487                                                          idxPostStep,n_order);
                                                   >> 488           }
                                                   >> 489           if (fUse_brem && fUse_eionisation) {
                                                   >> 490             pmanager->AddProcess(theeInverseBremsstrahlungProjToProjCase);
                                                   >> 491             n_order++;
                                                   >> 492             pmanager->SetProcessOrdering(
                                                   >> 493                               theeInverseBremsstrahlungProjToProjCase,
                                                   >> 494                                                        idxPostStep,n_order);
                                                   >> 495           }
                                                   >> 496 
                                                   >> 497           if (fUse_compton) {
                                                   >> 498             pmanager->AddProcess(theeInverseComptonProdToProjCase);
                                                   >> 499             n_order++;
                                                   >> 500             pmanager->SetProcessOrdering(theeInverseComptonProdToProjCase,
                                                   >> 501                                                          idxPostStep,n_order);
                                                   >> 502           }
                                                   >> 503           if (fUse_peeffect) {
                                                   >> 504             pmanager->AddDiscreteProcess(theInversePhotoElectricProcess);
                                                   >> 505             n_order++;
                                                   >> 506             pmanager->SetProcessOrdering(theInversePhotoElectricProcess,
                                                   >> 507                                                            idxPostStep,n_order);
                                                   >> 508           }
                                                   >> 509           if (fUse_pionisation) {
                                                   >> 510             pmanager->AddProcess(thepInverseIonisationProdToProjCase);
                                                   >> 511             n_order++;
                                                   >> 512             pmanager->SetProcessOrdering(thepInverseIonisationProdToProjCase,
                                                   >> 513                                                          idxPostStep,n_order);
                                                   >> 514           }
                                                   >> 515           if (fUse_ms && fUse_eionisation) {
                                                   >> 516             n_order++;
                                                   >> 517             pmanager->SetProcessOrdering(theeminusAdjointMS,
                                                   >> 518                                                         idxPostStep,n_order);
                                                   >> 519           }
519         }                                         520         }
520       }                                        << 521         
521     }                                          << 522            
522                                                << 523         if(particleName == "adj_gamma") {
523     if (particleName == "gamma") {             << 524           G4int n_order=0;
524       if (fUse_compton) {                      << 525           if (!fUse_forced_interaction){
525         pmanager->AddDiscreteProcess(theCompto << 526            G4AdjointAlongStepWeightCorrection* theAlongStepWeightCorrection =
526         G4AdjointCSManager::GetAdjointCSManage << 527                                       new G4AdjointAlongStepWeightCorrection();
527                                                << 528            pmanager->AddProcess(theAlongStepWeightCorrection);
528       }                                        << 529            pmanager->SetProcessOrdering(theAlongStepWeightCorrection,
529       if (fUse_peeffect) {                     << 530                                                        idxAlongStep,1);
530         pmanager->AddDiscreteProcess(thePEEffe << 531                 
531         G4AdjointCSManager::GetAdjointCSManage << 532            if (fUse_brem && fUse_eionisation) {
532       }                                        << 533             pmanager->AddProcess(theeInverseBremsstrahlungProdToProjCase);
                                                   >> 534             n_order++;
                                                   >> 535             pmanager->SetProcessOrdering(
                                                   >> 536                                   theeInverseBremsstrahlungProdToProjCase,
                                                   >> 537                                                    idxPostStep,n_order);
                                                   >> 538             }
                                                   >> 539            if (fUse_compton) {
                                                   >> 540             pmanager->AddDiscreteProcess(theeInverseComptonProjToProjCase);
                                                   >> 541             n_order++;
                                                   >> 542             pmanager->SetProcessOrdering(theeInverseComptonProjToProjCase,
                                                   >> 543                                                         idxPostStep,n_order);
                                                   >> 544            }
                                                   >> 545           }
                                                   >> 546           else {
                                                   >> 547            if (theForcedInteractionForGamma) {
                                                   >> 548             pmanager->AddProcess(theForcedInteractionForGamma);
                                                   >> 549             n_order++;
                                                   >> 550             pmanager->SetProcessOrdering(theForcedInteractionForGamma,
                                                   >> 551                                                        idxPostStep,n_order);
                                                   >> 552             pmanager->SetProcessOrdering(theForcedInteractionForGamma,
                                                   >> 553                                                       idxAlongStep,n_order);
                                                   >> 554            }
                                                   >> 555           }
                                                   >> 556         } 
                                                   >> 557    
                                                   >> 558         if (particleName == "gamma") {
                                                   >> 559           if (fUse_compton) {
                                                   >> 560             pmanager->AddDiscreteProcess(theComptonScattering);
                                                   >> 561                 G4AdjointCSManager::GetAdjointCSManager()->
                                                   >> 562                              RegisterEmProcess(theComptonScattering,particle);
                                                   >> 563           }
                                                   >> 564           if (fUse_peeffect) {
                                                   >> 565                 pmanager->AddDiscreteProcess(thePEEffect);
                                                   >> 566                 G4AdjointCSManager::GetAdjointCSManager()->
                                                   >> 567                                        RegisterEmProcess(thePEEffect,particle);
                                                   >> 568           }
533       if (fUse_gamma_conversion) {                569       if (fUse_gamma_conversion) {
534         pmanager->AddDiscreteProcess(theGammaC << 570             pmanager->AddDiscreteProcess(theGammaConversion);
535       }                                           571       }
536     }                                          << 572      }
537                                                << 573         
538     if (particleName == "e+" && fUse_gamma_con << 574      if (particleName == "e+" && fUse_gamma_conversion) {//positron
539       G4VProcess* theeplusMultipleScattering =    575       G4VProcess* theeplusMultipleScattering = new G4eMultipleScattering();
540       G4VProcess* theeplusIonisation = new G4e << 576       G4VProcess* theeplusIonisation         = new G4eIonisation();
541       G4VProcess* theeplusBremsstrahlung = new << 577       G4VProcess* theeplusBremsstrahlung     = new G4eBremsstrahlung();
542       G4VProcess* theeplusAnnihilation = new G << 578       G4VProcess* theeplusAnnihilation       = new G4eplusAnnihilation();
543                                                   579 
544       // add processes                            580       // add processes
545       pmanager->AddProcess(theeplusMultipleSca    581       pmanager->AddProcess(theeplusMultipleScattering);
546       pmanager->AddProcess(theeplusIonisation)    582       pmanager->AddProcess(theeplusIonisation);
547       pmanager->AddProcess(theeplusBremsstrahl    583       pmanager->AddProcess(theeplusBremsstrahlung);
548       pmanager->AddProcess(theeplusAnnihilatio    584       pmanager->AddProcess(theeplusAnnihilation);
549                                                   585 
550       // set ordering for AtRestDoIt              586       // set ordering for AtRestDoIt
551       pmanager->SetProcessOrderingToFirst(thee    587       pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
552                                                   588 
553       // set ordering for AlongStepDoIt           589       // set ordering for AlongStepDoIt
554       pmanager->SetProcessOrdering(theeplusMul << 590       pmanager->SetProcessOrdering(theeplusMultipleScattering,
555       pmanager->SetProcessOrdering(theeplusIon << 591                                                              idxAlongStep,1);
556       pmanager->SetProcessOrdering(theeplusBre << 592       pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,2);
                                                   >> 593       pmanager->SetProcessOrdering(theeplusBremsstrahlung,idxAlongStep,3);
557                                                   594 
558       // set ordering for PostStepDoIt            595       // set ordering for PostStepDoIt
559       pmanager->SetProcessOrdering(theeplusMul << 596       pmanager->SetProcessOrdering(theeplusMultipleScattering,
560       pmanager->SetProcessOrdering(theeplusIon << 597                                                              idxPostStep,1);
561       pmanager->SetProcessOrdering(theeplusBre << 598       pmanager->SetProcessOrdering(theeplusIonisation,idxPostStep,2);
562       pmanager->SetProcessOrdering(theeplusAnn << 599       pmanager->SetProcessOrdering(theeplusBremsstrahlung,idxPostStep,3);
563     }                                          << 600       pmanager->SetProcessOrdering(theeplusAnnihilation,idxPostStep,4);
564     if (particleName == "proton" && fUse_pioni << 601         }
565       if (fUse_ms && fUse_pionisation) pmanage << 602         if (particleName == "proton" && fUse_pionisation) {
566                                                << 603           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                                                << 
616       n_order++;                               << 
617       G4AdjointAlongStepWeightCorrection* theA << 
618         new G4AdjointAlongStepWeightCorrection << 
619       pmanager->AddProcess(theAlongStepWeightC << 
620       pmanager->SetProcessOrdering(theAlongSte << 
621       n_order = 0;                             << 
622       if (fUse_pionisation) {                  << 
623         pmanager->AddProcess(thepInverseIonisa << 
624         n_order++;                             << 
625         pmanager->SetProcessOrdering(thepInver << 
626       }                                        << 
627                                                   604 
628       if (fUse_ms && fUse_pionisation) {       << 605           if (fUse_pionisation){
629         n_order++;                             << 606                 pmanager->AddProcess(fPIonisation);
630         pmanager->SetProcessOrdering(thepMS, i << 607                 G4AdjointCSManager::GetAdjointCSManager()->
631       }                                        << 608                           RegisterEnergyLossProcess(fPIonisation,particle);
632     }                                          << 609           }
                                                   >> 610 
                                                   >> 611           G4int n_order=0;
                                                   >> 612           if (fUse_ms && fUse_pionisation) {
                                                   >> 613             n_order++;
                                                   >> 614                 pmanager->SetProcessOrdering(thepMS, idxAlongStep,n_order);
                                                   >> 615           }
                                                   >> 616 
                                                   >> 617           if (fUse_pionisation) {
                                                   >> 618               n_order++;
                                                   >> 619               pmanager->SetProcessOrdering(fPIonisation,idxAlongStep,n_order);
                                                   >> 620           }
                                                   >> 621                 
                                                   >> 622           n_order=0;
                                                   >> 623           if (fUse_ms && fUse_pionisation) {
                                                   >> 624                 n_order++;
                                                   >> 625               pmanager->SetProcessOrdering(thepMS, idxPostStep,n_order);
                                                   >> 626           }
                                                   >> 627 
                                                   >> 628           if (fUse_pionisation) {
                                                   >> 629               n_order++;
                                                   >> 630               pmanager->SetProcessOrdering(fPIonisation,idxPostStep,n_order);
                                                   >> 631           }
                                                   >> 632         
                                                   >> 633         }
                                                   >> 634         
                                                   >> 635         if (particleName == "adj_proton" && fUse_pionisation) {
                                                   >> 636           G4ContinuousGainOfEnergy* theContinuousGainOfEnergy =0;
                                                   >> 637           if (fUse_pionisation ) {
                                                   >> 638            theContinuousGainOfEnergy= new G4ContinuousGainOfEnergy();
                                                   >> 639            theContinuousGainOfEnergy->SetLossFluctuations(
                                                   >> 640                                    fUse_egain_fluctuation);
                                                   >> 641            theContinuousGainOfEnergy->SetDirectEnergyLossProcess(fPIonisation);
                                                   >> 642               theContinuousGainOfEnergy->SetDirectParticle(G4Proton::Proton());
                                                   >> 643               pmanager->AddProcess(theContinuousGainOfEnergy);
                                                   >> 644            }
                                                   >> 645 
                                                   >> 646            G4int n_order=0;
                                                   >> 647            if (fUse_ms) {
                                                   >> 648              n_order++;
                                                   >> 649              pmanager->AddProcess(thepMS);
                                                   >> 650              pmanager->SetProcessOrdering(thepMS, idxAlongStep,n_order);
                                                   >> 651            }
                                                   >> 652 
                                                   >> 653            n_order++;
                                                   >> 654            pmanager->SetProcessOrdering(theContinuousGainOfEnergy,idxAlongStep,
                                                   >> 655                                                                        n_order);
                                                   >> 656                 
                                                   >> 657            n_order++;
                                                   >> 658            G4AdjointAlongStepWeightCorrection* theAlongStepWeightCorrection =
                                                   >> 659                                       new G4AdjointAlongStepWeightCorrection();
                                                   >> 660           pmanager->AddProcess(theAlongStepWeightCorrection);
                                                   >> 661           pmanager->SetProcessOrdering(theAlongStepWeightCorrection,
                                                   >> 662                                                 idxAlongStep,
                                                   >> 663                                                         n_order);
                                                   >> 664           n_order=0;
                                                   >> 665           if (fUse_pionisation) {
                                                   >> 666             pmanager->AddProcess(thepInverseIonisationProjToProjCase);
                                                   >> 667             n_order++;
                                                   >> 668                 pmanager->SetProcessOrdering(
                                                   >> 669                                    thepInverseIonisationProjToProjCase,
                                                   >> 670                                                        idxPostStep,n_order);
                                                   >> 671           }
                                                   >> 672 
                                                   >> 673           if (fUse_ms && fUse_pionisation) {
                                                   >> 674             n_order++;
                                                   >> 675             pmanager->SetProcessOrdering(thepMS,idxPostStep,n_order);
                                                   >> 676           }
                                                   >> 677         }
633   }                                               678   }
634 }                                                 679 }
635                                                   680 
636 //....oooOO0OOooo........oooOO0OOooo........oo    681 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
637                                                   682 
638 #include "G4Decay.hh"                             683 #include "G4Decay.hh"
639 void G4AdjointPhysicsList::ConstructGeneral()     684 void G4AdjointPhysicsList::ConstructGeneral()
640 {                                                 685 {
641   // Add Decay Process                            686   // Add Decay Process
642   G4Decay* theDecayProcess = new G4Decay();       687   G4Decay* theDecayProcess = new G4Decay();
643   auto particleIterator = GetParticleIterator( << 688   auto particleIterator=GetParticleIterator();
644   particleIterator->reset();                      689   particleIterator->reset();
645   while ((*particleIterator)()) {              << 690   while( (*particleIterator)() ){
646     G4ParticleDefinition* particle = particleI    691     G4ParticleDefinition* particle = particleIterator->value();
647     G4ProcessManager* pmanager = particle->Get    692     G4ProcessManager* pmanager = particle->GetProcessManager();
648     if (theDecayProcess->IsApplicable(*particl << 693     if (theDecayProcess->IsApplicable(*particle)) { 
649       pmanager->AddProcess(theDecayProcess);   << 694       pmanager ->AddProcess(theDecayProcess);
650       // set ordering for PostStepDoIt and AtR    695       // set ordering for PostStepDoIt and AtRestDoIt
651       pmanager->SetProcessOrdering(theDecayPro << 696       pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
652       pmanager->SetProcessOrdering(theDecayPro << 697       pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
653     }                                             698     }
654   }                                               699   }
655 }                                                 700 }
656                                                   701 
657 //....oooOO0OOooo........oooOO0OOooo........oo    702 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
658                                                   703 
659 void G4AdjointPhysicsList::SetCuts()              704 void G4AdjointPhysicsList::SetCuts()
660 {                                                 705 {
661   if (verboseLevel > 0) {                      << 706   if (verboseLevel >0){
662     G4cout << "G4AdjointPhysicsList::SetCuts:"    707     G4cout << "G4AdjointPhysicsList::SetCuts:";
663     G4cout << "CutLength : " << G4BestUnit(def << 708     G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
664   }                                               709   }
665                                                   710 
666   // set cut values for gamma at first and for    711   // set cut values for gamma at first and for e- second and next for e+,
667   // because some processes for e+/e- need cut    712   // because some processes for e+/e- need cut values for gamma
668   //                                              713   //
669   SetCutValue(defaultCutValue, "gamma");          714   SetCutValue(defaultCutValue, "gamma");
670   SetCutValue(defaultCutValue, "e-");             715   SetCutValue(defaultCutValue, "e-");
671   SetCutValue(defaultCutValue, "e+");             716   SetCutValue(defaultCutValue, "e+");
672                                                   717 
673   if (verboseLevel > 0) DumpCutValuesTable();  << 718   if (verboseLevel>0) DumpCutValuesTable();
674 }                                                 719 }
675                                                   720 
676 //....oooOO0OOooo........oooOO0OOooo........oo    721 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
677                                                   722