Loading...
Searching...
No Matches
Par04Hit.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26#ifndef PAR04HIT_HH
27#define PAR04HIT_HH
28
29#include <stddef.h> // for size_t
30#include <G4Types.hh> // for G4int, G4double
31#include <map> // for map
32#include <tls.hh> // for G4ThreadLocal
33#include <vector> // for vector
34#include "G4Allocator.hh" // for G4Allocator
35#include "G4RotationMatrix.hh" // for G4RotationMatrix
36#include "G4THitsCollection.hh" // for G4THitsCollection
37#include "G4ThreeVector.hh" // for G4ThreeVector
38#include "G4VHit.hh" // for G4VHit
39class G4AttDef;
40class G4AttValue;
41class G4LogicalVolume;
42class G4String;
43
44/**
45 * @brief Hit class to store energy deposited in the sensitive detector.
46 *
47 * Hit class registers position and energy deposited within the sensitive
48 * detector. Cell ID is stored using identifiers of readout segmentation (z,
49 * phi, rho). Additionally, pointer to cell logical volume, its position and
50 * rotation are saved for visualisation purposes. Time allows to filter hits in
51 * visualisation. Type of hit allows to distinguish between hits originating
52 * from full simulation (type 0) and fast simulation (type 1).
53 *
54 */
55
56class Par04Hit : public G4VHit
57{
58 public:
59 Par04Hit();
60 Par04Hit(const Par04Hit& aRight);
61 virtual ~Par04Hit();
62
63 const Par04Hit& operator=(const Par04Hit& aRight);
64 int operator==(const Par04Hit& aRight) const;
65
66 inline void* operator new(size_t);
67 inline void operator delete(void* aHit);
68 /// Visualise hits. If pointer to the logical volume was set, cell shape is
69 /// drawn taking into account proper radial position (taken from fRhoId)
70 virtual void Draw() final;
71 /// Retrieve atributes' names in order to allow filtering
72 virtual const std::map<G4String, G4AttDef>* GetAttDefs() const final;
73 /// Create attributes for the visualisation.
74 virtual std::vector<G4AttValue>* CreateAttValues() const final;
75 /// Print hit properties.
76 virtual void Print() final;
77 /// Set position
78 inline void SetPos(G4ThreeVector aXYZ) { fPos = aXYZ; }
79 /// Get position
80 inline G4ThreeVector GetPos() const { return fPos; }
81 /// Set rotation
82 inline void SetRot(G4RotationMatrix aXYZ) { fRot = aXYZ; }
83 /// Get rotation
84 inline G4RotationMatrix GetRot() const { return fRot; }
85 /// Set energy
86 inline void SetEdep(G4double aEdep) { fEdep = aEdep; }
87 /// Add energy to previous value
88 inline void AddEdep(G4double aEdep) { fEdep += aEdep; }
89 /// Get energy
90 inline G4double GetEdep() const { return fEdep; }
91 /// Set number of deposits per hit/cell
92 inline void SetNdep(G4int aNdep) { fNdep = aNdep; }
93 /// Add number of deposits to previous value, by defualt increment
94 inline void AddNdep(G4int aNdep = 1) { fNdep += aNdep; }
95 /// Get number of deposits per hit/cell
96 inline G4int GetNdep() const { return fNdep; }
97 /// Set Z id of the cell in the readout segmentation
98 inline void SetZid(G4int aZ) { fZId = aZ; }
99 /// Get Z id of the cell in the readout segmentation
100 inline G4int GetZid() const { return fZId; }
101 /// Set Rho id of the cell in the readout segmentation
102 inline void SetRhoId(G4int aRho) { fRhoId = aRho; }
103 /// Get rho id of the cell in the readout segmentation
104 inline G4int GetRhoId() const { return fRhoId; }
105 /// Set phi id of the cell in the readout segmentation
106 inline void SetPhiId(G4int aPhi) { fPhiId = aPhi; }
107 /// Get phi id of the cell in the readout segmentation
108 inline G4int GetPhiId() const { return fPhiId; }
109 /// Set time
110 inline void SetTime(G4double aTime) { fTime = aTime; }
111 /// Get time
112 inline G4double GetTime() const { return fTime; }
113 /// Set type (0 = full sim, 1 = fast sim)
114 inline void SetType(G4int aType) { fType = aType; }
115 /// Get type (0 = full sim, 1 = fast sim)
116 inline G4int GetType() const { return fType; }
117 // Set pointer to cell logical volume
118 inline void SetLogV(G4LogicalVolume* aLogVol) { fLogVol = aLogVol; }
119 // Get pointer to cell logical volume
120 inline const G4LogicalVolume* GetLogVol() { return fLogVol; }
121
122 public:
123 /// Energy deposit
124 G4double fEdep = 0;
125 /// Counter of deposits in a hit/cell
126 G4int fNdep = 0;
127 /// Z ID of readout cell
128 G4int fZId = -1;
129 /// Rho ID of readout cell
130 G4int fRhoId = -1;
131 /// Phi ID of readout cell
132 G4int fPhiId = -1;
133 /// Position
134 G4ThreeVector fPos = { -1, -1, -1 };
135 /// Rotation
136 G4RotationMatrix fRot;
137 /// Time
138 G4double fTime = -1;
139 /// Type: 0 = full sim, 1 = fast sim
140 G4int fType = -1;
141 /// Pointer to logical volume for visualisation
143};
144
146
147extern G4ThreadLocal G4Allocator<Par04Hit>* Par04HitAllocator;
148
149inline void* Par04Hit::operator new(size_t)
150{
153 return (void*) Par04HitAllocator->MallocSingle();
154}
155
156inline void Par04Hit::operator delete(void* aHit)
157{
158 Par04HitAllocator->FreeSingle((Par04Hit*) aHit);
159}
160
161#endif /* PAR04HIT_HH */
G4ThreadLocal G4Allocator< Par04Hit > * Par04HitAllocator
Definition Par04Hit.cc:49
G4THitsCollection< Par04Hit > Par04HitsCollection
Definition Par04Hit.hh:145
Hit class to store energy deposited in the sensitive detector.
void SetNdep(G4int aNdep)
Set number of deposits per hit/cell.
Definition Par04Hit.hh:92
G4int fZId
Z ID of readout cell.
Definition Par04Hit.hh:128
void AddEdep(G4double aEdep)
Add energy to previous value.
Definition Par04Hit.hh:88
G4int GetZid() const
Get Z id of the cell in the readout segmentation.
Definition Par04Hit.hh:100
G4double fTime
Time.
Definition Par04Hit.hh:138
virtual void Print() final
Print hit properties.
Definition Par04Hit.cc:173
void SetLogV(G4LogicalVolume *aLogVol)
Definition Par04Hit.hh:118
virtual void Draw() final
Visualise hits.
Definition Par04Hit.cc:104
G4int fPhiId
Phi ID of readout cell.
Definition Par04Hit.hh:132
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const final
Retrieve atributes' names in order to allow filtering.
Definition Par04Hit.cc:144
G4ThreeVector GetPos() const
Get position.
Definition Par04Hit.hh:80
void SetRot(G4RotationMatrix aXYZ)
Set rotation.
Definition Par04Hit.hh:82
virtual ~Par04Hit()
virtual std::vector< G4AttValue > * CreateAttValues() const final
Create attributes for the visualisation.
Definition Par04Hit.cc:161
void AddNdep(G4int aNdep=1)
Add number of deposits to previous value, by defualt increment.
Definition Par04Hit.hh:94
G4int fRhoId
Rho ID of readout cell.
Definition Par04Hit.hh:130
G4RotationMatrix GetRot() const
Get rotation.
Definition Par04Hit.hh:84
const Par04Hit & operator=(const Par04Hit &aRight)
Definition Par04Hit.cc:80
G4double GetEdep() const
Get energy.
Definition Par04Hit.hh:90
void SetRhoId(G4int aRho)
Set Rho id of the cell in the readout segmentation.
Definition Par04Hit.hh:102
G4int fNdep
Counter of deposits in a hit/cell.
Definition Par04Hit.hh:126
void SetZid(G4int aZ)
Set Z id of the cell in the readout segmentation.
Definition Par04Hit.hh:98
G4int GetType() const
Get type (0 = full sim, 1 = fast sim)
Definition Par04Hit.hh:116
G4ThreeVector fPos
Position.
Definition Par04Hit.hh:134
G4int GetRhoId() const
Get rho id of the cell in the readout segmentation.
Definition Par04Hit.hh:104
G4LogicalVolume * fLogVol
Pointer to logical volume for visualisation.
Definition Par04Hit.hh:142
void SetTime(G4double aTime)
Set time.
Definition Par04Hit.hh:110
G4RotationMatrix fRot
Rotation.
Definition Par04Hit.hh:136
void SetEdep(G4double aEdep)
Set energy.
Definition Par04Hit.hh:86
void SetPhiId(G4int aPhi)
Set phi id of the cell in the readout segmentation.
Definition Par04Hit.hh:106
G4double fEdep
Energy deposit.
Definition Par04Hit.hh:124
G4int fType
Type: 0 = full sim, 1 = fast sim.
Definition Par04Hit.hh:140
void SetType(G4int aType)
Set type (0 = full sim, 1 = fast sim)
Definition Par04Hit.hh:114
void SetPos(G4ThreeVector aXYZ)
Set position.
Definition Par04Hit.hh:78
int operator==(const Par04Hit &aRight) const
Definition Par04Hit.cc:97
G4double GetTime() const
Get time.
Definition Par04Hit.hh:112
G4int GetNdep() const
Get number of deposits per hit/cell.
Definition Par04Hit.hh:96
const G4LogicalVolume * GetLogVol()
Definition Par04Hit.hh:120
G4int GetPhiId() const
Get phi id of the cell in the readout segmentation.
Definition Par04Hit.hh:108

Applications | User Support | Publications | Collaboration