Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:12

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file exoticphysics/monopole/include/G4MonopoleTransportation.hh
0027 /// \brief Definition of the G4MonopoleTransportation class
0028 //
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 //
0033 // ------------------------------------------------------------
0034 //        GEANT 4  include file implementation
0035 // ------------------------------------------------------------
0036 //
0037 // Class description:
0038 //
0039 // G4MonopoleTransportation is a process responsible for the transportation of
0040 // magnetic monopoles, i.e. the geometrical propagation encountering the
0041 // geometrical sub-volumes of the detectors.
0042 // It is also tasked with part of updating the "safety".
0043 
0044 // =======================================================================
0045 // Created:  3 May 2010, J. Apostolakis, B. Bozsogi
0046 // =======================================================================
0047 
0048 #ifndef G4MonopoleTransportation_hh
0049 #define G4MonopoleTransportation_hh 1
0050 
0051 #include "G4FieldManager.hh"
0052 #include "G4MonopoleFieldSetup.hh"
0053 #include "G4Navigator.hh"
0054 #include "G4ParticleChangeForTransport.hh"
0055 #include "G4PropagatorInField.hh"
0056 #include "G4Step.hh"
0057 #include "G4Track.hh"
0058 #include "G4TransportationManager.hh"
0059 #include "G4VProcess.hh"
0060 
0061 class G4SafetyHelper;
0062 class G4Monopole;
0063 
0064 class G4MonopoleTransportation : public G4VProcess
0065 {
0066     // Concrete class that does the geometrical transport
0067 
0068   public:  // with description
0069     G4MonopoleTransportation(const G4Monopole* p, G4int verbosityLevel = 1);
0070     ~G4MonopoleTransportation();
0071 
0072     virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track& track,
0073                                                            G4double previousStepSize,
0074                                                            G4double currentMinimumStep,
0075                                                            G4double& currentSafety,
0076                                                            G4GPILSelection* selection);
0077 
0078     virtual G4VParticleChange* AlongStepDoIt(const G4Track& track, const G4Step& stepData);
0079 
0080     virtual G4VParticleChange* PostStepDoIt(const G4Track& track, const G4Step& stepData);
0081     // Responsible for the relocation.
0082 
0083     virtual G4double PostStepGetPhysicalInteractionLength(const G4Track&, G4double previousStepSize,
0084                                                           G4ForceCondition* pForceCond);
0085     // Forces the PostStepDoIt action to be called,
0086     // but does not limit the step.
0087 
0088     G4PropagatorInField* GetPropagatorInField();
0089     void SetPropagatorInField(G4PropagatorInField* pFieldPropagator);
0090     // Access/set the assistant class that Propagate in a Field.
0091 
0092     inline G4double GetThresholdWarningEnergy() const;
0093     inline G4double GetThresholdImportantEnergy() const;
0094     inline G4int GetThresholdTrials() const;
0095 
0096     inline void SetThresholdWarningEnergy(G4double newEnWarn);
0097     inline void SetThresholdImportantEnergy(G4double newEnImp);
0098     inline void SetThresholdTrials(G4int newMaxTrials);
0099 
0100     // Get/Set parameters for killing loopers:
0101     //   Above 'important' energy a 'looping' particle in field will
0102     //   *NOT* be abandoned, except after fThresholdTrials attempts.
0103     // Below Warning energy, no verbosity for looping particles is issued
0104 
0105     inline G4double GetMaxEnergyKilled() const;
0106     inline G4double GetSumEnergyKilled() const;
0107     inline void ResetKilledStatistics(G4int report = 1);
0108     // Statistics for tracks killed (currently due to looping in field)
0109 
0110     inline void EnableShortStepOptimisation(G4bool optimise = true);
0111     // Whether short steps < safety will avoid to call Navigator (if field=0)
0112 
0113   public:  // without description
0114     virtual G4double AtRestGetPhysicalInteractionLength(const G4Track&, G4ForceCondition*)
0115     {
0116       return -1.0;
0117     };
0118     // No operation in  AtRestDoIt.
0119 
0120     virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&) { return 0; };
0121     // No operation in  AtRestDoIt.
0122 
0123     G4double GetZmagFieldValue() const { return fMagSetup->GetZmagFieldValue(); }
0124 
0125     virtual void StartTracking(G4Track* aTrack);
0126     // Reset state for new (potentially resumed) track
0127 
0128   protected:
0129     G4bool DoesGlobalFieldExist();
0130     // Checks whether a field exists for the "global" field manager.
0131 
0132   private:
0133     const G4Monopole* fParticleDef;
0134 
0135     G4MonopoleFieldSetup* fMagSetup;
0136 
0137     G4Navigator* fLinearNavigator;
0138     G4PropagatorInField* fFieldPropagator;
0139     // The Propagators used to transport the particle
0140 
0141     G4ThreeVector fTransportEndPosition;
0142     G4ThreeVector fTransportEndMomentumDir;
0143     G4double fTransportEndKineticEnergy;
0144     G4ThreeVector fTransportEndSpin;
0145     G4bool fMomentumChanged;
0146     //  G4bool               fEnergyChanged;
0147     G4bool fEndGlobalTimeComputed;
0148     G4double fCandidateEndGlobalTime;
0149     // The particle's state after this Step, Store for DoIt
0150 
0151     G4bool fParticleIsLooping;
0152 
0153     G4TouchableHandle fCurrentTouchableHandle;
0154 
0155     G4bool fGeometryLimitedStep;
0156     // Flag to determine whether a boundary was reached.
0157 
0158     G4ThreeVector fPreviousSftOrigin;
0159     G4double fPreviousSafety;
0160     // Remember last safety origin & value.
0161 
0162     G4ParticleChangeForTransport fParticleChange;
0163     // New ParticleChange
0164 
0165     G4double endpointDistance;
0166 
0167     // Thresholds for looping particles:
0168     //
0169     G4double fThreshold_Warning_Energy;  //  Warn above this energy
0170     G4double fThreshold_Important_Energy;  //  Hesitate above this
0171     G4int fThresholdTrials;  //    for this no of trials
0172                              // Above 'important' energy a 'looping' particle in field will
0173                              //   *NOT* be abandoned, except after fThresholdTrials attempts.
0174     // G4double fUnimportant_Energy;
0175     //  Below this energy, no verbosity for looping particles is issued
0176 
0177     // Counter for steps in which particle reports 'looping',
0178     //   if it is above 'Important' Energy
0179     G4int fNoLooperTrials;
0180     // Statistics for tracks abandoned
0181     G4double fSumEnergyKilled;
0182     G4double fMaxEnergyKilled;
0183 
0184     // Whether to avoid calling G4Navigator for short step ( < safety)
0185     //   If using it, the safety estimate for endpoint will likely be smaller.
0186     G4bool fShortStepOptimisation;
0187 
0188     G4SafetyHelper* fpSafetyHelper;  // To pass it the safety value obtained
0189     G4int noCalls;
0190 };
0191 
0192 #include "G4MonopoleTransportation.icc"
0193 
0194 #endif