Skip to content

Commit

Permalink
Move cluster error to weighted mean position error, based on cell size
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocos committed Nov 28, 2022
1 parent 71654b0 commit 3342528
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
12 changes: 12 additions & 0 deletions DataFormats/FTLRecHit/interface/FTLCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ class FTLCluster {
return weighted_mean(this->theHitENERGY, y_pos);
}

inline float positionError(const float sigmaPos) const {
float sumW2(0.f), sumW(0.f);
for (const auto& hitW : theHitENERGY) {
sumW2 += hitW * hitW;
sumW += hitW;
}
if (sumW > 0)
return sigmaPos * std::sqrt(sumW2) / sumW;
else
return -999.f;
}

inline float time() const {
auto t = [this](unsigned int i) { return this->theHitTIME[i]; };
return weighted_mean(this->theHitENERGY, t);
Expand Down
2 changes: 2 additions & 0 deletions RecoLocalFastTime/FTLClusterizer/interface/MTDCPEBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class MTDCPEBase : public MTDClusterParameterEstimator {
virtual TimeValue clusterTime(DetParam const& dp, ClusterParam& cp) const;
virtual TimeValueError clusterTimeError(DetParam const& dp, ClusterParam& cp) const;

static constexpr float sigma_flat = 1.f / std::sqrt(12.f);

protected:
//---------------------------------------------------------------------------
// Data members
Expand Down
7 changes: 4 additions & 3 deletions RecoLocalFastTime/FTLClusterizer/src/MTDCPEBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ LocalPoint MTDCPEBase::localPosition(DetParam const& dp, ClusterParam& cp) const
}

LocalError MTDCPEBase::localError(DetParam const& dp, ClusterParam& cp) const {
constexpr double one_over_twelve = 1. / 12.;
MeasurementPoint pos(cp.theCluster->x(), cp.theCluster->y());
MeasurementError simpleRect(one_over_twelve, 0, one_over_twelve);
return dp.theTopol->localError(pos, simpleRect);
float sigma2 = cp.theCluster->positionError(sigma_flat);
sigma2 *= sigma2;
MeasurementError posErr(sigma2, 0, sigma2);
return dp.theTopol->localError(pos, posErr);
}

MTDCPEBase::TimeValue MTDCPEBase::clusterTime(DetParam const& dp, ClusterParam& cp) const {
Expand Down

0 comments on commit 3342528

Please sign in to comment.