File indexing completed on 2026-04-29 07:38:43
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 #ifndef B5EmCalorimeterHit_h
0030 #define B5EmCalorimeterHit_h 1
0031
0032 #include "G4VHit.hh"
0033
0034 #include "G4Allocator.hh"
0035 #include "G4RotationMatrix.hh"
0036 #include "G4THitsCollection.hh"
0037 #include "G4ThreeVector.hh"
0038 #include "globals.hh"
0039
0040 class G4AttDef;
0041 class G4AttValue;
0042 class G4LogicalVolume;
0043
0044 namespace B5
0045 {
0046
0047
0048
0049
0050
0051
0052
0053
0054 class EmCalorimeterHit : public G4VHit
0055 {
0056 public:
0057 EmCalorimeterHit() = default;
0058 EmCalorimeterHit(G4int cellID);
0059 EmCalorimeterHit(const EmCalorimeterHit& right) = default;
0060 ~EmCalorimeterHit() override = default;
0061
0062 EmCalorimeterHit& operator=(const EmCalorimeterHit& right) = default;
0063 G4bool operator==(const EmCalorimeterHit& right) const;
0064
0065 inline void* operator new(size_t);
0066 inline void operator delete(void* aHit);
0067
0068 void Draw() override;
0069 const std::map<G4String, G4AttDef>* GetAttDefs() const override;
0070 std::vector<G4AttValue>* CreateAttValues() const override;
0071 void Print() override;
0072
0073 void SetCellID(G4int z) { fCellID = z; }
0074 G4int GetCellID() const { return fCellID; }
0075
0076 void SetEdep(G4double de) { fEdep = de; }
0077 void AddEdep(G4double de) { fEdep += de; }
0078 G4double GetEdep() const { return fEdep; }
0079
0080 void SetPos(G4ThreeVector xyz) { fPos = xyz; }
0081 G4ThreeVector GetPos() const { return fPos; }
0082
0083 void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
0084 G4RotationMatrix GetRot() const { return fRot; }
0085
0086 void SetLogV(G4LogicalVolume* val) { fPLogV = val; }
0087 const G4LogicalVolume* GetLogV() const { return fPLogV; }
0088
0089 private:
0090 G4int fCellID = -1;
0091 G4double fEdep = 0.;
0092 G4ThreeVector fPos;
0093 G4RotationMatrix fRot;
0094 const G4LogicalVolume* fPLogV = nullptr;
0095 };
0096
0097 using EmCalorimeterHitsCollection = G4THitsCollection<EmCalorimeterHit>;
0098
0099 extern G4ThreadLocal G4Allocator<EmCalorimeterHit>* EmCalorimeterHitAllocator;
0100
0101 inline void* EmCalorimeterHit::operator new(size_t)
0102 {
0103 if (!EmCalorimeterHitAllocator) {
0104 EmCalorimeterHitAllocator = new G4Allocator<EmCalorimeterHit>;
0105 }
0106 return (void*)EmCalorimeterHitAllocator->MallocSingle();
0107 }
0108
0109 inline void EmCalorimeterHit::operator delete(void* aHit)
0110 {
0111 EmCalorimeterHitAllocator->FreeSingle((EmCalorimeterHit*)aHit);
0112 }
0113
0114 }
0115
0116
0117
0118 #endif