25 #include "cetlib_except/exception.h" 36 #include "boost/multi_array.hpp" 57 <<
"Time difference must be greater than zero.";
61 <<
"Z-coordinate difference must be greater than zero.";
65 <<
"Y-coordinate difference must be greater than zero.";
89 unsigned int nwires_u = wireReadoutGeom.Nwires(uplane_id);
90 unsigned int nwires_v = wireReadoutGeom.Nwires(vplane_id);
91 unsigned int nwires_y = wireReadoutGeom.Nwires(zplane_id);
97 for (
unsigned int iu = 0; iu < nwires_u; iu++) {
99 for (
unsigned int iv = 0; iv < nwires_v; iv++) {
101 wireReadoutGeom.WireIDsIntersect(uplane_wire_id,
geo::WireID{vplane_id, iv})
106 for (
unsigned int iy = 0; iy < nwires_y; iy++) {
108 wireReadoutGeom.WireIDsIntersect(uplane_wire_id,
geo::WireID{zplane_id, iy})
124 std::unique_ptr<std::vector<recob::SpacePoint>>& spptCollection,
130 <<
"Time offsets not set before createSpacePoints call!" 131 <<
"\nYou should call SpacePointAlg_TimeSort::setTimeOffsets() in beginRun()!" 132 <<
"\nWill be set now, but you should modify your code!";
137 <<
"Coordinate arrays not filled before createSpacePoints call!" 138 <<
"\nYou should call SpacePointAlg_TimeSort::fillCoordinateArrays() in beginRun()!" 139 <<
"\nWill be filled now, but you should modify your code!";
149 <<
"Sorted " << hitVec_U.size() <<
" u hits, " << hitVec_V.size() <<
" v hits, " 150 << hitVec_Y.size() <<
" y hits.";
153 std::vector<art::Ptr<recob::Hit>>
::iterator ihitu = hitVec_U.begin();
154 std::vector<art::Ptr<recob::Hit>>
::iterator ihitv = hitVec_V.begin();
155 std::vector<art::Ptr<recob::Hit>>
::iterator ihity = hitVec_Y.begin();
156 std::vector<art::Ptr<recob::Hit>>
::iterator ihitv_inner, ihity_inner;
160 double time_hitv_inner, time_hity_inner;
161 while (ihitu != hitVec_U.end()) {
165 <<
"Hit times (u,v,y)=(" << time_hitu <<
"," << time_hitv <<
"," << time_hity <<
")";
170 if (ihitv == hitVec_V.end())
break;
173 if (ihitv == hitVec_V.end())
break;
178 if (ihity == hitVec_Y.end())
break;
181 if (ihity == hitVec_Y.end())
break;
196 mf::LogInfo(
"SpacePointAlg_TimeSort") <<
"Matching hit times (u,v,y)=(" << time_hitu <<
"," 197 << time_hitv <<
"," << time_hity <<
")";
202 time_hitv_inner = (*ihitv_inner)->PeakTime() +
TIME_OFFSET_V;
204 time_hity_inner = (*ihity_inner)->PeakTime() +
TIME_OFFSET_Y;
209 unsigned int uwire = (*ihitu)->WireID().Wire;
210 unsigned int vwire = (*ihitv_inner)->WireID().Wire;
211 unsigned int ywire = (*ihity_inner)->WireID().Wire;
231 xyz[2] = (
coordinates_UV_z[vwire][uwire] + coordinates_UY_z[ywire][uwire]) * 0.5;
234 double t_val = (time_hitu + time_hitv_inner + time_hity_inner) / 3.;
235 double t_err = 0.5 * std::sqrt((time_hitu - t_val) * (time_hitu - t_val) +
236 (time_hitv_inner - t_val) * (time_hitv_inner - t_val) +
237 (time_hity_inner - t_val) * (time_hity_inner - t_val));
243 spptCollection->push_back(spt);
246 std::vector<art::Ptr<recob::Hit>> myhits = {*ihitu, *ihitv_inner, *ihity_inner};
247 spptAssociatedHits->push_back(myhits);
251 if (time_hitv_inner <= time_hity_inner) {
253 if (ihitv_inner == hitVec_V.end())
break;
254 time_hitv_inner = (*ihitv_inner)->PeakTime() +
TIME_OFFSET_V;
258 if (ihity_inner == hitVec_Y.end())
break;
259 time_hity_inner = (*ihity_inner)->PeakTime() +
TIME_OFFSET_Y;
267 <<
"Finished with " << spptCollection->size() <<
" spacepoints.";
274 std::sort(hitVec.begin(), hitVec.end(), HitTimeComparison);
void sortHitsByTime(std::vector< art::Ptr< recob::Hit >> &hits_handle) const
SpacePointAlg_TimeSort(fhicl::ParameterSet const &pset)
float fYDiffMax
Maximum allowed time difference.
void setTimeOffsets(detinfo::DetectorPropertiesData const &detProp)
double GetXTicksCoefficient(int t, int c) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
double GetXTicksOffset(int p, int t, int c) const
Declaration of signal hit object.
The data type to uniquely identify a Plane.
constexpr auto abs(T v)
Returns the absolute value of the argument.
boost::multi_array< double, 2 > coordinates_UV_y
Planes which measure Z direction.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
float fZDiffMax
Maximum allowed y-coordinate difference.
boost::multi_array< double, 2 > coordinates_UY_z
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
bool TIME_OFFSET_SET
Maximum allowed z-coordinate difference.
T get(std::string const &key) const
The data type to uniquely identify a TPC.
Definition of data types for geometry description.
float PeakTime() const
Time of the signal peak, in tick units.
boost::multi_array< double, 2 > coordinates_UY_y
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void fillCoordinatesArrays()
void createSpacePoints(detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> &hitVec_U, std::vector< art::Ptr< recob::Hit >> &hitVec_V, std::vector< art::Ptr< recob::Hit >> &hitVec_Y, std::unique_ptr< std::vector< recob::SpacePoint >> &spptCollection, std::unique_ptr< std::vector< std::vector< art::Ptr< recob::Hit >>>> &spptAssociatedHits)
static constexpr WireIDIntersection invalid()
cet::coded_exception< error, detail::translate > exception
boost::multi_array< double, 2 > coordinates_UV_z