59 std::map<int, const simb::MCParticle*> trueParticles =
61 std::map<int, std::vector<int>> showersMothers =
65 auto const pfpHandle = Event.getValidHandle<std::vector<recob::PFParticle>>(
fPFParticleLabel);
68 auto const clusHandle = Event.getValidHandle<std::vector<recob::Cluster>>(
fPFParticleLabel);
71 std::vector<art::Ptr<recob::Cluster>> clusters = fmc.at(pfparticle.key());
76 std::vector<art::Ptr<recob::Hit>> showerHits;
77 for (
auto const&
cluster : clusters) {
80 std::vector<art::Ptr<recob::Hit>> hits = fmhc.at(
cluster.key());
81 showerHits.insert(showerHits.end(), hits.begin(), hits.end());
85 auto const clockData =
86 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(Event);
88 std::pair<int, double> ShowerTrackInfo =
90 clockData, showersMothers, showerHits, 2);
92 if (ShowerTrackInfo.first == -99999) {
93 mf::LogError(
"ShowerStartPositionCheater") <<
"True Shower Not Found";
97 const simb::MCParticle* trueParticle = trueParticles[ShowerTrackInfo.first];
99 mf::LogError(
"ShowerDirectionCheater") <<
"True shower not found, returning";
105 TVector3 trueStartPos = {-999, -999, -999};
108 if (
abs(trueParticle->PdgCode()) == 22) {
109 double initialEnergy = trueParticle->E();
110 unsigned int TrajPoints = trueParticle->NumberTrajectoryPoints();
111 for (
unsigned int trajPoint = 0; trajPoint < TrajPoints; trajPoint++) {
112 if (trueParticle->E(trajPoint) < initialEnergy) {
113 trueStartPos = trueParticle->Position(trajPoint).Vect();
119 trueStartPos = trueParticle->Position().Vect();
122 TVector3 trueStartPosErr = {-999, -999, -999};
std::map< int, const simb::MCParticle * > GetTrueParticleMap() const
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
std::map< int, std::vector< int > > GetTrueChain(std::map< int, const simb::MCParticle * > &trueParticles) const
std::pair< int, double > TrueParticleIDFromTrueChain(detinfo::DetectorClocksData const &clockData, std::map< int, std::vector< int >> const &ShowersMothers, std::vector< art::Ptr< recob::Hit >> const &hits, int planeid) const