18 auto const& wireID = src->
WireID();
23 double const globalWire =
50 const unsigned int nhits)
const 53 std::vector<art::Ptr<recob::Hit>> vec;
54 for (
unsigned int i = 0; i <
fHits2D.size(); i++) {
56 vec.push_back(
fHits2D[i]->GetHitPtr());
57 if (vec.size() == nhits)
break;
65 :
fCenter2D(center), fPoints2D(hits), fNbins(nbins)
68 for (
unsigned int i = 0; i <
fNbins; i++) {
83 TVector2 vstart(0, 1);
85 unsigned int saveid = 0;
87 for (
unsigned int i = 0; i <
fPoints2D.size(); i++) {
91 TVector2 vecp = pos - centre;
92 float sinsign = (vstart.X() * vecp.Y()) - (vstart.Y() * vecp.X());
93 float cosine = (vstart * vecp) / vecp.Mod();
94 float theta = 180.0F * (std::acos(cosine)) / TMath::Pi();
97 double bin = double(360.0) / double(
fNbins);
100 id = int(theta / bin);
101 else if (sinsign < 0)
102 id = int(theta / bin) + (
fNbins / 2);
115 for (
unsigned int id = 0;
id <
fNbins;
id++)
122 unsigned int saveid = 0;
123 for (
unsigned int i = 0; i <
fNbins; i++)
137 unsigned int iprev, inext;
146 double sumcharge = 0.0;
147 for (
unsigned int i = 0; i <
fNbins; i++)
149 sumcharge +=
fBins[i].GetTotCharge();
164 :
fNbins(nbins), fIdCl(idcl), fCandidateID(0), fIsCandidateIDset(false)
168 for (
unsigned int i = 0; i < src.size(); i++) {
175 for (
unsigned int i = 0; i <
fNbins; i++)
191 for (
unsigned int i = 0; i <
fPoints2D.size(); i++) {
197 double bx = nomx / denom;
198 double by = nomy / denom;
204 TVector2 vstart(0, 1);
206 for (
unsigned int i = 0; i <
fPoints2D.size(); i++) {
209 float sinsign = (vstart.X() * vecp.Y()) - (vstart.Y() * vecp.X());
210 float cosine = (vstart * vecp) / (vstart.Mod() * vecp.Mod());
211 float theta = 180.0F * (std::acos(cosine)) / TMath::Pi();
214 double bin = double(360.0) / double(
fNbins);
217 id = int(theta / bin);
218 else if (sinsign < 0)
219 id = int(theta / bin) + (
fNbins / 2);
225 for (
unsigned int id = 0;
id <
fBins.size();
id++)
231 double maxdist2 = 0.0;
233 for (
unsigned int id = 0;
id <
fBins.size();
id++) {
235 if (!
fBins[
id].Size())
continue;
237 Hit2D* candidate =
fBins[id].GetHits2D().front();
240 if (dist2 > maxdist2) { maxdist2 = dist2; }
250 unsigned int nbins =
fNbins * 4;
251 for (
unsigned int id = 0;
id <
fNbins;
id++) {
253 if (!
fBins[
id].Size())
continue;
255 std::vector<Hit2D*> points;
256 Hit2D* candidate2D =
fBins[id].GetHits2D().front();
258 for (
unsigned int i = 0; i <
fPoints2D.size(); i++) {
262 if ((distnorm > 0.5) && (dist2 < rad * rad)) points.push_back(
fPoints2D[i]);
265 if (
fBins[
id].Size() > 1) {
266 EndPoint ep(*candidate2D, points, nbins);
279 for (
unsigned int i = 0; i <
fCandidates.size(); i++) {
288 double max_asymmetry = 0.0;
289 unsigned int saveid = 0;
292 double maxdist2 = 0.0;
293 double maxcharge = 0.0;
294 unsigned int idmaxdist = 0;
295 unsigned int idmaxcharge = 0;
297 for (
unsigned int i = 0; i <
fCandidates.size(); i++) {
300 if (dist2 > maxdist2) {
304 if (charge > maxcharge) {
311 unsigned int idmaxdistb = 0;
313 if ((i == idmaxdist) || (i == idmaxcharge))
continue;
316 if (dist2 > maxdist2) {
323 for (
unsigned int i = 0; i <
fCandidates.size(); i++) {
326 if ((i == idmaxdist) || (i == idmaxcharge) || (i == idmaxdistb)) {
327 if (asymmetry > max_asymmetry) {
328 max_asymmetry = asymmetry;
336 for (
unsigned int i = 0; i <
fCandidates.size(); i++) {
339 if ((i == idmaxdist) || (i == idmaxdistb)) {
340 if (asymmetry > max_asymmetry) {
341 max_asymmetry = asymmetry;
Length_t WireCoordinate(Point_t const &pos, PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
DirOfGamma(const detinfo::DetectorPropertiesData &detProp, const std::vector< art::Ptr< recob::Hit >> &src, unsigned int nbins, unsigned int idcl)
Point_t const & GetCenter() const
Returns the world coordinate of the center of the wire [cm].
WireGeo const & WireIDToWireGeo(WireID const &wireid) const
Returns the specified wire.
Utilities related to art service access.
double Dist2(const TVector2 &v1, const TVector2 &v2)
The data type to uniquely identify a Plane.
std::vector< art::Ptr< recob::Hit > > fHits
CryostatID_t Cryostat
Index of cryostat.
std::vector< Hit2D * > fPoints2D
geo::WireID const & WireID() const
Initial tdc tick for hit.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::vector< Hit2D * > fHits2D
art::Ptr< recob::Hit > const & GetHitPtr() const
std::vector< Bin2D > fBins
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
const TVector2 & fCenter2D
key_type key() const noexcept
Hit2D(detinfo::DetectorPropertiesData const &detProp, art::Ptr< recob::Hit > src)
EndPoint(const Hit2D ¢er, const std::vector< Hit2D * > &hits, unsigned int nbins)
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.
double ConvertTicksToX(double ticks, int p, int t, int c) const
Implementation of the Projection Matching Algorithm.
float PeakTime() const
Time of the signal peak, in tick units.
float SummedADC() const
The sum of calibrated ADC counts of the hit (0. by default)
std::vector< EndPoint > fCandidates
TVector2 const & GetPointCm() const
double GetAsymmetry() const
TPCID_t TPC
Index of the TPC within its cryostat.
std::vector< Bin2D > fBins
art::Ptr< recob::Hit > fStartHit
art framework interface to geometry description
std::vector< art::Ptr< recob::Hit > > fIniHits
std::vector< Hit2D * > fPoints2D
Bin2D(const TVector2 ¢er)