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 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/transportation/include/G4Transportation.hh (Version 11.3.0) and /processes/transportation/include/G4Transportation.hh (Version 11.1)


  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 //                                                 26 //
 27 //                                                 27 //
 28 //                                                 28 // 
 29 // -------------------------------------------     29 // ------------------------------------------------------------
 30 //        GEANT 4  include file implementation     30 //        GEANT 4  include file implementation
 31 // -------------------------------------------     31 // ------------------------------------------------------------
 32 //                                                 32 //
 33 // Class description:                              33 // Class description:
 34 //                                                 34 //
 35 // G4Transportation is a process responsible f     35 // G4Transportation is a process responsible for the transportation of 
 36 // a particle, i.e. the geometrical propagatio     36 // a particle, i.e. the geometrical propagation encountering the 
 37 // geometrical sub-volumes of the detectors.       37 // geometrical sub-volumes of the detectors.
 38 // It is also tasked with part of updating the     38 // It is also tasked with part of updating the "safety".
 39                                                    39 
 40 // ===========================================     40 // =======================================================================
 41 // Created:  19 March 1997, J. Apostolakis         41 // Created:  19 March 1997, J. Apostolakis
 42 // ===========================================     42 // =======================================================================
 43 #ifndef G4Transportation_hh                        43 #ifndef G4Transportation_hh
 44 #define G4Transportation_hh 1                      44 #define G4Transportation_hh 1
 45                                                    45 
 46 #include "G4VProcess.hh"                           46 #include "G4VProcess.hh"
 47                                                    47 
 48 #include "G4Track.hh"                              48 #include "G4Track.hh"
 49 #include "G4Step.hh"                               49 #include "G4Step.hh"
 50 #include "G4ParticleChangeForTransport.hh"         50 #include "G4ParticleChangeForTransport.hh"
 51                                                    51 
 52 class G4Navigator;                                 52 class G4Navigator;
 53 class G4PropagatorInField;                         53 class G4PropagatorInField;
 54 class G4SafetyHelper;                              54 class G4SafetyHelper; 
 55 class G4TransportationLogger;                      55 class G4TransportationLogger;
 56                                                    56 
 57 class G4Transportation : public G4VProcess         57 class G4Transportation : public G4VProcess 
 58 {                                                  58 {
 59   // Concrete class that does the geometrical      59   // Concrete class that does the geometrical transport 
 60                                                    60 
 61   public:  // with description                     61   public:  // with description
 62                                                    62 
 63      G4Transportation( G4int verbosityLevel= 1     63      G4Transportation( G4int verbosityLevel= 1, const G4String& aName = "Transportation");
 64      ~G4Transportation();                          64      ~G4Transportation(); 
 65                                                    65 
 66      G4double      AlongStepGetPhysicalInterac     66      G4double      AlongStepGetPhysicalInteractionLength(
 67                              const G4Track& tr     67                              const G4Track& track,
 68                                    G4double  p     68                                    G4double  previousStepSize,
 69                                    G4double  c     69                                    G4double  currentMinimumStep, 
 70                                    G4double& c     70                                    G4double& currentSafety,
 71                                    G4GPILSelec     71                                    G4GPILSelection* selection
 72                             ); // override;        72                             ); // override;
 73                                                    73 
 74      G4VParticleChange* AlongStepDoIt(             74      G4VParticleChange* AlongStepDoIt(
 75                              const G4Track& tr     75                              const G4Track& track,
 76                              const G4Step& ste     76                              const G4Step& stepData
 77                             ); // override;        77                             ); // override; 
 78                                                    78 
 79      G4VParticleChange* PostStepDoIt(              79      G4VParticleChange* PostStepDoIt(
 80                              const G4Track& tr     80                              const G4Track& track,
 81                              const G4Step&  st     81                              const G4Step&  stepData
 82                             ); // override;        82                             ); // override;    
 83        // Responsible for the relocation           83        // Responsible for the relocation
 84                                                    84 
 85      G4double PostStepGetPhysicalInteractionLe     85      G4double PostStepGetPhysicalInteractionLength(
 86                              const G4Track& ,      86                              const G4Track& ,
 87                              G4double   previo     87                              G4double   previousStepSize,
 88                              G4ForceCondition*     88                              G4ForceCondition* pForceCond
 89                             ); // override;        89                             ); // override;                            
 90        // Forces the PostStepDoIt action to be     90        // Forces the PostStepDoIt action to be called, 
 91        // but does not limit the step              91        // but does not limit the step
 92                                                    92 
 93      inline G4bool FieldExertedForce() { retur     93      inline G4bool FieldExertedForce() { return fFieldExertedForce; }
 94                                                    94    
 95      G4PropagatorInField* GetPropagatorInField     95      G4PropagatorInField* GetPropagatorInField();
 96      void SetPropagatorInField( G4PropagatorIn     96      void SetPropagatorInField( G4PropagatorInField* pFieldPropagator);
 97        // Access/set the assistant class that      97        // Access/set the assistant class that Propagate in a Field
 98                                                    98 
 99      inline G4double GetThresholdWarningEnergy     99      inline G4double GetThresholdWarningEnergy() const; 
100      inline G4double GetThresholdImportantEner    100      inline G4double GetThresholdImportantEnergy() const; 
101      inline G4int GetThresholdTrials() const;     101      inline G4int GetThresholdTrials() const; 
102                                                   102 
103      inline void SetThresholdWarningEnergy( G4    103      inline void SetThresholdWarningEnergy( G4double newEnWarn ); 
104      inline void SetThresholdImportantEnergy(     104      inline void SetThresholdImportantEnergy( G4double newEnImp ); 
105      inline void SetThresholdTrials(G4int newM    105      inline void SetThresholdTrials(G4int newMaxTrials ); 
106      // Get/Set parameters for killing loopers    106      // Get/Set parameters for killing loopers: 
107      //   Above 'important' energy a 'looping'    107      //   Above 'important' energy a 'looping' particle in field will 
108      //   *NOT* be abandoned, except after fTh    108      //   *NOT* be abandoned, except after fThresholdTrials attempts.
109      // Below Warning energy, no verbosity for    109      // Below Warning energy, no verbosity for looping particles is issued
110                                                   110 
111      void SetHighLooperThresholds(); // Shortc    111      void SetHighLooperThresholds(); // Shortcut method - old values (meant for HEP)   
112      void SetLowLooperThresholds(); // Set low    112      void SetLowLooperThresholds(); // Set low thresholds - for low-E applications
113      void PushThresholdsToLogger(); // Inform     113      void PushThresholdsToLogger(); // Inform logger of current thresholds
114      void ReportLooperThresholds(); // Print v    114      void ReportLooperThresholds(); // Print values of looper thresholds
115                                                   115 
116      inline G4double GetMaxEnergyKilled() cons    116      inline G4double GetMaxEnergyKilled() const; 
117      inline G4double GetSumEnergyKilled() cons    117      inline G4double GetSumEnergyKilled() const;
118      inline void ResetKilledStatistics( G4int     118      inline void ResetKilledStatistics( G4int report = 1);      
119      // Statistics for tracks killed (currentl    119      // Statistics for tracks killed (currently due to looping in field)
120                                                   120 
121      inline void EnableShortStepOptimisation(G    121      inline void EnableShortStepOptimisation(G4bool optimise=true); 
122      // Whether short steps < safety will avoi    122      // Whether short steps < safety will avoid to call Navigator (if field=0)
123                                                   123 
124      static G4bool EnableMagneticMoment(G4bool    124      static G4bool EnableMagneticMoment(G4bool useMoment=true); 
125      // Whether to enable particles to be defl    125      // Whether to enable particles to be deflected with force due to magnetic moment
126                                                   126 
127      static G4bool EnableGravity(G4bool useGra    127      static G4bool EnableGravity(G4bool useGravity=true); 
128      // Whether to enable particles to be defl    128      // Whether to enable particles to be deflected with force due to gravity
129                                                   129 
130      static void   SetSilenceLooperWarnings( G    130      static void   SetSilenceLooperWarnings( G4bool val);
131      // Do not warn (or throw exception) about    131      // Do not warn (or throw exception) about 'looping' particles
132      static G4bool GetSilenceLooperWarnings();    132      static G4bool GetSilenceLooperWarnings();
133                                                   133    
134   public: // without description                  134   public: // without description    
135      static G4bool EnableUseMagneticMoment(G4b    135      static G4bool EnableUseMagneticMoment(G4bool useMoment=true)
136      { return EnableMagneticMoment(useMoment);    136      { return EnableMagneticMoment(useMoment); }  // Old name - will be deprecated
137                                                   137    
138   public:  // without description                 138   public:  // without description
139                                                   139 
140      G4double AtRestGetPhysicalInteractionLeng    140      G4double AtRestGetPhysicalInteractionLength( const G4Track&,
141                                                   141                                                   G4ForceCondition*)
142        { return -1.0; }  // No operation in At    142        { return -1.0; }  // No operation in AtRestGPIL
143                                                   143 
144      G4VParticleChange* AtRestDoIt( const G4Tr    144      G4VParticleChange* AtRestDoIt( const G4Track&, const G4Step& )
145        { return 0; }     // No operation in At    145        { return 0; }     // No operation in AtRestDoIt
146                                                   146 
147      void StartTracking(G4Track* aTrack);         147      void StartTracking(G4Track* aTrack);
148        // Reset state for new (potentially res    148        // Reset state for new (potentially resumed) track 
149                                                   149 
150      virtual void ProcessDescription(std::ostr    150      virtual void ProcessDescription(std::ostream& outFile) const; // override;
151      void PrintStatistics( std::ostream& outSt    151      void PrintStatistics( std::ostream& outStr) const;
152                                                   152    
153   protected:                                      153   protected:
154                                                   154 
155      void SetTouchableInformation(const G4Touc    155      void SetTouchableInformation(const G4TouchableHandle& touchable);
156                                                   156 
157      void ReportMissingLogger(const char * met    157      void ReportMissingLogger(const char * methodName);
158                                                   158    
159   protected:                                      159   protected:
160                                                   160 
161      G4Navigator* fLinearNavigator;               161      G4Navigator* fLinearNavigator;
162        // The navigator for the 'mass' geometr    162        // The navigator for the 'mass' geometry
163        // (the real one, that physics occurs i    163        // (the real one, that physics occurs in)
164      G4PropagatorInField* fFieldPropagator;       164      G4PropagatorInField* fFieldPropagator;
165        // The Propagators used to transport th    165        // The Propagators used to transport the particle
166                                                   166 
167      G4ThreeVector fTransportEndPosition=         167      G4ThreeVector fTransportEndPosition=     G4ThreeVector( 0.0, 0.0, 0.0 );
168      G4ThreeVector fTransportEndMomentumDir=      168      G4ThreeVector fTransportEndMomentumDir=  G4ThreeVector( 0.0, 0.0, 0.0 );
169      G4double      fTransportEndKineticEnergy=    169      G4double      fTransportEndKineticEnergy= 0.0;
170      G4ThreeVector fTransportEndSpin=  G4Three    170      G4ThreeVector fTransportEndSpin=  G4ThreeVector( 0.0, 0.0, 0.0 );
171      G4bool        fMomentumChanged=   true;      171      G4bool        fMomentumChanged=   true;
172      G4bool        fEndGlobalTimeComputed= fal    172      G4bool        fEndGlobalTimeComputed= false; 
173      G4double      fCandidateEndGlobalTime= 0.    173      G4double      fCandidateEndGlobalTime= 0.0;
174        // The particle's state after this Step    174        // The particle's state after this Step, Store for DoIt
175                                                   175 
176      G4bool        fAnyFieldExists= false;        176      G4bool        fAnyFieldExists= false; 
177                                                   177    
178      G4bool fParticleIsLooping = false;           178      G4bool fParticleIsLooping = false;
179      G4bool fNewTrack= true;          // Flag     179      G4bool fNewTrack= true;          // Flag from StartTracking 
180      G4bool fFirstStepInVolume= true;             180      G4bool fFirstStepInVolume= true;
181      G4bool fLastStepInVolume= false;  // Last    181      G4bool fLastStepInVolume= false;  // Last step - almost same as next flag
182                                 // (temporary     182                                 // (temporary redundancy for checking) 
183      G4bool fGeometryLimitedStep= true;           183      G4bool fGeometryLimitedStep= true;
184        // Flag to determine whether a boundary    184        // Flag to determine whether a boundary was reached
185                                                   185 
186      G4bool fFieldExertedForce= false; // Duri    186      G4bool fFieldExertedForce= false; // During current step
187                                                   187 
188      G4TouchableHandle fCurrentTouchableHandle    188      G4TouchableHandle fCurrentTouchableHandle;
189                                                   189      
190      G4ThreeVector fPreviousSftOrigin;            190      G4ThreeVector fPreviousSftOrigin;
191      G4double      fPreviousSafety;               191      G4double      fPreviousSafety; 
192        // Remember last safety origin & value.    192        // Remember last safety origin & value.
193                                                   193 
194      G4ParticleChangeForTransport fParticleCha    194      G4ParticleChangeForTransport fParticleChange;
195        // New ParticleChange                      195        // New ParticleChange
196                                                   196 
197      G4double fEndPointDistance;                  197      G4double fEndPointDistance;
198                                                   198 
199      // Thresholds for looping particles:         199      // Thresholds for looping particles: 
200      //                                           200      //
201      G4double fThreshold_Warning_Energy =   1.    201      G4double fThreshold_Warning_Energy =   1.0 * CLHEP::keV;  //  Warn above this energy
202      G4double fThreshold_Important_Energy = 1.    202      G4double fThreshold_Important_Energy = 1.0 * CLHEP::MeV;  //  Give a few trial above this E
203      G4int    fThresholdTrials = 10;       //     203      G4int    fThresholdTrials = 10;       //  Number of trials an important looper survives
204        // Above 'important' energy a 'looping'    204        // Above 'important' energy a 'looping' particle in field will 
205        // *NOT* be abandoned, except after fTh    205        // *NOT* be abandoned, except after fThresholdTrials attempts.
206      G4int    fAbandonUnstableTrials = 0;  //     206      G4int    fAbandonUnstableTrials = 0;  //  Number of trials after which to abandon
207                                            //     207                                            //   unstable loopers ( 0 = never )
208      // Counter for steps in which particle re    208      // Counter for steps in which particle reports 'looping',
209      //  ( Used if it is above 'Important' Ene    209      //  ( Used if it is above 'Important' Energy. )
210      G4int    fNoLooperTrials= 0;                 210      G4int    fNoLooperTrials= 0; 
211                                                   211 
212      // Statistics for tracks abandoned due to    212      // Statistics for tracks abandoned due to looping - and 'saved' despite looping
213      //                                           213      //
214      G4double fSumEnergyKilled= 0.0;              214      G4double fSumEnergyKilled= 0.0;
215      G4double fSumEnerSqKilled= 0.0;              215      G4double fSumEnerSqKilled= 0.0;   
216      G4double fMaxEnergyKilled= -1.0;             216      G4double fMaxEnergyKilled= -1.0;
217      G4int    fMaxEnergyKilledPDG= 0;             217      G4int    fMaxEnergyKilledPDG= 0;
218      unsigned long fNumLoopersKilled= 0;          218      unsigned long fNumLoopersKilled= 0;
219      G4double fSumEnergyKilled_NonElectron= 0.    219      G4double fSumEnergyKilled_NonElectron= 0.0;
220      G4double fSumEnerSqKilled_NonElectron= 0.    220      G4double fSumEnerSqKilled_NonElectron= 0.0;
221      G4double fMaxEnergyKilled_NonElectron= -1    221      G4double fMaxEnergyKilled_NonElectron= -1.0;
222      G4int    fMaxEnergyKilled_NonElecPDG= 0;     222      G4int    fMaxEnergyKilled_NonElecPDG= 0;
223      unsigned long fNumLoopersKilled_NonElectr    223      unsigned long fNumLoopersKilled_NonElectron= 0;
224      G4double fSumEnergySaved=  0.0;              224      G4double fSumEnergySaved=  0.0;
225      G4double fMaxEnergySaved= -1.0;              225      G4double fMaxEnergySaved= -1.0;
226      G4double fSumEnergyUnstableSaved = 0.0;      226      G4double fSumEnergyUnstableSaved = 0.0;
227      // Whether to avoid calling G4Navigator f    227      // Whether to avoid calling G4Navigator for short step ( < safety)
228      // If using it, the safety estimate for e    228      // If using it, the safety estimate for endpoint will likely be smaller.
229      //                                           229      //
230      G4bool   fShortStepOptimisation;             230      G4bool   fShortStepOptimisation; 
231                                                   231 
232      G4SafetyHelper* fpSafetyHelper;    // To     232      G4SafetyHelper* fpSafetyHelper;    // To pass it the safety value obtained
233      G4TransportationLogger* fpLogger;  // Rep    233      G4TransportationLogger* fpLogger;  // Reports issues / raises warnings
234                                                   234 
235   protected:                                      235   protected:
236                                                   236 
237      static G4bool fUseMagneticMoment;            237      static G4bool fUseMagneticMoment;
238      static G4bool fUseGravity;                   238      static G4bool fUseGravity;
239      static G4bool fSilenceLooperWarnings;  //    239      static G4bool fSilenceLooperWarnings;  // Flag to *Supress* all 'looper' warnings
240                                                   240    
241 };                                                241 };
242                                                   242 
243 #include "G4Transportation.icc"                   243 #include "G4Transportation.icc"
244                                                   244 
245 #endif                                            245 #endif  
246                                                   246