10 #include "art/Utilities/ToolMacros.h"
18 namespace ShowerRecoTools {
45 , fMaxDist(pset.
get<float>(
"MaxDist"))
46 , fPFParticleLabel(pset.
get<art::InputTag>(
"PFParticleLabel"))
47 , fVerbose(pset.
get<int>(
"Verbose"))
48 , fInitialTrackSpacePointsOutputLabel(
49 pset.
get<
std::string>(
"InitialTrackSpacePointsOutputLabel"))
50 , fInitialTrackHitsOutputLabel(pset.
get<
std::string>(
"InitialTrackHitsOutputLabel"))
51 , fInitialTrackInputTag(pset.
get<
std::string>(
"InitialTrackInputTag"))
52 , fShowerStartPositionInputTag(pset.
get<
std::string>(
"ShowerStartPositionInputTag"))
53 , fInitialTrackSpacePointsInputTag(pset.
get<
std::string>(
"InitialTrackSpacePointsInputTag"))
65 mf::LogError(
"ShowerTrackTrajToSpacePoint") <<
"Initial track not set" << std::endl;
72 mf::LogError(
"ShowerTrackTrajToSpacePoint")
73 <<
"Start position not set, returning " << std::endl;
80 mf::LogError(
"ShowerTrackTrajToSpacePoint")
81 <<
"Initial track spacepoints not set" << std::endl;
86 TVector3 ShowerStartPosition = {-999, -999, -999};
90 std::vector<art::Ptr<recob::SpacePoint>> intitaltrack_sp;
97 std::vector<art::Ptr<recob::SpacePoint>> new_intitaltrack_sp;
106 TVector3 TrajPosition = {TrajPositionPoint.X(), TrajPositionPoint.Y(), TrajPositionPoint.Z()};
109 TVector3 TrajPositionStart = {
110 TrajPositionStartPoint.X(), TrajPositionStartPoint.Y(), TrajPositionStartPoint.Z()};
113 if ((TrajPosition - TrajPositionStart).Mag() == 0) {
continue; }
114 if ((TrajPosition - ShowerStartPosition).Mag() == 0) {
continue; }
116 float MinDist = 9999;
117 unsigned int index = 999;
118 for (
unsigned int sp = 0; sp < intitaltrack_sp.size(); ++sp) {
120 art::Ptr<recob::SpacePoint> spacepoint = intitaltrack_sp[sp];
123 if (pos.Mag() < MinDist && pos.Mag() <
fMaxDist) {
129 if (index == 999) {
continue; }
131 new_intitaltrack_sp.push_back(intitaltrack_sp[index]);
134 intitaltrack_sp.erase(intitaltrack_sp.begin() + index);
138 auto const spHandle = Event.getValidHandle<std::vector<recob::SpacePoint>>(
fPFParticleLabel);
141 const art::FindOneP<recob::Hit>& fohsp =
145 std::vector<art::Ptr<recob::Hit>> trackHits;
146 for (
auto const& spacePoint : new_intitaltrack_sp) {
148 const art::Ptr<recob::Hit>
hit = fohsp.at(spacePoint.key());
149 trackHits.push_back(hit);
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
static constexpr Flag_t NoPoint
The trajectory point is not defined.
Declaration of signal hit object.
Point_t const & LocationAtPoint(size_t i) const
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
const art::FindOneP< T1 > & GetFindOneP(const art::ValidHandle< std::vector< T2 > > &handle, const art::Event &evt, const art::InputTag &moduleTag)
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
Provides recob::Track data product.
PointFlags_t const & FlagsAtPoint(size_t i) const
2D representation of charge deposited in the TDC/wire plane
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
TVector3 SpacePointPosition(art::Ptr< recob::SpacePoint > const &sp) const