37 HepMC::ThreeVector rp_topology_stripaxis = rp_topology_.GetStripReadoutAxisDir();
38 CLHEP::Hep3Vector rp_topology_stripaxis_clhep;
40 rp_topology_stripaxis_clhep.setX(rp_topology_stripaxis.x());
41 rp_topology_stripaxis_clhep.setY(rp_topology_stripaxis.y());
42 rp_topology_stripaxis_clhep.setZ(rp_topology_stripaxis.z());
46 TVector2
v(rd_dir.X(), rd_dir.Y());
53 return det_algebra_obj;
60 auto it = det_data_map_.find(det_id);
61 if (it != det_data_map_.end()) {
64 det_data_map_[det_id] = prepareReconstAlgebraData(det_id, tot_rp_geom);
65 return &det_data_map_[det_id];
84 vector<HitWithAlg> applicable_hits;
86 for (
auto &ds : hits) {
87 unsigned int detId = ds.detId();
92 applicable_hits.push_back({detId, &
h, alg});
96 if (applicable_hits.size() < 5)
99 TMatrixD
H(applicable_hits.size(), 4);
100 TVectorD V(applicable_hits.size());
101 TVectorD V_inv(applicable_hits.size());
102 TVectorD
U(applicable_hits.size());
104 for (
unsigned int i = 0;
i < applicable_hits.size(); ++
i) {
112 double var = applicable_hits[
i].hit->sigma();
115 V_inv[
i] = 1.0 /
var;
116 U[
i] = applicable_hits[
i].hit->position() - alg_obj->
rec_u_0_;
119 TMatrixD H_T_V_inv(TMatrixD::kTransposed,
H);
120 multiplyByDiagonalInPlace(H_T_V_inv, V_inv);
121 TMatrixD V_a(H_T_V_inv);
126 LogError(
"TotemRPLocalTrackFitterAlgorithm") <<
"Error in TotemRPLocalTrackFitterAlgorithm::fitTrack > " 127 <<
"Fit matrix is singular. Skipping.";
135 fitted_track.
setZ0(z_0);
140 for (
unsigned int i = 0;
i < applicable_hits.size(); ++
i) {
144 double sigma_str = applicable_hits[
i].hit->sigma();
145 double sigma_str_2 = sigma_str * sigma_str;
146 TVector2 fited_det_xy_point = fitted_track.
trackPoint(det_z);
147 double U_readout = applicable_hits[
i].hit->position() - alg_obj->
rec_u_0_;
148 double U_fited = (readout_dir *= fited_det_xy_point);
149 double residual = U_fited - U_readout;
150 TMatrixD V_T_Cov_X_Y(1, 2);
151 V_T_Cov_X_Y(0, 0) = readout_dir.X();
152 V_T_Cov_X_Y(0, 1) = readout_dir.Y();
154 double fit_strip_var = V_T_Cov_X_Y_mult(0, 0) * readout_dir.X() + V_T_Cov_X_Y_mult(0, 1) * readout_dir.Y();
155 double pull_normalization =
sqrt(sigma_str_2 - fit_strip_var);
156 double pull = residual / pull_normalization;
158 Chi_2 += residual * residual / sigma_str_2;
161 *(applicable_hits[
i].
hit), TVector3(fited_det_xy_point.X(), fited_det_xy_point.Y(), det_z), residual, pull);
162 fitted_track.
addHit(applicable_hits[
i].detId, hit_point);
173 for (
int i = 0;
i < mt.GetNrows(); ++
i) {
174 for (
int j = 0;
j < mt.GetNcols(); ++
j) {
void setChiSquared(double &chiSquared)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void multiplyByDiagonalInPlace(TMatrixD &mt, const TVectorD &diag)
A matrix multiplication shorthand.
TVector3 centre_of_det_global_position_
void addHit(unsigned int detId, const FittedRecHit &hit)
void reset()
Resets the reconstruction-data cache.
TVector2 readout_direction_
non paralell projection and rot_cor included
TVector2 trackPoint(double z) const
returns (x, y) vector
A track fit through a single RP.
CLHEP::Hep3Vector sensorTranslation(unsigned int id) const
bool available_
if det should be included in the reconstruction
TMatrixD trackPointInterpolationCovariance(double z) const
double rec_u_0_
in mm, position of det. centre projected on readout direction
TotemRPLocalTrackFitterAlgorithm(const edm::ParameterSet &conf)
Reconstructed hit in TOTEM RP.
The manager class for TOTEM RP geometry.
void setValid(bool valid)
RPDetCoordinateAlgebraObjs prepareReconstAlgebraData(unsigned int det_id, const CTPPSGeometry &tot_rp_geom)
Build the reconstruction data.
CLHEP::Hep3Vector localToGlobalDirection(unsigned int id, const CLHEP::Hep3Vector &) const
bool fitTrack(const edm::DetSetVector< TotemRPRecHit > &hits, double z_0, const CTPPSGeometry &tot_geom, TotemRPLocalTrack &fitted_track)
performs the track fit, returns true if successful
void setCovarianceMatrix(const TMatrixD &par_covariance_matrix)
void setParameterVector(const TVectorD &track_params_vector)
RPDetCoordinateAlgebraObjs * getDetAlgebraData(unsigned int det_id, const CTPPSGeometry &tot_rp_geom)