29 globalWire = geom->
WireCoordinate(wireCentre[1], wireCentre[2], plane, 0, cryo);
33 globalWire = geom->
WireCoordinate(wireCentre[1], wireCentre[2], plane, 1, cryo);
62 std::vector<art::Ptr<recob::Hit>>
66 std::vector<art::Ptr<recob::Hit>> vec;
67 for (
unsigned int i = 0; i <
fHits2D.size(); i++) {
69 vec.push_back(
fHits2D[i]->GetHitPtr());
70 if (vec.size() == nhits)
break;
78 :
fCenter2D(center), fPoints2D(hits), fNbins(nbins)
81 for (
unsigned int i = 0; i <
fNbins; i++) {
97 TVector2 vstart(0, 1);
99 unsigned int saveid = 0;
101 for (
unsigned int i = 0; i <
fPoints2D.size(); i++) {
105 TVector2 vecp = pos - centre;
106 float sinsign = (vstart.X() * vecp.Y()) - (vstart.Y() * vecp.X());
107 float cosine = (vstart * vecp) / vecp.Mod();
108 float theta = 180.0F * (std::acos(cosine)) / TMath::Pi();
111 double bin = double(360.0) / double(
fNbins);
114 id =
int(theta / bin);
115 else if (sinsign < 0)
129 for (
unsigned int id = 0;
id <
fNbins;
id++)
137 unsigned int saveid = 0;
138 for (
unsigned int i = 0; i <
fNbins; i++)
153 unsigned int iprev, inext;
162 double sumcharge = 0.0;
163 for (
unsigned int i = 0; i <
fNbins; i++)
165 sumcharge +=
fBins[i].GetTotCharge();
181 :
fNbins(nbins), fIdCl(idcl), fCandidateID(0), fIsCandidateIDset(false)
185 for (
unsigned int i = 0; i < src.size(); i++) {
192 for (
unsigned int i = 0; i <
fNbins; i++)
209 for (
unsigned int i = 0; i <
fPoints2D.size(); i++) {
215 double bx = nomx / denom;
216 double by = nomy / denom;
223 TVector2 vstart(0, 1);
225 for (
unsigned int i = 0; i <
fPoints2D.size(); i++) {
228 float sinsign = (vstart.X() * vecp.Y()) - (vstart.Y() * vecp.X());
229 float cosine = (vstart * vecp) / (vstart.Mod() * vecp.Mod());
230 float theta = 180.0F * (std::acos(cosine)) / TMath::Pi();
233 double bin = double(360.0) / double(
fNbins);
236 id =
int(theta / bin);
237 else if (sinsign < 0)
244 for (
unsigned int id = 0;
id <
fBins.size();
id++)
251 double maxdist2 = 0.0;
253 for (
unsigned int id = 0;
id <
fBins.size();
id++) {
255 if (!
fBins[
id].Size())
continue;
257 Hit2D* candidate =
fBins[id].GetHits2D().front();
260 if (dist2 > maxdist2) { maxdist2 = dist2; }
272 for (
unsigned int id = 0;
id <
fNbins;
id++) {
274 if (!
fBins[
id].Size())
continue;
276 std::vector<Hit2D*> points;
277 Hit2D* candidate2D =
fBins[id].GetHits2D().front();
279 for (
unsigned int i = 0; i <
fPoints2D.size(); i++) {
283 if ((distnorm > 0.5) && (dist2 < rad *
rad)) points.push_back(
fPoints2D[i]);
286 if (
fBins[
id].Size() > 1) {
287 EndPoint ep(*candidate2D, points, nbins);
301 for (
unsigned int i = 0; i <
fCandidates.size(); i++) {
311 double max_asymmetry = 0.0;
312 unsigned int saveid = 0;
315 double maxdist2 = 0.0;
316 double maxcharge = 0.0;
317 unsigned int idmaxdist = 0;
318 unsigned int idmaxcharge = 0;
320 for (
unsigned int i = 0; i <
fCandidates.size(); i++) {
323 if (dist2 > maxdist2) {
327 if (charge > maxcharge) {
334 unsigned int idmaxdistb = 0;
336 if ((i == idmaxdist) || (i == idmaxcharge))
continue;
339 if (dist2 > maxdist2) {
346 for (
unsigned int i = 0; i <
fCandidates.size(); i++) {
349 if ((i == idmaxdist) || (i == idmaxcharge) || (i == idmaxdistb)) {
350 if (asymmetry > max_asymmetry) {
351 max_asymmetry = asymmetry;
359 for (
unsigned int i = 0; i <
fCandidates.size(); i++) {
362 if ((i == idmaxdist) || (i == idmaxdistb)) {
363 if (asymmetry > max_asymmetry) {
364 max_asymmetry = asymmetry;
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
static constexpr double rad
DirOfGamma(const detinfo::DetectorPropertiesData &detProp, const std::vector< art::Ptr< recob::Hit >> &src, unsigned int nbins, unsigned int idcl)
double Dist2(const TVector2 &v1, const TVector2 &v2)
geo::WireID WireID() const
std::vector< art::Ptr< recob::Hit > > fHits
CryostatID_t Cryostat
Index of cryostat.
std::vector< Hit2D * > fPoints2D
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::vector< Hit2D * > fHits2D
art framework interface to geometry description
art::Ptr< recob::Hit > const & GetHitPtr() const
std::vector< Bin2D > fBins
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.
QTextStream & bin(QTextStream &s)
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
std::vector< art::Ptr< recob::Hit > > fIniHits
std::vector< Hit2D * > fPoints2D
WireGeo const & WireIDToWireGeo(geo::WireID const &wireid) const
Bin2D(const TVector2 ¢er)