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

Fix particle hypothesis having to be positive in truth tracking. #23

Merged
merged 1 commit into from
Aug 24, 2024
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
11 changes: 10 additions & 1 deletion ACTSTracking/Helpers.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,16 @@ EVENT::TrackState* ACTS2Marlin_trackState(int location,
EVENT::LCCollection* getCollection(EVENT::LCEvent* evt,
const std::string& name);

Acts::ParticleHypothesis convertParticle(const EVENT::MCParticle* mcParticle);
//! Get particle hypothesis for a given MCParticle object
/**
* The particle hypothesis is determined by the PDG code of the MCParticle. The
* absolute value is taken, as this is a requirement from ACTS.
*
* \param mcParticle MCParticle object for which to determine a hypothesis
*
* \return The ACTS particle hypothesis
*/
Acts::ParticleHypothesis getParticleHypothesis(const EVENT::MCParticle* mcParticle);

} // namespace ACTSTracking

2 changes: 1 addition & 1 deletion src/ACTSTruthCKFTrackingProc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void ACTSTruthCKFTrackingProc::processEvent(LCEvent* evt) {
std::pow(_initialTrackError_relP * p / (p * p), 2);

Acts::BoundTrackParameters seed(perigeeSurface, params, cov,
ACTSTracking::convertParticle(mcParticle));
ACTSTracking::getParticleHypothesis(mcParticle));
seeds.push_back(seed);
}

Expand Down
2 changes: 1 addition & 1 deletion src/ACTSTruthTrackingProc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ void ACTSTruthTrackingProc::processEvent(LCEvent* evt) {
Acts::Vector3(mcParticle->getVertex()));

Acts::BoundTrackParameters initialparams(perigeeSurface, params,
cov, ACTSTracking::convertParticle(mcParticle));
cov, ACTSTracking::getParticleHypothesis(mcParticle));
// reference Examples TruthTracking/ParticleSmearing.cpp
streamlog_out(DEBUG) << "Initial Paramemeters" << std::endl
<< initialparams << std::endl;
Expand Down
16 changes: 2 additions & 14 deletions src/Helpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -502,37 +502,25 @@ EVENT::LCCollection* getCollection(EVENT::LCEvent* evt,
}
}

Acts::ParticleHypothesis convertParticle(const EVENT::MCParticle* mcParticle)
Acts::ParticleHypothesis getParticleHypothesis(const EVENT::MCParticle* mcParticle)
{
switch (mcParticle->getPDG()) {
switch (std::abs(mcParticle->getPDG())) {
case 11:
return Acts::ParticleHypothesis {Acts::PdgParticle::eElectron};
case -11:
return Acts::ParticleHypothesis {Acts::PdgParticle::ePositron};
case 13:
return Acts::ParticleHypothesis {Acts::PdgParticle::eMuon};
case -13:
return Acts::ParticleHypothesis {Acts::PdgParticle::eAntiMuon};
case 15:
return Acts::ParticleHypothesis {Acts::PdgParticle::eTau};
case -15:
return Acts::ParticleHypothesis {Acts::PdgParticle::eAntiTau};
case 22:
return Acts::ParticleHypothesis {Acts::PdgParticle::eGamma};
case 111:
return Acts::ParticleHypothesis {Acts::PdgParticle::ePionZero};
case 211:
return Acts::ParticleHypothesis {Acts::PdgParticle::ePionPlus};
case -211:
return Acts::ParticleHypothesis {Acts::PdgParticle::ePionMinus};
case 2112:
return Acts::ParticleHypothesis {Acts::PdgParticle::eNeutron};
case -2112:
return Acts::ParticleHypothesis {Acts::PdgParticle::eAntiNeutron};
case 2212:
return Acts::ParticleHypothesis {Acts::PdgParticle::eProton};
case -2212:
return Acts::ParticleHypothesis {Acts::PdgParticle::eAntiProton};
}

Acts::PdgParticle pdg = Acts::PdgParticle::eInvalid;
Expand Down
Loading