25 :
verbosity(ps.getUntrackedParameter<unsigned
int>(
"verbosity", 0)),
26 minimumHitsPerProjectionPerRP(ps.getParameter<unsigned
int>(
"minimumHitsPerProjectionPerRP")),
27 maxResidualToSigma(ps.getParameter<double>(
"maxResidualToSigma")) {}
33 printf(
">> LocalTrackFitter::Fit\n");
35 bool selectionChanged =
true;
36 unsigned int loopCounter = 0;
37 while (selectionChanged) {
39 while (selectionChanged) {
41 printf(
"* fit loop %u\n", loopCounter++);
43 bool fitFailed =
false;
48 printf(
"\tFIT FAILED\n");
66 bool &selectionChanged)
const {
68 printf(
" - LocalTrackFitter::FitAndRemoveOutliers\n");
87 const unsigned int &
detId = it->id;
90 const auto &dirData =
d.getDirectionData(it->dirIdx);
92 A(
j, 0) = it->z * dirData.dx;
94 A(
j, 2) = it->z * dirData.dy;
97 measVec(
j) = it->position + dirData.s - (it->z -
d.z) * dirData.dz;
99 Vi(
j,
j) = 1. / it->sigma / it->sigma;
105 TMatrixD ATViA(4, 4);
107 TMatrixD ATViAI(ATViA);
110 ATViAI = ATViA.Invert();
117 theta = ATViAI * AT * Vi * measVec;
131 for (
int i = 0;
i <
R.GetNrows();
i++)
135 printf(
" ax = %.3f mrad, bx = %.4f mm, ay = %.3f mrad, by = %.4f mm, z0 = %.3f mm\n",
141 printf(
" ndof = %i, chi^2/ndof/si^2 = %.3f\n", trackFit.
ndf, trackFit.
chi_sq / trackFit.
ndf);
145 selectionChanged =
false;
146 TVectorD interpolation(
A *
theta);
152 printf(
", dirIdx=%u: interpol = %+8.1f um, residual = %+6.1f um, residual / sigma = %+6.2f\n",
154 interpolation[
j] * 1E3,
159 double resToSigma =
R[
j] / it->sigma;
162 selectionChanged =
true;
164 printf(
" Removed\n");
174 printf(
" - RemoveInsufficientPots\n");
176 selectionChanged =
false;
179 map<unsigned int, pair<set<unsigned int>, set<unsigned int> > > planeMap;
182 const unsigned int rpId = senId.
rpId();
186 if ((plane % 2) == 0)
187 planeMap[rpId].first.insert(senId);
189 planeMap[rpId].second.insert(senId);
193 planeMap[rpId].first.insert(senId);
194 planeMap[rpId].second.insert(senId);
199 selectionChanged =
false;
201 for (
auto it = planeMap.begin(); it != planeMap.end(); ++it) {
205 printf(
"\tRP %u: projection1 = %lu, projection 2 = %lu\n",
207 it->second.first.size(),
208 it->second.second.size());
214 printf(
"\t\tremoving %u\n", dit->id);
216 selectionChanged =
true;
Detector ID class for TOTEM Si strip detectors.
double z0
the point where intercepts are measured, in mm
A structure to hold relevant geometrical information about one detector/sensor.
unsigned int minimumHitsPerProjectionPerRP
minimum of hits to accept data from a RP
Local (linear) track description (or a fit result). Uses global reference system. ...
unsigned int verbosity
verbosity level
signed int ndf
the number of degrees of freedom
void removeInsufficientPots(HitCollection &, bool &selectionChanged) const
removes the hits of pots with too few planes active
bool fit(HitCollection &, const AlignmentGeometry &, LocalTrackFit &) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
double maxResidualToSigma
hits with higher ratio residual/sigma will be dropped
double chi_sq
the residual sum of squares
void printId(unsigned int id)
std::vector< Hit > HitCollection
Base class for CTPPS detector IDs.
LocalTrackFitter()
dummy constructor (not to be used)
void fitAndRemoveOutliers(HitCollection &, const AlignmentGeometry &, LocalTrackFit &, bool &failed, bool &selectionChanged) const
Geom::Theta< T > theta() const
double bx
intercepts in mm