Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Data Fields
IORTDetectorSD Class Reference

#include <IORTDetectorSD.hh>

Inheritance diagram for IORTDetectorSD:
G4VSensitiveDetector

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 ()
 
const 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
 

Data Fields

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.

References G4VSensitiveDetector::collectionName, and G4CollectionNameVector::insert().

53  :
55 {
56  G4String HCname;
57  collectionName.insert(HCname="IORTDetectorHitsCollection");
58  HitsCollection = NULL;
59  sensitiveDetectorName = dname;
60 }
G4VSensitiveDetector(G4String name)
G4CollectionNameVector collectionName
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 200 of file IORTDetectorSD.cc.

References G4VSensitiveDetector::GetCollectionID().

201 {
202  static G4int HCID = -1;
203  if(HCID < 0)
204  {
205  HCID = GetCollectionID(0);
206  }
207 
208  HCE -> AddHitsCollection(HCID,HitsCollection);
209 }
int G4int
Definition: G4Types.hh:78
virtual G4int GetCollectionID(G4int i)
void IORTDetectorSD::Initialize ( G4HCofThisEvent )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 68 of file IORTDetectorSD.cc.

References G4VSensitiveDetector::collectionName.

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.

References IORTAnalysisManager::GetInstance(), IORTMatrix::GetInstance(), G4VSensitiveDetector::GetName(), and python.hepunit::MeV.

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 
104 #ifdef G4ANALYSIS_USE_ROOT
106 #endif
107 
109 
110  if (matrix)
111  {
112 
113  // Increment Fluences & accumulate energy spectra
114  // Hit voxels are marked with track_id throught hitTrack matrix
115  G4int* hitTrack = matrix -> GetHitTrack(i,j,k); // hitTrack MUST BE cleared at every eventAction!
116  if ( *hitTrack != trackID )
117  {
118  *hitTrack = trackID;
119  /*
120  * Fill FLUENCE data for every single nuclide
121  * Exclude e-, neutrons, gamma, ...
122  */
123  if ( Z >= 1)
124  matrix -> Fill(trackID, particleDef, i, j, k, 0, true);
125 #ifdef G4ANALYSIS_USE_ROOT
126 /*
127  // Fragments kinetic energy (ntuple)
128  if (trackID !=1 && Z>=1)
129  {
130  // First step kinetic energy for every fragment
131  analysis -> FillKineticFragmentTuple(i, j, k, A, Z, kineticEnergy/MeV);
132  }
133  // Kinetic energy spectra for primary particles
134 
135  if ( trackID == 1 && i == 0)
136  {
137  // First step kinetic energy for primaries only
138  analysis -> FillKineticEnergyPrimaryNTuple(i, j, k, kineticEnergy/MeV);
139  }
140 */
141 #endif
142  }
143 
144  if(energyDeposit != 0)
145  {
146 /*
147  * This method will fill a dose matrix for every single nuclide.
148  * A method of the IORTMatrix class (StoreDoseFluenceAscii())
149  * is called automatically at the end of main (or via the macro command /analysis/writeDoseFile.
150  * It permits to store all dose/fluence data into a single plane ASCII file.
151 */
152  // if (A==1 && Z==1) // primary and sec. protons
153  if ( Z>=1 ) // exclude e-, neutrons, gamma, ...
154  matrix -> Fill(trackID, particleDef, i, j, k, energyDeposit);
155  /*
156  * Create a hit with the information of position is in the detector
157  */
158  IORTDetectorHit* detectorHit = new IORTDetectorHit();
159  detectorHit -> SetEdepAndPosition(i, j, k, energyDeposit);
160  HitsCollection -> insert(detectorHit);
161  }
162  }
163 
164 #ifdef G4ANALYSIS_USE_ROOT
165  if(energyDeposit != 0)
166  {
167  if(trackID != 1)
168  {
169  if (particleName == "proton")
170  analysis -> SecondaryProtonEnergyDeposit(i, energyDeposit/MeV);
171 
172  else if (particleName == "neutron")
173  analysis -> SecondaryNeutronEnergyDeposit(i, energyDeposit/MeV);
174 
175  else if (particleName == "alpha")
176  analysis -> SecondaryAlphaEnergyDeposit(i, energyDeposit/MeV);
177 
178  else if (particleName == "gamma")
179  analysis -> SecondaryGammaEnergyDeposit(i, energyDeposit/MeV);
180 
181  else if (particleName == "e-")
182  analysis -> SecondaryElectronEnergyDeposit(i, energyDeposit/MeV);
183 
184  else if (particleName == "triton")
185  analysis -> SecondaryTritonEnergyDeposit(i, energyDeposit/MeV);
186 
187  else if (particleName == "deuteron")
188  analysis -> SecondaryDeuteronEnergyDeposit(i, energyDeposit/MeV);
189 
190  else if (particleName == "pi+" || particleName == "pi-" || particleName == "pi0")
191  analysis -> SecondaryPionEnergyDeposit(i, energyDeposit/MeV);
192  }
193  }
194 #endif
195 
196  return true;
197 }
int G4int
Definition: G4Types.hh:78
static IORTAnalysisManager * GetInstance()
static IORTMatrix * GetInstance()
Definition: IORTMatrix.cc:61
double G4double
Definition: G4Types.hh:76

Field Documentation

std::ofstream IORTDetectorSD::ofs

Definition at line 56 of file IORTDetectorSD.hh.


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