Skip to content

Commit

Permalink
RICH: for OneToOne relation to SimHit in MCRecoTrackerHitAssociation
Browse files Browse the repository at this point in the history
  • Loading branch information
veprbl committed Apr 24, 2024
1 parent 14bc49b commit be7dcb4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/algorithms/digi/PhotoMultiplierHitDigi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <Evaluator/DD4hepUnits.h>
#include <algorithms/logger.h>
#include <edm4eic/EDM4eicVersion.h>
#include <edm4hep/Vector3d.h>
#include <fmt/core.h>
#include <math.h>
Expand Down Expand Up @@ -168,11 +169,16 @@ void PhotoMultiplierHitDigi::process(

// build `MCRecoTrackerHitAssociation` (for non-noise hits only)
if(!data.sim_hit_indices.empty()) {
auto hit_assoc = hit_assocs->create();
hit_assoc.setWeight(1.0); // not used
hit_assoc.setRawHit(raw_hit);
for(auto i : data.sim_hit_indices)
for(auto i : data.sim_hit_indices) {
auto hit_assoc = hit_assocs->create();
hit_assoc.setWeight(1.0); // not used
hit_assoc.setRawHit(raw_hit);
#if EDM4EIC_VERSION_MAJOR >= 6
hit_assoc.setSimHit(sim_hits->at(i));
#else
hit_assoc.addToSimHits(sim_hits->at(i));
#endif
}
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/algorithms/pid/IrtCherenkovParticleID.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <TString.h>
#include <TVector3.h>
#include <edm4eic/CherenkovParticleIDHypothesis.h>
#include <edm4eic/EDM4eicVersion.h>
#include <edm4eic/TrackPoint.h>
#include <edm4hep/MCParticleCollection.h>
#include <edm4hep/SimTrackerHitCollection.h>
Expand Down Expand Up @@ -218,17 +219,22 @@ std::map<std::string, std::unique_ptr<edm4eic::CherenkovParticleIDCollection>> e
for(const auto& hit_assoc : *in_hit_assocs) {
if(hit_assoc.getRawHit().isAvailable()) {
if(hit_assoc.getRawHit().id() == raw_hit.id()) {
#if EDM4EIC_VERSION_MAJOR >= 6
mc_photon = hit_assoc.getSimHit().getMCParticle();
#else
// hit association found, get the MC photon and break the loop
// FIXME: occasionally there will be more than one photon associated with a hit;
// for now let's just take the first one...
if(hit_assoc.simHits_size() > 0) {
mc_photon = hit_assoc.getSimHits(0).getMCParticle();
#endif
mc_photon_found = true;
if(mc_photon.getPDG() != -22)
m_log->warn("non-opticalphoton hit: PDG = {}",mc_photon.getPDG());
#if EDM4EIC_VERSION_MAJOR >= 6
#else
}
else if(m_cfg.CheatModeEnabled())
m_log->error("cheat mode enabled, but no MC photons provided");
#endif
break;
}
}
Expand Down

0 comments on commit be7dcb4

Please sign in to comment.