32 #include "boost/multi_array.hpp" 54 mf::LogError(
"SpacePointAlg_TimeSort") <<
"Time difference must be greater than zero.";
58 mf::LogError(
"SpacePointAlg_TimeSort") <<
"Z-coordinate difference must be greater than zero.";
62 mf::LogError(
"SpacePointAlg_TimeSort") <<
"Y-coordinate difference must be greater than zero.";
92 for(
unsigned int iu=0; iu<nwires_u; iu++){
93 for(
unsigned int iv=0; iv<nwires_v; iv++){
100 for(
unsigned int iy=0; iy<nwires_y; iy++){
116 std::unique_ptr<std::vector<recob::SpacePoint> > &spptCollection,
122 <<
"Time offsets not set before createSpacePoints call!" 123 <<
"\nYou should call SpacePointAlg_TimeSort::setTimeOffsets() in beginRun()!" 124 <<
"\nWill be set now, but you should modify your code!";
129 <<
"Coordinate arrays not filled before createSpacePoints call!" 130 <<
"\nYou should call SpacePointAlg_TimeSort::fillCoordinateArrays() in beginRun()!" 131 <<
"\nWill be filled now, but you should modify your code!";
142 << hitVec_U.size() <<
" u hits, " 143 << hitVec_V.size() <<
" v hits, " 144 << hitVec_Y.size() <<
" y hits.";
147 std::vector< art::Ptr<recob::Hit> >
::iterator ihitu = hitVec_U.begin();
148 std::vector< art::Ptr<recob::Hit> >
::iterator ihitv = hitVec_V.begin();
149 std::vector< art::Ptr<recob::Hit> >
::iterator ihity = hitVec_Y.begin();
150 std::vector< art::Ptr<recob::Hit> >
::iterator ihitv_inner,ihity_inner;
154 double time_hitv_inner,time_hity_inner;
155 while(ihitu != hitVec_U.end()){
159 <<
"Hit times (u,v,y)=(" 167 if(ihitv==hitVec_V.end())
break;
170 if(ihitv==hitVec_V.end())
break;
175 if(ihity==hitVec_Y.end())
break;
178 if(ihity==hitVec_Y.end())
break;
193 <<
"Matching hit times (u,v,y)=(" 201 time_hitv_inner = (*ihitv_inner)->PeakTime() +
TIME_OFFSET_V;
203 time_hity_inner = (*ihity_inner)->PeakTime() +
TIME_OFFSET_Y;
207 unsigned int uwire = (*ihitu)->WireID().Wire;
208 unsigned int vwire = (*ihitv_inner)->WireID().Wire;
209 unsigned int ywire = (*ihity_inner)->WireID().Wire;
212 <<
"(y,z) coordinate for uv/uy: (" 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);
252 if(time_hitv_inner <= time_hity_inner){
254 if(ihitv_inner==hitVec_V.end())
break;
255 time_hitv_inner = (*ihitv_inner)->PeakTime() +
TIME_OFFSET_V;
259 if(ihity_inner==hitVec_Y.end())
break;
260 time_hity_inner = (*ihity_inner)->PeakTime() +
TIME_OFFSET_Y;
269 <<
"Finished with " << spptCollection->size() <<
" spacepoints.";
SpacePointAlg_TimeSort(fhicl::ParameterSet const &pset)
float fYDiffMax
Maximum allowed time difference.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Declaration of signal hit object.
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
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
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.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
bool TIME_OFFSET_SET
Maximum allowed z-coordinate difference.
bool HitTimeComparison(art::Ptr< recob::Hit > a, art::Ptr< recob::Hit > b)
virtual double GetXTicksCoefficient(int t, int c) const =0
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.
void createSpacePoints(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)
Utility object to perform functions of association.
boost::multi_array< double, 2 > coordinates_UY_y
void reconfigure(fhicl::ParameterSet const &pset)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void fillCoordinatesArrays()
~SpacePointAlg_TimeSort()
art framework interface to geometry description
void sortHitsByTime(std::vector< art::Ptr< recob::Hit > > &hits_handle)
boost::multi_array< double, 2 > coordinates_UV_z
virtual double GetXTicksOffset(int p, int t, int c) const =0