55 if (
fVerbose) mf::LogError(
"ShowerTrackDirection") <<
"Initial track not set" << std::endl;
62 mf::LogError(
"ShowerTrackDirection") <<
"Start position not set, returning " << std::endl;
68 ShowerEleHolder.
GetElement(
"InitialTrack", InitialTrack);
73 TVector3 StartPosition_vec = {-999, -999, -999};
74 ShowerEleHolder.
GetElement(
"ShowerStartPosition", StartPosition_vec);
75 StartPosition.SetCoordinates(
76 StartPosition_vec.X(), StartPosition_vec.Y(), StartPosition_vec.Z());
79 StartPosition = InitialTrack.
Start();
83 float sumX = 0, sumX2 = 0;
84 float sumY = 0, sumY2 = 0;
85 float sumZ = 0, sumZ2 = 0;
97 sumX += TrajPosition.X();
98 sumX2 += TrajPosition.X() * TrajPosition.X();
99 sumY += TrajPosition.Y();
100 sumY2 += TrajPosition.Y() * TrajPosition.Y();
101 sumZ += TrajPosition.Z();
102 sumZ2 += TrajPosition.Z() * TrajPosition.Z();
106 geo::Vector_t Mean = {sumX / NumTraj, sumY / NumTraj, sumZ / NumTraj};
112 if (sumX2 / NumTraj - ((sumX / NumTraj) * ((sumX / NumTraj))) > 0) {
113 RMSX = std::sqrt(sumX2 / NumTraj - ((sumX / NumTraj) * ((sumX / NumTraj))));
115 if (sumY2 / NumTraj - ((sumY / NumTraj) * ((sumY / NumTraj))) > 0) {
116 RMSY = std::sqrt(sumY2 / NumTraj - ((sumY / NumTraj) * ((sumY / NumTraj))));
118 if (sumZ2 / NumTraj - ((sumZ / NumTraj) * ((sumZ / NumTraj))) > 0) {
119 RMSZ = std::sqrt(sumZ2 / NumTraj - ((sumZ / NumTraj) * ((sumZ / NumTraj))));
122 TVector3 Direction_Mean = {0, 0, 0};
133 geo::Vector_t Direction = (TrajPosition - StartPosition).Unit();
136 if ((
std::abs((Direction - Mean).
X()) < 1 * RMSX) &&
137 (
std::abs((Direction - Mean).Y()) < 1 * RMSY) &&
138 (
std::abs((Direction - Mean).Z()) < 1 * RMSZ)) {
139 TVector3 Direction_vec = {Direction.X(), Direction.Y(), Direction.Z()};
140 if (Direction_vec.Mag() == 0) {
continue; }
141 Direction_Mean += Direction_vec;
148 TVector3 Direction = Direction_Mean.Unit();
149 TVector3 DirectionErr = {RMSX, RMSY, RMSZ};
150 ShowerEleHolder.
SetElement(Direction, DirectionErr,
"ShowerDirection");
154 mf::LogError(
"ShowerTrackDirection")
155 <<
"None of the points are within 1 sigma" << std::endl;
163 float sumX = 0, sumX2 = 0;
164 float sumY = 0, sumY2 = 0;
165 float sumZ = 0, sumZ2 = 0;
174 sumX += Direction.X();
175 sumX2 += Direction.X() * Direction.X();
176 sumY += Direction.Y();
177 sumY2 += Direction.Y() * Direction.Y();
178 sumZ += Direction.Z();
179 sumZ2 += Direction.Z() * Direction.Z();
183 geo::Vector_t Mean = {sumX / NumTraj, sumY / NumTraj, sumZ / NumTraj};
189 if (sumX2 / NumTraj - ((sumX / NumTraj) * ((sumX / NumTraj))) > 0) {
190 RMSX = std::sqrt(sumX2 / NumTraj - ((sumX / NumTraj) * ((sumX / NumTraj))));
192 if (sumY2 / NumTraj - ((sumY / NumTraj) * ((sumY / NumTraj))) > 0) {
193 RMSY = std::sqrt(sumY2 / NumTraj - ((sumY / NumTraj) * ((sumY / NumTraj))));
195 if (sumZ2 / NumTraj - ((sumZ / NumTraj) * ((sumZ / NumTraj))) > 0) {
196 RMSZ = std::sqrt(sumZ2 / NumTraj - ((sumZ / NumTraj) * ((sumZ / NumTraj))));
201 TVector3 Direction_Mean = {0, 0, 0};
208 if ((
std::abs((Direction - Mean).
X()) < 1 * RMSX) &&
209 (
std::abs((Direction - Mean).Y()) < 1 * RMSY) &&
210 (
std::abs((Direction - Mean).Z()) < 1 * RMSZ)) {
211 TVector3 Direction_vec = {Direction.X(), Direction.Y(), Direction.Z()};
212 if (Direction_vec.Mag() == 0) {
continue; }
213 Direction_Mean += Direction_vec;
220 TVector3 Direction = Direction_Mean.Unit();
221 TVector3 DirectionErr = {RMSX, RMSY, RMSZ};
222 ShowerEleHolder.
SetElement(Direction, DirectionErr,
"ShowerDirection");
226 mf::LogError(
"ShowerTrackDirection")
227 <<
"None of the points are within 1 sigma" << std::endl;
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
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.
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker see the discussion of warn common echo in *Note Linker such as a global int variable echo as opposed to a large global array echo echo I echo The symbol is an indirect reference to another symbol This echo is a GNU extension to the a out object file format which is echo rarely used echo echo N echo The symbol is a debugging symbol echo echo R echo The symbol is in a read only data section echo echo S echo The symbol is in an uninitialized data section for small echo objects echo echo T echo The symbol is in the the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo W echo The symbol is a weak symbol that has not been specifically echo tagged as a weak object symbol When a weak defined symbol echo is linked with a normal defined the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo echo The symbol is a stabs symbol in an a out object file In echo this the next values printed are the stabs other echo the stabs desc and the stab type Stabs symbols are echo used to hold debugging information For more echo see *Note or object file format specific echo echo For Mac OS X
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.
process_name largeant stream1 can override from command line with o or output physics producers generator N
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: