Skip to content

Commit

Permalink
* add properties (mass and charge) saved to hddm reaction output elem…
Browse files Browse the repository at this point in the history
…ent [rtj]
  • Loading branch information
rjones30 committed Dec 14, 2022
1 parent af8dcce commit 9aaa575
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/GlueXUserEventInformation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ void GlueXUserEventInformation::AddBeamParticle(int geanttype, double t0,
double mass = GlueXPrimaryGeneratorAction::GetMass(geanttype);
double E = sqrt(mass*mass + mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2]);
pmo(0).setE(E/GeV);
hddm_s::PropertiesList pro = beam(0).addPropertiesList();
int pdg = GlueXPrimaryGeneratorAction::ConvertGeant3ToPdg(geanttype);
G4ParticleDefinition *g4type = GlueXPrimaryGeneratorAction::GetParticle(pdg);
pro(0).setCharge(g4type->GetPDGCharge());
pro(0).setMass(mass);
}

void GlueXUserEventInformation::AddBeamParticle(int geanttype, double t0,
Expand All @@ -179,15 +184,20 @@ void GlueXUserEventInformation::AddTargetParticle(int geanttype, double t0,
if (rea.size() == 0) {
rea = pev(0).addReactions();
}
hddm_s::TargetList beam = rea(0).addTargets();
beam(0).setType((Particle_t)geanttype);
hddm_s::MomentumList pmo = beam(0).addMomenta();
hddm_s::TargetList targ = rea(0).addTargets();
targ(0).setType((Particle_t)geanttype);
hddm_s::MomentumList pmo = targ(0).addMomenta();
pmo(0).setPx(mom[0]/GeV);
pmo(0).setPy(mom[1]/GeV);
pmo(0).setPz(mom[2]/GeV);
double mass = GlueXPrimaryGeneratorAction::GetMass(geanttype);
double E = sqrt(mass*mass + mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2]);
pmo(0).setE(E/GeV);
hddm_s::PropertiesList pro = targ(0).addPropertiesList();
int pdg = GlueXPrimaryGeneratorAction::ConvertGeant3ToPdg(geanttype);
G4ParticleDefinition *g4type = GlueXPrimaryGeneratorAction::GetParticle(pdg);
pro(0).setCharge(g4type->GetPDGCharge());
pro(0).setMass(mass);
}

void GlueXUserEventInformation::AddTargetParticle(int geanttype, double t0,
Expand All @@ -196,8 +206,8 @@ void GlueXUserEventInformation::AddTargetParticle(int geanttype, double t0,
const G4ThreeVector &pol)
{
AddTargetParticle(geanttype, t0, pos, mom);
hddm_s::TargetList beam = fOutputRecord->getTargets();
hddm_s::PolarizationList polar = beam(0).addPolarizations();
hddm_s::TargetList targ = fOutputRecord->getTargets();
hddm_s::PolarizationList polar = targ(0).addPolarizations();
polar(0).setPx(pol[0]);
polar(0).setPy(pol[1]);
polar(0).setPz(pol[2]);
Expand Down

0 comments on commit 9aaa575

Please sign in to comment.