G4UMDPixelHit.h
Go to the documentation of this file.
1 #ifndef _G4StationSimulatorOG_G4UMDPixelHit_h_
2 #define _G4StationSimulatorOG_G4UMDPixelHit_h_
3 
4 #include <G4VHit.hh>
5 #include <G4THitsCollection.hh>
6 #include <G4Allocator.hh>
7 #include <G4ThreeVector.hh>
8 #include <G4VPhysicalVolume.hh>
9 
10 
11 namespace G4StationSimulatorOG {
12 
13  class G4UMDPixelHit : public G4VHit {
14 
15  public:
16  G4UMDPixelHit() = default;
17  virtual ~G4UMDPixelHit() = default;
18 
19  inline void* operator new(const size_t size);
20  inline void operator delete(void* const hit);
21 
22  // This methods should be implemented to draw and print with customized style
23  void Draw() override;
24  void Print() override { }
25 
26  // Setter methods
27  void AddHit(const G4double t) { fTimes.push_back(t); }
28  void SetModuleId(const G4int id) { fModuleId = id; }
29  void SetPixelId(const G4int id) { fPixelId = id; }
30  void SetPixelName(const G4String name) { fPixelName = name; }
31  void SetDrawIt(const G4bool draw) { fDrawIt = draw; }
32  void SetUMDPixelPhysVol(G4VPhysicalVolume* const physVol) { fHitPhysVol = physVol; }
33 
34  // Getters methods
35  const std::vector<G4double>& GetTimes() const { return fTimes; }
36  const G4String& GetPixelName() const { return fPixelName; }
37  G4int GetPixelId() const { return fPixelId; }
38  G4int GetModuleId() const { return fModuleId; }
39  G4bool GetDrawIt() const { return fDrawIt; }
40  G4VPhysicalVolume* GetUMDPixelPhysVol() const { return fHitPhysVol; }
41 
42  private:
43  std::vector<G4double> fTimes;
44  G4int fModuleId = 0;
45  G4int fPixelId = 0;
46  G4String fPixelName = "unnamed";
47  G4bool fDrawIt = false;
48  G4VPhysicalVolume* fHitPhysVol = nullptr;
49 
50  };
51 
52 
53  using G4UMDPixelHitCollection = G4THitsCollection<G4StationSimulatorOG::G4UMDPixelHit>;
54 
55 
56  // Class for fast allocation of objects to the heap
57  extern G4ThreadLocal G4Allocator<G4StationSimulatorOG::G4UMDPixelHit>* gG4UMDPixelHitAllocator;
58 
59 
60  // Operators new and delete must be provided
61  inline
62  void*
63  G4UMDPixelHit::operator new(size_t /*size*/)
64  {
66  gG4UMDPixelHitAllocator = new G4Allocator<G4UMDPixelHit>;
67 
68  return gG4UMDPixelHitAllocator->MallocSingle();
69  }
70 
71 
72  inline
73  void
74  G4UMDPixelHit::operator delete(void* const hit)
75  {
76  gG4UMDPixelHitAllocator->FreeSingle((G4UMDPixelHit*)hit);
77  }
78 
79 }
80 
81 
82 #endif
const G4String & GetPixelName() const
Definition: G4UMDPixelHit.h:36
void SetModuleId(const G4int id)
Definition: G4UMDPixelHit.h:28
void AddHit(const G4double t)
Definition: G4UMDPixelHit.h:27
G4THitsCollection< G4StationSimulatorOG::G4UMDPixelHit > G4UMDPixelHitCollection
Definition: G4UMDPixelHit.h:53
G4ThreadLocal G4Allocator< G4UMDPixelHit > * gG4UMDPixelHitAllocator
void SetDrawIt(const G4bool draw)
Definition: G4UMDPixelHit.h:31
std::vector< G4double > fTimes
Definition: G4UMDPixelHit.h:43
const std::vector< G4double > & GetTimes() const
Definition: G4UMDPixelHit.h:35
G4VPhysicalVolume * GetUMDPixelPhysVol() const
Definition: G4UMDPixelHit.h:40
void SetUMDPixelPhysVol(G4VPhysicalVolume *const physVol)
Definition: G4UMDPixelHit.h:32
void SetPixelName(const G4String name)
Definition: G4UMDPixelHit.h:30

, generated on Tue Sep 26 2023.