64 fRCut =
p.get<
float>(
"RCut", 12.0);
65 fDCut =
p.get<
float>(
"DCut", 2.0);
70 consumes< std::vector<rec::Track> >(trackTag);
73 produces< std::vector<rec::Vertex> >();
74 produces< art::Assns<rec::Track, rec::Vertex, rec::TrackEnd> >();
78 std::unique_ptr< std::vector<rec::Vertex> >
79 vtxCol(
new std::vector<rec::Vertex>);
80 std::unique_ptr< art::Assns<rec::Track, rec::Vertex, rec::TrackEnd> >
84 auto const&
tracks = *trackHandle;
89 size_t nTrack = tracks.size();
90 std::vector<int> usedflag_beg(nTrack,0);
91 std::vector<int> usedflag_end(nTrack,0);
98 std::vector< std::tuple<TrackPar,TrackEnd,int> > trackParEnds;
99 for (
size_t iTrack=0; iTrack<nTrack-1; ++iTrack) {
100 TrackPar thisTrack = tracks.at(iTrack);
102 for (
int fin=0; fin<2; ++fin) {
103 trackParEnds.clear();
104 TrackEnd thisTrackEnd(fin == 0 ? 1 : 0);
105 if (!
goodTrack(thisTrack,thisTrackEnd))
continue;
106 trackParEnds.emplace_back( std::make_tuple(thisTrack,thisTrackEnd,iTrack) );
107 TVector3 thisEndinSpace;
110 usedflag_beg.at(iTrack) = 1;
115 usedflag_end.at(iTrack) = 1;
120 for (
size_t jTrack=iTrack+1; jTrack<nTrack; ++jTrack) {
121 TrackPar thatTrack = tracks.at(jTrack);
122 for (
int fin2=0; fin2<2; ++fin2)
124 TrackEnd thatTrackEnd(fin2 == 0 ? 1 : 0);
125 if (thatTrackEnd ==
TrackEndBeg && usedflag_beg.at(jTrack) != 0)
continue;
126 if (thatTrackEnd ==
TrackEndEnd && usedflag_end.at(jTrack) != 0)
continue;
127 if (!
goodTrack(thatTrack,thatTrackEnd))
continue;
128 TVector3 thatEndinSpace;
138 if ( (thisEndinSpace-thatEndinSpace).Mag() >
fRCut)
continue;
143 std::vector<TrackPar> vtracks;
144 std::vector<TrackEnd> usebeg;
145 vtracks.push_back(thisTrack);
146 vtracks.push_back(thatTrack);
147 usebeg.push_back(thisTrackEnd);
148 usebeg.push_back(thatTrackEnd);
149 std::vector<float> xyz(3,0);
150 std::vector< std::vector<float> > covmat;
151 std::vector<float> doca;
161 usedflag_beg.at(jTrack) = 1;
165 usedflag_end.at(jTrack) = 1;
167 trackParEnds.emplace_back( std::make_tuple(thatTrack,thatTrackEnd,jTrack) );
174 size_t nTrackEnds = trackParEnds.size();
176 if ( nTrackEnds>=2) {
178 std::vector<TrackPar> vtracks;
179 std::vector<TrackEnd> usebeg;
180 for (
size_t iTrackEnd=0; iTrackEnd<nTrackEnds; ++iTrackEnd) {
181 vtracks.push_back( std::get<TrackPar>(trackParEnds[iTrackEnd]) );
182 usebeg.push_back ( std::get<1>(trackParEnds[iTrackEnd]) );
184 std::vector<float> xyz(3,0);
185 std::vector< std::vector<float> > covmat;
186 std::vector<float> doca;
192 for (
size_t i=0; i<3;++i) {
193 for (
size_t j=0; j<3; ++j) {
194 cmv[icounter] = covmat.at(i).at(j);
200 vtxCol->emplace_back(xyz.data(),cmv,time);
201 auto const vtxpointer = vtxPtrMaker(vtxCol->size()-1);
202 for (
size_t i=0; i<trackParEnds.size(); ++i) {
203 TrackEnd endInVertex = std::get<1>(trackParEnds[i]);
204 auto const trackpointer = trackPtrMaker( std::get<2>(trackParEnds[i]) );
205 trkVtxAssns->addSingle(trackpointer,vtxpointer,endInVertex);
vertexfinder1 & operator=(vertexfinder1 const &)=delete
int fitVertex(std::vector< TrackPar > &tracks, std::vector< float > &xyz, float &chisquared, std::vector< std::vector< float > > &covmat, double &time, std::vector< TrackEnd > usebeg, std::vector< float > &doca)
EDProducer(fhicl::ParameterSet const &pset)
TrackEnd const TrackEndEnd
void produce(art::Event &e) override
TVector3 getXYZEnd() const
TVector3 getXYZBeg() const
#define DEFINE_ART_MODULE(klass)
vertexfinder1(fhicl::ParameterSet const &p)
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
bool goodTrack(TrackPar trk, TrackEnd usebeg)
size_t getNTPCClusters() const
General GArSoft Utilities.
TrackEnd const TrackEndBeg