Geant4  10.02.p03
GammaKnifeController Class Reference

#include <GammaKnifeController.hh>

Collaboration diagram for GammaKnifeController:

Public Member Functions

 GammaKnifeController (GammaKnifeDetectorConstruction *)
 
 ~GammaKnifeController ()
 
void BeamOn (G4int)
 
void ReadFile (std::string fileName)
 

Private Member Functions

void StoreHits ()
 
void PrepareHitsAccumulation ()
 
void AccumulateAllHits ()
 
void RotateForward (G4int)
 
void RotateBack (G4int)
 

Private Attributes

std::vector< G4doublephiAngles
 
std::vector< G4doublethetaAngles
 
GammaKnifeDetectorConstructiondetector
 
GammaKnifeMessengermessenger
 
MeshScoreMapscoreMaps
 

Detailed Description

Definition at line 44 of file GammaKnifeController.hh.

Constructor & Destructor Documentation

◆ GammaKnifeController()

GammaKnifeController::GammaKnifeController ( GammaKnifeDetectorConstruction det)

Definition at line 35 of file GammaKnifeController.cc.

35  : scoreMaps( 0 )
36 {
37  detector = det;
38 
39  messenger = new GammaKnifeMessenger( this );
40 }
GammaKnifeDetectorConstruction * detector
GammaKnifeMessenger * messenger

◆ ~GammaKnifeController()

GammaKnifeController::~GammaKnifeController ( )

Definition at line 42 of file GammaKnifeController.cc.

43 {
44  delete messenger;
45 }
GammaKnifeMessenger * messenger

Member Function Documentation

◆ AccumulateAllHits()

void GammaKnifeController::AccumulateAllHits ( )
private

Definition at line 140 of file GammaKnifeController.cc.

141 {
143  if (scm)
144  {
145  for (size_t i = 0; i < scm->GetNumberOfMesh(); i++)
146  {
147  G4VScoringMesh* mesh = scm->GetMesh(i);
148  MeshScoreMap& storedScoreMap = scoreMaps[i];
149  MeshScoreMap::iterator it = storedScoreMap.begin();
150  for( ; it != storedScoreMap.end(); it++)
151  {
152  mesh->Accumulate( it->second );
153  }
154  }
155  }
156 }
std::map< G4String, G4THitsMap< G4double > *> MeshScoreMap
size_t GetNumberOfMesh() const
void Accumulate(G4THitsMap< G4double > *map)
G4VScoringMesh * GetMesh(G4int i) const
static G4ScoringManager * GetScoringManagerIfExist()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BeamOn()

void GammaKnifeController::BeamOn ( G4int  n_event)

Definition at line 47 of file GammaKnifeController.cc.

48 {
50  for (G4int i = 0; i < GAMMAKNIFE_SOURCES; i++)
51  {
52  RotateForward(i);
54 
55  if (i != (GAMMAKNIFE_SOURCES - 1))
56  StoreHits();
57 
58  RotateBack(i);
59  }
61 }
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
int G4int
Definition: G4Types.hh:78
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
#define GAMMAKNIFE_SOURCES
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrepareHitsAccumulation()

void GammaKnifeController::PrepareHitsAccumulation ( )
private

Definition at line 92 of file GammaKnifeController.cc.

93 {
95  if (scm)
96  {
97  size_t size = scm->GetNumberOfMesh();
98  scoreMaps = new MeshScoreMap[size];
99  for (size_t i = 0; i < size; i++)
100  {
101  G4VScoringMesh * mesh = scm->GetMesh(i);
102 
103  MeshScoreMap scoreMap = mesh->GetScoreMap();
104  MeshScoreMap& storedScoreMap = scoreMaps[i];
105 
106  MeshScoreMap::iterator it = scoreMap.begin();
107  for( ; it != scoreMap.end(); it++)
108  {
109  std::string hitMapName = it->first;
110  G4THitsMap<G4double>* hitMapToStore = new G4THitsMap<G4double>("GammaKnifeController", hitMapName);
111  storedScoreMap[ hitMapName ] = hitMapToStore;
112  }
113  }
114  }
115 }
std::map< G4String, G4THitsMap< G4double > *> MeshScoreMap
MeshScoreMap GetScoreMap() const
size_t GetNumberOfMesh() const
G4VScoringMesh * GetMesh(G4int i) const
static G4ScoringManager * GetScoringManagerIfExist()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadFile()

void GammaKnifeController::ReadFile ( std::string  fileName)

Definition at line 158 of file GammaKnifeController.cc.

159 {
160  //G4cout << "Enter ReadFile()...";
161  const int SZ = 100;
162  char buf[SZ];
163 
164  phiAngles.clear(); // If called for the second time
165  thetaAngles.clear(); // we won't have 402 positions...
166 
167  std::ifstream ifs;
168  ifs.open( fileName.c_str() );
169 
170  for (G4int i = 0; i < GAMMAKNIFE_SOURCES; i++)
171  {
172  G4double phi, theta;
173 
174  /* Skip the "Axx" at the beginning of the line */
175  for (G4int c = 0; c < 4; c++) ifs.get();
176 
177  ifs >> phi >> theta;
178  ifs.getline(buf, SZ); // Next line
179 
180  phiAngles.push_back( phi * degree );
181  thetaAngles.push_back( theta * degree );
182  }
183  ifs.close();
184  //G4cout << "... done " << G4endl;
185 }
std::vector< G4double > phiAngles
std::vector< G4double > thetaAngles
int G4int
Definition: G4Types.hh:78
#define GAMMAKNIFE_SOURCES
static const double degree
Definition: G4SIunits.hh:143
double G4double
Definition: G4Types.hh:76
Here is the caller graph for this function:

◆ RotateBack()

void GammaKnifeController::RotateBack ( G4int  position)
private

Definition at line 78 of file GammaKnifeController.cc.

79 {
81  if (scm)
82  {
83  for (size_t i = 0; i < scm->GetNumberOfMesh(); i++)
84  {
85  G4VScoringMesh * mesh = scm->GetMesh(i);
86  mesh->RotateZ( - phiAngles[position] );
87  mesh->RotateX( - thetaAngles[position] );
88  }
89  }
90 }
size_t GetNumberOfMesh() const
std::vector< G4double > phiAngles
std::vector< G4double > thetaAngles
void RotateX(G4double delta)
G4VScoringMesh * GetMesh(G4int i) const
static G4ScoringManager * GetScoringManagerIfExist()
void RotateZ(G4double delta)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RotateForward()

void GammaKnifeController::RotateForward ( G4int  position)
private

Definition at line 63 of file GammaKnifeController.cc.

64 {
65  // Rotate all scoring meshes to the right position
67  if (scm)
68  {
69  for (size_t i = 0; i < scm->GetNumberOfMesh(); i++)
70  {
71  G4VScoringMesh * mesh = scm->GetMesh(i);
72  mesh->RotateX( thetaAngles[position] );
73  mesh->RotateZ( phiAngles[position] );
74  }
75  }
76 }
size_t GetNumberOfMesh() const
std::vector< G4double > phiAngles
std::vector< G4double > thetaAngles
void RotateX(G4double delta)
G4VScoringMesh * GetMesh(G4int i) const
static G4ScoringManager * GetScoringManagerIfExist()
void RotateZ(G4double delta)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ StoreHits()

void GammaKnifeController::StoreHits ( )
private

Definition at line 117 of file GammaKnifeController.cc.

118 {
120  if (scm)
121  {
122  for (size_t i = 0; i < scm->GetNumberOfMesh(); i++)
123  {
124  G4VScoringMesh* mesh = scm->GetMesh(i);
125 
126 
127  MeshScoreMap scoreMap = mesh->GetScoreMap();
128  MeshScoreMap& storedScoreMap = scoreMaps[i];
129 
130  MeshScoreMap::iterator it = scoreMap.begin();
131  for( ; it != scoreMap.end(); it++)
132  {
133  std::string hitMapName = it->first;
134  *storedScoreMap[hitMapName] += *(it->second);
135  }
136  }
137  }
138 }
std::map< G4String, G4THitsMap< G4double > *> MeshScoreMap
MeshScoreMap GetScoreMap() const
size_t GetNumberOfMesh() const
G4VScoringMesh * GetMesh(G4int i) const
static G4ScoringManager * GetScoringManagerIfExist()
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ detector

GammaKnifeDetectorConstruction* GammaKnifeController::detector
private

Definition at line 72 of file GammaKnifeController.hh.

◆ messenger

GammaKnifeMessenger* GammaKnifeController::messenger
private

Definition at line 74 of file GammaKnifeController.hh.

◆ phiAngles

std::vector<G4double> GammaKnifeController::phiAngles
private

Definition at line 68 of file GammaKnifeController.hh.

◆ scoreMaps

MeshScoreMap* GammaKnifeController::scoreMaps
private

Definition at line 76 of file GammaKnifeController.hh.

◆ thetaAngles

std::vector<G4double> GammaKnifeController::thetaAngles
private

Definition at line 70 of file GammaKnifeController.hh.


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