25 #include "cetlib_except/exception.h" 36 #include "boost/multi_array.hpp" 58 <<
"Time difference must be greater than zero.";
62 <<
"Z-coordinate difference must be greater than zero.";
66 <<
"Y-coordinate difference must be greater than zero.";
95 for (
unsigned int iu = 0; iu < nwires_u; iu++) {
96 for (
unsigned int iv = 0; iv < nwires_v; iv++) {
106 for (
unsigned int iy = 0; iy < nwires_y; iy++) {
128 std::unique_ptr<std::vector<recob::SpacePoint>>& spptCollection,
134 <<
"Time offsets not set before createSpacePoints call!" 135 <<
"\nYou should call SpacePointAlg_TimeSort::setTimeOffsets() in beginRun()!" 136 <<
"\nWill be set now, but you should modify your code!";
141 <<
"Coordinate arrays not filled before createSpacePoints call!" 142 <<
"\nYou should call SpacePointAlg_TimeSort::fillCoordinateArrays() in beginRun()!" 143 <<
"\nWill be filled now, but you should modify your code!";
153 <<
"Sorted " << hitVec_U.size() <<
" u hits, " << hitVec_V.size() <<
" v hits, " 154 << hitVec_Y.size() <<
" y hits.";
157 std::vector<art::Ptr<recob::Hit>>
::iterator ihitu = hitVec_U.begin();
158 std::vector<art::Ptr<recob::Hit>>
::iterator ihitv = hitVec_V.begin();
159 std::vector<art::Ptr<recob::Hit>>
::iterator ihity = hitVec_Y.begin();
160 std::vector<art::Ptr<recob::Hit>>
::iterator ihitv_inner, ihity_inner;
164 double time_hitv_inner, time_hity_inner;
165 while (ihitu != hitVec_U.end()) {
169 <<
"Hit times (u,v,y)=(" << time_hitu <<
"," << time_hitv <<
"," << time_hity <<
")";
174 if (ihitv == hitVec_V.end())
break;
177 if (ihitv == hitVec_V.end())
break;
182 if (ihity == hitVec_Y.end())
break;
185 if (ihity == hitVec_Y.end())
break;
200 mf::LogInfo(
"SpacePointAlg_TimeSort") <<
"Matching hit times (u,v,y)=(" << time_hitu <<
"," 201 << time_hitv <<
"," << time_hity <<
")";
206 time_hitv_inner = (*ihitv_inner)->PeakTime() +
TIME_OFFSET_V;
208 time_hity_inner = (*ihity_inner)->PeakTime() +
TIME_OFFSET_Y;
213 unsigned int uwire = (*ihitu)->WireID().Wire;
214 unsigned int vwire = (*ihitv_inner)->WireID().Wire;
215 unsigned int ywire = (*ihity_inner)->WireID().Wire;
235 xyz[2] = (
coordinates_UV_z[vwire][uwire] + coordinates_UY_z[ywire][uwire]) * 0.5;
238 double t_val = (time_hitu + time_hitv_inner + time_hity_inner) / 3.;
239 double t_err = 0.5 * std::sqrt((time_hitu - t_val) * (time_hitu - t_val) +
240 (time_hitv_inner - t_val) * (time_hitv_inner - t_val) +
241 (time_hity_inner - t_val) * (time_hity_inner - t_val));
247 spptCollection->push_back(spt);
250 std::vector<art::Ptr<recob::Hit>> myhits = {*ihitu, *ihitv_inner, *ihity_inner};
251 spptAssociatedHits->push_back(myhits);
255 if (time_hitv_inner <= time_hity_inner) {
257 if (ihitv_inner == hitVec_V.end())
break;
258 time_hitv_inner = (*ihitv_inner)->PeakTime() +
TIME_OFFSET_V;
262 if (ihity_inner == hitVec_Y.end())
break;
263 time_hity_inner = (*ihity_inner)->PeakTime() +
TIME_OFFSET_Y;
271 <<
"Finished with " << spptCollection->size() <<
" spacepoints.";
279 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
boost::multi_array< double, 2 > coordinates_UV_y
Planes which measure Z direction.
float fZDiffMax
Maximum allowed y-coordinate difference.
boost::multi_array< double, 2 > coordinates_UY_z
U view on both sides of the APA.
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.
art framework interface to geometry description
bool TIME_OFFSET_SET
Maximum allowed z-coordinate difference.
T get(std::string const &key) const
bool IntersectionPoint(geo::WireID const &wid1, geo::WireID const &wid2, double &y, double &z) const
Returns the intersection point of two wires.
Definition of data types for geometry description.
float PeakTime() const
Time of the signal peak, in tick units.
Declaration of signal hit object.
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)
cet::coded_exception< error, detail::translate > exception
V view on both sides of the APA.
boost::multi_array< double, 2 > coordinates_UV_z