70 <<
"Start position not set, returning " <<
std::endl;
75 TVector3 StartPosition = {-999, -999, -99};
89 StartPosition = {Start_point.X(), Start_point.Y(), Start_point.Z()};
96 const art::FindManyP<recob::SpacePoint>& fmsp =
100 std::vector<art::Ptr<recob::Hit>> InitialTrackHits;
104 float sumX = 0, sumX2 = 0;
105 float sumY = 0, sumY2 = 0;
106 float sumZ = 0, sumZ2 = 0;
109 std::vector<art::Ptr<recob::SpacePoint>> intitaltrack_sp;
110 for (
auto const hit : InitialTrackHits) {
111 std::vector<art::Ptr<recob::SpacePoint>> sps = fmsp.at(
hit.key());
112 for (
auto const sp : sps) {
113 intitaltrack_sp.push_back(sp);
117 if (pos.Mag() == 0) {
continue; }
120 sumX2 += pos.X() * pos.X();
122 sumY2 += pos.Y() * pos.Y();
124 sumZ2 += pos.Z() * pos.Z();
128 float NumSps = intitaltrack_sp.size();
129 TVector3 Mean = {sumX / NumSps, sumY / NumSps, sumZ / NumSps};
135 if (sumX2 / NumSps - ((sumX / NumSps) * ((sumX / NumSps))) > 0) {
136 RMSX = std::sqrt(sumX2 / NumSps - ((sumX / NumSps) * ((sumX / NumSps))));
138 if (sumY2 / NumSps - ((sumY / NumSps) * ((sumY / NumSps))) > 0) {
139 RMSY = std::sqrt(sumY2 / NumSps - ((sumY / NumSps) * ((sumY / NumSps))));
141 if (sumZ2 / NumSps - ((sumZ / NumSps) * ((sumZ / NumSps))) > 0) {
142 RMSZ = std::sqrt(sumZ2 / NumSps - ((sumZ / NumSps) * ((sumZ / NumSps))));
146 TVector3 Direction_Mean = {0, 0, 0};
148 for (
auto const sp : intitaltrack_sp) {
151 if ((
std::abs((Direction - Mean).
X()) < 1 * RMSX) &&
152 (
std::abs((Direction - Mean).
Y()) < 1 * RMSY) &&
153 (
std::abs((Direction - Mean).
Z()) < 1 * RMSZ)) {
154 if (Direction.Mag() == 0) {
continue; }
162 TVector3
Direction = Direction_Mean.Unit();
168 <<
"None of the points are within 1 sigma" <<
std::endl;
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)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Point_t const & Start() const
Access to track position at different points.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
Detector simulation of raw signals on wires.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
auto const & get(AssnsNode< L, R, D > const &r)
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
QTextStream & endl(QTextStream &s)
TVector3 SpacePointPosition(art::Ptr< recob::SpacePoint > const &sp) const