23 #include "art_root_io/TFileService.h" 24 #include "art_root_io/TFileDirectory.h" 73 size_t napas = geo->
NTPC()/2;
90 std::vector<art::Ptr<recob::Hit> > hitsUV[2];
91 std::vector<art::Ptr<recob::Hit> > hitsZ;
95 for (
size_t i = 0; i<OrigHits.size(); ++i)
97 unsigned int hitapa(0), hitcryo(0);
103 switch (OrigHits[i]->
View())
106 hitsUV[0].push_back(OrigHits[i]);
116 hitsUV[1].push_back(OrigHits[i]);
125 hitsZ.push_back(OrigHits[i]);
134 throw cet::exception(
"DisambigAlgProtoDUNESP") <<
": hit view unkonwn. \n";
144 size_t zsize = hitsZ.size();
149 for (
size_t uv=0; uv<2; uv++)
152 size_t uvsize = hitsUV[uv].size();
153 size_t othersize = hitsUV[
other].size();
155 for (
size_t iuv = 0; iuv < uvsize; ++iuv)
161 double tuv = hitsUV[uv][iuv]->PeakTime()
164 std::vector<size_t> zmatches;
165 std::vector<size_t> othermatches;
166 for (
size_t z = 0;
z < zsize;
z++)
168 double tz = hitsZ[
z]->PeakTime()
177 zmatches.push_back(
z);
180 for (
size_t iother = 0; iother < othersize; iother++)
182 double tother = hitsUV[
other][iother]->PeakTime()
186 othermatches.push_back(iother);
193 if (zmatches.size() == 0 && othermatches.size() == 0)
continue;
198 std::vector< double > zmatchz;
199 std::vector< double > zmatchy;
200 std::vector< double > othermatchz;
201 std::vector< double > othermatchy;
203 std::vector<geo::WireID> wires = geo->
ChannelToWire(hitsUV[uv][iuv]->Channel());
204 size_t wsize = wires.size();
205 std::vector<size_t> ndoublets(wsize,0);
206 std::vector<size_t> ntriplets(wsize,0);
208 for (
size_t w=0;
w<wsize;
w++)
215 for (
size_t z=0;
z<zmatches.size();
z++)
223 zmatchz.push_back(isect.
z);
224 zmatchy.push_back(isect.
y);
229 for (
size_t iother=0; iother<othermatches.size(); iother++)
231 std::vector<geo::WireID> otherwires = geo->
ChannelToWire(hitsUV[other][othermatches[iother]]->Channel());
232 for (
size_t otherw = 0; otherw < otherwires.size(); otherw++)
240 othermatchz.push_back(isect.
z);
241 othermatchy.push_back(isect.
y);
248 for (
size_t izmatch=0;izmatch<zmatchz.size();izmatch++)
250 bool found_triplet =
false;
251 for (
size_t iothermatch=0;iothermatch<othermatchz.size();iothermatch++)
253 double disz = zmatchz[izmatch]-othermatchz[iothermatch];
254 double disy = zmatchy[izmatch]-othermatchy[iothermatch];
255 if ( disz*disz + disy*disy <
fDcut2 )
258 found_triplet =
true;
261 if (!found_triplet) ndoublets[
w] ++;
263 for (
size_t iothermatch=0;iothermatch<othermatchz.size();iothermatch++)
265 bool found_triplet =
false;
266 for (
size_t izmatch=0;izmatch<zmatchz.size();izmatch++)
268 double disz = zmatchz[izmatch]-othermatchz[iothermatch];
269 double disy = zmatchy[izmatch]-othermatchy[iothermatch];
270 if ( disz*disz + disy*disy <
fDcut2 )
272 found_triplet =
true;
275 if (!found_triplet) ndoublets[
w] ++;
280 bool found_disambig =
false;
282 for (
size_t w=0;
w<wsize;
w++)
284 if (!found_disambig && (ntriplets[
w]>0 || ndoublets[
w] > 0))
287 found_disambig =
true;
289 if (ntriplets[
w] > ntriplets[bestwire])
292 found_disambig =
true;
294 if ( (ntriplets[
w] == ntriplets[bestwire]) && (ndoublets[
w] > ndoublets[bestwire]))
297 found_disambig =
true;
320 auto tpc = wireid.
TPC;
322 if (tpc == 0 || tpc == 3 || tpc == 4 || tpc == 7 || tpc == 8 || tpc == 11)
342 if (apa == 5) tpc=10;
double z
z position of intersection
Encapsulate the construction of a single cyostat.
AdcChannelData::View View
double GetXTicksOffset(int p, int t, int c) const
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
Planes which measure Z direction.
void reconfigure(fhicl::ParameterSet const &p)
void RunDisambig(detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< recob::Hit > > &OrigHits)
Run disambiguation as currently configured.
std::vector< std::pair< art::Ptr< recob::Hit >, geo::WireID > > fDisambigHits
The final list of hits to pass back to be made.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
T get(std::string const &key) const
unsigned int ChannelToAPA(uint32_t chan)
Get number of the APA containing the given channel.
Encapsulate the geometry of a wire.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
bool notOuterWire(geo::WireID wireid)
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, geo::Point_t &intersection) const
Computes the intersection between two wires.
Declaration of signal hit object.
Encapsulate the construction of a single detector plane.
DisambigAlgProtoDUNESP(fhicl::ParameterSet const &pset)
double y
y position of intersection
Declaration of basic channel signal object.
TPCID_t TPC
Index of the TPC within its cryostat.
dune::apa::APAGeometryAlg fAPAGeo
recob::tracking::Plane Plane
LArSoft geometry interface.
cet::coded_exception< error, detail::translate > exception
Encapsulate the construction of a single detector plane.