Core function: given a set of CPANs, return a float which indicates the compatibility the cluster combination.
47 if ( clusters.size() == 1 )
50 if (
_verbose) { std::cout <<
"Number of clusters taken into account: " << clusters.size() <<
std::endl; }
56 std::vector<std::vector<util::PxHit> >
Hits(3, std::vector<util::PxHit>());
58 for (
size_t c=0;
c < clusters.size();
c++)
59 Hits.
at( clusters.at(
c)->Plane() ) = clusters.at(
c)->GetHitVector();
66 std::vector<int> StartWires;
67 std::vector<int> EndWires;
69 for (
int pl=0; pl < 3; pl++){
70 StartWires.push_back(9999);
71 EndWires.push_back(0);
77 std::cout <<
"Need to insert fake hit ranges...";
92 if ( StartWires.at(
h) == 9999 ) { StartWires.at(
h) = 1; }
93 if ( EndWires.at(
h) == 0 ) { EndWires.at(
h) = geo->
Nwires(
h)-1; }
114 Double_t xyzStart0WireStart[3] = {0., 0., 0.};
115 Double_t xyzStart0WireEnd[3] = {0., 0., 0.};
116 Double_t xyzEnd0WireStart[3] = {0., 0., 0.};
117 Double_t xyzEnd0WireEnd[3] = {0., 0., 0.};
118 Double_t xyzStart1WireStart[3] = {0., 0., 0.};
119 Double_t xyzStart1WireEnd[3] = {0., 0., 0.};
120 Double_t xyzEnd1WireStart[3] = {0., 0., 0.};
121 Double_t xyzEnd1WireEnd[3] = {0., 0., 0.};
122 Double_t xyzStart2WireStart[3] = {0., 0., 0.};
123 Double_t xyzStart2WireEnd[3] = {0., 0., 0.};
124 Double_t xyzEnd2WireStart[3] = {0., 0., 0.};
125 Double_t xyzEnd2WireEnd[3] = {0., 0., 0.};
128 std::cout <<
"Wire Ranges:" <<
std::endl;
129 std::cout <<
"U-Plane: [ " << StartWires.at(0) <<
", " << EndWires.at(0) <<
"]" <<
std::endl;
130 std::cout <<
"V-Plane: [ " << StartWires.at(1) <<
", " << EndWires.at(1) <<
"]" <<
std::endl;
131 std::cout <<
"Y-Plane: [ " << StartWires.at(2) <<
", " << EndWires.at(2) <<
"]" <<
std::endl;
142 geo->
WireEndPoints(0, 0, 0, StartWires.at(0), xyzStart0WireStart, xyzStart0WireEnd);
143 geo->
WireEndPoints(0, 0, 0, EndWires.at(0), xyzEnd0WireStart, xyzEnd0WireEnd);
144 geo->
WireEndPoints(0, 0, 1, StartWires.at(1), xyzStart1WireStart, xyzStart1WireEnd);
145 geo->
WireEndPoints(0, 0, 1, EndWires.at(1), xyzEnd1WireStart, xyzEnd1WireEnd);
146 geo->
WireEndPoints(0, 0, 2, StartWires.at(2), xyzStart2WireStart, xyzStart2WireEnd);
147 geo->
WireEndPoints(0, 0, 2, EndWires.at(2), xyzEnd2WireStart, xyzEnd2WireEnd);
151 double zMin = xyzStart2WireStart[2];
153 double zMax = xyzEnd2WireStart[2];
161 double slopeU = tan(30*3.14/180.);
162 double slopeV = tan(-30*3.14/180.);
165 double bUup = xyzStart0WireStart[1] - xyzStart0WireStart[2] * slopeU;
166 double bUdn = xyzEnd0WireStart[1] - xyzEnd0WireStart[2] * slopeU;
167 double bVdn = xyzStart1WireStart[1] - xyzStart1WireStart[2] * slopeV;
168 double bVup = xyzEnd1WireStart[1] - xyzEnd1WireStart[2] * slopeV;
170 if ( bUup < bUdn ) { std::cout <<
"Uup and Udn are mixed up!" <<
std::endl; }
171 if ( bVdn > bVup ) { std::cout <<
"Vup and Vdn are mixed up!" <<
std::endl; }
178 double VdnZmin = slopeV * zMin + bVdn;
179 double VdnZmax = slopeV * zMax + bVdn;
180 double VupZmin = slopeV * zMin + bVup;
181 double VupZmax = slopeV * zMax + bVup;
182 double UdnZmin = slopeU * zMin + bUdn;
183 double UdnZmax = slopeU * zMax + bUdn;
184 double UupZmin = slopeU * zMin + bUup;
185 double UupZmax = slopeU * zMax + bUup;
188 std::cout <<
"Y-Plane and U-Plane points [Z,Y]:" <<
std::endl;
189 std::cout <<
"\t\t[ " << zMin <<
", " << UdnZmin <<
"]" <<
std::endl;
190 std::cout <<
"\t\t[ " << zMin <<
", " << UupZmin <<
"]" <<
std::endl;
191 std::cout <<
"\t\t[ " << zMax <<
", " << UupZmax <<
"]" <<
std::endl;
192 std::cout <<
"\t\t[ " << zMax <<
", " << UdnZmax <<
"]" <<
std::endl;
193 std::cout <<
"Y-Plane and V-Plane points [Z,Y]:" <<
std::endl;
194 std::cout <<
"\t\t[ " << zMin <<
", " << VdnZmin <<
"]" <<
std::endl;
195 std::cout <<
"\t\t[ " << zMin <<
", " << VupZmin <<
"]" <<
std::endl;
196 std::cout <<
"\t\t[ " << zMax <<
", " << VupZmax <<
"]" <<
std::endl;
197 std::cout <<
"\t\t[ " << zMax <<
", " << VdnZmax <<
"]" <<
std::endl;
208 std::vector< std::pair<float,float> > WireIntersection;
212 zInt = (bUup-bVup)/(slopeV-slopeU);
213 if ( (zInt > zMin) and (zInt < zMax) )
214 WireIntersection.push_back( std::make_pair( zInt, slopeV*zInt+bVup ) );
216 if ( (VupZmax < UupZmax) and (VupZmax > UdnZmax) )
217 WireIntersection.push_back( std::make_pair( zMax, VupZmax ) );
219 if ( (VupZmin < UupZmin) and ( VupZmin > UdnZmin) )
220 WireIntersection.push_back( std::make_pair( zMin, VupZmin ) );
222 zInt = (bUdn-bVup)/(slopeV-slopeU);
223 if ( (zInt > zMin) and (zInt < zMax) )
224 WireIntersection.push_back( std::make_pair( zInt, slopeV*zInt+bVup ) );
228 zInt = (bUup-bVdn)/(slopeV-slopeU);
229 if ( (zInt > zMin) and (zInt < zMax) )
230 WireIntersection.push_back( std::make_pair( zInt, slopeV*zInt+bVdn ) );
232 if ( (VdnZmax < UupZmax) and (VdnZmax > UdnZmax) )
233 WireIntersection.push_back( std::make_pair( zMax, VdnZmax ) );
235 if ( (VdnZmin < UupZmin) and ( VdnZmin > UdnZmin) )
236 WireIntersection.push_back( std::make_pair( zMin, VdnZmin ) );
238 zInt = (bUdn-bVdn)/(slopeV-slopeU);
239 if ( (zInt > zMin) and (zInt < zMax) )
240 WireIntersection.push_back( std::make_pair( zInt, slopeV*zInt+bVdn ) );
244 if ( (UupZmax < VupZmax) and ( UupZmax > VdnZmax) )
245 WireIntersection.push_back( std::make_pair( zMax, UupZmax ) );
247 if ( (UdnZmax < VupZmax) and ( UdnZmax > VdnZmax) )
248 WireIntersection.push_back( std::make_pair( zMax, UdnZmax ) );
252 if ( (UupZmin < VupZmin) and ( UupZmin > VdnZmin) )
253 WireIntersection.push_back( std::make_pair( zMin, UupZmin ) );
255 if ( (UdnZmin < VupZmin) and ( UdnZmin > VdnZmin) )
256 WireIntersection.push_back( std::make_pair( zMin, UdnZmin ) );
259 if ( WireIntersection.size() == 0 ){
269 double PolyArea = -1;
271 WirePolygon.UntanglePolygon();
274 std::vector< std::pair<float,float> > TPCCorners;
275 TPCCorners.push_back( std::make_pair(0., -geo->
DetHalfHeight()) );
278 TPCCorners.push_back( std::make_pair(0., geo->
DetHalfHeight()) );
280 if (TPCPolygon.Contained(WirePolygon) ){
282 std::cout <<
"Wire Overlap contained in TPC" <<
std::endl;
283 std::cout <<
"Intersection Polygon Coordinates [Z,Y]: " <<
std::endl;
284 for (
unsigned int s=0;
s < WirePolygon.Size();
s++)
285 std::cout <<
"\t\t[ " << WirePolygon.Point(
s).first <<
", " << WirePolygon.Point(
s).second <<
"]" <<
std::endl;
288 PolyArea = WirePolygon.Area();
292 std::cout <<
"Wire overlap not fully contained in TPC" <<
std::endl;
293 std::cout <<
"Intersection Polygon Coordinates [Z,Y]: " <<
std::endl;
294 for (
unsigned int s=0;
s < WirePolygon.Size();
s++)
295 std::cout <<
"\t\t[ " << WirePolygon.Point(
s).first <<
", " << WirePolygon.Point(
s).second <<
"]" <<
std::endl;
299 Polygon2D IntersectionPolygon(TPCPolygon, WirePolygon);
300 PolyArea = IntersectionPolygon.Area();
304 if (
_verbose) { std::cout <<
"Intersection area: " << PolyArea << std::endl <<
std::endl; }
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
reference at(size_type n)
Detector simulation of raw signals on wires.
art::PtrVector< recob::Hit > Hits
void WireEndPoints(geo::WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
Namespace collecting geometry-related classes utilities.
QTextStream & endl(QTextStream &s)
h
training ###############################