source: trunk/examples/advanced/hadrontherapy/include/HadrontherapyDetectorHit.hh @ 1230

Last change on this file since 1230 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 3.7 KB
Line 
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// HadrontherapyDetectorHit.hh;
27// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy//
28
29#ifndef HadrontherapyDetectorHit_h
30#define HadrontherapyDetectorHit_h 1
31
32#include "G4VHit.hh"
33#include "G4THitsCollection.hh"
34#include "G4Allocator.hh"
35
36class HadrontherapyDetectorHit : public G4VHit
37{
38public:
39  HadrontherapyDetectorHit();
40  ~HadrontherapyDetectorHit();
41 
42  HadrontherapyDetectorHit(const HadrontherapyDetectorHit &right);
43 
44  const HadrontherapyDetectorHit& operator = (const HadrontherapyDetectorHit &right);
45 
46  int operator == (const HadrontherapyDetectorHit &right) const;
47
48  inline void *operator new(size_t);
49  inline void operator delete(void *aHit);
50
51private:
52  G4int xHitID; // Hit x voxel
53  G4int zHitID; // Hit z voxel
54  G4int yHitID; // Hit y voxel
55  G4double energyDeposit; // Energy deposit associated with the hit
56
57public:
58  // Methods to get the information - energy deposit and associated
59  // position in the phantom - of the hits stored in the hits collection 
60 
61  inline G4int GetXID() // Get x index of the voxel
62  {return xHitID;}
63
64  inline G4int GetZID() // Get y index of the voxel   
65  {return zHitID;}
66
67  inline G4int GetYID() // Get z index of the voxel 
68  {return yHitID;}
69   
70  inline G4double GetEdep() // Get energy deposit
71  {return energyDeposit;}
72 
73  // Methods to store the information of the hit ( energy deposit, position in the phantom )
74  // in the hits collection
75
76  inline void SetEdepAndPosition(G4int xx, G4int yy, G4int zz, G4double eDep)
77  {
78    xHitID = xx;
79    yHitID = yy;
80    zHitID = zz;
81    energyDeposit = eDep;
82  }
83};
84
85typedef G4THitsCollection<HadrontherapyDetectorHit> HadrontherapyDetectorHitsCollection;
86extern G4Allocator<HadrontherapyDetectorHit> HadrontherapyDetectorHitAllocator;
87
88inline void* HadrontherapyDetectorHit::operator new(size_t)
89{
90  void *aHit;
91  aHit = (void *) HadrontherapyDetectorHitAllocator.MallocSingle();
92  return aHit;
93}
94
95inline void HadrontherapyDetectorHit::operator delete(void *aHit)
96{
97  HadrontherapyDetectorHitAllocator.FreeSingle((HadrontherapyDetectorHit*) aHit);
98}
99#endif
100
101
Note: See TracBrowser for help on using the repository browser.