Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSF time now double (was float). Both write (Actor) and read (Source) #205

Merged
merged 2 commits into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/digits_hits/include/GatePhaseSpaceActor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected:
float ekPost;
float ekPre;
float w;
float t;//t is either time or local time.
double t;//t is either time or local time.
G4int m;
Char_t vol[256];

Expand Down
2 changes: 1 addition & 1 deletion source/digits_hits/src/GatePhaseSpaceActor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void GatePhaseSpaceActor::Construct()
if (EnableElectronicDEDX) pListeVar->Branch("Ekpost", &ekPost, "Ekpost/F");
if (EnableElectronicDEDX) pListeVar->Branch("Ekpre", &ekPre, "Ekpre/F");
if (EnableWeight) pListeVar->Branch("Weight", &w, "Weight/F");
if (EnableTime || EnableLocalTime) pListeVar->Branch("Time", &t, "Time/F");
if (EnableTime || EnableLocalTime) pListeVar->Branch("Time", &t, "Time/D");
if (EnableMass) pListeVar->Branch("Mass", &m, "Mass/I"); // in MeV/c2
if (EnableXPosition) pListeVar->Branch("X", &x, "X/F");
if (EnableYPosition) pListeVar->Branch("Y", &y, "Y/F");
Expand Down
8 changes: 6 additions & 2 deletions source/physics/include/GateSourcePhaseSpace.hh
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,16 @@ protected:

float energy;
float x, y, z;
float dx, dy, dz, t;
float dx, dy, dz;
float ftime;
double dtime;
EDataType time_type;
float weight;

// char volumeName;
char particleName[64];
G4String mParticleTypeNameGivenByUser;
float mParticleTime ;//m_source->GetTime();
double mParticleTime ;//m_source->GetTime();
G4double mMomentum;

bool mAlreadyLoad;
Expand Down
19 changes: 14 additions & 5 deletions source/physics/src/GateSourcePhaseSpace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ GateSourcePhaseSpace::GateSourcePhaseSpace(G4String name ):GateVSource( name )
pIAEARecordType = 0;
pIAEAheader = 0;


pParticleDefinition = 0;
pParticle = 0;
pVertex = 0;
Expand All @@ -76,7 +75,9 @@ GateSourcePhaseSpace::GateSourcePhaseSpace(G4String name ):GateVSource( name )
mParticleMomentum2 = G4ThreeVector();

x = y = z = dx = dy = dz = px = py = pz = energy = 0.;
t= -1.;
dtime= -1.;
ftime= -1.;
time_type = EDataType::kOther_t;
weight = 1.;
strcpy(particleName, "");

Expand Down Expand Up @@ -137,8 +138,15 @@ void GateSourcePhaseSpace::Initialize()
if (T->GetListOfBranches()->FindObject("Weight")) {
T->SetBranchAddress("Weight",&weight);
}
if (T->GetListOfBranches()->FindObject("Time")) {
T->SetBranchAddress("Time",&t);
auto tob = T->GetListOfBranches()->FindObject("Time");
if (tob) {
auto tt = dynamic_cast<TBranch*>(tob);
TClass * expectedClass;
tt-> GetExpectedType(expectedClass, time_type);
if (time_type == EDataType::kDouble_t)
T->SetBranchAddress("Time",&dtime);
else
T->SetBranchAddress("Time",&ftime);
}

if (mRmax>0){
Expand Down Expand Up @@ -223,7 +231,8 @@ void GateSourcePhaseSpace::GenerateROOTVertex( G4Event* /*aEvent*/ )

mParticleMomentum = G4ThreeVector(px,py,pz);

if (t>0) mParticleTime = t;
if (time_type == EDataType::kDouble_t and dtime>0) mParticleTime = dtime;
if (time_type == EDataType::kFloat_t and ftime>0) mParticleTime = ftime;
}
// ----------------------------------------------------------------------------------

Expand Down