Warning, file /geant4/examples/extended/field/field02/include/F02CalorHit.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #ifndef F02CalorHit_h
0034 #define F02CalorHit_h 1
0035
0036 #include "G4Allocator.hh"
0037 #include "G4THitsCollection.hh"
0038 #include "G4VHit.hh"
0039
0040
0041
0042 class F02CalorHit : public G4VHit
0043 {
0044 public:
0045 F02CalorHit() = default;
0046 F02CalorHit(const F02CalorHit&);
0047 ~F02CalorHit() override = default;
0048
0049 const F02CalorHit& operator=(const F02CalorHit&);
0050 G4bool operator==(const F02CalorHit&) const;
0051
0052 inline void* operator new(size_t);
0053 inline void operator delete(void*);
0054
0055 void Print() override;
0056
0057 public:
0058 void AddAbs(G4double de, G4double dl)
0059 {
0060 fEdepAbs += de;
0061 fTrackLengthAbs += dl;
0062 };
0063 void AddGap(G4double de, G4double dl)
0064 {
0065 fEdepGap += de;
0066 fTrackLengthGap += dl;
0067 };
0068
0069 G4double GetEdepAbs() { return fEdepAbs; };
0070 G4double GetTrackAbs() { return fTrackLengthAbs; };
0071 G4double GetEdepGap() { return fEdepGap; };
0072 G4double GetTrackGap() { return fTrackLengthGap; };
0073
0074 private:
0075 G4double fEdepAbs = 0.;
0076 G4double fTrackLengthAbs = 0.;
0077 G4double fEdepGap = 0.;
0078 G4double fTrackLengthGap = 0.;
0079 };
0080
0081
0082
0083 using F02CalorHitsCollection = G4THitsCollection<F02CalorHit>;
0084
0085 extern G4ThreadLocal G4Allocator<F02CalorHit>* F02CalorHitAllocator;
0086
0087
0088
0089 inline void* F02CalorHit::operator new(size_t)
0090 {
0091 if (!F02CalorHitAllocator) F02CalorHitAllocator = new G4Allocator<F02CalorHit>;
0092 return (void*)F02CalorHitAllocator->MallocSingle();
0093 }
0094
0095
0096
0097 inline void F02CalorHit::operator delete(void* aHit)
0098 {
0099 F02CalorHitAllocator->FreeSingle((F02CalorHit*)aHit);
0100 }
0101
0102 #endif