Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 28 #ifndef G4Channeling_h 29 #define G4Channeling_h 1 30 31 #include "G4ios.hh" 32 #include "globals.hh" 33 #include "G4VDiscreteProcess.hh" 34 #include "G4ChannelingMaterialData.hh" 35 #include "G4ExtendedMaterial.hh" 36 #include "G4LogicalCrystalVolume.hh" 37 38 class G4ChannelingTrackData; 39 40 class G4Channeling : public G4VDiscreteProcess 41 { 42 public: 43 44 G4Channeling(); 45 virtual ~G4Channeling(); 46 virtual G4VParticleChange* PostStepDoIt(const G4Track&, 47 const G4Step&); 48 virtual G4bool IsApplicable(const G4ParticleDefinition& aPD){ 49 return(aPD.GetPDGCharge() != 0.); 50 }; 51 virtual void BuildPhysicsTable(const G4ParticleDefinition&){;}; 52 53 protected: 54 virtual G4double GetMeanFreePath(const G4Track&, 55 G4double, 56 G4ForceCondition*); 57 58 private: 59 G4ParticleDefinition* GetParticleDefinition(const G4Track& aTrack){ 60 return const_cast<G4ParticleDefinition*>(aTrack.GetParticleDefinition()); 61 } 62 private: 63 G4StepPoint* GetPre(const G4Track& aTrack){return aTrack.GetStep()->GetPreStepPoint();} 64 G4StepPoint* GetPost(const G4Track& aTrack){return aTrack.GetStep()->GetPostStepPoint();} 65 66 67 private: 68 G4ChannelingMaterialData* GetMatData(const G4Track& aTrack){ 69 G4LogicalVolume* aLV = aTrack.GetVolume()->GetLogicalVolume(); 70 if(aLV->IsExtended() == true){ 71 G4ExtendedMaterial* aEM = (G4ExtendedMaterial*) aTrack.GetVolume()->GetLogicalVolume()->GetMaterial(); 72 return (G4ChannelingMaterialData*) aEM->RetrieveExtension("channeling"); 73 } 74 else{ 75 return nullptr; 76 } 77 } 78 79 //---------------------------------------- 80 // Functions for the calculations of 81 // parameters related to channeling 82 //---------------------------------------- 83 public: 84 G4double GetCriticalAngle(const G4Track& aTrack){ 85 return std::sqrt(2.0*GetMatData(aTrack)->GetPot()->GetMaxMin() 86 /GetPre(aTrack)->GetTotalEnergy());} 87 G4double GetOscillationPeriod(const G4Track& aTrack){ 88 return (CLHEP::pi * GetMatData(aTrack)->GetPot()->GetIntSp(0) 89 / GetCriticalAngle(aTrack)); 90 } 91 //---------------------------------------- 92 // Channeling Auxiliary Track Information 93 //---------------------------------------- 94 private: 95 G4int fChannelingID; 96 G4ChannelingTrackData* GetTrackData(const G4Track&); 97 98 //---------------------------------------- 99 // Variables for the integration 100 // of the particle trajectory 101 //---------------------------------------- 102 private: 103 G4bool UpdateIntegrationStep(const G4Track&, 104 G4ThreeVector&, 105 G4double&); 106 G4bool UpdateParameters(const G4Track&); 107 108 void GetEF(const G4Track&,G4ThreeVector&,G4ThreeVector&); 109 110 public: 111 void PosToLattice(G4StepPoint* step,G4ThreeVector&); 112 113 public: 114 G4double GetTransverseVariationMax() {return fTransverseVariationMax;}; 115 void SetTransverseVariationMax(G4double aDouble) {fTransverseVariationMax = aDouble;}; 116 117 G4double GetTimeStepMin() {return fTimeStepMin;}; 118 void SetTimeStepMin(G4double aDouble) {fTimeStepMin = aDouble;}; 119 120 private: 121 G4double fTimeStepMin; 122 G4double fTimeStepMax; 123 124 G4double fTransverseVariationMax; 125 126 const G4ThreeVector k010; 127 G4ThreeVector fSpin; 128 }; 129 130 #endif 131 132 133 134 135 136 137 138 139 140 141