66 ShowerEleHolder.
GetElement(
"InitialTrack", InitialTrack);
71 TVector3 StartPosition_vec = {-999, -999, -999};
72 ShowerEleHolder.
GetElement(
"ShowerStartPosition", StartPosition_vec);
73 StartPosition.SetCoordinates(
74 StartPosition_vec.X(), StartPosition_vec.Y(), StartPosition_vec.Z());
77 StartPosition = InitialTrack.
Start();
81 float sumX = 0, sumX2 = 0;
82 float sumY = 0, sumY2 = 0;
83 float sumZ = 0, sumZ2 = 0;
95 sumX += TrajPosition.X();
96 sumX2 += TrajPosition.X() * TrajPosition.X();
97 sumY += TrajPosition.Y();
98 sumY2 += TrajPosition.Y() * TrajPosition.Y();
99 sumZ += TrajPosition.Z();
100 sumZ2 += TrajPosition.Z() * TrajPosition.Z();
104 geo::Vector_t Mean = {sumX / NumTraj, sumY / NumTraj, sumZ / NumTraj};
110 if (sumX2 / NumTraj - ((sumX / NumTraj) * ((sumX / NumTraj))) > 0) {
111 RMSX = std::sqrt(sumX2 / NumTraj - ((sumX / NumTraj) * ((sumX / NumTraj))));
113 if (sumY2 / NumTraj - ((sumY / NumTraj) * ((sumY / NumTraj))) > 0) {
114 RMSY = std::sqrt(sumY2 / NumTraj - ((sumY / NumTraj) * ((sumY / NumTraj))));
116 if (sumZ2 / NumTraj - ((sumZ / NumTraj) * ((sumZ / NumTraj))) > 0) {
117 RMSZ = std::sqrt(sumZ2 / NumTraj - ((sumZ / NumTraj) * ((sumZ / NumTraj))));
120 TVector3 Direction_Mean = {0, 0, 0};
134 if ((
std::abs((Direction - Mean).
X()) < 1 * RMSX) &&
135 (
std::abs((Direction - Mean).
Y()) < 1 * RMSY) &&
136 (
std::abs((Direction - Mean).
Z()) < 1 * RMSZ)) {
137 TVector3 Direction_vec = {Direction.X(), Direction.Y(), Direction.Z()};
138 if (Direction_vec.Mag() == 0) {
continue; }
139 Direction_Mean += Direction_vec;
146 TVector3 Direction = Direction_Mean.Unit();
147 TVector3 DirectionErr = {RMSX, RMSY, RMSZ};
148 ShowerEleHolder.
SetElement(Direction, DirectionErr,
"ShowerDirection");
153 <<
"None of the points are within 1 sigma" <<
std::endl;
161 float sumX = 0, sumX2 = 0;
162 float sumY = 0, sumY2 = 0;
163 float sumZ = 0, sumZ2 = 0;
172 sumX += Direction.X();
173 sumX2 += Direction.X() * Direction.X();
174 sumY += Direction.Y();
175 sumY2 += Direction.Y() * Direction.Y();
176 sumZ += Direction.Z();
177 sumZ2 += Direction.Z() * Direction.Z();
181 geo::Vector_t Mean = {sumX / NumTraj, sumY / NumTraj, sumZ / NumTraj};
187 if (sumX2 / NumTraj - ((sumX / NumTraj) * ((sumX / NumTraj))) > 0) {
188 RMSX = std::sqrt(sumX2 / NumTraj - ((sumX / NumTraj) * ((sumX / NumTraj))));
190 if (sumY2 / NumTraj - ((sumY / NumTraj) * ((sumY / NumTraj))) > 0) {
191 RMSY = std::sqrt(sumY2 / NumTraj - ((sumY / NumTraj) * ((sumY / NumTraj))));
193 if (sumZ2 / NumTraj - ((sumZ / NumTraj) * ((sumZ / NumTraj))) > 0) {
194 RMSZ = std::sqrt(sumZ2 / NumTraj - ((sumZ / NumTraj) * ((sumZ / NumTraj))));
199 TVector3 Direction_Mean = {0, 0, 0};
206 if ((
std::abs((Direction - Mean).
X()) < 1 * RMSX) &&
207 (
std::abs((Direction - Mean).
Y()) < 1 * RMSY) &&
208 (
std::abs((Direction - Mean).
Z()) < 1 * RMSZ)) {
209 TVector3 Direction_vec = {Direction.X(), Direction.Y(), Direction.Z()};
210 if (Direction_vec.Mag() == 0) {
continue; }
211 Direction_Mean += Direction_vec;
218 TVector3 Direction = Direction_Mean.Unit();
219 TVector3 DirectionErr = {RMSX, RMSY, RMSZ};
220 ShowerEleHolder.
SetElement(Direction, DirectionErr,
"ShowerDirection");
225 <<
"None of the points are within 1 sigma" <<
std::endl;
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.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
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
static constexpr HitIndex_t InvalidHitIndex
Value marking an invalid hit index.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
PointFlags_t const & FlagsAtPoint(size_t i) const
Vector_t DirectionAtPoint(size_t i) const
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)