Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
@@ -42,12 +42,13 @@
#define doiPETActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
#include "doiPETAnalysis.hh"
//
class doiPETAnalysis;
class doiPETActionInitialization : public G4VUserActionInitialization
{
public:
doiPETActionInitialization();
doiPETActionInitialization(doiPETAnalysis* );
virtual ~doiPETActionInitialization();
virtual void BuildForMaster() const;
@@ -56,6 +57,7 @@ public:
//virtual G4VSteppingVerbose* InitializeSteppingVerbose() const;
private:
doiPETAnalysis* analysis;
// doiPETDetectorConstruction* fDetector;
};
//
@@ -54,23 +54,10 @@
#include <iterator>
#include <vector>
#include <algorithm>
#include "G4AnalysisManager.hh"
#ifdef USEROOT
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#include "TRandom3.h"
#include "TFile.h"
#include "TNtuple.h"
#include "g4root.hh"
#include "TROOT.h"
#include "TFile.h"
#include "TH1.h"
#include "TH2.h"
#include "TTree.h"
#include "TLeaf.h"
#include "TSystem.h"
#pragma GCC diagnostic pop
#endif
// Define the total number of columns in the ntuple
const G4int MaxNtCol = 17;
class doiPETAnalysisMessenger;
@@ -96,17 +83,19 @@ public:
void GetParentParticleName(G4String);
void GetSizeOfDetector (G4double, G4double, G4double);
void GetScatterIndexInPhantom(G4double);
void SetScatterIndexInPhantom(G4int);
void SetSourcePosition(G4ThreeVector);//
void SetEventID(G4int);
void BlurringParameters();
void GetTimeOfAnnihilation(G4double);
void PMTPosition();
void AngerLogic(G4int, G4int, G4int, G4double, G4double, G4double, G4double);
void AngerLogic(G4double, G4double, G4double, G4double, G4double, G4bool);
void ReadReflectorPattern();
void PrepareDOILookUpTable(G4String);
void SetActivity(G4double);
void SetIsotopeHalfLife(G4double);
@@ -117,14 +106,28 @@ public:
G4double QuantumEffifciency(G4double, G4int, G4int);
void ReadOut(G4int, G4int, G4double, G4double, G4ThreeVector, G4double);
//G4ROOT
void book(); // booking the ROOT file
void FillListModeEvent(); //Single or Coinsidence
void finish();
// Close the ROOT file with all the results stored in nutples
private:
static doiPETAnalysis* instance;
doiPETAnalysisMessenger* fAnalysisMessenger;
//std::multimap< G4int, InteractionInformation* > mapBlockInteraction;
std::set<G4int> setBlockInteraction;
G4double upperThreshold, lowerThreshold;
G4double upperThreshold, lowerThreshold;
G4double triggerEnergy;
//G4ROOT
G4bool factoryOn;
G4int fNtColId[MaxNtCol];
//
//G4ThreeVector sourcePosition;
@@ -166,7 +169,7 @@ private:
G4double shiftCoeff;
G4double PositionAngerZ, PositionAngerY;
//reflector pattern
std::vector<G4int> ireflectorLayer1_Tangential;
std::vector<G4int> ireflectorLayer1_Axial;
@@ -191,6 +194,11 @@ private:
//interaction position with respect to the crystal axis
G4ThreeVector interactionPos;
//interaction position
G4double intPosX;
G4double intPosY;
G4double intPosZ;
G4double interactionTime;
@@ -216,10 +224,16 @@ private:
G4int DOI_ID0, DOI_ID1;
G4double timeStamp0, timeStamp1;
G4double totalEdep0, totalEdep1;
G4double sposX, sposY, sposZ;
//choice for the user
G4bool getSinglesData;
G4bool getCoincidenceData;
//
G4bool ApplyAngerLogic;
G4double PMTblurring_tan;
G4double PMTblurring_axial;
G4String outputData;
G4int numberOfHit;
@@ -248,6 +262,7 @@ private:
//G4bool variableResolution;
G4bool fixedResolution;
G4bool isDOIlookUpTablePrepared;
G4double energyResolution_fixed;
std::vector<std::vector<G4double>> energyResolution_cryDependent;
@@ -282,14 +297,16 @@ private:
G4String asciiFileName;
G4String rootFileName;
#ifdef USEROOT
TTree* tSingles;
TTree* tCoincidence;
//TH1F*hb;
#endif
// #ifdef USEROOT
// TFile* file;
// TTree* tSingles;
// TTree* tCoincidence;
// //TH1F*hb;
// #endif
//input file to read reflector pattern
std::ifstream ifs;
};
#endif
@@ -60,239 +60,241 @@ class doiPETDetectorConstructionMessenger;
class doiPETDetectorConstruction : public G4VUserDetectorConstruction
{
public:
doiPETDetectorConstruction();
virtual ~doiPETDetectorConstruction();
doiPETDetectorConstruction();
virtual ~doiPETDetectorConstruction();
public:
virtual G4VPhysicalVolume* Construct();
virtual G4VPhysicalVolume* Construct();
void ConstructPhantom(G4LogicalVolume*);
void ChangePhantom(G4String choice);
void SetPhantomPosition(G4ThreeVector);
void SetPhantomRadius(G4double);
void SetPhantomLength(G4double);
void ConstructPhantom(G4LogicalVolume*);
void ChangePhantom(G4String choice);
void SetPhantomPosition(G4ThreeVector);
void SetPhantomRadius(G4double);
void SetPhantomLength(G4double);
void SetNumberOfSleeves(G4int);
private:
void DefineMaterials();
doiPETDetectorConstructionMessenger* fDetectorMessenger;
doiPETAnalysis* pAnalysis;
void DefineMaterials();
doiPETDetectorConstructionMessenger* fDetectorMessenger;
doiPETAnalysis* pAnalysis;
G4LogicalVolume* phantom_logicalV;
G4VPhysicalVolume* phantom_physicalV;
// G4LogicalVolume* gelatin_logicalV;
// G4VPhysicalVolume* gelatin_physicalV;
G4LogicalVolume* phantom_logicalV;
G4VPhysicalVolume* phantom_physicalV;
//G4LogicalVolume* gelatin_logicalV;
//G4VPhysicalVolume* gelatin_physicalV;
//wolrd
G4LogicalVolume* world_logicalV;
G4VPhysicalVolume* world_physicalV;
//world
G4LogicalVolume* world_logicalV;
G4VPhysicalVolume* world_physicalV;
//detector block
G4LogicalVolume* blockDetector_logicalV;
G4VPhysicalVolume* blockDetector_physicalV;
//detector block
G4LogicalVolume* blockDetector_logicalV;
G4VPhysicalVolume* blockDetector_physicalV;
//air volume to fill the detector block
G4LogicalVolume* airBox_logicalV;
G4VPhysicalVolume* airBox_physicalV;
//air volume to fill the detector block
G4LogicalVolume* airBox_logicalV;
G4VPhysicalVolume* airBox_physicalV;
//crystals
G4LogicalVolume* crystal_logicalV;
G4VPhysicalVolume* crystal_physicalV;
//crystals
G4LogicalVolume* crystal_logicalV;
G4VPhysicalVolume* crystal_physicalV;
//water
G4LogicalVolume* water_logicalV;
G4VPhysicalVolume* water_physicalV;
//water
G4LogicalVolume* water_logicalV;
G4VPhysicalVolume* water_physicalV;
//lung
G4LogicalVolume* lung_logicalV;
G4VPhysicalVolume* lung_physicalV;
//lung
G4LogicalVolume* lung_logicalV;
G4VPhysicalVolume* lung_physicalV;
//test line phantom
G4LogicalVolume* test_logicalV;
G4VPhysicalVolume* test_physicalV;
//test line phantom
G4LogicalVolume* test_logicalV;
G4VPhysicalVolume* test_physicalV;
G4LogicalVolume* lung_logicalV_PMMA;
G4VPhysicalVolume* lung_physicalVPMMA;
G4LogicalVolume* lung_logicalV_PMMA;
G4VPhysicalVolume* lung_physicalVPMMA;
//cold regions
// G4LogicalVolume* coldRegion_logicalV;
// G4VPhysicalVolume* coldRegion_physicalV;
//cold regions
//G4LogicalVolume* coldRegion_logicalV;
//G4VPhysicalVolume* coldRegion_physicalV;
//
//Surrounding PMMA for hot sphere
G4LogicalVolume* hotSpherePMMA_logicalV;
G4VPhysicalVolume* hotSpherePMMA_physicalV;
//
//Surrounding PMMA for hot sphere
G4LogicalVolume* hotSpherePMMA_logicalV;
G4VPhysicalVolume* hotSpherePMMA_physicalV;
//hot water phantom (activity is distributed)
G4LogicalVolume* hotSphereWater_logicalV;
G4VPhysicalVolume* hotSphereWater_physicalV;
//hot water phantom (activity is distributed)
G4LogicalVolume* hotSphereWater_logicalV;
G4VPhysicalVolume* hotSphereWater_physicalV;
//surrounding PMMA cold sphere
G4LogicalVolume* coldSpherePMMA_logicalV;
G4VPhysicalVolume* coldSpherePMMA_physicalV;
//surrounding PMMA cold sphere
G4LogicalVolume* coldSpherePMMA_logicalV;
G4VPhysicalVolume* coldSpherePMMA_physicalV;
//cold Water phantom in the cold PMMA sphere
G4LogicalVolume* coldSphereWater_logicalV;
G4VPhysicalVolume* coldSphereWater_physicalV;
//cold Water phantom in the cold PMMA sphere
G4LogicalVolume* coldSphereWater_logicalV;
G4VPhysicalVolume* coldSphereWater_physicalV;
//fillable polyethylene phantom for sensitivity
G4LogicalVolume* phantomPE_logicalV;
G4VPhysicalVolume* phantomPE_physicalV;
//fillable polyethylene phantom for sensitivity
G4LogicalVolume* phantomPE_logicalV;
G4VPhysicalVolume* phantomPE_physicalV;
//Image quality phantom for small animal NEMA NU-4
G4LogicalVolume* waterPhantom_logicalV;
G4VPhysicalVolume* WaterPhantom_physicalV;
//Image quality phantom for small animal NEMA NU-4
G4LogicalVolume* waterPhantom_logicalV;
G4VPhysicalVolume* WaterPhantom_physicalV;
G4LogicalVolume* rod_phantom_logicalV;
G4VPhysicalVolume* rod_phantom_physicalV;
G4LogicalVolume* rod_phantom_logicalV;
G4VPhysicalVolume* rod_phantom_physicalV;
G4LogicalVolume* chamberPMMA_logicalV;
G4VPhysicalVolume* chamberPMMA_physicalV;
G4LogicalVolume* chamberPMMA_logicalV;
G4VPhysicalVolume* chamberPMMA_physicalV;
//
G4LogicalVolume* chamberWater_logicalV;
G4VPhysicalVolume* chamberWater_physicalV;
//
G4LogicalVolume* chamberWater_logicalV;
G4VPhysicalVolume* chamberWater_physicalV;
//
G4LogicalVolume* chamberAir_logicalV;
G4VPhysicalVolume* chamberAir_physicalV;
//
G4LogicalVolume* chamberAir_logicalV;
G4VPhysicalVolume* chamberAir_physicalV;
//Dimension of the sphere
G4double spherePositionX, spherePositionY; // spherePositionZ;
G4double sphereDiameter;
G4double distanceFromCenter;
G4int numberOfSpheres;
G4double sphereWallThickness;
G4double zOffsetSpherePhantom;
//Dimension of the sphere
G4double spherePositionX, spherePositionY; //, spherePositionZ;
G4double sphereDiameter;
G4double distanceFromCenter;
G4int numberOfSpheres;
G4double sphereWallThickness;
G4double zOffsetSpherePhantom;
G4String PhantomType;
G4String PhantomType;
//materials
G4Material* air;
G4Material* pmma;
G4Material* water;
G4Material* polyethylene;
G4Material* polyethylene_NEMA;
// G4Material* inflatedLung;
G4Material* polystyrene;
G4Material* Aluminum;
//materials
G4Material* air;
G4Material* pmma;
G4Material* water;
G4Material* polyethylene;
G4Material* polyethylene_NEMA;
//G4Material* inflatedLung;
G4Material* polystyrene;
G4Material* Aluminum;
//elements for GSO
G4Element* O;
G4Element* Si;
G4Element* Gd;
G4Material* GSO;
//elements for GSO
G4Element* O;
G4Element* Si;
G4Element* Gd;
G4Material* GSO;
G4Material* crystalMaterial;
//G4Material* phantomMaterial;
G4Material* crystalMaterial;
//G4Material* phantomMaterial;
G4bool fCheckOverlaps;
G4bool isotopes;
G4bool fCheckOverlaps;
G4bool isotopes;
//size of world
G4double worldSizeX;
G4double worldSizeY;
G4double worldSizeZ;
//size of world
G4double worldSizeX;
G4double worldSizeY;
G4double worldSizeZ;
//The following is moved to doiPETGlobalParameters.hh
//G4int numberOfCrystal_DOI;
//G4int numberOfCrystal_tangential;
//G4int numberOfCrystal_axial;
//The following is moved to doiPETGlobalParameters.hh
//G4int numberOfCrystal_DOI;
//G4int numberOfCrystal_tangential;
//G4int numberOfCrystal_axial;
////
//G4double sizeOfCrystal_DOI;
//G4double sizeOfCrystal_tangential;
//G4double sizeOfCrystal_axial;
////
//G4double sizeOfCrystal_DOI;
//G4double sizeOfCrystal_tangential;
//G4double sizeOfCrystal_axial;
////
//G4double crystalGap_DOI;
//G4double crystalGap_tangential;
//G4double crystalGap_axial;
////
//G4double crystalGap_DOI;
//G4double crystalGap_tangential;
//G4double crystalGap_axial;
G4double sizeOfAirBox_DOI;
G4double sizeOfAirBox_axial;
G4double sizeOfAirBox_tangential;
G4double sizeOfAirBox_DOI;
G4double sizeOfAirBox_axial;
G4double sizeOfAirBox_tangential;
G4double sizeOfBlockDetector_DOI;
G4double sizeOfBlockDetector_axial;
G4double sizeOfBlockDetector_tangential;
G4double sizeOfBlockDetector_DOI;
G4double sizeOfBlockDetector_axial;
G4double sizeOfBlockDetector_tangential;
//G4double AluminumCoverThickness;
//G4double AluminumCoverThickness;
//G4int numberOfPETDetector;
//G4int numberOfRings;
//G4int numberOfPETDetector;
//G4int numberOfRings;
//G4double scannerRadius;
G4double thetaDetector; //The azimuthal angle for arranging the detector in the PET ring
//G4double ringGap;
G4int blockIndex;
// G4int AlCase_Index;
G4int crystalIndex;
//G4double scannerRadius;
G4double thetaDetector; //The azimuthal angle for arranging the detector in the PET ring
//G4double ringGap;
G4int blockIndex;
//G4int AlCase_Index;
G4int crystalIndex;
//detector position
G4double detectorPositionX;
G4double detectorPositionY;
G4double detectorPositionZ;
//detector position
G4double detectorPositionX;
G4double detectorPositionY;
G4double detectorPositionZ;
//crystal position
G4double crystalPositionX;
G4double crystalPositionY;
G4double crystalPositionZ;
//crystal position
G4double crystalPositionX;
G4double crystalPositionY;
G4double crystalPositionZ;
G4ThreeVector phantomPosition;
G4ThreeVector phantomPosition;
//
G4double phantomRadius;
G4double phantomLength;
//
G4double phantomRadius;
G4double phantomLength;
//Phantom dimension for rectangular box (placed for therapy study)
// G4double phantomSizeX, phantomSizeY, phantomSizeZ;
//Phantom dimension for rectangular box (placed for therapy study)
//G4double phantomSizeX, phantomSizeY, phantomSizeZ;
//the following is to make the body phantom
G4double yOffsetBodyPhantom;
G4double zOffsetBodyPhantom;
G4double lengthOfBodyPhantom; //Interior length ( = 180m mm) + wallthickness (= 3mm)
G4double radiusOfBodyPhantom;
G4double wallThicknessOfBodyPhantom;
G4double radiusOfLungPhantom;
//the following is to make the body phantom
G4double yOffsetBodyPhantom;
G4double zOffsetBodyPhantom;
G4double lengthOfBodyPhantom; //Interior length ( = 180m mm) + wallthickness (= 3mm)
G4double radiusOfBodyPhantom;
G4double wallThicknessOfBodyPhantom;
G4double radiusOfLungPhantom;
//Test phantom defnition. The phantom has the same as that that of NECR phantom except
G4double hieghtOfTestPhantom;
G4double diameterOfTestPhantom;
//Test phantom defnition. The phantom has the same as that that of NECR phantom except
G4double hieghtOfTestPhantom;
G4double diameterOfTestPhantom;
//To the cylindrical phantom to make the body phantom
G4double radiusOfSmallcyl;
G4double boxWidth;
G4double boxHeight;
//To the cylindrical phantom to make the body phantom
G4double radiusOfSmallcyl;
G4double boxWidth;
G4double boxHeight;
//Image quality phantom for small animals
G4double waterPhantomRadius;
G4double waterPhantomLength;
//Image quality phantom for small animals
G4double waterPhantomRadius;
G4double waterPhantomLength;
G4double rodPhantomLength;
G4double rodDiameter;
G4int numberOfRods;
G4double rodPhantomLength;
G4double rodDiameter;
G4int numberOfRods;
//Declare position for the rod phantoms
G4double rodPositionX, rodPositionY, rodPositionZ;
//Declare position for cold region chanmbers
G4double chamberPositionX, chamberPositionY, chamberPositionZ;
G4double chamberPhantomLength;
G4double chamberDiameter;
G4double wallThicknessOfChamber;
//Declare position for the rod phantoms
G4double rodPositionX, rodPositionY, rodPositionZ;
//Declare position for cold region chanmbers
G4double chamberPositionX, chamberPositionY, chamberPositionZ;
G4double chamberPhantomLength;
G4double chamberDiameter;
G4double wallThicknessOfChamber;
//Declare the number of concentric (Al) sleeves
G4int numOfSleeves;
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -75,6 +75,7 @@ private:
G4UIcmdWith3VectorAndUnit *changeThePhantomPositionCmd;
G4UIcmdWithADoubleAndUnit* changePhantomRadiusCmd;
G4UIcmdWithADoubleAndUnit* changePhantomLengthCmd;
G4UIcmdWithAnInteger* changeNumOfSleevesCmd;
};
#endif
@@ -51,15 +51,15 @@
class doiPETEventAction : public G4UserEventAction
{
public:
doiPETEventAction();
virtual ~doiPETEventAction();
doiPETEventAction();
virtual ~doiPETEventAction();
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
private:
// G4int eventID;
G4int printModulo;
//G4int eventID;
G4int printModulo;
};
#endif
+11 -6
View File
@@ -26,6 +26,7 @@
/// \file electromagnetic/TestEm11/include/doiPETRun.hh
/// \brief Definition of the doiPETRun class
//
// $Id: doiPETRun.hh 71375 2013-06-14 07:39:33Z maire $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -66,24 +67,28 @@ public:
void SetAnnihilationTime(G4double);
void SetEventID(G4int);
virtual void Merge(const G4Run*);
// void EndOfRun();
G4ThreeVector CenterOfMassInteractionPos(const std::vector<G4int>&, const std::vector<G4double>&, G4double, const std::vector<G4ThreeVector>&);
//void EndOfRun();
private:
std::multimap< G4int, InteractionInformation* > mapBlockInteraction;
std::set<G4int> setBlockInteraction;
std::ofstream ofs;
std::vector<G4int> crystalID_vec;
std::vector<G4ThreeVector> posInter_vec;
std::vector<G4double>edepInCry_vec;
//center of mass interaction of position
G4ThreeVector posInterInCrystal;
G4int eventID;
doiPETRunAction* fRunAction;
doiPETAnalysis* fAnalysis;
G4double totalEdep;
G4int blockID, crystalID;
//
G4double activityNow;
G4double InitialActivity;
G4double halfLife;
G4double totalTime;
G4double prev_totalTime;
G4double timeInterval;
@@ -43,6 +43,7 @@
#include "G4UserRunAction.hh"
#include "globals.hh"
#include "doiPETAnalysis.hh"
class doiPETDetectorConstruction;
class doiPETRun;
@@ -54,8 +55,13 @@ class doiPETPrimaryGeneratorAction;
class doiPETRunAction : public G4UserRunAction
{
public:
#ifdef ANALYSIS_USE
doiPETRunAction(doiPETAnalysis* analysis);
#else
doiPETRunAction();
#endif
//doiPETRunAction();
doiPETRunAction(/*doiPETDetectorConstruction*, doiPETPrimaryGeneratorAction**/);
//doiPETRunAction(/*doiPETDetectorConstruction*, doiPETPrimaryGeneratorAction**/);
virtual ~doiPETRunAction();
virtual G4Run* GenerateRun();
@@ -63,8 +69,10 @@ public:
virtual void EndOfRunAction(const G4Run*);
private:
doiPETRun* fRun;
//HistoManager* fHistoManager;
doiPETRun* fRun;
#ifdef ANALYSIS_USE
doiPETAnalysis* analysisMan;
#endif
};
#endif