32 det_data_map_.clear();
44 HepMC::ThreeVector rp_topology_stripaxis = rp_topology_.GetStripReadoutAxisDir();
45 CLHEP::Hep3Vector rp_topology_stripaxis_clhep;
47 rp_topology_stripaxis_clhep.setX(rp_topology_stripaxis.x());
48 rp_topology_stripaxis_clhep.setY(rp_topology_stripaxis.y());
49 rp_topology_stripaxis_clhep.setZ(rp_topology_stripaxis.z());
51 TVector3 rd_dir = convert3vector( tot_rp_geom.
LocalToGlobalDirection(det_id, rp_topology_stripaxis_clhep ) );
53 TVector2
v(rd_dir.X(), rd_dir.Y());
59 return det_algebra_obj;
67 auto it = det_data_map_.find(det_id);
68 if (it != det_data_map_.end())
72 det_data_map_[det_id] = prepareReconstAlgebraData(det_id, tot_rp_geom);
73 return &det_data_map_[det_id];
92 vector<HitWithAlg> applicable_hits;
96 unsigned int detId = ds.detId();
102 applicable_hits.push_back({ detId, &
h, alg});
106 if (applicable_hits.size() < 5)
109 TMatrixD
H(applicable_hits.size(), 4);
110 TVectorD V(applicable_hits.size());
111 TVectorD V_inv(applicable_hits.size());
112 TVectorD
U(applicable_hits.size());
114 for(
unsigned int i = 0;
i < applicable_hits.size(); ++
i)
123 double var = applicable_hits[
i].hit->getSigma();
127 U[
i] = applicable_hits[
i].hit->getPosition() - alg_obj->
rec_u_0_;
130 TMatrixD H_T_V_inv(TMatrixD::kTransposed,
H);
131 multiplyByDiagonalInPlace(H_T_V_inv, V_inv);
132 TMatrixD V_a(H_T_V_inv);
140 LogError(
"TotemRPLocalTrackFitterAlgorithm") <<
"Error in TotemRPLocalTrackFitterAlgorithm::fitTrack > " 141 <<
"Fit matrix is singular. Skipping.";
149 fitted_track.
setZ0(z_0);
154 for(
unsigned int i=0;
i<applicable_hits.size(); ++
i)
159 double sigma_str = applicable_hits[
i].hit->getSigma();
160 double sigma_str_2 = sigma_str*sigma_str;
161 TVector2 fited_det_xy_point = fitted_track.
getTrackPoint(det_z);
162 double U_readout = applicable_hits[
i].hit->getPosition() - alg_obj->
rec_u_0_;
163 double U_fited = (readout_dir*=fited_det_xy_point);
164 double residual = U_fited - U_readout;
165 TMatrixD V_T_Cov_X_Y(1,2);
166 V_T_Cov_X_Y(0,0) = readout_dir.X();
167 V_T_Cov_X_Y(0,1) = readout_dir.Y();
169 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();
170 double pull_normalization =
sqrt(sigma_str_2 - fit_strip_var);
171 double pull = residual/pull_normalization;
173 Chi_2 += residual*residual / sigma_str_2;
176 fited_det_xy_point.Y(), det_z), residual, pull);
177 fitted_track.
addHit(applicable_hits[
i].detId, hit_point);
189 for(
int i=0;
i<mt.GetNrows(); ++
i)
191 for(
int j=0; j<mt.GetNcols(); ++j)
void setChiSquared(double &chiSquared)
void multiplyByDiagonalInPlace(TMatrixD &mt, const TVectorD &diag)
A matrix multiplication shorthand.
TVector2 getTrackPoint(double z) const
returns (x, y) vector
TVector3 centre_of_det_global_position_
void addHit(unsigned int detId, const FittedRecHit &hit)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void reset()
Resets the reconstruction-data cache.
TVector2 readout_direction_
non paralell projection and rot_cor included
A track fit through a single RP.
CLHEP::Hep3Vector LocalToGlobalDirection(unsigned int id, const CLHEP::Hep3Vector &dir) const
bool available_
if det should be included in the reconstruction
TMatrixD trackPointInterpolationCovariance(double z) const
RPDetCoordinateAlgebraObjs prepareReconstAlgebraData(unsigned int det_id, const TotemRPGeometry &tot_rp_geom)
Build the reconstruction data.
CLHEP::Hep3Vector GetDetTranslation(unsigned int id) 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.
bool fitTrack(const edm::DetSetVector< TotemRPRecHit > &hits, double z_0, const TotemRPGeometry &tot_geom, TotemRPLocalTrack &fitted_track)
performs the track fit, returns true if successful
void setValid(bool valid)
The manager class for TOTEM RP geometry.
void setCovarianceMatrix(const TMatrixD &par_covariance_matrix)
void setParameterVector(const TVectorD &track_params_vector)
RPDetCoordinateAlgebraObjs * getDetAlgebraData(unsigned int det_id, const TotemRPGeometry &tot_rp_geom)