44 :
IShowerTool(pset.get<fhicl::ParameterSet>(
"BaseTools"))
45 , fLArPandoraShowerCheatingAlg(pset.get<fhicl::ParameterSet>(
"LArPandoraShowerCheatingAlg"))
46 , fPFParticleLabel(pset.get<
art::InputTag>(
"PFParticleLabel"))
47 , fHitModuleLabel(pset.get<
art::InputTag>(
"HitModuleLabel"))
48 , fShowerStartPositionOutputLabel(pset.get<std::string>(
"ShowerStartPositionOutputLabel"))
49 , fTrueParticleOutputLabel(pset.get<std::string>(
"TrueParticleOutputLabel"))
53 const art::Ptr<recob::PFParticle>& pfparticle,
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 geo::Point_t 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 = geo::vect::toPoint(trueParticle->Position(trajPoint).Vect());
119 trueStartPos = geo::vect::toPoint(trueParticle->Position().Vect());
122 geo::Point_t trueStartPosErr = {-999, -999, -999};
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