11 #include "art/Utilities/ToolMacros.h"
20 namespace ShowerRecoTools {
33 std::vector<art::Ptr<recob::SpacePoint>>& spacePoints,
34 TVector3& showerStartPosition,
35 TVector3& showerDirection);
54 , fMaxProjectionDist(pset.
get<float>(
"MaxProjectionDist"))
55 , fMaxPerpendicularDist(pset.
get<float>(
"MaxPerpendicularDist"))
56 , fForwardHitsOnly(pset.
get<
bool>(
"ForwardHitsOnly"))
57 , fPFParticleLabel(pset.
get<art::InputTag>(
"PFParticleLabel"))
58 , fVerbose(pset.
get<int>(
"Verbose"))
59 , fShowerStartPositionInputLabel(pset.
get<
std::string>(
"ShowerStartPositionInputLabel"))
60 , fInitialTrackHitsOutputLabel(pset.
get<
std::string>(
"InitialTrackHitsOutputLabel"))
61 , fInitialTrackSpacePointsOutputLabel(
62 pset.
get<
std::string>(
"InitialTrackSpacePointsOutputLabel"))
63 , fShowerDirectionInputLabel(pset.
get<
std::string>(
"ShowerDirectionInputLabel"))
68 const art::Ptr<recob::PFParticle>& pfparticle,
76 mf::LogError(
"Shower3DCylinderTrackHitFinder")
77 <<
"Start position not set, returning " << std::endl;
82 mf::LogError(
"Shower3DCylinderTrackHitFinder")
83 <<
"Direction not set, returning " << std::endl;
87 TVector3 ShowerStartPosition = {-999, -999, -999};
90 TVector3 ShowerDirection = {-999, -999, -999};
94 auto const pfpHandle = Event.getValidHandle<std::vector<recob::PFParticle>>(
fPFParticleLabel);
97 const art::FindManyP<recob::SpacePoint>& fmspp =
101 auto const spHandle = Event.getValidHandle<std::vector<recob::SpacePoint>>(
fPFParticleLabel);
104 const art::FindManyP<recob::Hit>& fmhsp =
108 std::vector<art::Ptr<recob::SpacePoint>> spacePoints = fmspp.at(pfparticle.key());
111 if (spacePoints.empty()) {
113 mf::LogError(
"Shower3DCylinderTrackHitFinder")
114 <<
"No space points, returning " << std::endl;
120 spacePoints, ShowerStartPosition, ShowerDirection);
123 std::vector<art::Ptr<recob::SpacePoint>> trackSpacePoints;
127 std::vector<art::Ptr<recob::Hit>> trackHits;
128 for (
auto const& spacePoint : trackSpacePoints) {
129 const art::Ptr<recob::Hit>
hit = fmhsp.at(spacePoint.key()).
front();
131 trackHits.push_back(hit);
140 std::vector<art::Ptr<recob::SpacePoint>>
142 std::vector<art::Ptr<recob::SpacePoint>>& spacePoints,
143 TVector3& showerStartPosition,
144 TVector3& showerDirection)
148 std::vector<art::Ptr<recob::SpacePoint>> trackSpacePoints;
150 for (
const auto& spacePoint : spacePoints) {
154 spacePoint, showerStartPosition, showerDirection);
156 spacePoint, showerStartPosition, showerDirection, proj);
161 trackSpacePoints.push_back(spacePoint);
163 return trackSpacePoints;
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
void OrderShowerSpacePoints(std::vector< art::Ptr< recob::SpacePoint >> &showersps, TVector3 const &vertex, TVector3 const &direction) const
Declaration of signal hit object.
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
const art::FindManyP< T1 > & GetFindManyP(const art::ValidHandle< std::vector< T2 > > &handle, const art::Event &evt, const art::InputTag &moduleTag)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
bool CheckElement(const std::string &Name) const
double SpacePointProjection(art::Ptr< recob::SpacePoint > const &sp, TVector3 const &vertex, TVector3 const &direction) const
int GetElement(const std::string &Name, T &Element) const
double SpacePointPerpendicular(art::Ptr< recob::SpacePoint > const &sp, TVector3 const &vertex, TVector3 const &direction) const
2D representation of charge deposited in the TDC/wire plane