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
1 change: 1 addition & 0 deletions inc/InfoMCStructHelper.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ namespace mu2e {
void fillStepPointMCInfo(StepPointMCCollection const& mcsteps, MCStepInfos& mcstepinfos);
void fillSimInfo(const art::Ptr<SimParticle>& sp, SimInfo& siminfo);
void fillSimInfo(const SimParticle& sp, SimInfo& siminfo);
void fillSimInfoEnd(const SimParticle& sp, SimInfo& siminfo);
};
}

Expand Down
15 changes: 15 additions & 0 deletions src/InfoMCStructHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ namespace mu2e {

SimInfo sim_info;
fillSimInfo(current_sim_particle, sim_info);
// In staged MC a particle is split into one SimParticle per stage.
// current_sim_particle is the first stage, so the start values above
// describe where the particle was created. Take the end values from
// current_sim_particle_ptr instead: the stage that made the track hits
// (generation 0) or that produced the previous generation (e.g. the
// muon at the point where it decayed), not the first stage, which may
// end at a stage boundary such as a killer volume.
fillSimInfoEnd(*current_sim_particle_ptr, sim_info);
sim_info.trkrel = MCRelationship(current_sim_particle_ptr, trkprimaryptr);
sim_info.rank = imatch;

Expand Down Expand Up @@ -292,6 +300,13 @@ namespace mu2e {
siminfo.endmom = XYZVectorF(sp.endMomentum());
}

void InfoMCStructHelper::fillSimInfoEnd(const SimParticle& sp, SimInfo& siminfo) {
GeomHandle<DetectorSystem> det;
siminfo.stopCode = sp.stoppingCode();
siminfo.endpos = XYZVectorF(det->toDetector(sp.endPosition()));
siminfo.endmom = XYZVectorF(sp.endMomentum());
}

void InfoMCStructHelper::fillVDInfo(const KalSeed& kseed, const KalSeedMC& kseedmc, std::vector<std::vector<MCStepInfo>>& all_vdinfos) {
std::vector<MCStepInfo> vdinfos;
const auto& vdsteps = kseedmc._vdsteps;
Expand Down