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