60 for(
int ii = 0; ii < ntrack; ++ii) {
63 const TVector3 start1(track1.
Vertex<TVector3>());
64 const TVector3 end1(track1.
End<TVector3>());
68 std::vector< std::tuple< std::string, int, int, double, double> > headvv;
69 std::vector< std::tuple< std::string, int, int, double, double> > tailvv;
72 std::vector< std::vector<std::pair< double, double>> > matchhead;
73 std::vector< std::vector<std::pair< double, double>> > matchtail;
78 for(
int jj = ii+1; jj < ntrack; ++jj) {
81 const TVector3& start2(track2.
Vertex<TVector3>());
82 const TVector3& end2(track2.
End<TVector3>());
84 const TVector3& end2Dir(track2.
EndDirection<TVector3>());
93 if ( c12 || c21 || c11 || c22 )
97 if (c12||c11) { head=
true; }
98 if (c11) { sHT2 =
"H"; }
else if (c12) { sHT2 =
"T"; }
99 if (c21||c22) { tail=
true; }
100 if (c21) { sHT2 =
"H"; }
else if (c22) { sHT2 =
"T"; }
104 head =
false; tail =
false;
105 if ( ((start1-end2).Mag() < (start2-end1).Mag()) || ((start1-end2).Mag() < (start2-end2).Mag()) || ((start1-start2).Mag() < (start2-end1).Mag()) || ((start1-start2).Mag() < (start2-end2).Mag()) )
106 { head =
true; tail =
false; }
108 { head =
false; tail =
true; }
114 std::vector< std::pair <double,double> > headv;
115 headv.push_back(std::pair<double,double>(
abs(start1Dir.Dot(start2Dir)), (start1-start2).Mag()) );
116 headv.push_back(std::pair<double,double>(
abs(start1Dir.Dot(end2Dir)), (start1-end2).Mag()) );
118 matchhead.push_back( headv );
120 if ( ((matchhead.size() > 1) && ( (matchhead.back().at(0).second < matchhead.front().at(0).second) || (matchhead.back().at(1).second < matchhead.front().at(1).second ) ) ) || matchhead.size()==1 )
122 if (matchhead.size()>1) matchhead.erase(matchhead.begin());
123 if (headvv.size()>1) headvv.erase(headvv.begin());
124 if (!sHT2.compare(
"H"))
126 auto tupTmp =std::make_tuple(sHT2,ii,jj,matchhead.back().at(0).first,matchhead.back().at(0).second);
127 headvv.push_back (tupTmp);
131 auto tupTmp = std::make_tuple(sHT2,ii,jj,matchhead.back().at(1).first,matchhead.back().at(1).second);
132 headvv.push_back (tupTmp);
136 matchhead.pop_back();
147 std::vector< std::pair <double,double> > tailv;
148 tailv.push_back(std::pair<double,double>(
abs(end1Dir.Dot(start2Dir)),(start2-end1).Mag() ) );
149 tailv.push_back(std::pair<double,double>(
abs(end1Dir.Dot(end2Dir)),(end1-end2).Mag() ) );
150 matchtail.push_back( tailv );
152 if ( ((matchtail.size() > 1) && ( (matchtail.back().at(0).second < matchtail.front().at(0).second) || (matchtail.back().at(1).second < matchtail.front().at(1).second ) ) ) || matchtail.size()==1 )
154 if (matchtail.size()>1) matchtail.erase(matchtail.begin());
155 if (tailvv.size()>1) tailvv.erase(tailvv.begin());
156 if (!sHT2.compare(
"T"))
158 auto tupTmp = std::make_tuple(sHT2,ii,jj,matchtail.back().at(0).first,matchtail.back().at(0).second);
159 tailvv.push_back(tupTmp);
163 auto tupTmp = std::make_tuple(sHT2,ii,jj,matchtail.back().at(1).first,matchtail.back().at(1).second);
164 tailvv.push_back(tupTmp);
168 matchtail.pop_back();
185 int otrk = std::get<2>(headvv.back());
188 for (
int kk=0;kk<ii;++kk)
190 if (std::get<2>(
fh.at(kk)) == otrk && !sotrkht.compare(std::get<0>(
fh.at(kk)) ) )
195 if (std::get<4>(headvv.back()) < std::get<4>(
fh.at(kk)) && std::get<4>(headvv.back())!=0.0)
197 auto tupTmp2 = std::make_tuple(
std::string(
"NA"),kk,-12,0.0,0.0);
200 else if (std::get<4>(headvv.back())!=0.0)
210 int otrk = std::get<2>(tailvv.back());
213 for (
int kk=0;kk<ii;++kk)
215 if (std::get<2>(
ft.at(kk)) == otrk && !sotrkht.compare(std::get<0>(
ft.at(kk)) ) )
219 if (std::get<4>(tailvv.back()) < std::get<4>(
ft.at(kk)) && std::get<4>(tailvv.back())!=0.0)
221 auto tupTmp2 = std::make_tuple(
std::string(
"NA"),kk,-12,0.0,0.0);
224 else if (std::get<4>(tailvv.back())!=0.0)
237 auto tupTmp2 = std::make_tuple(
std::string(
"NA"),ii,-12,0.0,0.0);
239 if (!headvv.size()) headvv.push_back(tupTmp2);
240 if (!tailvv.size()) tailvv.push_back(tupTmp2);
242 fh.push_back(headvv.back());
243 ft.push_back(tailvv.back());
std::vector< std::tuple< std::string, int, int, double, double > > fh
art::Handle< std::vector< recob::Track > > ftListHandle
std::vector< recob::Track > fTrackVec
Vector_t VertexDirection() const
std::vector< std::vector< std::string > > fHT
Point_t const & Vertex() const
Vector_t EndDirection() const
std::vector< std::tuple< std::string, int, int, double, double > > ft
Point_t const & End() const
std::vector< art::PtrVector< recob::Track > > fTrackComposite
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track: