27 for (
unsigned int i = 0; i < 3; i++) {
58 std::vector<pma::Hit3D*> hitsColl, hitsInd1, hitsInd2;
59 for (
size_t i = 0; i < 3; ++i)
63 switch (h->View2D()) {
64 case geo::kZ: hitsColl.push_back(h);
break;
65 case geo::kV: hitsInd2.push_back(h);
break;
66 case geo::kU: hitsInd1.push_back(h);
break;
75 for (
size_t b = 0; b < chain->
NextCount(); b++) {
79 switch (h->View2D()) {
80 case geo::kZ: hitsColl.push_back(h);
break;
81 case geo::kV: hitsInd2.push_back(h);
break;
82 case geo::kU: hitsInd1.push_back(h);
break;
89 switch (h->View2D()) {
90 case geo::kZ: hitsColl.push_back(h);
break;
91 case geo::kV: hitsInd2.push_back(h);
break;
92 case geo::kU: hitsInd1.push_back(h);
break;
103 float amp, sigmaMax = 0.0F;
105 fNHits[0] = hitsInd1.size();
106 for (
size_t i = 0; i < hitsInd1.size(); i++) {
107 amp = hitsInd1[i]->GetAmplitude();
108 if (amp > sigmaMax) sigmaMax = amp;
111 for (
size_t i = 0; i < hitsInd1.size(); i++) {
112 if (sigmaMax > 0.0F) {
113 amp = hitsInd1[i]->GetAmplitude();
115 hitsInd1[i]->SetSigmaFactor((
float)sqrt(amp / sigmaMax));
117 hitsInd1[i]->SetSigmaFactor(0.01F);
120 hitsInd1[i]->SetSigmaFactor(1.0F);
125 fNHits[1] = hitsInd2.size();
126 for (
size_t i = 0; i < hitsInd2.size(); i++) {
127 amp = hitsInd2[i]->GetAmplitude();
128 if (amp > sigmaMax) sigmaMax = amp;
131 for (
size_t i = 0; i < hitsInd2.size(); i++) {
132 if (sigmaMax > 0.0F) {
133 amp = hitsInd2[i]->GetAmplitude();
135 hitsInd2[i]->SetSigmaFactor((
float)sqrt(amp / sigmaMax));
137 hitsInd2[i]->SetSigmaFactor(0.01F);
140 hitsInd2[i]->SetSigmaFactor(1.0F);
145 fNHits[2] = hitsColl.size();
146 for (
size_t i = 0; i < hitsColl.size(); i++) {
147 amp = hitsColl[i]->SummedADC();
148 if (amp > sigmaMax) sigmaMax = amp;
151 for (
size_t i = 0; i < hitsColl.size(); i++) {
152 if (sigmaMax > 0.0F) {
153 amp = hitsColl[i]->SummedADC();
155 hitsColl[i]->SetSigmaFactor((
float)sqrt(amp / sigmaMax));
157 hitsColl[i]->SetSigmaFactor(0.01F);
160 hitsColl[i]->SetSigmaFactor(1.0F);
168 mf::LogWarning(
"pma::Element3D") <<
"Hits assigned to TPC-crossing element.";
175 double d, ref_sum = 0.0F;
178 if (d > 0.0) ref_sum += d *
d;
191 mf::LogWarning(
"pma::Element3D") <<
"Hits assigned to TPC-crossing element.";
195 double hit_sum = 0.0F;
197 if (h->IsEnabled()) {
198 unsigned int hitView = h->View2D();
201 h->GetSigmaFactor() *
213 mf::LogWarning(
"pma::Element3D") <<
"Hits assigned to TPC-crossing element.";
217 TVector3 mean3D(0, 0, 0);
220 if (h->View2D() == view) {
221 mean3D += h->Point3D();
224 if (!nHits)
return 0.0;
225 mean3D *= (1.0 / nHits);
227 double r2, maxR2 = 0.0;
228 for (
auto h : fAssignedHits)
229 if (h->View2D() == view) {
231 if (r2 > maxR2) maxR2 = r2;
241 for (
size_t i = 0; i < 3; ++i)
246 for (
size_t i = 0; i < 3; ++i) {
247 if (nhits[i] >= 2 * nmax_per_view) {
248 m[i] = nhits[i] / nmax_per_view;
251 else if (nhits[i] > nmax_per_view) {
252 m[i] = nhits[i] / (nhits[i] - nmax_per_view);
263 bool b, changed =
false;
267 size_t view = h->View2D();
269 if (count[view] % m[view] == 0)
270 h->SetEnabled(state[view]);
272 h->SetEnabled(!(state[view]));
279 changed |= (b != h->IsEnabled());
286 bool changed =
false;
288 changed |= !(h->IsEnabled());
double GetHitsRadius2D(const std::vector< pma::Hit3D * > &hits, bool exact=false)
std::vector< TVector3 * > fAssignedPoints
double Dist2(const TVector2 &v1, const TVector2 &v2)
Planes which measure Z direction.
virtual pma::SortedObjectBase * Next(unsigned int=0) const
double HitsRadius3D(unsigned int view) const
virtual void ClearAssigned(pma::Track3D *trk=0)
Implementation of the Projection Matching Algorithm.
virtual unsigned int NextCount(void) const
Implementation of the Projection Matching Algorithm.
static float fOptFactors[3]
double SumDist2(void) const
std::vector< pma::Hit3D * > fAssignedHits
Implementation of the Projection Matching Algorithm.
bool SelectRndHits(size_t nmax_per_view)
size_t fNThisHitsEnabledAll
virtual double GetDistance2To(const TVector3 &p3d) const =0
Distance [cm] from the 3D point to the object 3D.
void UpdateHitParams(void)
virtual pma::SortedObjectBase * Prev(void) const
virtual double SumDist2Hits(void) const =0
size_t NEnabledHits(unsigned int view=geo::kUnknown) const
Implementation of the Projection Matching Algorithm.
static float OptFactor(unsigned int view)