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 | // $Id: MedLinacPhantomHit.hh,v 1.3 2006/06/29 16:03:49 gunter Exp $ |
---|
27 | // |
---|
28 | // |
---|
29 | // Code developed by: M. Piergentili |
---|
30 | // It manages the hits and the enrgy deposit in the phantom associated with |
---|
31 | // each hit ... |
---|
32 | |
---|
33 | #ifndef MedLinacPhantomHit_h |
---|
34 | #define MedLinacPhantomHit_h 1 |
---|
35 | |
---|
36 | #include "G4VHit.hh" |
---|
37 | #include "G4THitsCollection.hh" |
---|
38 | #include "G4Allocator.hh" |
---|
39 | #include "G4ThreeVector.hh" |
---|
40 | #include "G4LogicalVolume.hh" |
---|
41 | #include "G4Transform3D.hh" |
---|
42 | #include "G4RotationMatrix.hh" |
---|
43 | |
---|
44 | class MedLinacPhantomHit : public G4VHit |
---|
45 | { |
---|
46 | public: |
---|
47 | MedLinacPhantomHit(G4LogicalVolume* ,G4int ,G4int ,G4int ); |
---|
48 | ~MedLinacPhantomHit(); |
---|
49 | MedLinacPhantomHit(const MedLinacPhantomHit &right); |
---|
50 | const MedLinacPhantomHit& operator = (const MedLinacPhantomHit &right); |
---|
51 | int operator == (const MedLinacPhantomHit &right) const; |
---|
52 | |
---|
53 | inline void *operator new(size_t); |
---|
54 | inline void operator delete(void *aHit); |
---|
55 | |
---|
56 | void Draw(); |
---|
57 | void Print(); |
---|
58 | |
---|
59 | private: |
---|
60 | const G4LogicalVolume* logicalVolume;// Logical volume where the hit happened |
---|
61 | G4int xHitPosition; // Hit x coordinate |
---|
62 | G4int zHitPosition; // Hit z coordinate |
---|
63 | G4int yHitPosition; // Hit y coordinate |
---|
64 | G4ThreeVector hitPosition; //position of the hit |
---|
65 | G4RotationMatrix rotation; // rotation of the logical volume |
---|
66 | G4double energyDeposit; // energy deposit associated with the hit |
---|
67 | |
---|
68 | public: |
---|
69 | //... |
---|
70 | // Set Hit position |
---|
71 | inline void SetCellID(G4int XID,G4int YID,G4int ZID) |
---|
72 | {xHitPosition = XID; zHitPosition = ZID; yHitPosition = YID; } |
---|
73 | |
---|
74 | inline G4int GetXID() // Get hit x coordinate |
---|
75 | {return xHitPosition;} |
---|
76 | |
---|
77 | inline G4int GetZID() // Get hit z coordinate |
---|
78 | {return zHitPosition;} |
---|
79 | |
---|
80 | inline G4int GetYID() // Get hit y coordinate |
---|
81 | {return yHitPosition;} |
---|
82 | |
---|
83 | inline void SetEdep(G4double edep) //Set hit energy deposit |
---|
84 | {energyDeposit = edep;} |
---|
85 | |
---|
86 | inline void AddEdep(G4double edep) // Add energy deposit |
---|
87 | {energyDeposit += edep;} |
---|
88 | |
---|
89 | inline G4double GetEdep() // Get energy deposit |
---|
90 | {return energyDeposit;} |
---|
91 | |
---|
92 | inline void SetPos(G4ThreeVector xyz) // Set hit position |
---|
93 | {hitPosition = xyz;} |
---|
94 | |
---|
95 | inline G4ThreeVector GetPos() // Get hit position |
---|
96 | {return hitPosition;} |
---|
97 | |
---|
98 | inline void SetRot(G4RotationMatrix rmat) //set rotation |
---|
99 | {rotation = rmat;} |
---|
100 | |
---|
101 | inline G4RotationMatrix GetRot() //get rotation |
---|
102 | {return rotation;} |
---|
103 | |
---|
104 | //... |
---|
105 | // It returns the logical volume where the hit happened |
---|
106 | inline const G4LogicalVolume * GetLogicalVolume() |
---|
107 | {return logicalVolume;} |
---|
108 | }; |
---|
109 | |
---|
110 | typedef G4THitsCollection<MedLinacPhantomHit> MedLinacPhantomHitsCollection; |
---|
111 | extern G4Allocator<MedLinacPhantomHit> MedLinacPhantomHitAllocator; |
---|
112 | |
---|
113 | inline void* MedLinacPhantomHit::operator new(size_t) |
---|
114 | { |
---|
115 | void *aHit; |
---|
116 | aHit = (void *) MedLinacPhantomHitAllocator.MallocSingle(); |
---|
117 | return aHit; |
---|
118 | } |
---|
119 | |
---|
120 | inline void MedLinacPhantomHit::operator delete(void *aHit) |
---|
121 | { |
---|
122 | MedLinacPhantomHitAllocator.FreeSingle((MedLinacPhantomHit*) aHit); |
---|
123 | } |
---|
124 | #endif |
---|
125 | |
---|
126 | |
---|