10 #include "art/Utilities/ToolMacros.h"
17 namespace ShowerRecoTools {
51 const fhicl::ParameterSet& pset)
53 , fVerbose(pset.
get<int>(
"Verbose"))
54 , fUsePandoraVertex(pset.
get<
bool>(
"UsePandoraVertex"))
55 , fAllowDynamicSliding(pset.
get<
bool>(
"AllowDynamicSliding"))
56 , fUsePositionInfo(pset.
get<
bool>(
"UsePositionInfo"))
57 , fUseStartPos(pset.
get<
bool>(
"UseStartPos"))
58 , fAngleCut(pset.
get<float>(
"AngleCut"))
59 , fInitialTrackInputLabel(pset.
get<
std::string>(
"InitialTrackInputLabel"))
60 , fShowerStartPositionInputLabel(pset.
get<
std::string>(
"ShowerStartPositionInputLabel"))
61 , fShowerDirectionOutputLabel(pset.
get<
std::string>(
"ShowerDirectionOutputLabel"))
67 const art::Ptr<recob::PFParticle>& pfparticle,
75 mf::LogError(
"ShowerTrackColinearTrajPointDirection")
76 <<
"Initial track not set" << std::endl;
85 mf::LogError(
"ShowerTrackColinearTrajPointDirection")
86 <<
"Not Enough trajectory points." << std::endl;
102 mf::LogError(
"ShowerTrackColinearTrajPointDirection")
103 <<
"Shower start position not set" << std::endl;
106 TVector3 StartPosition_vec = {-999, -999, -999};
108 StartPosition.SetCoordinates(
109 StartPosition_vec.X(), StartPosition_vec.Y(), StartPosition_vec.Z());
112 StartPosition = InitialTrack.
Start();
130 int nexttraj = traj + 1;
142 int nextnexttraj = nexttraj + 1;
143 auto nextnextflags = InitialTrack.
FlagsAtPoint(nextnexttraj);
150 nextnextflags = InitialTrack.
FlagsAtPoint(nextnexttraj);
155 mf::LogError(
"ShowerTrackColinearTrajPointDirection")
156 <<
"Trajectory point not set as rest of the traj points are bogus." << std::endl;
165 NextTrajPosition_vec = InitialTrack.
LocationAtPoint(nexttraj) - StartPosition;
166 NextNextTrajPosition_vec = InitialTrack.
LocationAtPoint(nextnexttraj) - StartPosition;
169 NextTrajPosition_vec =
171 NextNextTrajPosition_vec =
176 TVector3 TrajPosition = {TrajPosition_vec.X(), TrajPosition_vec.Y(), TrajPosition_vec.Z()};
177 TVector3 NextTrajPosition = {
178 NextTrajPosition_vec.X(), NextTrajPosition_vec.Y(), NextTrajPosition_vec.Z()};
179 TVector3 NextNextTrajPosition = {
180 NextNextTrajPosition_vec.X(), NextNextTrajPosition_vec.Y(), NextNextTrajPosition_vec.Z()};
183 if (TrajPosition.Mag() == 0) {
continue; }
184 if (NextTrajPosition.Mag() == 0) {
continue; }
185 if (NextNextTrajPosition.Mag() == 0) {
continue; }
188 if (TrajPosition.Angle(NextTrajPosition) <
fAngleCut &&
189 TrajPosition.Angle(NextNextTrajPosition) <
fAngleCut) {
202 Direction_vec = (TrajPosition - StartPosition).Unit();
236 int prevtraj = traj - 1;
253 int nexttraj = traj + 1;
265 int nextnexttraj = nexttraj + 1;
266 auto nextnextflags = InitialTrack.
FlagsAtPoint(nextnexttraj);
273 nextnextflags = InitialTrack.
FlagsAtPoint(nextnexttraj);
278 mf::LogError(
"ShowerTrackColinearTrajPointDirection")
279 <<
"Trajectory point not set as rest of the traj points are bogus." << std::endl;
287 TVector3 TrajDirection = {
288 TrajDirection_vec.X(), TrajDirection_vec.Y(), TrajDirection_vec.Z()};
289 TVector3 NextTrajDirection = {
290 NextTrajDirection_vec.X(), NextTrajDirection_vec.Y(), NextTrajDirection_vec.Z()};
291 TVector3 NextNextTrajDirection = {NextNextTrajDirection_vec.X(),
292 NextNextTrajDirection_vec.Y(),
293 NextNextTrajDirection_vec.Z()};
296 if (TrajDirection.Mag() == 0) {
continue; }
297 if (NextTrajDirection.Mag() == 0) {
continue; }
298 if (NextNextTrajDirection.Mag() == 0) {
continue; }
301 if (TrajDirection.Angle(NextTrajDirection) <
fAngleCut &&
302 TrajDirection.Angle(NextNextTrajDirection) <
fAngleCut) {
311 mf::LogError(
"ShowerSmartTrackTrajectoryPointDirectio")
312 <<
"Trajectory point not set." << std::endl;
317 TVector3 Direction = {Direction_vec.X(), Direction_vec.Y(), Direction_vec.Z()};
318 TVector3 DirectionErr = {-999, -999, -999};
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
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.
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.
Point_t const & Start() const
Access to track position at different points.
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
Vector_t DirectionAtPoint(size_t i) const
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: