Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/biasing/importance/src/G4ImportanceProcess.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 /processes/biasing/importance/src/G4ImportanceProcess.cc (Version 11.3.0) and /processes/biasing/importance/src/G4ImportanceProcess.cc (Version 11.0)


  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 // G4ImportanceProcess                             26 // G4ImportanceProcess
 27 //                                                 27 //
 28 // Author: Michael Dressel, 2002                   28 // Author: Michael Dressel, 2002
 29 // -------------------------------------------     29 // --------------------------------------------------------------------
 30                                                    30 
 31 #include "G4ImportanceProcess.hh"                  31 #include "G4ImportanceProcess.hh"
 32 #include "G4VImportanceAlgorithm.hh"               32 #include "G4VImportanceAlgorithm.hh"
 33 #include "G4GeometryCell.hh"                       33 #include "G4GeometryCell.hh"
 34 #include "G4SamplingPostStepAction.hh"             34 #include "G4SamplingPostStepAction.hh"
 35 #include "G4VTrackTerminator.hh"                   35 #include "G4VTrackTerminator.hh"
 36 #include "G4VIStore.hh"                            36 #include "G4VIStore.hh"
 37                                                    37 
 38 #include "G4Step.hh"                               38 #include "G4Step.hh"
 39 #include "G4Navigator.hh"                          39 #include "G4Navigator.hh"
 40 #include "G4VTouchable.hh"                         40 #include "G4VTouchable.hh"
 41 #include "G4VPhysicalVolume.hh"                    41 #include "G4VPhysicalVolume.hh"
 42 #include "G4ParticleChange.hh"                     42 #include "G4ParticleChange.hh"
 43 #include "G4PathFinder.hh"                         43 #include "G4PathFinder.hh"
 44 #include "G4TransportationManager.hh"              44 #include "G4TransportationManager.hh"
 45 #include "G4StepPoint.hh"                          45 #include "G4StepPoint.hh"
 46 #include "G4FieldTrackUpdator.hh"                  46 #include "G4FieldTrackUpdator.hh"
 47                                                    47 
 48                                                    48 
 49 G4ImportanceProcess::                              49 G4ImportanceProcess::
 50 G4ImportanceProcess(const G4VImportanceAlgorit     50 G4ImportanceProcess(const G4VImportanceAlgorithm &aImportanceAlgorithm,
 51                     const G4VIStore &aIstore,  <<  51                         const G4VIStore &aIstore,
 52                     const G4VTrackTerminator * <<  52                         const G4VTrackTerminator *TrackTerminator,
 53                     const G4String &aName, G4b <<  53                         const G4String &aName, G4bool para)
 54  : G4VProcess(aName, fParallel),                   54  : G4VProcess(aName, fParallel),
 55    fParticleChange(new G4ParticleChange),          55    fParticleChange(new G4ParticleChange),
 56    fImportanceAlgorithm(aImportanceAlgorithm),     56    fImportanceAlgorithm(aImportanceAlgorithm),
 57    fIStore(aIstore),                               57    fIStore(aIstore),
 58    fParaflag(para)                                 58    fParaflag(para)
 59 {                                                  59 {
 60   G4cout << "### G4ImportanceProcess:: Creatin     60   G4cout << "### G4ImportanceProcess:: Creating " << G4endl;
 61   if (TrackTerminator != nullptr)                  61   if (TrackTerminator != nullptr)
 62   {                                                62   {
 63     fPostStepAction = new G4SamplingPostStepAc     63     fPostStepAction = new G4SamplingPostStepAction(*TrackTerminator);
 64   }                                                64   }
 65   else                                             65   else
 66   {                                                66   {
 67     fPostStepAction = new G4SamplingPostStepAc     67     fPostStepAction = new G4SamplingPostStepAction(*this);
 68   }                                                68   }
 69   if (fParticleChange == nullptr)                  69   if (fParticleChange == nullptr)
 70   {                                                70   {
 71     G4Exception("G4ImportanceProcess::G4Import     71     G4Exception("G4ImportanceProcess::G4ImportanceProcess()",
 72                 "FatalError", FatalException,      72                 "FatalError", FatalException,
 73                 "Failed allocation of G4Partic     73                 "Failed allocation of G4ParticleChange !");
 74   }                                                74   }
 75   G4VProcess::pParticleChange = fParticleChang     75   G4VProcess::pParticleChange = fParticleChange;
 76                                                    76 
 77                                                    77 
 78   fGhostStep = new G4Step();                       78   fGhostStep = new G4Step();
 79   fGhostPreStepPoint = fGhostStep->GetPreStepP     79   fGhostPreStepPoint = fGhostStep->GetPreStepPoint();
 80   fGhostPostStepPoint = fGhostStep->GetPostSte     80   fGhostPostStepPoint = fGhostStep->GetPostStepPoint();
 81                                                    81 
 82   fTransportationManager = G4TransportationMan     82   fTransportationManager = G4TransportationManager::GetTransportationManager();
 83   fPathFinder = G4PathFinder::GetInstance();       83   fPathFinder = G4PathFinder::GetInstance();
 84                                                    84 
 85   if (verboseLevel>0)                              85   if (verboseLevel>0)
 86   {                                                86   {
 87     G4cout << GetProcessName() << " is created     87     G4cout << GetProcessName() << " is created " << G4endl;
 88   }                                                88   }
 89                                                    89 
 90   G4cout << "G4ImportanceProcess:: importance      90   G4cout << "G4ImportanceProcess:: importance process paraflag is: " << fParaflag << G4endl;
 91                                                    91 
 92 }                                                  92 }
 93                                                    93 
 94 G4ImportanceProcess::~G4ImportanceProcess()        94 G4ImportanceProcess::~G4ImportanceProcess()
 95 {                                                  95 {
                                                   >>  96 
 96   delete fPostStepAction;                          97   delete fPostStepAction;
 97   delete fParticleChange;                          98   delete fParticleChange;
                                                   >>  99   // delete fGhostStep;
                                                   >> 100   // delete fGhostWorld;
                                                   >> 101   // delete fGhostNavigator;
                                                   >> 102 
 98 }                                                 103 }
 99                                                   104 
                                                   >> 105 
                                                   >> 106 
100 //--------------------------------------------    107 //------------------------------------------------------
101 //                                                108 //
102 // SetParallelWorld                               109 // SetParallelWorld 
103 //                                                110 //
104 //--------------------------------------------    111 //------------------------------------------------------
105 void G4ImportanceProcess::SetParallelWorld(con << 112 void G4ImportanceProcess::
                                                   >> 113 SetParallelWorld(const G4String &parallelWorldName)
106 {                                                 114 {
107   G4cout << G4endl << G4endl << G4endl;           115   G4cout << G4endl << G4endl << G4endl;
108   G4cout << "G4ImportanceProcess:: SetParallel    116   G4cout << "G4ImportanceProcess:: SetParallelWorld name = " << parallelWorldName << G4endl;
109 //++++++++++++++++++++++++++++++++++++++++++++    117 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
110 // Get pointers of the parallel world and its     118 // Get pointers of the parallel world and its navigator
111 //++++++++++++++++++++++++++++++++++++++++++++    119 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
112   fGhostWorldName = parallelWorldName;            120   fGhostWorldName = parallelWorldName;
113   fGhostWorld = fTransportationManager->GetPar    121   fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
114   fGhostNavigator = fTransportationManager->Ge    122   fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
115 //++++++++++++++++++++++++++++++++++++++++++++    123 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
116 }                                                 124 }
117                                                   125 
                                                   >> 126 // void G4ImportanceProcess::
                                                   >> 127 // SetParallelWorld(const G4VPhysicalVolume* parallelWorld)
                                                   >> 128 // {
                                                   >> 129 // //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                                   >> 130 // // Get pointer of navigator
                                                   >> 131 // //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                                   >> 132 //   // G4cout << " G4ImportanceProcess:: Got here 1 " << G4endl;
                                                   >> 133 //   // fGhostWorldName = parallelWorld->GetName();
                                                   >> 134 //   // G4cout << " G4ImportanceProcess:: Got here 2 ghostName:" << fGhostWorldName << G4endl;
                                                   >> 135 //   fGhostWorld = parallelWorld;
                                                   >> 136 //   G4cout << " G4ImportanceProcess:: Got here 3 " << G4endl;
                                                   >> 137 //   fGhostNavigator = fTransportationManager->GetNavigator(parallelWorld);
                                                   >> 138 //   G4cout << " G4ImportanceProcess:: Got here 4 " << G4endl;
                                                   >> 139 // //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                                   >> 140 // }
                                                   >> 141 
118 //--------------------------------------------    142 //------------------------------------------------------
119 //                                                143 //
120 // StartTracking                                  144 // StartTracking
121 //                                                145 //
122 //--------------------------------------------    146 //------------------------------------------------------
123 void G4ImportanceProcess::StartTracking(G4Trac    147 void G4ImportanceProcess::StartTracking(G4Track* trk)
124 {                                                 148 {
125 //++++++++++++++++++++++++++++++++++++++++++++    149 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
126 // Activate navigator and get the navigator ID    150 // Activate navigator and get the navigator ID
127 //++++++++++++++++++++++++++++++++++++++++++++    151 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                                   >> 152 // G4cout << " G4ParallelWorldScoringProcess::StartTracking" << G4endl;
128                                                   153 
129   if(fParaflag)                                << 154   if(fParaflag) {
130   {                                            << 
131     if(fGhostNavigator != nullptr)                155     if(fGhostNavigator != nullptr)
132     {                                          << 156       { fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
133       fNavigatorID = fTransportationManager->A << 
134     }                                          << 
135     else                                          157     else
136     {                                          << 158       {
137       G4Exception("G4ImportanceProcess::StartT << 159   G4Exception("G4ImportanceProcess::StartTracking",
138                   "ProcParaWorld000",FatalExce << 160         "ProcParaWorld000",FatalException,
139                   "G4ImportanceProcess is used << 161         "G4ImportanceProcess is used for tracking without having a parallel world assigned");
140     }                                          << 162       }
                                                   >> 163 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
141                                                   164 
                                                   >> 165 // G4cout << "G4ParallelWorldScoringProcess::StartTracking <<<<<<<<<<<<<<<<<< " << G4endl;
142 //++++++++++++++++++++++++++++++++++++++++++++    166 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
143 // Let PathFinder initialize                      167 // Let PathFinder initialize
144 //++++++++++++++++++++++++++++++++++++++++++++    168 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
145     fPathFinder->PrepareNewTrack(trk->GetPosit    169     fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
                                                   >> 170 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
146                                                   171 
147 //++++++++++++++++++++++++++++++++++++++++++++    172 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
148 // Setup initial touchables for the first step    173 // Setup initial touchables for the first step
149 //++++++++++++++++++++++++++++++++++++++++++++    174 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
150     fOldGhostTouchable = fPathFinder->CreateTo    175     fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
151     fGhostPreStepPoint->SetTouchableHandle(fOl    176     fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
152     fNewGhostTouchable = fOldGhostTouchable;      177     fNewGhostTouchable = fOldGhostTouchable;
153     fGhostPostStepPoint->SetTouchableHandle(fN    178     fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
154                                                   179 
155   // Initialize                                   180   // Initialize 
156     fGhostSafety = -1.;                           181     fGhostSafety = -1.;
157     fOnBoundary = false;                          182     fOnBoundary = false;
158   }                                               183   }
                                                   >> 184 
159 }                                                 185 }
160                                                   186 
                                                   >> 187 
161 G4double G4ImportanceProcess::                    188 G4double G4ImportanceProcess::
162 PostStepGetPhysicalInteractionLength(const G4T << 189 PostStepGetPhysicalInteractionLength(const G4Track& ,
                                                   >> 190                                      G4double   ,
163                                      G4ForceCo    191                                      G4ForceCondition* condition)
164 {                                                 192 {
                                                   >> 193 //   *condition = Forced;
                                                   >> 194 //   return kInfinity;
                                                   >> 195 
                                                   >> 196 //  *condition = StronglyForced;
165   *condition = Forced;                            197   *condition = Forced;
166   return DBL_MAX;                                 198   return DBL_MAX;
167 }                                                 199 }
168                                                   200   
169 G4VParticleChange *                               201 G4VParticleChange *
170 G4ImportanceProcess::PostStepDoIt(const G4Trac    202 G4ImportanceProcess::PostStepDoIt(const G4Track &aTrack,
171                                       const G4    203                                       const G4Step &aStep)
172 {                                                 204 {
173   fParticleChange->Initialize(aTrack);            205   fParticleChange->Initialize(aTrack);
174                                                   206 
175   if(aTrack.GetNextVolume() == nullptr)        << 207   if(fParaflag) {
176   {                                            << 
177     return fParticleChange;                    << 
178   }                                            << 
179                                                << 
180   if(fParaflag)                                << 
181   {                                            << 
182     fOldGhostTouchable = fGhostPostStepPoint->    208     fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
183     //xbug?    fOnBoundary = false;               209     //xbug?    fOnBoundary = false;
184     CopyStep(aStep);                              210     CopyStep(aStep);
185                                                   211     
186     if(fOnBoundary)                               212     if(fOnBoundary)
187     {                                          << 213       {
188 //++++++++++++++++++++++++++++++++++++++++++++    214 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
189 // Locate the point and get new touchable         215 // Locate the point and get new touchable
190 //++++++++++++++++++++++++++++++++++++++++++++    216 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
191   //??  fPathFinder->Locate(step.GetPostStepPo    217   //??  fPathFinder->Locate(step.GetPostStepPoint()->GetPosition(),
192   //??                      step.GetPostStepPo    218   //??                      step.GetPostStepPoint()->GetMomentumDirection());
193   fNewGhostTouchable = fPathFinder->CreateTouc    219   fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
194     }                                          << 220   //AH  G4cout << " on boundary " << G4endl;
                                                   >> 221 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                                   >> 222       }
195     else                                          223     else
196     {                                          << 224       {
197       // reuse the touchable                   << 225   // Do I need this ??????????????????????????????????????????????????????????
198       fNewGhostTouchable = fOldGhostTouchable; << 226   // fGhostNavigator->LocateGlobalPointWithinVolume(track.GetPosition());
199     }                                          << 227   // ?????????????????????????????????????????????????????????????????????????
                                                   >> 228   
                                                   >> 229   // fPathFinder->ReLocate(track.GetPosition());
                                                   >> 230   
                                                   >> 231   // reuse the touchable
                                                   >> 232   fNewGhostTouchable = fOldGhostTouchable;
                                                   >> 233   //AH  G4cout << " NOT on boundary " << G4endl;
                                                   >> 234       }
200                                                   235     
201     fGhostPreStepPoint->SetTouchableHandle(fOl    236     fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
202     fGhostPostStepPoint->SetTouchableHandle(fN    237     fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
203                                                   238     
                                                   >> 239 //   if ( (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary)
                                                   >> 240 //     && (aStep.GetStepLength() > kCarTolerance) )
                                                   >> 241 //   {
                                                   >> 242 //     if (aTrack.GetTrackStatus()==fStopAndKill)
                                                   >> 243 //     {
                                                   >> 244 //       G4cout << "WARNING - G4ImportanceProcess::PostStepDoIt()"
                                                   >> 245 //              << "          StopAndKill track." << G4endl;
                                                   >> 246 //     }
                                                   >> 247 
                                                   >> 248 //     G4StepPoint *prepoint  = aStep.GetPreStepPoint();
                                                   >> 249 //     G4StepPoint *postpoint = aStep.GetPostStepPoint();
                                                   >> 250 //     G4GeometryCell prekey(*(prepoint->GetPhysicalVolume()), 
                                                   >> 251 //                          prepoint->GetTouchable()->GetReplicaNumber());
                                                   >> 252 //     G4GeometryCell postkey(*(postpoint->GetPhysicalVolume()), 
                                                   >> 253 //                           postpoint->GetTouchable()->GetReplicaNumber());
                                                   >> 254 
                                                   >> 255 
204     if ( (fGhostPostStepPoint->GetStepStatus()    256     if ( (fGhostPostStepPoint->GetStepStatus() == fGeomBoundary)
205    && (aStep.GetStepLength() > kCarTolerance)     257    && (aStep.GetStepLength() > kCarTolerance) )
206     {                                          << 
207       if (aTrack.GetTrackStatus()==fStopAndKil << 
208       {                                           258       {
209         G4cout << "WARNING - G4ImportanceProce << 259   if (aTrack.GetTrackStatus()==fStopAndKill)
210                << "          StopAndKill track << 260     {
                                                   >> 261       G4cout << "WARNING - G4ImportanceProcess::PostStepDoIt()"
                                                   >> 262        << "          StopAndKill track. on boundary" << G4endl;
                                                   >> 263     }
                                                   >> 264   
                                                   >> 265   G4GeometryCell prekey(*(fGhostPreStepPoint->GetPhysicalVolume()), 
                                                   >> 266             fGhostPreStepPoint->GetTouchable()->GetReplicaNumber());
                                                   >> 267   G4GeometryCell postkey(*(fGhostPostStepPoint->GetPhysicalVolume()), 
                                                   >> 268              fGhostPostStepPoint->GetTouchable()->GetReplicaNumber());
                                                   >> 269   
                                                   >> 270   //AH
                                                   >> 271   /*
                                                   >> 272   G4cout << G4endl;
                                                   >> 273   G4cout << G4endl;
                                                   >> 274   G4cout << " inside parallel importance process " << aTrack.GetCurrentStepNumber() << G4endl;
                                                   >> 275   G4cout << G4endl;
                                                   >> 276   G4cout << G4endl;
                                                   >> 277   G4cout << " prekey: " << fGhostPreStepPoint->GetPhysicalVolume()->GetName() << " replica:" 
                                                   >> 278          << fGhostPreStepPoint->GetTouchable()->GetReplicaNumber() << G4endl;
                                                   >> 279   G4cout << " prekey ISTORE: " << fIStore.GetImportance(prekey) << G4endl;
                                                   >> 280   G4cout << " postkey: " << G4endl;
                                                   >> 281   G4cout << " postkey ISTORE: " << fIStore.GetImportance(postkey) << G4endl;
                                                   >> 282   */
                                                   >> 283   //AH
                                                   >> 284   G4Nsplit_Weight nw = fImportanceAlgorithm.
                                                   >> 285     Calculate(fIStore.GetImportance(prekey),
                                                   >> 286         fIStore.GetImportance(postkey), 
                                                   >> 287         aTrack.GetWeight());
                                                   >> 288   //AH
                                                   >> 289   /*
                                                   >> 290   G4cout << " prekey weight: " << fIStore.GetImportance(prekey) 
                                                   >> 291          << " postkey weight: " << fIStore.GetImportance(postkey) 
                                                   >> 292          << " split weight: " << nw << G4endl;
                                                   >> 293   G4cout << " before poststepaction " << G4endl;
                                                   >> 294   */
                                                   >> 295   //AH
                                                   >> 296   fPostStepAction->DoIt(aTrack, fParticleChange, nw);
                                                   >> 297   //AH  G4cout << " after post step do it " << G4endl;
211       }                                           298       }
212                                                << 299   } else {
213       G4GeometryCell prekey(*(fGhostPreStepPoi << 
214                             fGhostPreStepPoint << 
215       G4GeometryCell postkey(*(fGhostPostStepP << 
216                              fGhostPostStepPoi << 
217                                                << 
218       G4Nsplit_Weight nw =                     << 
219           fImportanceAlgorithm.Calculate(fISto << 
220                              fIStore.GetImport << 
221                              aTrack.GetWeight( << 
222       fPostStepAction->DoIt(aTrack, fParticleC << 
223     }                                          << 
224   }                                            << 
225   else                                         << 
226   {                                            << 
227     if ( (aStep.GetPostStepPoint()->GetStepSta    300     if ( (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary)
228          && (aStep.GetStepLength() > kCarToler << 301    && (aStep.GetStepLength() > kCarTolerance) )
229     {                                          << 
230       if (aTrack.GetTrackStatus()==fStopAndKil << 
231       {                                           302       {
232         G4cout << "WARNING - G4ImportanceProce << 303   //AH  G4cout << " inside non-parallel importance process " << G4endl;
233                << "          StopAndKill track << 304   if (aTrack.GetTrackStatus()==fStopAndKill)
234                << G4endl;                      << 305     {
235       }                                        << 306       G4cout << "WARNING - G4ImportanceProcess::PostStepDoIt()"
                                                   >> 307        << "          StopAndKill track. on boundary non-parallel" << G4endl;
                                                   >> 308     }
236                                                   309   
237       G4StepPoint *prepoint  = aStep.GetPreSte << 310   G4StepPoint *prepoint  = aStep.GetPreStepPoint();
238       G4StepPoint *postpoint = aStep.GetPostSt << 311   G4StepPoint *postpoint = aStep.GetPostStepPoint();
239                                                << 312   
240       G4GeometryCell prekey(*(prepoint->GetPhy << 313   G4GeometryCell prekey(*(prepoint->GetPhysicalVolume()), 
241                             prepoint->GetTouch << 314             prepoint->GetTouchable()->GetReplicaNumber());
242       G4GeometryCell postkey(*(postpoint->GetP << 315   G4GeometryCell postkey(*(postpoint->GetPhysicalVolume()), 
243                              postpoint->GetTou << 316              postpoint->GetTouchable()->GetReplicaNumber());
244                                                << 317   
245       G4Nsplit_Weight nw =                     << 318   G4Nsplit_Weight nw = fImportanceAlgorithm.
246           fImportanceAlgorithm.Calculate(fISto << 319     Calculate(fIStore.GetImportance(prekey),
247                                          fISto << 320         fIStore.GetImportance(postkey), 
248                                          aTrac << 321         aTrack.GetWeight());
                                                   >> 322   //AH
                                                   >> 323   /*
                                                   >> 324   G4cout << " prekey weight: " << fIStore.GetImportance(prekey) 
                                                   >> 325          << " postkey weight: " << fIStore.GetImportance(postkey) 
                                                   >> 326          << " split weight: " << nw << G4endl;
                                                   >> 327   G4cout << " before poststepaction 2 " << G4endl;
                                                   >> 328   */
                                                   >> 329   //AH
249   fPostStepAction->DoIt(aTrack, fParticleChang    330   fPostStepAction->DoIt(aTrack, fParticleChange, nw);
250     }                                          << 331   //AH  G4cout << " after poststepaction 2 " << G4endl;
                                                   >> 332       }
251   }                                               333   }
252   return fParticleChange;                         334   return fParticleChange;
253 }                                                 335 }
254                                                   336 
255 void G4ImportanceProcess::KillTrack() const       337 void G4ImportanceProcess::KillTrack() const
256 {                                                 338 {
257   fParticleChange->ProposeTrackStatus(fStopAnd    339   fParticleChange->ProposeTrackStatus(fStopAndKill);
258 }                                                 340 }
259                                                   341 
260 const G4String& G4ImportanceProcess::GetName() << 342 const G4String &G4ImportanceProcess::GetName() const
261 {                                                 343 {
262   return theProcessName;                          344   return theProcessName;
263 }                                                 345 }
264                                                   346 
265 G4double G4ImportanceProcess::                    347 G4double G4ImportanceProcess::
266 AlongStepGetPhysicalInteractionLength(            348 AlongStepGetPhysicalInteractionLength(
267                     const G4Track& track, G4do << 349             const G4Track& track, G4double  previousStepSize, G4double  currentMinimumStep,
268                     G4double currentMinimumSte << 350             G4double& proposedSafety, G4GPILSelection* selection)
269                     G4double& proposedSafety,  << 
270 {                                                 351 {
271   if(fParaflag)                                << 352   if(fParaflag) {    
272   {                                            << 
273     *selection = NotCandidateForSelection;        353     *selection = NotCandidateForSelection;
274     G4double returnedStep = DBL_MAX;              354     G4double returnedStep = DBL_MAX;
275                                                   355     
276     if (previousStepSize > 0.)                    356     if (previousStepSize > 0.)
277       { fGhostSafety -= previousStepSize; }       357       { fGhostSafety -= previousStepSize; }
278     //  else                                      358     //  else
279     //  { fGhostSafety = -1.; }                   359     //  { fGhostSafety = -1.; }
280     if (fGhostSafety < 0.) { fGhostSafety = 0. << 360     if (fGhostSafety < 0.) fGhostSafety = 0.0;
281                                                   361     
282     // ---------------------------------------    362     // ------------------------------------------
283     // Determination of the proposed STEP LENG    363     // Determination of the proposed STEP LENGTH:
284     // ---------------------------------------    364     // ------------------------------------------
285     if (currentMinimumStep <= fGhostSafety &&     365     if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
286     {                                          << 
287       // I have no chance to limit             << 
288       returnedStep = currentMinimumStep;       << 
289       fOnBoundary = false;                     << 
290       proposedSafety = fGhostSafety - currentM << 
291     }                                          << 
292     else // (currentMinimumStep > fGhostSafety << 
293     {                                          << 
294       G4FieldTrackUpdator::Update(&fFieldTrack << 
295       //++++++++++++++++++++++++++++++++++++++ << 
296       // ComputeStep                           << 
297       //++++++++++++++++++++++++++++++++++++++ << 
298       returnedStep                             << 
299     = fPathFinder->ComputeStep(fFieldTrack,cur << 
300                                      track.Get << 
301                                      fEndTrack << 
302       //++++++++++++++++++++++++++++++++++++++ << 
303       if(feLimited == kDoNot)                  << 
304       {                                           366       {
305         // Track is not on the boundary        << 367   // I have no chance to limit
306         fOnBoundary = false;                   << 368   returnedStep = currentMinimumStep;
307         fGhostSafety = fGhostNavigator->Comput << 369   fOnBoundary = false;
                                                   >> 370   proposedSafety = fGhostSafety - currentMinimumStep;
                                                   >> 371   //AH  G4cout << " step not limited, why? " << G4endl;
308       }                                           372       }
309       else                                     << 373     else // (currentMinimumStep > fGhostSafety: I may limit the Step)
310       {                                        << 
311         // Track is on the boundary            << 
312         fOnBoundary = true;                    << 
313       }                                        << 
314       proposedSafety = fGhostSafety;           << 
315       if(feLimited == kUnique || feLimited ==  << 
316       {                                           374       {
317         *selection = CandidateForSelection;    << 375   G4FieldTrackUpdator::Update(&fFieldTrack,&track);
318       }                                        << 376   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
319       else if (feLimited == kSharedTransport)  << 377   // ComputeStep
320       {                                        << 378   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
321         returnedStep *= (1.0 + 1.0e-9);        << 379   returnedStep
322         // Expand to disable its selection in  << 380     = fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
                                                   >> 381              track.GetCurrentStepNumber(),fGhostSafety,feLimited,
                                                   >> 382              fEndTrack,track.GetVolume());
                                                   >> 383   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                                   >> 384   if(feLimited == kDoNot)
                                                   >> 385     {
                                                   >> 386       //AH      G4cout << " computestep came back with not-boundary " << G4endl;
                                                   >> 387       // Track is not on the boundary
                                                   >> 388       fOnBoundary = false;
                                                   >> 389       fGhostSafety = fGhostNavigator->ComputeSafety(fEndTrack.GetPosition());
                                                   >> 390     }
                                                   >> 391   else
                                                   >> 392     {
                                                   >> 393       // Track is on the boundary
                                                   >> 394       //AH      G4cout << " FOUND A BOUNDARY ! " << track.GetCurrentStepNumber() << G4endl;
                                                   >> 395       fOnBoundary = true;
                                                   >> 396       // proposedSafety = fGhostSafety;
                                                   >> 397     }
                                                   >> 398   proposedSafety = fGhostSafety;
                                                   >> 399   if(feLimited == kUnique || feLimited == kSharedOther) {
                                                   >> 400     *selection = CandidateForSelection;
                                                   >> 401   }else if (feLimited == kSharedTransport) { 
                                                   >> 402     returnedStep *= (1.0 + 1.0e-9);  
                                                   >> 403     // Expand to disable its selection in Step Manager comparison
                                                   >> 404   }
                                                   >> 405   
323       }                                           406       }
324     }                                          << 
325                                                   407 
326     // --------------------------------------- << 408   // ----------------------------------------------
327     // Returns the fGhostSafety as the propose << 409   // Returns the fGhostSafety as the proposedSafety
328     // The SteppingManager will take care of k << 410   // The SteppingManager will take care of keeping
329     // the smallest one.                       << 411   // the smallest one.
330     // --------------------------------------- << 412   // ----------------------------------------------
331     return returnedStep;                          413     return returnedStep;
332   }                                            << 414 
333   else                                         << 415   } else {
334   {                                            << 416 
335     return DBL_MAX;                               417     return DBL_MAX;
                                                   >> 418 
336   }                                               419   }
                                                   >> 420 
337 }                                                 421 }
338                                                   422 
339 G4double G4ImportanceProcess::                    423 G4double G4ImportanceProcess::
340 AtRestGetPhysicalInteractionLength(const G4Tra    424 AtRestGetPhysicalInteractionLength(const G4Track& ,
341                                    G4ForceCond    425                                    G4ForceCondition*) 
342 {                                                 426 {
343   return -1.0;                                    427   return -1.0;
344 }                                                 428 }
345                                                   429   
346 G4VParticleChange* G4ImportanceProcess::          430 G4VParticleChange* G4ImportanceProcess::
347 AtRestDoIt(const G4Track&, const G4Step&)         431 AtRestDoIt(const G4Track&, const G4Step&) 
348 {                                                 432 {
349   return nullptr;                                 433   return nullptr;
350 }                                                 434 }
351                                                   435 
352 G4VParticleChange* G4ImportanceProcess::          436 G4VParticleChange* G4ImportanceProcess::
353 AlongStepDoIt(const G4Track& aTrack, const G4S    437 AlongStepDoIt(const G4Track& aTrack, const G4Step& )
354 {                                                 438 {
355   // Dummy ParticleChange ie: does nothing        439   // Dummy ParticleChange ie: does nothing
356   // Expecting G4Transportation to move the tr    440   // Expecting G4Transportation to move the track
                                                   >> 441   //AH  G4cout << " along step do it " << G4endl;
357   pParticleChange->Initialize(aTrack);            442   pParticleChange->Initialize(aTrack);
358   return pParticleChange;                         443   return pParticleChange; 
359 }                                                 444 }
360                                                   445 
361 void G4ImportanceProcess::CopyStep(const G4Ste << 446 void G4ImportanceProcess::CopyStep(const G4Step & step)
362 {                                                 447 {
363   fGhostStep->SetTrack(step.GetTrack());          448   fGhostStep->SetTrack(step.GetTrack());
364   fGhostStep->SetStepLength(step.GetStepLength    449   fGhostStep->SetStepLength(step.GetStepLength());
365   fGhostStep->SetTotalEnergyDeposit(step.GetTo    450   fGhostStep->SetTotalEnergyDeposit(step.GetTotalEnergyDeposit());
366   fGhostStep->SetControlFlag(step.GetControlFl    451   fGhostStep->SetControlFlag(step.GetControlFlag());
367                                                   452 
368   *fGhostPreStepPoint = *(step.GetPreStepPoint    453   *fGhostPreStepPoint = *(step.GetPreStepPoint());
369   *fGhostPostStepPoint = *(step.GetPostStepPoi    454   *fGhostPostStepPoint = *(step.GetPostStepPoint());
370                                                   455 
371 //++++++++++++++++++++++++++++++++++++++++++++    456 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
372 // Set StepStatus for ghost world                 457 // Set StepStatus for ghost world
373 //++++++++++++++++++++++++++++++++++++++++++++    458 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
374   if(fOnBoundary)                                 459   if(fOnBoundary)
375   { fGhostPostStepPoint->SetStepStatus(fGeomBo    460   { fGhostPostStepPoint->SetStepStatus(fGeomBoundary); }
376   else if(fGhostPostStepPoint->GetStepStatus()    461   else if(fGhostPostStepPoint->GetStepStatus()==fGeomBoundary)
377   { fGhostPostStepPoint->SetStepStatus(fPostSt    462   { fGhostPostStepPoint->SetStepStatus(fPostStepDoItProc); }
378 //++++++++++++++++++++++++++++++++++++++++++++    463 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
379 }                                                 464 }
380                                                   465