1 #ifndef RECOTOOL_CFALGOSTARTPOINTCOMPAT_CXX 2 #define RECOTOOL_CFALGOSTARTPOINTCOMPAT_CXX 34 if(clusters.size()==2)
return -1;
41 if ( clusters.size() != 3 )
47 double startWirecm0 = clusters.at(0)->GetParams().start_point.w;
48 double startTimecm0 = clusters.at(0)->GetParams().start_point.t;
49 int startWire0 = int( startWirecm0 /
_w2cm );
50 unsigned int Pl0 = clusters.at(0)->GetParams().start_point.plane;
52 double startWirecm1 = clusters.at(1)->GetParams().start_point.w;
53 double startTimecm1 = clusters.at(1)->GetParams().start_point.t;
54 int startWire1 = int( startWirecm1 /
_w2cm );
55 unsigned int Pl1 = clusters.at(1)->GetParams().start_point.plane;
57 double startWirecm2 = clusters.at(2)->GetParams().start_point.w;
58 double startTimecm2 = clusters.at(2)->GetParams().start_point.t;
59 int startWire2 = int( startWirecm2 /
_w2cm );
60 unsigned int Pl2 = clusters.at(2)->GetParams().start_point.plane;
69 double yS01, zS01, yS02, zS02, yS12, zS12;
94 Double_t Start2[3] = {-100., yS01, zS01};
95 Double_t Start1[3] = {-100., yS02, zS02};
96 Double_t Start0[3] = {-100., yS12, zS12};
97 UInt_t WireStart0 = 0;
98 UInt_t WireStart1 = 0;
99 UInt_t WireStart2 = 0;
100 try { WireStart0 = geo->
NearestWire( Start0, Pl0); }
103 std::cout << e.what() << std::endl;
104 std::cout <<
"Exception caught!" << std::endl;
107 try { WireStart1 = geo->
NearestWire( Start1, Pl1); }
110 std::cout << e.what() << std::endl;
111 std::cout <<
"Exception caught!" << std::endl;
114 try { WireStart2 = geo->
NearestWire( Start2, Pl2); }
117 std::cout << e.what() << std::endl;
118 std::cout <<
"Exception caught!" << std::endl;
123 std::vector<util::PxHit> hits0 = clusters.at(0)->GetHitVector();
124 std::vector<util::PxHit> hits1 = clusters.at(1)->GetHitVector();
125 std::vector<util::PxHit> hits2 = clusters.at(2)->GetHitVector();
127 double minWire0 = 9999;
128 double minWire1 = 9999;
129 double minWire2 = 9999;
133 double minTime0 = 9999;
134 double minTime1 = 9999;
135 double minTime2 = 9999;
140 double hitTimeTMP = 0;
142 for (
auto& h: hits0){
143 hitWireTMP = int(h.w/
_w2cm);
144 hitTimeTMP = int(h.t/
_t2cm);
145 if ( hitWireTMP < minWire0 ) { minWire0 = hitWireTMP; }
146 if ( hitWireTMP > maxWire0 ) { maxWire0 = hitWireTMP; }
147 if ( hitTimeTMP < minTime0 ) { minTime0 = hitTimeTMP; }
148 if ( hitTimeTMP > maxTime0 ) { maxTime0 = hitTimeTMP; }
150 for (
auto& h: hits1){
151 hitWireTMP = int(h.w/
_w2cm);
152 hitTimeTMP = int(h.t/
_t2cm);
153 if ( hitWireTMP < minWire1 ) { minWire1 = hitWireTMP; }
154 if ( hitWireTMP > maxWire1 ) { maxWire1 = hitWireTMP; }
155 if ( hitTimeTMP < minTime1 ) { minTime1 = hitTimeTMP; }
156 if ( hitTimeTMP > maxTime1 ) { maxTime1 = hitTimeTMP; }
158 for (
auto& h: hits2){
159 hitWireTMP = int(h.w/
_w2cm);
160 hitTimeTMP = int(h.t/
_t2cm);
161 if ( hitWireTMP < minWire2 ) { minWire2 = hitWireTMP; }
162 if ( hitWireTMP > maxWire2 ) { maxWire2 = hitWireTMP; }
163 if ( hitTimeTMP < minTime2 ) { minTime2 = hitTimeTMP; }
164 if ( hitTimeTMP > maxTime2 ) { maxTime2 = hitTimeTMP; }
168 std::cout <<
"Start W,T on plane 0: " <<
"[ " << startWirecm0 <<
", " << startTimecm0 <<
" ]" << std::endl;
169 std::cout <<
"Start Wire, planne 0: " << startWire0 << std::endl;
170 std::cout <<
"Start W,T on plane 1: " <<
"[ " << startWirecm1 <<
", " << startTimecm1 <<
" ]" << std::endl;
171 std::cout <<
"Start Wire, planne 1: " << startWire1 << std::endl;
172 std::cout <<
"Start W,T on plane 2: " <<
"[ " << startWirecm2 <<
", " << startTimecm2 <<
" ]" << std::endl;
173 std::cout <<
"Start Wire, planne 2: " << startWire2 << std::endl;
174 std::cout << std::endl;
175 std::cout <<
"Start Reco Point from clusters on planes 1 and 2 (Z,Y):" << std::endl
176 <<
"[ " << zS12 <<
", " << yS12 <<
" ]" << std::endl;
177 std::cout <<
"Nearest wire on Pl0 to reco-start point from Pl1, Pl2:" << std::endl
178 << WireStart0 << std::endl;
179 std::cout <<
"Min-Max Wire for Hits from Cluster on Plane 0:" << std::endl
180 <<
"[ " << minWire0 <<
", " << maxWire0 <<
" ]" << std::endl;
181 std::cout <<
"Start Reco Point from clusters on planes 0 and 2 (Z,Y):" << std::endl
182 <<
"[ " << zS02 <<
", " << yS02 <<
" ]" << std::endl;
183 std::cout <<
"Nearest wire on Pl1 to reco-start point from Pl0, Pl2:" << std::endl
184 << WireStart1 << std::endl;
185 std::cout <<
"Min-Max Wire for Hits from Cluster on Plane 1:" << std::endl
186 <<
"[ " << minWire1 <<
", " << maxWire1 <<
" ]" << std::endl;
187 std::cout <<
"Start Reco Point from clusters on planes 0 and 1 (Z,Y):" << std::endl
188 <<
"[ " << zS01 <<
", " << yS01 <<
" ]" << std::endl;
189 std::cout <<
"Nearest wire on Pl2 to reco-start point from Pl0, Pl1:" << std::endl
190 << WireStart2 << std::endl;
191 std::cout <<
"Min-Max Wire for Hits from Cluster on Plane 2:" << std::endl
192 <<
"[ " << minWire2 <<
", " << maxWire2 <<
" ]" << std::endl;
193 std::cout << std::endl;
197 double compat = 9999;
200 if ( (WireStart0 > minWire0) and (WireStart0 < maxWire0) ){
201 if (
std::min( (WireStart0-minWire0) , (maxWire0-WireStart0) ) < compat ){
202 compat =
std::min( (WireStart0-minWire0) , (maxWire0-WireStart0) );
205 if ( (WireStart1 > minWire1) and (WireStart1 < maxWire1) ){
206 if (
std::min( (WireStart0-minWire0) , (maxWire0-WireStart0) ) < compat ){
207 compat =
std::min( (WireStart0-minWire0) , (maxWire0-WireStart0) );
210 if ( (WireStart2 > minWire2) and (WireStart2 < maxWire2) ){
211 if (
std::min( (WireStart0-minWire0) , (maxWire0-WireStart0) ) < compat ){
212 compat =
std::min( (WireStart0-minWire0) , (maxWire0-WireStart0) );
216 if ( compat != 9999 )
Double_t TimeToCm() const
Double_t WireToCm() const
Class def header for a class CFAlgoStartPointCompat.
geo::WireID::WireID_t NearestWire(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the index of wire closest to position in the specified TPC.
bool IntersectionPoint(geo::WireID const &wid1, geo::WireID const &wid2, double &y, double &z) const
Returns the intersection point of two wires.
Namespace collecting geometry-related classes utilities.
cet::coded_exception< error, detail::translate > exception