Skip to content
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
129 changes: 64 additions & 65 deletions src/programs/Simulation/gen_primex_eta_he4/HddmOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ class HddmOut {

Particle_t targetType;
Particle_t beamType;

public:
HddmOut(string filename) {
cout << "opening HDDM file: " << filename << endl;
ostream = init_s_HDDM((char*)filename.c_str());
targetType = Helium;
beamType = Gamma;
}

~HddmOut() {
close_s_HDDM(ostream);
}

void init(int runNo) {
//This sets the run number and event characteristics
//The HDDM entry has one event, which has one reaction
Expand Down Expand Up @@ -98,17 +98,16 @@ class HddmOut {
beam->properties->charge = ParticleCharge(beamType);
beam->properties->mass = ParticleMass(beamType);
beam->momentum = make_s_Momentum();

}

void write(tmpEvt_t evt, int runNum, int eventNum) {
init(runNum);
phyEvt->in[0].eventNo = eventNum;
reaction->vertices = vertices = make_s_Vertices(1);
vertices->mult = 1;
vertices->in[0].origin = origin = make_s_Origin();
vertices->in[0].products = products = make_s_Products(evt.nGen);

origin->t = 0.0;
origin->vx = 0.0;
origin->vy = 0.0;
Expand All @@ -117,20 +116,20 @@ class HddmOut {
target->type = evt.t_targ;
target->properties->charge = ParticleCharge(evt.t_targ);
target->properties->mass = ParticleMass(evt.t_targ);

target->momentum->px = evt.target.Px();
target->momentum->py = evt.target.Py();
target->momentum->pz = evt.target.Pz();
target->momentum->E = evt.target.E();

beam->momentum->px = evt.beam.Px();
beam->momentum->py = evt.beam.Py();
beam->momentum->pz = evt.beam.Pz();
beam->momentum->E = evt.beam.E();
//cout <<"beam energy " << evt.beam.E() << " nGen " << evt.nGen << " str_meson " << evt.str_meson << endl;
products->mult = evt.nGen;
reaction->weight = evt.weight;

if (evt.nGen == 2) {
products->in[0].type = evt.t_meso;
products->in[0].pdgtype = PDGtype(evt.t_meso);
Expand All @@ -147,22 +146,22 @@ class HddmOut {
products->in[0].momentum->py = py;
products->in[0].momentum->pz = pz;
products->in[0].momentum->E = E;

products->in[1].pdgtype = PDGtype(evt.t_targ);
if (evt.str_target == "Deuteron") {
products->in[1].pdgtype = 1000010020;
products->in[1].pdgtype = 1000010020;
} else if (evt.str_target == "H3" || evt.str_target == "Triton") {
products->in[1].pdgtype = 1000010030;
products->in[1].pdgtype = 1000010030;
} else if (evt.str_target == "He3" || evt.str_target == "Helium-3") {
products->in[1].pdgtype = 1000020030;
products->in[1].pdgtype = 1000020030;
} else if (evt.str_target == "He4" || evt.str_target == "Helium") {
products->in[1].pdgtype = 1000020040;
products->in[1].pdgtype = 1000020040;
} else if (evt.str_target == "Be9" || evt.str_target == "Beryllium-9") {
products->in[1].pdgtype = 1000040090;
products->in[1].pdgtype = 1000040090;
} else if (evt.str_target == "Proton") {
products->in[1].pdgtype = 2212;
products->in[1].pdgtype = 2212;
} else if (evt.str_target == "Neutron") {
products->in[1].pdgtype = 2112;
products->in[1].pdgtype = 2112;
}
products->in[1].type = evt.t_targ;
products->in[1].id = 2;
Expand Down Expand Up @@ -211,22 +210,22 @@ class HddmOut {
products->in[1].momentum->py = py;
products->in[1].momentum->pz = pz;
products->in[1].momentum->E = E;

products->in[2].pdgtype = PDGtype(evt.t_targ);
if (evt.str_target == "Deuteron") {
products->in[2].pdgtype = 1000010020;
products->in[2].pdgtype = 1000010020;
} else if (evt.str_target == "H3" || evt.str_target == "Triton") {
products->in[2].pdgtype = 1000010030;
products->in[2].pdgtype = 1000010030;
} else if (evt.str_target == "He3" || evt.str_target == "Helium-3") {
products->in[2].pdgtype = 1000020030;
products->in[2].pdgtype = 1000020030;
} else if (evt.str_target == "He4" || evt.str_target == "Helium") {
products->in[2].pdgtype = 1000020040;
products->in[2].pdgtype = 1000020040;
} else if (evt.str_target == "Be9" || evt.str_target == "Beryllium-9") {
products->in[2].pdgtype = 1000040090;
products->in[2].pdgtype = 1000040090;
} else if (evt.str_target == "Proton") {
products->in[2].pdgtype = 2212;
products->in[2].pdgtype = 2212;
} else if (evt.str_target == "Neutron") {
products->in[2].pdgtype = 2112;
products->in[2].pdgtype = 2112;
}
products->in[2].type = evt.t_targ;
products->in[2].id = 3;
Expand Down Expand Up @@ -258,26 +257,26 @@ class HddmOut {
products->in[0].momentum->py = py;
products->in[0].momentum->pz = pz;
products->in[0].momentum->E = E;

products->in[1].pdgtype = PDGtype(evt.t_part);
if (evt.str_participant == "Deuteron") {
products->in[1].pdgtype = 1000010020;
products->in[1].pdgtype = 1000010020;
} else if (evt.str_participant == "H3" || evt.str_participant == "Triton") {
products->in[1].pdgtype = 1000010030;
products->in[1].pdgtype = 1000010030;
} else if (evt.str_participant == "He3" || evt.str_participant == "Helium-3") {
products->in[1].pdgtype = 1000020030;
products->in[1].pdgtype = 1000020030;
} else if (evt.str_participant == "He4" || evt.str_participant == "Helium") {
products->in[1].pdgtype = 1000020040;
products->in[1].pdgtype = 1000020040;
} else if (evt.str_participant == "B11" || evt.str_participant == "Boron-11") {
products->in[1].pdgtype = 1000050110;
products->in[1].pdgtype = 1000050110;
} else if (evt.str_participant == "C12" || evt.str_participant == "Carbon") {
products->in[1].pdgtype = 1000060120;
products->in[1].pdgtype = 1000060120;
} else if (evt.str_participant == "Be9" || evt.str_participant == "Beryllium-9") {
products->in[1].pdgtype = 1000040090;
products->in[1].pdgtype = 1000040090;
} else if (evt.str_participant == "Proton") {
products->in[1].pdgtype = 2212;
products->in[1].pdgtype = 2212;
} else if (evt.str_participant == "Neutron") {
products->in[1].pdgtype = 2112;
products->in[1].pdgtype = 2112;
}
products->in[1].type = evt.t_part;
//cout << PDGtype(evt.t_targ) << endl;
Expand All @@ -294,27 +293,27 @@ class HddmOut {
products->in[1].momentum->py = py;
products->in[1].momentum->pz = pz;
products->in[1].momentum->E = E;

//if (evt.str_spectator != "Neutron") {
products->in[2].pdgtype = PDGtype(evt.t_spec);
if (evt.str_spectator == "Deuteron") {
products->in[2].pdgtype = 1000010020;
products->in[2].pdgtype = 1000010020;
} else if (evt.str_spectator == "H3" || evt.str_spectator == "Triton") {
products->in[2].pdgtype = 1000010030;
products->in[2].pdgtype = 1000010030;
} else if (evt.str_spectator == "He3" || evt.str_spectator == "Helium-3") {
products->in[2].pdgtype = 1000020030;
products->in[2].pdgtype = 1000020030;
} else if (evt.str_spectator == "He4" || evt.str_spectator == "Helium") {
products->in[2].pdgtype = 1000020040;
products->in[2].pdgtype = 1000020040;
} else if (evt.str_spectator == "B11" || evt.str_spectator == "Boron-11") {
products->in[2].pdgtype = 1000050110;
products->in[2].pdgtype = 1000050110;
} else if (evt.str_spectator == "C12" || evt.str_spectator == "Carbon") {
products->in[2].pdgtype = 1000060120;
products->in[2].pdgtype = 1000060120;
} else if (evt.str_spectator == "Be9" || evt.str_spectator == "Beryllium-9") {
products->in[2].pdgtype = 1000040090;
products->in[2].pdgtype = 1000040090;
} else if (evt.str_spectator == "Proton") {
products->in[2].pdgtype = 2212;
products->in[2].pdgtype = 2212;
} else if (evt.str_spectator == "Neutron") {
products->in[2].pdgtype = 2112;
products->in[2].pdgtype = 2112;
}
products->in[2].type = evt.t_spec;
products->in[2].id = 3;
Expand Down Expand Up @@ -363,26 +362,26 @@ class HddmOut {
products->in[1].momentum->py = py;
products->in[1].momentum->pz = pz;
products->in[1].momentum->E = E;

products->in[2].pdgtype = PDGtype(evt.t_part);
if (evt.str_participant == "Deuteron") {
products->in[2].pdgtype = 1000010020;
products->in[2].pdgtype = 1000010020;
} else if (evt.str_participant == "H3" || evt.str_participant == "Triton") {
products->in[2].pdgtype = 1000010030;
products->in[2].pdgtype = 1000010030;
} else if (evt.str_participant == "He3" || evt.str_participant == "Helium-3") {
products->in[2].pdgtype = 1000020030;
products->in[2].pdgtype = 1000020030;
} else if (evt.str_participant == "He4" || evt.str_participant == "Helium") {
products->in[2].pdgtype = 1000020040;
products->in[2].pdgtype = 1000020040;
} else if (evt.str_participant == "B11" || evt.str_participant == "Boron-11") {
products->in[2].pdgtype = 1000050110;
products->in[2].pdgtype = 1000050110;
} else if (evt.str_participant == "C12" || evt.str_participant == "Carbon") {
products->in[2].pdgtype = 1000060120;
products->in[2].pdgtype = 1000060120;
} else if (evt.str_participant == "Be9" || evt.str_participant == "Beryllium-9") {
products->in[2].pdgtype = 1000040090;
products->in[2].pdgtype = 1000040090;
} else if (evt.str_participant == "Proton") {
products->in[2].pdgtype = 2212;
products->in[2].pdgtype = 2212;
} else if (evt.str_participant == "Neutron") {
products->in[2].pdgtype = 2112;
products->in[2].pdgtype = 2112;
}
products->in[2].type = evt.t_part;
//cout << PDGtype(evt.t_targ) << endl;
Expand All @@ -399,27 +398,27 @@ class HddmOut {
products->in[2].momentum->py = py;
products->in[2].momentum->pz = pz;
products->in[2].momentum->E = E;

//if (evt.str_spectator != "Neutron") {
products->in[3].pdgtype = PDGtype(evt.t_spec);
if (evt.str_spectator == "Deuteron") {
products->in[3].pdgtype = 1000010020;
products->in[3].pdgtype = 1000010020;
} else if (evt.str_spectator == "H3" || evt.str_spectator == "Triton") {
products->in[3].pdgtype = 1000010030;
products->in[3].pdgtype = 1000010030;
} else if (evt.str_spectator == "He3" || evt.str_spectator == "Helium-3") {
products->in[3].pdgtype = 1000020030;
products->in[3].pdgtype = 1000020030;
} else if (evt.str_spectator == "He4" || evt.str_spectator == "Helium") {
products->in[3].pdgtype = 1000020040;
products->in[3].pdgtype = 1000020040;
} else if (evt.str_spectator == "B11" || evt.str_spectator == "Boron-11") {
products->in[3].pdgtype = 1000050110;
products->in[3].pdgtype = 1000050110;
} else if (evt.str_spectator == "C12" || evt.str_spectator == "Carbon") {
products->in[3].pdgtype = 1000060120;
products->in[3].pdgtype = 1000060120;
} else if (evt.str_spectator == "Be9" || evt.str_spectator == "Beryllium-9") {
products->in[3].pdgtype = 1000040090;
products->in[3].pdgtype = 1000040090;
} else if (evt.str_spectator == "Proton") {
products->in[3].pdgtype = 2212;
products->in[3].pdgtype = 2212;
} else if (evt.str_spectator == "Neutron") {
products->in[3].pdgtype = 2112;
products->in[3].pdgtype = 2112;
}
products->in[3].type = evt.t_spec;
products->in[3].id = 4;
Expand Down
Loading