|
|
|||
File indexing completed on 2026-07-13 08:21:05
0001 #ifndef G4HepEmWoodcockHelper_h 0002 #define G4HepEmWoodcockHelper_h 1 0003 0004 #include "G4Navigator.hh" 0005 #include "globals.hh" 0006 0007 class G4VSolid; 0008 class G4MaterialCutsCouple; 0009 class G4Material; 0010 class G4LogicalVolume; 0011 class G4VPhysicalVolume; 0012 class G4Track; 0013 0014 struct G4HepEmData; 0015 struct G4HepEmMatCutData; 0016 class G4HepEmGammaTrack; 0017 0018 #include <map> 0019 0020 /** 0021 * @file G4HepEmWoodcockHelper.hh 0022 * @class G4HepEmWoodcockHelper 0023 * @author M. Novak 0024 * @date 2024 0025 * 0026 * A helper class to perform Woodcock-tracking of photons in some Geant4 detector 0027 * regions (utilised in the G4HepEmTrackinManager). 0028 */ 0029 0030 class G4HepEmWoodcockHelper { 0031 public: 0032 G4HepEmWoodcockHelper(); 0033 ~G4HepEmWoodcockHelper(); 0034 0035 // Returns true only if at least one Woodcock tracking region has been found 0036 G4bool Initialize(std::vector<std::string>& wdtRegionNames, struct G4HepEmMatCutData* hepEmMatCutData, G4VPhysicalVolume* worldVolume); 0037 0038 0039 void SetKineticEnergyLimit(G4double val) { fWDTKineticEnergyLimit = val; } 0040 G4double GetKineticEnergyLimit() const { return fWDTKineticEnergyLimit; } 0041 0042 0043 // Checks if this step will be done in a WDT region with high enough kinetic energy. 0044 // Finds the root volume of the region in chich this step will be done and 0045 // sets the following fileds: fWDTTransform, fWDTHepEmIMC, fWDTSolid, fWDTCouple 0046 // Returns `false` is the step is not in a WDT region or the energy is too low. 0047 G4bool FindWDTVolume(int regionID, const G4Track& aTrack); 0048 0049 // Keeps "Woodock" tracking inside an envelop, found and set up in `FindWDTVolume`, 0050 // till the photon gets close to this volume boundary (returns `true`) or 0051 // reaches a point of interaction (returns `false`). The accumulated step length 0052 // during the tracking is written to the field of the input G4HepEmTrack while 0053 // all relevant pre-step point infomatin is set to thier post-step point value 0054 // (as several volume boundaries might have been crossed between the pre- and 0055 // post step points and interaction can only happen at the post step point if any). 0056 G4bool KeepTracking(const struct G4HepEmData* theHepEmData, G4HepEmGammaTrack* theGammaTrack, G4Track& aTrack); 0057 0058 // Returns whether the region for the given region index is using woodcock tracking 0059 G4bool IsWDTRegion(G4int regionId) const; 0060 0061 // For a given region index with Woodcock tracking and root logical volume index, 0062 // this function returns the G4HepEm material cut couple index of that volume if it is indeed 0063 // a root logical volume of a Woodcock tracking region, -1 otherwise 0064 G4int GetWDTCoupleHepEmIndex(G4int regionId, G4int logicalVolumeId) const; 0065 0066 private: 0067 0068 void ClearData(); 0069 0070 void FindWDTMaterial(G4LogicalVolume* lvol, double& maxDensity, G4Material** maxDensityMat); 0071 0072 0073 // One `WDTDataPerRootLogVol` data is structured for each root logical volume 0074 // of a Woodcock tracking reagion: with a pointer to its solid, to the mat.- 0075 // cuts couple of the "heaviest" material in this branch, i.e. below the root 0076 // logical volume, and its corresponding G4HepEm material-cuts couple index. 0077 struct WDTDataPerRootLogVol { 0078 WDTDataPerRootLogVol() 0079 : fSolid(nullptr), fG4Couple(nullptr), fG4CoupleHepEmIndex(-1) {} 0080 WDTDataPerRootLogVol(G4VSolid* solid, G4MaterialCutsCouple* couple, G4int hepEmIMC) 0081 : fSolid(solid), fG4Couple(couple), fG4CoupleHepEmIndex(hepEmIMC) {} 0082 G4VSolid* fSolid; // solid of the root logical vol. 0083 G4MaterialCutsCouple* fG4Couple; // couple with the heaviest material 0084 G4int fG4CoupleHepEmIndex; // G4HepEm mat-cut index of that 0085 }; 0086 0087 // All `WDTDataPerRootLogVol` that belongs to one Woodcock tracking region, i.e. 0088 // as many as root logical volume of that region. Indexed by the ID of the 0089 // root logical volume (i.e. that's the key). 0090 struct WDTDataForARegion { 0091 std::map<G4int, WDTDataPerRootLogVol*> fWDTDataRegion; 0092 }; 0093 0094 // Woodcock tracking related data for all regions where Woodcock tracking was 0095 // requested by giving the name of the regions (and a detector region with that 0096 // name has been found). Indexed by the G4Region ID (i.e. that's the key). 0097 // All these data are initialised when the `Initialize` method is invoked. 0098 std::map<G4int, WDTDataForARegion*> fWDTData; 0099 0100 // Some data that are used during the Woodcock tracking and their values are 0101 // set accoring to the root logical volume inside which the actual tracking is 0102 // performed. Most of these values are set based on the `WDTDataPerRootLogVol`, 0103 // (stored for all root logical volumes of all Woodcock tracking regions) 0104 // inside the `FindRootVolume` method. 0105 // NOTE: none of these objects are owned 0106 G4VSolid* fWDTSolid; 0107 G4MaterialCutsCouple* fWDTCouple; 0108 G4int fWDTHepEmIMC; 0109 G4AffineTransform fWDTTransform; // transformation of the actual phy. vol. 0110 0111 // A navigator used to locate points (not to mess with the navigator for tarcking) 0112 G4Navigator fWDTNavigator; 0113 0114 // A kinetic energy limit below which Woodcock tracking is turned off. 0115 G4double fWDTKineticEnergyLimit; 0116 }; 0117 0118 #endif // G4HepEmWoodcockHelper
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|