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