42 :
IShowerTool(pset.get<fhicl::ParameterSet>(
"BaseTools"))
43 , fPFParticleLabel(pset.get<
art::InputTag>(
"PFParticleLabel"))
44 , fVerbose(pset.get<int>(
"Verbose"))
45 , fShowerStartPositionOutputLabel(pset.get<std::string>(
"ShowerStartPositionOutputLabel"))
46 , fShowerDirectionInputLabel(pset.get<std::string>(
"ShowerDirectionInputLabel"))
50 const art::Ptr<recob::PFParticle>& pfparticle,
56 auto const pfpHandle = Event.getValidHandle<std::vector<recob::PFParticle>>(
fPFParticleLabel);
58 const art::FindManyP<recob::Vertex>& fmv =
62 throw cet::exception(
"ShowerPFPVertexStartPosition")
63 <<
"Vertex and PF particle association is somehow not valid. Stopping";
66 std::vector<art::Ptr<recob::Vertex>> vtx_cand;
68 vtx_cand = fmv.at(pfparticle.key());
72 mf::LogError(
"ShowerPFPVertexStartPosition") <<
"PFP-Vertex assan not set, returning";
76 if (vtx_cand.size() != 1) {
78 mf::LogError(
"ShowerPFPVertexStartPosition")
79 <<
"Wrong number of vertices: " << vtx_cand.size() <<
", returning";
84 if (vtx_cand.size() == 1) {
85 art::Ptr<recob::Vertex> StartPositionVertex = vtx_cand[0];
86 auto ShowerStartPosition(StartPositionVertex->position());
87 geo::Point_t ShowerStartPositionErr = {-999, -999, -999};
96 geo::Vector_t ShowerDirection = {-999, -999, -999};
99 const art::FindManyP<recob::SpacePoint>& fmspp =
103 auto const spHandle = Event.getValidHandle<std::vector<recob::SpacePoint>>(
fPFParticleLabel);
104 const art::FindManyP<recob::Hit>& fmh =
108 std::vector<art::Ptr<recob::SpacePoint>> spacePoints_pfp = fmspp.at(pfparticle.key());
111 if (spacePoints_pfp.empty()) {
return 0; }
114 auto const clockData =
115 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(Event);
117 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(Event, clockData);
120 clockData, detProp, spacePoints_pfp, fmh);
124 spacePoints_pfp, ShowerCentre, ShowerDirection);
127 auto ShowerStartPosition = spacePoints_pfp[0]->position();
129 geo::Point_t ShowerStartPositionErr = {-999, -999, -999};
137 mf::LogWarning(
"ShowerPFPVertexStartPosition")
138 <<
"Start Position has not been set yet. If you are not calculating the start position "
139 "again then maybe you should stop";