Dear Geant4 experts, I wonder the reason of error with my global time setting.
I want to calculate the time of flight by subtracting the global time of each reaction in two different sensitive detector by shooting a neutron generated from spontaneous Cf-252 source. (Especially, between Li6 (n, a) t Reaction in GS20 detector and neutron in Liquid scintillation detector)
To get the global time information, I used the code as shown below.
#include "detector.hh"
SensitiveDetector::SensitiveDetector(G4String name) : G4VSensitiveDetector(name)
{}
SensitiveDetector::~SensitiveDetector()
{}
G4bool SensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory* ROhist)
{
G4Track* track = step->GetTrack();
G4StepPoint* Step = step->GetPreStepPoint();
G4double startingReactionTimeofLSD = 0.0;
G4double startingReactionTimeofGS20 = 0.0;
G4String detectorName = GetName();
G4AnalysisManager* man = G4AnalysisManager::Instance();
if (track->GetParentID() == 0) {
startingReactionTimeofLSD = 0.0;
startingReactionTimeofGS20 = 0.0;
}
G4int ParentID = track->GetParentID();
G4int TrackID = track->GetTrackID();
const G4Event* event = G4RunManager::GetRunManager()->GetCurrentEvent();
G4int EventID = event->GetEventID();
G4double KineticE = 0.0;
KineticE = track->GetKineticEnergy();
G4Material* material = track->GetMaterial();
G4String materialName = material->GetName();
G4Material* Nextmaterial = track->GetNextMaterial();
G4String NextMaterialName = Nextmaterial->GetName();
G4LogicalVolume* volume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume();
G4String volumeName = volume->GetName();
G4double DepositedEnergyinLSD = 0.0;
G4double DepositedEnergyinGS20 = 0.0;
G4String processName = "Unknown";
if (step->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) {
processName = step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
}
const G4ParticleDefinition* particleDefinition = track->GetParticleDefinition();
G4String particleName = particleDefinition->GetParticleName();
if (particleName == "neutron" || particleName == "triton" || particleName == "alpha" || particleName == "gamma")
{
if (detectorName == "LSDSensitiveDetector")
{
startingReactionTimeofLSD = Step->GetGlobalTime();
DepositedEnergyinLSD = step->GetTotalEnergyDeposit();
}
else if (detectorName == "GS20SensitiveDetector")
{
startingReactionTimeofGS20 = Step->GetGlobalTime();
DepositedEnergyinGS20 = step->GetTotalEnergyDeposit();
}
man->FillNtupleDColumn(0, startingReactionTimeofLSD);
man->FillNtupleDColumn(1, startingReactionTimeofGS20);
man->FillNtupleDColumn(2, DepositedEnergyinLSD);
man->FillNtupleDColumn(3, DepositedEnergyinGS20);
man->FillNtupleSColumn(4, processName);
man->FillNtupleSColumn(5, particleName);
man->FillNtupleIColumn(6, ParentID);
man->FillNtupleIColumn(7, TrackID);
man->FillNtupleIColumn(8, EventID);
man->FillNtupleDColumn(9, KineticE);
man->FillNtupleSColumn(10, volumeName);
man->FillNtupleSColumn(11, materialName);
man->FillNtupleSColumn(12, NextMaterialName);
man->AddNtupleRow(0);
}
return true;
}
Nevertheless, according to the simulation results, the measured global times that have same Event ID possess the same global time as can be seen below example.
ReactionGloablTimeinLS | ReactionGloablTimeinGS20 | DepositedEinLSD | DepositedEinGS20 | Physical Reaction | ParticleName | Parent ID | Track ID | Event ID | Kinetic Energy | Volume Name | Material | NextMaterial |
---|---|---|---|---|---|---|---|---|---|---|---|---|
10031400000000000.00 | 0.00 | 0 | 0 | Transportation | gamma | 1 | 14 | 57 | 0.41666 | LSDSensitiveDetector | G4_XYLENE | Al |
0.00 | 10031400000000000.00 | 0 | 0 | Transportation | gamma | 1 | 14 | 57 | 0.41666 | GS20SensitiveDetector | ENRICHEDLi | Atomsphere |
36930600000000000.00 | 0.00 | 0.00107394 | 0 | hadElastic | neutron | 1 | 10 | 115 | 0.000455835 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 9.74E-05 | 0 | hadElastic | neutron | 1 | 10 | 115 | 0.000358576 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 9.65E-05 | 0 | hadElastic | neutron | 1 | 10 | 115 | 0.000262196 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 0.000219244 | 0 | hadElastic | neutron | 1 | 10 | 115 | 4.31E-05 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 4.23E-05 | 0 | hadElastic | neutron | 1 | 10 | 115 | 8.73E-07 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 5.95E-07 | 0 | hadElastic | neutron | 1 | 10 | 115 | 2.96E-07 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 2.92E-07 | 0 | hadElastic | neutron | 1 | 10 | 115 | 1.02E-07 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 5.58E-08 | 0 | hadElastic | neutron | 1 | 10 | 115 | 9.14E-08 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 9.12E-08 | 0 | hadElastic | neutron | 1 | 10 | 115 | 1.42E-08 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 1.71E-08 | 0 | hadElastic | neutron | 1 | 10 | 115 | 1.12E-08 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 0 | 0 | nCapture | neutron | 1 | 10 | 115 | 0 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
36930600000000000.00 | 0.00 | 0 | 0 | Transportation | gamma | 10 | 15 | 115 | 2.22439 | LSDSensitiveDetector | G4_XYLENE | Al |
0.00 | 36930600000000000.00 | 0 | 0 | Transportation | gamma | 10 | 15 | 115 | 2.22439 | GS20SensitiveDetector | ENRICHEDLi | Atomsphere |
36930600000000000.00 | 0.00 | 0 | 0 | Transportation | gamma | 1 | 2 | 115 | 0.608227 | LSDSensitiveDetector | G4_XYLENE | Al |
0.00 | 36930600000000000.00 | 0 | 0 | Transportation | gamma | 1 | 2 | 115 | 0.608227 | GS20SensitiveDetector | ENRICHEDLi | Atomsphere |
0.00 | 77319900000000000.00 | 0 | 0 | Transportation | gamma | 1 | 13 | 205 | 0.261372 | GS20SensitiveDetector | ENRICHEDLi | Atomsphere |
77319900000000000.00 | 0.00 | 0 | 0 | Transportation | gamma | 1 | 12 | 205 | 0.452845 | LSDSensitiveDetector | G4_XYLENE | Al |
0.00 | 77319900000000000.00 | 0 | 0 | compt | gamma | 1 | 12 | 205 | 0.216071 | GS20SensitiveDetector | ENRICHEDLi | ENRICHEDLi |
0.00 | 77319900000000000.00 | 0 | 0 | Transportation | gamma | 1 | 12 | 205 | 0.216071 | GS20SensitiveDetector | ENRICHEDLi | Atomsphere |
77319900000000000.00 | 0.00 | 0 | 0 | Transportation | gamma | 1 | 6 | 205 | 1.05561 | LSDSensitiveDetector | G4_XYLENE | Al |
0.00 | 77319900000000000.00 | 0 | 0 | Transportation | gamma | 1 | 6 | 205 | 1.05561 | GS20SensitiveDetector | ENRICHEDLi | Atomsphere |
77319900000000000.00 | 0.00 | 0 | 0 | Transportation | gamma | 1 | 2 | 205 | 0.672663 | LSDSensitiveDetector | G4_XYLENE | Al |
0.00 | 77319900000000000.00 | 0 | 0 | Transportation | gamma | 1 | 2 | 205 | 0.672663 | GS20SensitiveDetector | ENRICHEDLi | Atomsphere |
707391000000000000.00 | 0.00 | 0 | 0 | Transportation | neutron | 1 | 12 | 252 | 4.42679 | LSDSensitiveDetector | G4_XYLENE | Al |
0.00 | 707391000000000000.00 | 0 | 0 | Transportation | neutron | 1 | 12 | 252 | 4.42679 | GS20SensitiveDetector | ENRICHEDLi | Atomsphere |
10713400000000000.00 | 0.00 | 0 | 0 | Transportation | gamma | 1 | 8 | 260 | 1.28398 | LSDSensitiveDetector | G4_XYLENE | Al |
0.00 | 10713400000000000.00 | 0 | 0 | Transportation | gamma | 1 | 6 | 260 | 0.213953 | GS20SensitiveDetector | ENRICHEDLi | Atomsphere |
62066000000000000.00 | 0.00 | 1.26E-08 | 0 | hadElastic | neutron | 1 | 11 | 289 | 5.77E-08 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
62066000000000000.00 | 0.00 | 3.89E-08 | 0 | hadElastic | neutron | 1 | 11 | 289 | 3.05E-08 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
62066000000000000.00 | 0.00 | 0 | 0 | Transportation | neutron | 1 | 11 | 289 | 3.05E-08 | LSDSensitiveDetector | G4_XYLENE | Al |
62066000000000000.00 | 0.00 | 0 | 0 | compt | gamma | 1 | 7 | 289 | 0.601535 | LSDSensitiveDetector | G4_XYLENE | G4_XYLENE |
62066000000000000.00 | 0.00 | 0 | 0 | Transportation | gamma | 1 | 7 | 289 | 0.601535 | LSDSensitiveDetector | G4_XYLENE | Al |
0.00 | 52441400000000000.00 | 0 | 0 | Transportation | gamma | 1 | 6 | 319 | 0.599478 | GS20SensitiveDetector | ENRICHEDLi | Atomsphere |
Could you let me know the way to solve this problem?
Always thanks to all of Geant4 experts.