G4CoupledTransportation.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4CoupledTransportation.hh 69887 2013-05-17 08:17:02Z gcosmo $
00028 //
00029 // 
00030 // ------------------------------------------------------------
00031 //        GEANT 4  include file implementation
00032 // ------------------------------------------------------------
00033 //
00034 // Class description:
00035 //
00036 // G4CoupledTransportation is an optional process to transport  
00037 // a particle, in case of coupled navigation in parallel geometries
00038 //  i.e. the geometrical propagation will be done
00039 //   encountering the geometrical volumes of the detectors and
00040 //   those of parallel geometries (eg for biasing, scoring, fast simulation)
00041 // It is tasked with updating the "safety" to reflect the geometrical
00042 //   distance to the nearest volume, and the time of flight of the particle.
00043 
00044 // =======================================================================
00045 // Created:  17 May 2006, J. Apostolakis
00046 // =======================================================================
00047 #ifndef G4CoupledTransportation_hh
00048 #define G4CoupledTransportation_hh 1
00049 
00050 #include "G4VProcess.hh"
00051 
00052 #include "G4FieldManager.hh"
00053 
00054 #include "G4Navigator.hh"
00055 #include "G4TransportationManager.hh"
00056 #include "G4PropagatorInField.hh"
00057 #include "G4PathFinder.hh"
00058 
00059 #include "G4Track.hh"
00060 #include "G4Step.hh"
00061 #include "G4ParticleChangeForTransport.hh"
00062 class G4SafetyHelper; 
00063 
00064 class G4CoupledTransportation : public G4VProcess 
00065 {
00066   // Concrete class that does the geometrical transport 
00067 
00068   public:  // with description
00069 
00070      G4CoupledTransportation( G4int verbosityLevel= 0); 
00071      ~G4CoupledTransportation(); 
00072 
00073      G4double      AlongStepGetPhysicalInteractionLength(
00074                              const G4Track& track,
00075                                    G4double  previousStepSize,
00076                                    G4double  currentMinimumStep, 
00077                                    G4double& currentSafety,
00078                                    G4GPILSelection* selection
00079                             );
00080 
00081      G4VParticleChange* AlongStepDoIt(
00082                              const G4Track& track,
00083                              const G4Step& stepData
00084                             );
00085 
00086      G4VParticleChange* PostStepDoIt(
00087                              const G4Track& track,
00088                              const G4Step&  stepData
00089                             );
00090        // Responsible for the relocation.
00091 
00092      G4double PostStepGetPhysicalInteractionLength(
00093                              const G4Track& ,
00094                              G4double   previousStepSize,
00095                              G4ForceCondition* pForceCond
00096                             );
00097        // Forces the PostStepDoIt action to be called, 
00098        // but does not limit the step.
00099 
00100      G4PropagatorInField* GetPropagatorInField();
00101      void SetPropagatorInField( G4PropagatorInField* pFieldPropagator);
00102        // Access/set the assistant class that Propagate in a Field.
00103 
00104      inline void   SetVerboseLevel( G4int verboseLevel );
00105      inline G4int  GetVerboseLevel() const;
00106        // Level of warnings regarding eg energy conservation
00107        // in field integration.
00108 
00109      inline G4double GetThresholdWarningEnergy() const; 
00110      inline G4double GetThresholdImportantEnergy() const; 
00111      inline G4int GetThresholdTrials() const; 
00112 
00113      inline void SetThresholdWarningEnergy( G4double newEnWarn ); 
00114      inline void SetThresholdImportantEnergy( G4double newEnImp ); 
00115      inline void SetThresholdTrials(G4int newMaxTrials ); 
00116 
00117      // Get/Set parameters for killing loopers: 
00118      //   Above 'important' energy a 'looping' particle in field will 
00119      //   *NOT* be abandoned, except after fThresholdTrials attempts.
00120      // Below Warning energy, no verbosity for looping particles is issued
00121 
00122      inline G4double GetMaxEnergyKilled() const; 
00123      inline G4double GetSumEnergyKilled() const;
00124      inline void ResetKilledStatistics( G4int report = 1);      
00125      // Statistics for tracks killed (currently due to looping in field)
00126 
00127      inline G4bool EnableUseMagneticMoment(G4bool useMoment=true); 
00128      // Whether to deflect particles with force due to magnetic moment
00129 
00130   public:  // without description
00131 
00132      void StartTracking(G4Track* aTrack); 
00133      void EndTracking();
00134 
00135      G4double AtRestGetPhysicalInteractionLength(
00136                              const G4Track& ,
00137                              G4ForceCondition* 
00138                             ) { return -1.0; };
00139        // No operation in  AtRestDoIt.
00140 
00141      G4VParticleChange* AtRestDoIt(
00142                              const G4Track& ,
00143                              const G4Step&
00144                             ) {return 0;};
00145        // No operation in  AtRestDoIt.
00146 
00147   protected:
00148 
00149      G4bool               DoesGlobalFieldExist();
00150        // Checks whether a field exists for the "global" field manager.
00151 
00152      void ReportInexactEnergy(G4double startEnergy, G4double endEnergy);
00153        // Issue warning
00154 
00155      void ReportMove( G4ThreeVector OldVector, G4ThreeVector NewVector,
00156                       const G4String& Quantity );
00157 
00158   private:
00159 
00160      G4Navigator*         fMassNavigator;
00161        // The navigator for the 'mass' geometry (the real one, that physics occurs in)
00162      G4PathFinder*        fPathFinder;
00163      G4int fNavigatorId;
00164        // The PathFinder used to transport the particle
00165 
00166      G4PropagatorInField* fFieldPropagator;
00167        // Still required in order to find/set the fieldmanager
00168 
00169      G4bool fGlobalFieldExists; 
00170      // G4bool fStartedNewTrack;   //  True for first step or restarted tracking 
00171                                    //    until first step's AlongStepGPIL
00172 
00173      G4ThreeVector        fTransportEndPosition;
00174      G4ThreeVector        fTransportEndMomentumDir;
00175      G4double             fTransportEndKineticEnergy;
00176      G4ThreeVector        fTransportEndSpin;
00177      G4bool               fMomentumChanged;
00178        // The particle's state after this Step, Store for DoIt
00179 
00180      G4bool               fEndGlobalTimeComputed; 
00181      G4double             fCandidateEndGlobalTime;
00182 
00183      G4bool               fParticleIsLooping;
00184    
00185      G4ThreeVector        fPreviousSftOrigin; 
00186      G4double             fPreviousMassSafety;
00187      G4double             fPreviousFullSafety;
00188 
00189      G4TouchableHandle    fCurrentTouchableHandle;
00190      
00191      // G4bool         fFieldExists;
00192        // Whether a magnetic field exists ...
00193        // A data member for this is problematic: it is useful only if it
00194        // can be initialised and updated -- and a scheme is not yet possible.
00195 
00196      G4bool fMassGeometryLimitedStep;
00197        // Flag to determine whether a 'mass' boundary was reached.
00198      G4bool fAnyGeometryLimitedStep; 
00199        // Did any geometry limit the step ?
00200 
00201      G4ParticleChangeForTransport fParticleChange;
00202        // New ParticleChange
00203 
00204      G4double endpointDistance;
00205 
00206 
00207   // Thresholds for looping particles: 
00208   // 
00209      G4double fThreshold_Warning_Energy;     //  Warn above this energy
00210      G4double fThreshold_Important_Energy;   //  Hesitate above this
00211      G4int    fThresholdTrials;              //    for this no of trials
00212        // Above 'important' energy a 'looping' particle in field will 
00213        //   *NOT* be abandoned, except after fThresholdTrials attempts.
00214 
00215   // Counter for steps in which particle reports 'looping',
00216   //   if it is above 'Important' Energy 
00217      G4int    fNoLooperTrials; 
00218   // Statistics for tracks abandoned
00219      G4double fSumEnergyKilled;
00220      G4double fMaxEnergyKilled;
00221 
00222      G4SafetyHelper* fpSafetyHelper;  // To pass it the safety value obtained
00223 
00224   // Whether to track state change from magnetic moment in a B-field
00225      G4bool   fUseMagneticMoment; 
00226 
00227   // Verbosity 
00228      G4int    fVerboseLevel;
00229        // Verbosity level for warnings
00230        // eg about energy non-conservation in magnetic field.
00231 };
00232 
00233 #include "G4CoupledTransportation.icc"
00234 
00235 #endif  

Generated on Mon May 27 17:47:58 2013 for Geant4 by  doxygen 1.4.7