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