Skip to content

Commit

Permalink
Merge pull request #193 from helazhar/NTLE
Browse files Browse the repository at this point in the history
Adding Neutron Track Length Estimator actor (NTLE)
  • Loading branch information
dsarrut committed Jul 19, 2018
2 parents dafbd6f + 19cfbbe commit 1fa9f64
Show file tree
Hide file tree
Showing 12 changed files with 5,968 additions and 0 deletions.
3,187 changes: 3,187 additions & 0 deletions source/digits_hits/include/GateKermaFactorDatabase.hh

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions source/digits_hits/include/GateKermaFactorHandler.hh
@@ -0,0 +1,68 @@
/*----------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See GATE/LICENSE.txt for further details
----------------------*/

/*!
\class GateKermaFactorHandler
\authors: Halima Elazhar (halima.elazhar@ihpc.cnrs.fr)
Thomas Deschler (thomas.deschler@iphc.cnrs.fr)
*/

#ifndef GATEKERMAFACTORHANDLER_HH
#define GATEKERMAFACTORHANDLER_HH

#include "GateKermaFactorDatabase.hh"
#include "GateNTLEMuEnDatabase.hh"

#include <G4Material.hh>

#include <TGraph.h>

class GateKermaFactorHandler
{
public:
GateKermaFactorHandler();
~GateKermaFactorHandler() {};

void SetEnergy(double);
void SetCubicVolume(double);
void SetDistance(double);
void SetMaterial(const G4Material*);
void SetKFExtrapolation(const bool _KFExtrapolation = true) {mKFExtrapolation = _KFExtrapolation;}
void SetKFDA (const bool _KFDA = true) {mKFDA = _KFDA;}
void SetKermaEquivalentFactor(const bool _KermaEquivalentFactor = true) {mKermaEquivalentFactor = _KermaEquivalentFactor;}
void SetPhotonKermaEquivalentFactor(const bool _PhotonKermaEquivalentFactor = true) {mPhotonKermaEquivalentFactor = _PhotonKermaEquivalentFactor;}

double GetDose();
double GetDoseCorrected();
double GetDoseCorrectedTLE();

double GetFlux();

TGraph* GetKermaFactorGraph();

private:
double GetKermaFactor(double);
double GetPhotonFactor(const G4Material*);
double GetMuEnOverRho();

double m_energy;
double m_cubicVolume;
double m_distance;
double m_kerma_factor;

bool mKFExtrapolation;
bool mKFDA;
bool mKermaEquivalentFactor;
bool mPhotonKermaEquivalentFactor;

const G4Material* m_material;

std::vector<double> kfTable;
std::vector<double> MuEnTable;
};
#endif
133 changes: 133 additions & 0 deletions source/digits_hits/include/GateNTLEDoseActor.hh
@@ -0,0 +1,133 @@
/*----------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See GATE/LICENSE.txt for further details
----------------------*/

/*!
\class GateNTLEDoseActor
\authors: Halima Elazhar (halima.elazhar@ihpc.cnrs.fr)
Thomas Deschler (thomas.deschler@iphc.cnrs.fr)
*/

#ifndef GATENTLEDOSEACTOR_HH
#define GATENTLEDOSEACTOR_HH

#include "GateVImageActor.hh"
#include "GateActorManager.hh"
#include "GateNTLEDoseActorMessenger.hh"
#include "GateImageWithStatistic.hh"
#include "GateKermaFactorHandler.hh"

#include <G4UnitsTable.hh>

#include <TMultiGraph.h>

class GateNTLEDoseActor : public GateVImageActor
{
public:

//-----------------------------------------------------------------------------
// Actor name
virtual ~GateNTLEDoseActor();

FCT_FOR_AUTO_CREATOR_ACTOR(GateNTLEDoseActor)

//-----------------------------------------------------------------------------
// Constructs the sensor
virtual void Construct();

void EnableEdepImage (bool b) { mIsEdepImageEnabled = b; }
void EnableEdepSquaredImage (bool b) { mIsEdepSquaredImageEnabled = b; }
void EnableEdepUncertaintyImage (bool b) { mIsEdepUncertaintyImageEnabled = b; }

void EnableDoseImage (bool b) { mIsDoseImageEnabled = b; }
void EnableDoseSquaredImage (bool b) { mIsDoseSquaredImageEnabled = b; }
void EnableDoseUncertaintyImage (bool b) { mIsDoseUncertaintyImageEnabled = b; }

void EnableFluxImage (bool b) { mIsFluxImageEnabled = b; }
void EnableFluxSquaredImage (bool b) { mIsFluxSquaredImageEnabled = b; }
void EnableFluxUncertaintyImage (bool b) { mIsFluxUncertaintyImageEnabled = b; }

void EnableDoseCorrection (bool b) { mIsDoseCorrectionEnabled = b; }
void EnableDoseCorrectionTLE (bool b) { mIsDoseCorrectionTLEEnabled = b; }

void EnableKFExtrapolation (bool b) { mIsKFExtrapolated = b; }
void EnableKFDA (bool b) { mIsKFDA = b; }
void EnableKermaFactorDump (bool b) { mIsKermaFactorDumped = b; }
void EnableKillSecondary (bool b) { mIsKillSecondaryEnabled = b; }

void EnableKermaEquivalentFactor (bool b) { mIsKermaEquivalentFactorEnabled = b; }
void EnablePhotonKermaEquivalentFactor(bool b) { mIsPhotonKermaEquivalentFactorEnabled = b; }

virtual void BeginOfRunAction (const G4Run*);
virtual void BeginOfEventAction(const G4Event*);

virtual void UserSteppingAction(const GateVVolume*, const G4Step*);
virtual void UserSteppingActionInVoxel(const int , const G4Step*);
virtual void UserPreTrackActionInVoxel(const int , const G4Track*) {}
virtual void UserPostTrackActionInVoxel(const int , const G4Track*) {}

/// Saves the data collected to the file
virtual void SaveData();
virtual void ResetData();

///Scorer related
//virtual G4bool ProcessHits(G4Step *, G4TouchableHistory*);
virtual void clear(){ResetData();}
virtual void Initialize(G4HCofThisEvent*){}
virtual void EndOfEvent(G4HCofThisEvent*){}

protected:
GateNTLEDoseActor(G4String name, G4int depth=0);
GateNTLEDoseActorMessenger * pMessenger;

GateImageWithStatistic mEdepImage;
GateImageWithStatistic mDoseImage;
GateImageWithStatistic mFluxImage;

GateImage mLastHitEventImage;

GateKermaFactorHandler* mKFHandler;

G4String mEdepFilename;
G4String mDoseFilename;
G4String mFluxFilename;

bool mIsLastHitEventImageEnabled;

bool mIsEdepImageEnabled;
bool mIsEdepSquaredImageEnabled;
bool mIsEdepUncertaintyImageEnabled;

bool mIsDoseImageEnabled;
bool mIsDoseSquaredImageEnabled;
bool mIsDoseUncertaintyImageEnabled;

bool mIsFluxImageEnabled;
bool mIsFluxSquaredImageEnabled;
bool mIsFluxUncertaintyImageEnabled;

bool mIsDoseCorrectionEnabled;
bool mIsDoseCorrectionTLEEnabled;

bool mIsKFExtrapolated;
bool mIsKFDA;
bool mIsKermaFactorDumped;
bool mIsKillSecondaryEnabled;

bool mIsKermaEquivalentFactorEnabled;
bool mIsPhotonKermaEquivalentFactorEnabled;

int mCurrentEvent;

std::vector<G4String> mMaterialList;

TMultiGraph* mg;
};

MAKE_AUTO_CREATOR_ACTOR(NTLEDoseActor,GateNTLEDoseActor)

#endif
58 changes: 58 additions & 0 deletions source/digits_hits/include/GateNTLEDoseActorMessenger.hh
@@ -0,0 +1,58 @@
/*----------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See GATE/LICENSE.txt for further details
----------------------*/

/*
\class GateNTLEDoseActorMessenger
\authors: Halima Elazhar (halima.elazhar@ihpc.cnrs.fr)
Thomas Deschler (thomas.deschler@iphc.cnrs.fr)
*/

#ifndef GATENTLEDOSEACTORMESSENGER_HH
#define GATENTLEDOSEACTORMESSENGER_HH

#include "G4UIcmdWithABool.hh"
#include "GateImageActorMessenger.hh"

class GateNTLEDoseActor;
class GateNTLEDoseActorMessenger : public GateImageActorMessenger
{
public:
GateNTLEDoseActorMessenger(GateNTLEDoseActor*);
virtual ~GateNTLEDoseActorMessenger();

void BuildCommands(G4String);
void SetNewValue(G4UIcommand*, G4String);

protected:
GateNTLEDoseActor* pDoseActor;

G4UIcmdWithABool* pEnableEdepCmd;
G4UIcmdWithABool* pEnableEdepSquaredCmd;
G4UIcmdWithABool* pEnableEdepUncertaintyCmd;

G4UIcmdWithABool* pEnableDoseCmd;
G4UIcmdWithABool* pEnableDoseSquaredCmd;
G4UIcmdWithABool* pEnableDoseUncertaintyCmd;

G4UIcmdWithABool* pEnableFluxCmd;
G4UIcmdWithABool* pEnableFluxSquaredCmd;
G4UIcmdWithABool* pEnableFluxUncertaintyCmd;

G4UIcmdWithABool* pEnableDoseCorrectionCmd;
G4UIcmdWithABool* pEnableDoseCorrectionTLECmd;

G4UIcmdWithABool* pEnableKFExtrapolationCmd;
G4UIcmdWithABool* pEnableKFDACmd;
G4UIcmdWithABool* pEnableKermaFactorDumpCmd;
G4UIcmdWithABool* pEnableKillSecondaryCmd;

G4UIcmdWithABool* pEnableKermaEquivalentFactorCmd;
G4UIcmdWithABool* pEnablePhotonKermaEquivalentFactorCmd;
};

#endif

0 comments on commit 1fa9f64

Please sign in to comment.