184 auto const* geom = lar::providerFrom<geo::Geometry>();
189 for (
auto&
t : tracks.
tracks()) {
192 auto const& node0 = *(
t.Track()->Nodes()[0]);
193 auto const& node1 = *(
t.Track()->Nodes()[
t.Track()->Nodes().size() - 1]);
197 (node0.Point3D()[hIdx] > node1.Point3D()[hIdx]) ? node0.Point3D() : node1.Point3D();
199 (node0.Point3D()[hIdx] <= node1.Point3D()[hIdx]) ? node0.Point3D() : node1.Point3D();
206 bool foundTrack =
false;
207 for (
auto const&
tt : tracks.
tracks()) {
209 if ((&
tt) == (&
t))
continue;
212 TVector3 trkVtx = (
tt.Track()->Nodes()[0])->
Point3D();
213 TVector3 trkEnd = (
tt.Track()->Nodes()[
tt.Track()->Nodes().size() - 1])->
Point3D();
235 std::vector<float> nSigmaPerView;
238 for (
auto const view : geom->Views()) {
241 std::map<size_t, std::vector<double>> dedx;
242 t.Track()->GetRawdEdxSequence(dedx, view);
244 std::vector<double> trk_dedx;
246 for (
int h =
t.Track()->NextHit(-1, view);
h != -1;
h =
t.Track()->NextHit(
h, view)) {
248 if (
h >
t.Track()->PrevHit(
t.Track()->size(), view))
break;
250 if (dedx[
h][5] / dedx[
h][6] <= 0 || dedx[
h][5] / dedx[
h][6] > 1e6)
continue;
251 trk_dedx.push_back(dedx[
h][5] / dedx[
h][6]);
254 if (trk_dedx.size() == 0) {
256 <<
"View " << view <<
" has no hits." <<
std::endl;
261 double mean = sum /
static_cast<double>(trk_dedx.size());
264 accum += (d -
mean) * (d - mean);
266 double stdev = sqrt(accum / static_cast<double>(trk_dedx.size() - 1));
269 <<
" View " << view <<
" has average dedx " << mean <<
" +/- " << stdev
270 <<
" and final dedx " << trk_dedx[trk_dedx.size() - 1] <<
std::endl;
272 nSigmaPerView.push_back(fabs((trk_dedx[trk_dedx.size() - 1] -
mean) / stdev));
275 bool notStopper =
true;
276 short unsigned int n2Sigma = 0;
277 short unsigned int n3Sigma = 0;
278 for (
auto const nSigma : nSigmaPerView) {
279 if (nSigma >= 2.0) ++n2Sigma;
280 if (nSigma >= 3.0) ++n3Sigma;
283 if (n3Sigma > 0) notStopper =
false;
284 if (n2Sigma == nSigmaPerView.size()) notStopper =
false;
296 <<
" - Tagged " << n <<
" tracks stopping in the detector after starting at the top." end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
::fhicl::TupleAs< Point(::geo::Length_t,::geo::Length_t,::geo::Length_t)> Point3D
Atom object for reading a 3D point or vector (centimeters).
std::vector< double > fDimensionsMin
short int ConvertDirToInt(const TVector3 &dir) const
std::vector< double > fDimensionsMax
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
double fApparentStopperMargin
std::vector< TrkCandidate > const & tracks() const
QTextStream & endl(QTextStream &s)