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

#include <IORTDetectorSD.hh>

Inheritance diagram for IORTDetectorSD:
Collaboration diagram for IORTDetectorSD:

Public Member Functions

 IORTDetectorSD (G4String name)
 
 ~IORTDetectorSD ()
 
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 50 of file IORTDetectorSD.hh.

Constructor & Destructor Documentation

IORTDetectorSD::IORTDetectorSD ( G4String  name)

Definition at line 53 of file IORTDetectorSD.cc.

53  :
55 {
56  G4String HCname;
57  collectionName.insert(HCname="IORTDetectorHitsCollection");
58  HitsCollection = NULL;
59  sensitiveDetectorName = dname;
60 }
G4VSensitiveDetector(G4String name)
G4CollectionNameVector collectionName

Here is the call graph for this function:

IORTDetectorSD::~IORTDetectorSD ( )

Definition at line 63 of file IORTDetectorSD.cc.

64 {
65 }

Member Function Documentation

void IORTDetectorSD::EndOfEvent ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 195 of file IORTDetectorSD.cc.

196 {
197  static G4int HCID = -1;
198  if(HCID < 0)
199  {
200  HCID = GetCollectionID(0);
201  }
202 
203  HCE -> AddHitsCollection(HCID,HitsCollection);
204 }
int G4int
Definition: G4Types.hh:78
virtual G4int GetCollectionID(G4int i)

Here is the call graph for this function:

void IORTDetectorSD::Initialize ( G4HCofThisEvent )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 68 of file IORTDetectorSD.cc.

69 {
70  HitsCollection = new IORTDetectorHitsCollection(sensitiveDetectorName,
71  collectionName[0]);
72 }
G4CollectionNameVector collectionName
G4THitsCollection< IORTDetectorHit > IORTDetectorHitsCollection
G4bool IORTDetectorSD::ProcessHits ( G4Step aStep,
G4TouchableHistory ROhist 
)
virtual

Implements G4VSensitiveDetector.

Definition at line 75 of file IORTDetectorSD.cc.

76 {
77  //The code doesn't seem to get here if we use the IAEA geometry. FIXME
78  if(!ROhist)
79  return false;
80 
81  if (aStep -> GetPreStepPoint() -> GetPhysicalVolume() -> GetName() != "DetectorPhys")
82  return false;
83  // Get kinetic energy
84  G4Track * theTrack = aStep -> GetTrack();
85  //G4double kineticEnergy = theTrack -> GetKineticEnergy();
86 
87  G4ParticleDefinition *particleDef = theTrack -> GetDefinition();
88  //Get particle name
89  G4String particleName = particleDef -> GetParticleName();
90  // G4cout << particleDef -> GetParticleType() << '\n';
91  // Get unique track_id (in an event)
92  G4int trackID = theTrack -> GetTrackID();
93 
94  G4double energyDeposit = aStep -> GetTotalEnergyDeposit();
95 
96  G4int Z = particleDef-> GetAtomicNumber();
97  //G4int A = particleDef-> GetAtomicMass();
98 
99  // Read voxel indexes: i is the x index, k is the z index
100  G4int k = ROhist -> GetReplicaNumber(0);
101  G4int i = ROhist -> GetReplicaNumber(2);
102  G4int j = ROhist -> GetReplicaNumber(1);
103 
105 
107 
108  if (matrix)
109  {
110 
111  // Increment Fluences & accumulate energy spectra
112  // Hit voxels are marked with track_id throught hitTrack matrix
113  G4int* hitTrack = matrix -> GetHitTrack(i,j,k); // hitTrack MUST BE cleared at every eventAction!
114  if ( *hitTrack != trackID )
115  {
116  *hitTrack = trackID;
117  /*
118  * Fill FLUENCE data for every single nuclide
119  * Exclude e-, neutrons, gamma, ...
120  */
121  if ( Z >= 1)
122  matrix -> Fill(trackID, particleDef, i, j, k, 0, true);
123  /*
124  // Fragments kinetic energy (ntuple)
125  if (trackID !=1 && Z>=1)
126  {
127  // First step kinetic energy for every fragment
128  analysis -> FillKineticFragmentTuple(i, j, k, A, Z, kineticEnergy/MeV);
129  }
130  // Kinetic energy spectra for primary particles
131 
132  if ( trackID == 1 && i == 0)
133  {
134  // First step kinetic energy for primaries only
135  analysis -> FillKineticEnergyPrimaryNTuple(i, j, k, kineticEnergy/MeV);
136  }
137  */
138  }
139 
140  if(energyDeposit != 0)
141  {
142 /*
143  * This method will fill a dose matrix for every single nuclide.
144  * A method of the IORTMatrix class (StoreDoseFluenceAscii())
145  * is called automatically at the end of main (or via the macro command /analysis/writeDoseFile.
146  * It permits to store all dose/fluence data into a single plane ASCII file.
147 */
148  // if (A==1 && Z==1) // primary and sec. protons
149  if ( Z>=1 ) // exclude e-, neutrons, gamma, ...
150  matrix -> Fill(trackID, particleDef, i, j, k, energyDeposit);
151  /*
152  * Create a hit with the information of position is in the detector
153  */
154  IORTDetectorHit* detectorHit = new IORTDetectorHit();
155  detectorHit -> SetEdepAndPosition(i, j, k, energyDeposit);
156  HitsCollection -> insert(detectorHit);
157  }
158  }
159 
160  if(energyDeposit != 0)
161  {
162  if(trackID != 1)
163  {
164  if (particleName == "proton")
165  analysis -> SecondaryProtonEnergyDeposit(i, energyDeposit/MeV);
166 
167  else if (particleName == "neutron")
168  analysis -> SecondaryNeutronEnergyDeposit(i, energyDeposit/MeV);
169 
170  else if (particleName == "alpha")
171  analysis -> SecondaryAlphaEnergyDeposit(i, energyDeposit/MeV);
172 
173  else if (particleName == "gamma")
174  analysis -> SecondaryGammaEnergyDeposit(i, energyDeposit/MeV);
175 
176  else if (particleName == "e-")
177  analysis -> SecondaryElectronEnergyDeposit(i, energyDeposit/MeV);
178 
179  else if (particleName == "triton")
180  analysis -> SecondaryTritonEnergyDeposit(i, energyDeposit/MeV);
181 
182  else if (particleName == "deuteron")
183  analysis -> SecondaryDeuteronEnergyDeposit(i, energyDeposit/MeV);
184 
185  else if (particleName == "pi+" || particleName == "pi-" ||
186  particleName == "pi0")
187  analysis -> SecondaryPionEnergyDeposit(i, energyDeposit/MeV);
188  }
189  }
190 
191  return true;
192 }
int G4int
Definition: G4Types.hh:78
static IORTAnalysisManager * GetInstance()
static constexpr double MeV
Definition: G4SIunits.hh:214
static IORTMatrix * GetInstance()
Definition: IORTMatrix.cc:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Member Data Documentation

std::ofstream IORTDetectorSD::ofs

Definition at line 56 of file IORTDetectorSD.hh.


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