Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HadrontherapyDetectorSD Class Reference

#include <HadrontherapyDetectorSD.hh>

Inheritance diagram for HadrontherapyDetectorSD:
Collaboration diagram for HadrontherapyDetectorSD:

Public Member Functions

 HadrontherapyDetectorSD (G4String name)
 
 ~HadrontherapyDetectorSD ()
 
void Initialize (G4HCofThisEvent *)
 
G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *ROhist)
 
void EndOfEvent (G4HCofThisEvent *HCE)
 
- Public Member Functions inherited from G4VSensitiveDetector
 G4VSensitiveDetector (G4String name)
 
 G4VSensitiveDetector (const G4VSensitiveDetector &right)
 
virtual ~G4VSensitiveDetector ()
 
G4VSensitiveDetectoroperator= (const G4VSensitiveDetector &right)
 
G4int operator== (const G4VSensitiveDetector &right) const
 
G4int operator!= (const G4VSensitiveDetector &right) const
 
virtual void clear ()
 
virtual void DrawAll ()
 
virtual void PrintAll ()
 
G4bool Hit (G4Step *aStep)
 
void SetROgeometry (G4VReadOutGeometry *value)
 
void SetFilter (G4VSDFilter *value)
 
G4int GetNumberOfCollections () const
 
G4String GetCollectionName (G4int id) const
 
void SetVerboseLevel (G4int vl)
 
void Activate (G4bool activeFlag)
 
G4bool isActive () const
 
G4String GetName () const
 
G4String GetPathName () const
 
G4String GetFullPathName () const
 
G4VReadOutGeometryGetROgeometry () const
 
G4VSDFilterGetFilter () const
 
virtual G4VSensitiveDetectorClone () const
 

Public Attributes

std::ofstream ofs
 

Additional Inherited Members

- Protected Member Functions inherited from G4VSensitiveDetector
virtual G4int GetCollectionID (G4int i)
 
- Protected Attributes inherited from G4VSensitiveDetector
G4CollectionNameVector collectionName
 
G4String SensitiveDetectorName
 
G4String thePathName
 
G4String fullPathName
 
G4int verboseLevel
 
G4bool active
 
G4VReadOutGeometryROgeometry
 
G4VSDFilterfilter
 

Detailed Description

Definition at line 38 of file HadrontherapyDetectorSD.hh.

Constructor & Destructor Documentation

HadrontherapyDetectorSD::HadrontherapyDetectorSD ( G4String  name)

Definition at line 42 of file HadrontherapyDetectorSD.cc.

42  :
44 {
45  G4String HCname;
46  collectionName.insert(HCname="HadrontherapyDetectorHitsCollection");
47  HitsCollection = NULL;
48  sensitiveDetectorName = name;
49 
50 }
const XML_Char * name
Definition: expat.h:151
G4VSensitiveDetector(G4String name)
G4CollectionNameVector collectionName

Here is the call graph for this function:

HadrontherapyDetectorSD::~HadrontherapyDetectorSD ( )

Definition at line 53 of file HadrontherapyDetectorSD.cc.

54 {
55 }

Member Function Documentation

void HadrontherapyDetectorSD::EndOfEvent ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 225 of file HadrontherapyDetectorSD.cc.

226 {
227 
228  static G4int HCID = -1;
229  if(HCID < 0)
230  {
231  HCID = GetCollectionID(0);
232  }
233 
234  HCE -> AddHitsCollection(HCID,HitsCollection);
235 }
int G4int
Definition: G4Types.hh:78
virtual G4int GetCollectionID(G4int i)

Here is the call graph for this function:

void HadrontherapyDetectorSD::Initialize ( G4HCofThisEvent )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 58 of file HadrontherapyDetectorSD.cc.

59 {
60 
61  HitsCollection = new HadrontherapyDetectorHitsCollection(sensitiveDetectorName,
62  collectionName[0]);
63 }
G4THitsCollection< HadrontherapyDetectorHit > HadrontherapyDetectorHitsCollection
G4CollectionNameVector collectionName
G4bool HadrontherapyDetectorSD::ProcessHits ( G4Step aStep,
G4TouchableHistory ROhist 
)
virtual

Implements G4VSensitiveDetector.

Definition at line 66 of file HadrontherapyDetectorSD.cc.

67 {
68 
69 
70  if (aStep -> GetPreStepPoint() -> GetPhysicalVolume() -> GetName() != "RODetectorZDivisionPhys") return false;
71 
72 
73  // Get kinetic energy
74  G4Track * theTrack = aStep -> GetTrack();
75  G4double kineticEnergy = theTrack -> GetKineticEnergy();
76 
77  G4ParticleDefinition *particleDef = theTrack -> GetDefinition();
78  //Get particle name
79  G4String particleName = particleDef -> GetParticleName();
80 
81  G4int pdg = particleDef ->GetPDGEncoding();
82 
83  // Get unique track_id (in an event)
84  G4int trackID = theTrack -> GetTrackID();
85 
86  G4double energyDeposit = aStep -> GetTotalEnergyDeposit();
87 
88  G4double DX = aStep -> GetStepLength();
89  G4int Z = particleDef-> GetAtomicNumber();
90  G4int A = particleDef-> GetAtomicMass();
91 
92 
93  // Read voxel indexes: i is the x index, k is the z index
94  const G4VTouchable* touchable = aStep->GetPreStepPoint()->GetTouchable();
95  G4int k = touchable->GetReplicaNumber(0);
96  G4int i = touchable->GetReplicaNumber(2);
97  G4int j = touchable->GetReplicaNumber(1);
98 
99 
100 
101 #ifdef G4ANALYSIS_USE_ROOT
103 #endif
104 
107 
108 
109  // ******************** let ***************************
110  if (let)
111  {
112  if ( !(Z==0 && A==1) ) // All but not neutrons
113  {
114  if( energyDeposit>0. && DX >0. )
115  {
116  if (pdg !=22) // not gamma
117  {
118  let -> FillEnergySpectrum(trackID, particleDef,energyDeposit, DX, i, j, k);
119  }
120  else if (kineticEnergy > 50.*keV) // gamma cut
121  {
122  let -> FillEnergySpectrum(trackID, particleDef,energyDeposit, DX, i , j, k);
123  }
124 
125  }
126  }
127  }
128 
129 
130 
131  // ******************** let ***************************
132 
133 
134  if (matrix)
135  {
136 
137  // Increment Fluences & accumulate energy spectra
138  // Hit voxels are marked with track_id throught hitTrack matrix
139  G4int* hitTrack = matrix -> GetHitTrack(i,j,k); // hitTrack MUST BE cleared at every eventAction!
140  if ( *hitTrack != trackID )
141  {
142  *hitTrack = trackID;
143  /*
144  * Fill FLUENCE data for every single nuclide
145  * Exclude e-, neutrons, gamma, ...
146  */
147  if ( Z >= 1) matrix -> Fill(trackID, particleDef, i, j, k, 0, true);
148 
149 
150 #ifdef G4ANALYSIS_USE_ROOT
151 /*
152  // Fragments kinetic energy (ntuple)
153  if (trackID !=1 && Z>=1)
154  {
155  // First step kinetic energy for every fragment
156  analysis -> FillKineticFragmentTuple(i, j, k, A, Z, kineticEnergy/MeV);
157  }
158  // Kinetic energy spectra for primary particles
159 
160  if ( trackID == 1 && i == 0)
161  {
162  // First step kinetic energy for primaries only
163  analysis -> FillKineticEnergyPrimaryNTuple(i, j, k, kineticEnergy/MeV);
164  }
165 */
166 #endif
167  }
168 
169  if(energyDeposit != 0)
170  {
171 /*
172  * This method will fill a dose matrix for every single nuclide.
173  * A method of the HadrontherapyMatrix class (StoreDoseFluenceAscii())
174  * is called automatically at the end of main (or via the macro command /analysis/writeDoseFile.
175  * It permits to store all dose/fluence data into a single plane ASCII file.
176 */
177  // if (A==1 && Z==1) // primary and sec. protons
178  if ( Z>=1 ) // exclude e-, neutrons, gamma, ...
179  matrix -> Fill(trackID, particleDef, i, j, k, energyDeposit);
180  /*
181  * Create a hit with the information of position is in the detector
182  */
184  detectorHit -> SetEdepAndPosition(i, j, k, energyDeposit);
185  HitsCollection -> insert(detectorHit);
186  }
187  }
188 
189 #ifdef G4ANALYSIS_USE_ROOT
190  if(energyDeposit != 0)
191  {
192  if(trackID != 1)
193  {
194  if (particleName == "proton")
195  analysis -> SecondaryProtonEnergyDeposit(i, energyDeposit/MeV);
196 
197  else if (particleName == "neutron")
198  analysis -> SecondaryNeutronEnergyDeposit(i, energyDeposit/MeV);
199 
200  else if (particleName == "alpha")
201  analysis -> SecondaryAlphaEnergyDeposit(i, energyDeposit/MeV);
202 
203  else if (particleName == "gamma")
204  analysis -> SecondaryGammaEnergyDeposit(i, energyDeposit/MeV);
205 
206  else if (particleName == "e-")
207  analysis -> SecondaryElectronEnergyDeposit(i, energyDeposit/MeV);
208 
209  else if (particleName == "triton")
210  analysis -> SecondaryTritonEnergyDeposit(i, energyDeposit/MeV);
211 
212  else if (particleName == "deuteron")
213  analysis -> SecondaryDeuteronEnergyDeposit(i, energyDeposit/MeV);
214 
215  else if (particleName == "pi+" || particleName == "pi-" || particleName == "pi0")
216  analysis -> SecondaryPionEnergyDeposit(i, energyDeposit/MeV);
217  }
218  }
219 #endif
220 
221  return true;
222 }
static HadrontherapyAnalysisManager * GetInstance()
static HadrontherapyLet * GetInstance()
const G4VTouchable * GetTouchable() const
int G4int
Definition: G4Types.hh:78
G4StepPoint * GetPreStepPoint() const
static HadrontherapyMatrix * GetInstance()
double A(double temperature)
virtual G4int GetReplicaNumber(G4int depth=0) const
Definition: G4VTouchable.cc:58
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76
static constexpr double keV
Definition: G4SIunits.hh:216

Here is the call graph for this function:

Member Data Documentation

std::ofstream HadrontherapyDetectorSD::ofs

Definition at line 44 of file HadrontherapyDetectorSD.hh.


The documentation for this class was generated from the following files: