24 = lar::providerFrom<detinfo::DetectorPropertiesService>();
32 double x = detprop->ConvertTicksToX(src->
PeakTime(), plane, tpc, cryo);
37 globalWire = geom->
WireCoordinate(wireCentre[1], wireCentre[2], plane, 0, cryo);
42 globalWire = geom->
WireCoordinate(wireCentre[1], wireCentre[2], plane, 1, cryo);
76 std::vector< art::Ptr< recob::Hit > > vec;
77 for (
unsigned int i = 0; i <
fHits2D.size(); i++)
81 vec.push_back(
fHits2D[i]->GetHitPtr());
82 if (vec.size() == nhits)
break;
95 for (
unsigned int i = 0; i <
fNbins; i++)
111 TVector2 vstart(0, 1);
113 unsigned int saveid = 0;
bool exist =
false;
114 for (
unsigned int i = 0; i <
fPoints2D.size(); i++)
118 TVector2 pos(
fPoints2D[i]->GetPointCm());
120 TVector2 vecp = pos - centre;
121 float sinsign = (vstart.X() * vecp.Y()) - (vstart.Y() * vecp.X());
122 float cosine = (vstart * vecp) / vecp.Mod();
123 float theta = 180.0F * (std::acos(cosine)) / TMath::Pi();
125 unsigned int id = 0;
double bin = double(360.0) / double(
fNbins);
127 if (sinsign >= 0)
id = int (theta / bin);
128 else if (sinsign < 0)
id = int (theta / bin) + (
fNbins / 2);
134 else {saveid = i; exist =
true;}
144 unsigned int saveid = 0;
145 for (
unsigned int i = 0; i <
fNbins; i++)
160 unsigned int iprev, inext;
167 double sumcharge = 0.0;
168 for (
unsigned int i = 0; i <
fNbins; i++)
184 fIsCandidateIDset(false)
188 for (
unsigned int i = 0; i < src.size(); i++)
196 for (
unsigned int i = 0; i <
fNbins; i++)
210 double nomx = 0.0;
double nomy = 0.0;
212 for (
unsigned int i = 0; i <
fPoints2D.size(); i++)
219 double bx = nomx / denom;
double by = nomy / denom;
225 TVector2 vstart(0, 1);
227 for (
unsigned int i = 0; i <
fPoints2D.size(); i++)
231 float sinsign = (vstart.X() * vecp.Y()) - (vstart.Y() * vecp.X());
232 float cosine = (vstart * vecp) / (vstart.Mod() * vecp.Mod());
233 float theta = 180.0F * (std::acos(cosine)) / TMath::Pi();
235 unsigned int id = 0;
double bin = double(360.0) / double(
fNbins);
237 if (sinsign >= 0)
id = int (theta / bin);
238 else if (sinsign < 0)
id = int (theta / bin) + (
fNbins/2);
244 for (
unsigned int id = 0;
id <
fBins.size();
id++)
fBins[
id].Sort();
250 double maxdist2 = 0.0;
252 for (
unsigned int id = 0;
id <
fBins.size();
id++)
255 if (!
fBins[
id].Size())
continue;
257 Hit2D* candidate =
fBins[id].GetHits2D().front();
261 if (dist2 > maxdist2)
274 for (
unsigned int id = 0;
id <
fNbins;
id++)
277 if (!
fBins[
id].Size())
continue;
279 std::vector< Hit2D* > points;
280 Hit2D* candidate2D =
fBins[id].GetHits2D().front();
282 for (
unsigned int i = 0; i <
fPoints2D.size(); i++)
287 if ((distnorm > 0.5) && (dist2 < rad*rad)) points.push_back(
fPoints2D[i]);
291 if (
fBins[
id].Size() > 1)
293 EndPoint ep(*candidate2D, points, nbins);
304 for (
unsigned int i = 0; i <
fCandidates.size(); i++)
315 double max_asymmetry = 0.0;
316 unsigned int saveid = 0;
bool found =
false;
318 double maxdist2 = 0.0;
double maxcharge = 0.0;
319 unsigned int idmaxdist = 0;
unsigned int idmaxcharge = 0;
321 for (
unsigned int i = 0; i <
fCandidates.size(); i++)
325 if (dist2 > maxdist2) { maxdist2 = dist2; idmaxdist = i;}
326 if (charge > maxcharge) { maxcharge = charge; idmaxcharge = i;}
329 maxdist2 = 0.0;
unsigned int idmaxdistb = 0;
332 if ((i == idmaxdist) || (i == idmaxcharge))
continue;
335 if (dist2 > maxdist2) { maxdist2 = dist2; idmaxdistb = i;}
340 for (
unsigned int i = 0; i <
fCandidates.size(); i++)
344 if ((i == idmaxdist) || (i == idmaxcharge) || (i == idmaxdistb))
346 if (asymmetry > max_asymmetry)
348 max_asymmetry = asymmetry;
349 saveid = i; found =
true;
356 for (
unsigned int i = 0; i <
fCandidates.size(); i++)
360 if ((i == idmaxdist) || (i == idmaxdistb))
362 if (asymmetry > max_asymmetry)
364 max_asymmetry = asymmetry;
365 saveid = i; found =
true;
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
std::vector< Hit2D * > fPoints2D
Utilities related to art service access.
DirOfGamma(const std::vector< art::Ptr< recob::Hit > > &src, unsigned int nbins, unsigned int idcl)
art::Ptr< recob::Hit > const & GetHitPtr(void) const
double Dist2(const TVector2 &v1, const TVector2 &v2)
geo::WireID WireID() const
Initial tdc tick for hit.
void ComputeMaxCharge(void)
CryostatID_t Cryostat
Index of cryostat.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
void FindInitialPart(void)
std::vector< Bin2D > fBins
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< art::Ptr< recob::Hit > > fIniHits
void ComputeBaryCenter(void)
std::vector< Hit2D * > fPoints2D
const TVector2 & fCenter2D
std::vector< Bin2D > fBins
EndPoint(const Hit2D ¢er, const std::vector< Hit2D * > &hits, unsigned int nbins)
Implementation of the Projection Matching Algorithm.
PlaneID_t Plane
Index of the plane within its TPC.
Description of geometry of one entire detector.
std::vector< art::Ptr< recob::Hit > > GetIniHits(const double radius=10.0, const unsigned int nhits=10) const
Detector simulation of raw signals on wires.
Encapsulate the geometry of a wire.
TVector2 const & GetPointCm(void) const
bool FindCandidates(void)
double GetCharge(void) const
Implementation of the Projection Matching Algorithm.
float PeakTime() const
Time of the signal peak, in tick units.
void ComputeMaxDist(void)
Encapsulate the construction of a single detector plane.
std::vector< Hit2D * > fHits2D
float SummedADC() const
The sum of calibrated ADC counts of the hit (0. by default)
TPCID_t TPC
Index of the TPC within its cryostat.
double GetAsymmetry(void) const
std::vector< art::Ptr< recob::Hit > > fHits
art framework interface to geometry description
art::Ptr< recob::Hit > fStartHit
Encapsulate the construction of a single detector plane.
std::vector< EndPoint > fCandidates
WireGeo const & WireIDToWireGeo(geo::WireID const &wireid) const
Returns the specified wire.
Bin2D(const TVector2 ¢er)
Hit2D(art::Ptr< recob::Hit > src)