ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalib::StraightPatRec Class Reference

#include <StraightPatRec.h>

Inheritance diagram for MuonCalib::StraightPatRec:
Collaboration diagram for MuonCalib::StraightPatRec:

Public Types

typedef std::vector< unsigned int > HitSelection

Public Member Functions

 StraightPatRec ()
 Default constructor: road width for pattern recognition = 0.5 mm.
 StraightPatRec (const double r_road_width)
 Constructor: user-defined road width for pattern recognition.
double roadWidth () const
 get the final track in the local co-ordinate frame, i.e.
void setRoadWidth (const double r_road_width)
 set the road width for the pattern recognition = r_road_width
void setTimeOut (const double time_out)
 set the time-out for the track finding to time_out (in seconds)
void setFixSelection (bool fix_sel)
bool fit (MuonCalibSegment &r_segment) const
 reconstruction of the track using all hits in the segment "r_segment", returns true in case of success; the algorithm overwrites the track radii, the track position, track direction, and chi^2 per degrees of freedom; warning: the errors of the track radii are only approximate reconstruction of the track using only those hits in r_segment for which the r_selection[.
bool fit (MuonCalibSegment &r_segment, HitSelection r_selection) const
 fit subset of the hits.
bool fit (MuonCalibSegment &r_segment, HitSelection r_selection, MTStraightLine &line_track) const
 the CurvedPatRec class relies on the first place on information cached in the MSStraightLine
void printLevel (int)
bool fitCallByReference (MuonCalibSegment &r_segment, HitSelection &r_selection, MTStraightLine &line_track) const
bool fitCallByReference (MuonCalibSegment &r_segment, HitSelection &r_selection) const
void SetRefineSegmentFlag (const bool flag)
 number of hits selected for track
bool RefineSegmentFlag () const
 get refine segment flag
void switchOnRefit ()
 switch on/off chi^2 refit after hit selection
void switchOffRefit ()
bool refit () const
 return refit flag

Protected Attributes

bool m_refine_segment
 flags
bool m_refit

Private Member Functions

void init ()
void init (const double r_road_width)
MTStraightLine tangent (const Amg::Vector3D &r_w1, const double r_r1, const double r_sigma12, const Amg::Vector3D &r_w2, const double r_r2, const double r_sigma22, const int &r_case) const
MTStraightLine fitCandidate (MuonCalibSegment &r_segment, const std::vector< unsigned int > &r_selection, const MTStraightLine &cand_line) const

Private Attributes

bool m_fix_selection
double m_r_max
double m_road_width
double m_time_out

Detailed Description

Definition at line 24 of file StraightPatRec.h.

Member Typedef Documentation

◆ HitSelection

typedef std::vector<unsigned int> MuonCalib::IMdtSegmentFitter::HitSelection
inherited

Definition at line 32 of file IMdtSegmentFitter.h.

Constructor & Destructor Documentation

◆ StraightPatRec() [1/2]

MuonCalib::StraightPatRec::StraightPatRec ( )
inline

Default constructor: road width for pattern recognition = 0.5 mm.

Definition at line 27 of file StraightPatRec.h.

◆ StraightPatRec() [2/2]

MuonCalib::StraightPatRec::StraightPatRec ( const double r_road_width)
inline

Constructor: user-defined road width for pattern recognition.

Definition at line 30 of file StraightPatRec.h.

Member Function Documentation

◆ fit() [1/3]

bool StraightPatRec::fit ( MuonCalibSegment & r_segment) const
virtual

reconstruction of the track using all hits in the segment "r_segment", returns true in case of success; the algorithm overwrites the track radii, the track position, track direction, and chi^2 per degrees of freedom; warning: the errors of the track radii are only approximate reconstruction of the track using only those hits in r_segment for which the r_selection[.

] is 0, return true in case of success; the algorithm overwrites the track position, direction, and the chi^2 in r_segment; it updates the distances of all hits from the track, i.e. also of those hits which were rejected from the track reconstruction; warning : the errors of the track CLHEP::radii are only approximate

Implements MuonCalib::IMdtSegmentFitter.

Definition at line 288 of file StraightPatRec.cxx.

288 {
289 // select all hits //
290 HitSelection selection(r_segment.mdtHitsOnTrack(), 0);
291
292 // call the other fit function //
293 return fit(r_segment, std::move(selection));
294}
std::vector< unsigned int > HitSelection
unsigned int mdtHitsOnTrack() const
retrieve the number of MdtCalibHitBase s assigned to this segment
bool fit(MuonCalibSegment &r_segment) const
reconstruction of the track using all hits in the segment "r_segment", returns true in case of succes...
const std::string selection

◆ fit() [2/3]

bool StraightPatRec::fit ( MuonCalibSegment & seg,
HitSelection selection ) const
virtual

fit subset of the hits.

If the HitSelection vector contains a 0 for a given hit the hit is used else the hit is not included in the fit. The size of the HitSelection vector should be equal to the number of hits on track else no fit is performed.

Implements MuonCalib::IMdtSegmentFitter.

Definition at line 295 of file StraightPatRec.cxx.

295{ return fitCallByReference(r_segment, r_selection); }
bool fitCallByReference(MuonCalibSegment &r_segment, HitSelection &r_selection, MTStraightLine &line_track) const

◆ fit() [3/3]

bool StraightPatRec::fit ( MuonCalibSegment & r_segment,
HitSelection r_selection,
MTStraightLine & line_track ) const

the CurvedPatRec class relies on the first place on information cached in the MSStraightLine

Definition at line 296 of file StraightPatRec.cxx.

296 {
297 return fitCallByReference(r_segment, r_selection, line_track);
298}

◆ fitCallByReference() [1/2]

bool StraightPatRec::fitCallByReference ( MuonCalibSegment & r_segment,
HitSelection & r_selection ) const

Definition at line 299 of file StraightPatRec.cxx.

299 {
300 MTStraightLine fitted_track{};
301 return fitCallByReference(r_segment, r_selection, fitted_track);
302}

◆ fitCallByReference() [2/2]

bool StraightPatRec::fitCallByReference ( MuonCalibSegment & r_segment,
HitSelection & r_selection,
MTStraightLine & line_track ) const

Definition at line 303 of file StraightPatRec.cxx.

303 {
305 // VARIABLES //
307
308 time_t start, end; // start and end time (needed for time-out)
309 time(&start);
310 double diff; // difference of start and end time (needed for time-out)
311 Combination combination;
312
313 std::vector<unsigned int> hit_index; // hit indices for given selection
314 unsigned int try_nb_hits; // try this given number of hits for the
315 // segment reconstruction
316
317 MuonCalibSegment::MdtHitVec selected_hits;
318 std::vector<unsigned int> selected_hits_index;
319
320 Amg::Vector3D w_min, w_max; // wire with the minimum local z coordinate,
321 // wire with the maximum local z coordinate
322 double r_min, r_max{}; // corresponding drift CLHEP::radii
323 double sigma2_min, sigma2_max; // corresponding spatial resolution
324
325 unsigned int counter1; // auxiliary counter
326
327 unsigned int nb_candidates(0); // number of straight-track candidates
328
329 MTStraightLine tangents[4]; // the four tangents to the drift circles of a
330 // hit pair
331 MTStraightLine aux_track; // auxiliary track
332 Amg::Vector3D null(0.0, 0.0, 0.0);
333 Amg::Vector3D xhat(1.0, 0.0, 0.0);
334
335 MTStraightLine initial_track(r_segment.position(), r_segment.direction(), null, null);
336 // initial track stored in the segment
337 Amg::Vector3D aux_pos, aux_dir; // auxiliary position and direction vectors
338
340 // RESET //
342
343 if (r_segment.mdtHitsOnTrack() != r_selection.size()) {
344 MsgStream log(Athena::getMessageSvc(), "StraightPatRec");
345 log << MSG::WARNING
346 << "fitCallByReference() - Vector with selected hits unequal to the number of hits on the segment! The user selection will "
347 "be "
348 "ignored!"
349 << endmsg;
350 r_selection.clear();
351 r_selection.assign(r_segment.hitsOnTrack(), 0);
352 }
353
354 // Filling selected_hits vector
355 for (unsigned int k = 0; k < r_segment.mdtHitsOnTrack(); k++) {
356 if (!r_selection[k]) {
357 selected_hits.push_back(r_segment.mdtHOT()[k]);
358 selected_hits_index.push_back(k);
359 }
360 }
361
363 // RETURN, IF THERE ARE LESS THAN 3 HITS, I.E. THE TRACK IS NOT UNIQUELY //
364 // DEFINED BY THE HITS. //
366
367 if (selected_hits.size() < 3) { return false; }
368
370 // FIX POTENTIAL SECOND-COORDINATE PROBLEM OF THE INITIAL TRACK SEGMENT //
372
373 if (r_segment.direction().z() == 0.0) {
374 Amg::Vector3D dir(r_segment.direction().x(), r_segment.direction().y(), 1.0);
375 initial_track = MTStraightLine(r_segment.position(), dir, null, null);
376 }
377
379 // TRACK RECONSTRUCTION //
381 // try to find a segment with as many hits as selected initially //
382
383 HitSelection final_selection(r_selection);
384
385 try_nb_hits = selected_hits.size();
386 //=============================================================================
387 while (nb_candidates == 0) {
388 //-----------------------------------------------------------------------------
389 // Return in case of large amount of fake hits
390 if (try_nb_hits < 5 && (selected_hits.size() - try_nb_hits) > 2) return false;
391 // reset //
392 double best_chi2ndf = -1.0;
393 MTStraightLine best_aux_line(initial_track);
394
395 // loop over all combinations //
396 combination.setNewParameters(selected_hits.size(), try_nb_hits);
397
398 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
399 for (unsigned int cb = 0; cb < combination.numberOfCombinations(); cb++) {
400 //.............................................................................
401
402 // time-out //
403 time(&end);
404 diff = difftime(end, start);
405 if (diff > m_time_out) { return false; }
406
407 // get the present hit combination //
408 if (cb == 0) {
409 combination.currentCombination(hit_index);
410 } else {
411 combination.nextCombination(hit_index);
412 }
413
414 // Current selection of hits
415 HitSelection tmp_selection(r_selection);
416 tmp_selection.assign(tmp_selection.size(), 1);
417 for (unsigned int k = 0; k < try_nb_hits; k++) { tmp_selection[selected_hits_index[hit_index[k] - 1]] = 0; }
418
419 // investigate the current combination //
420 // find the wires with minimum and maximum local z //
421 w_min = selected_hits[hit_index[0] - 1]->localPosition();
422 w_max = selected_hits[hit_index[0] - 1]->localPosition();
423 r_min = selected_hits[hit_index[0] - 1]->driftRadius();
424 r_max = selected_hits[hit_index[0] - 1]->driftRadius();
425 sigma2_min = selected_hits[hit_index[0] - 1]->sigma2DriftRadius();
426 sigma2_max = selected_hits[hit_index[0] - 1]->sigma2DriftRadius();
427 for (unsigned int k = 1; k < try_nb_hits; k++) {
428 if (selected_hits[hit_index[k] - 1]->localPosition().z() < w_min.z()) {
429 w_min = selected_hits[hit_index[k] - 1]->localPosition();
430 r_min = selected_hits[hit_index[k] - 1]->driftRadius();
431 sigma2_min = selected_hits[hit_index[k] - 1]->sigma2DriftRadius();
432 }
433 if (selected_hits[hit_index[k] - 1]->localPosition().z() > w_max.z()) {
434 w_max = selected_hits[hit_index[k] - 1]->localPosition();
435 r_max = selected_hits[hit_index[k] - 1]->driftRadius();
436 sigma2_max = selected_hits[hit_index[k] - 1]->sigma2DriftRadius();
437 }
438 }
439
440 // set the spatial resolution to 0.1 CLHEP::mm if it is 0 //
441 if (sigma2_min == 0) { sigma2_min = 0.1; }
442 if (sigma2_max == 0) { sigma2_max = 0.1; }
443
444 // get the four segment candidates tangential to the outermost hits //
445 for (unsigned int r_case = 1; r_case < 5; r_case++) {
446 tangents[r_case - 1] = tangent(w_min, r_min, sigma2_min, w_max, r_max, sigma2_max, r_case);
447 }
448
449 // determine additional track points within the road width around //
450 // the four tangents and determine a segment //
451 for (unsigned int r_case = 1; r_case < 5; r_case++) {
452 counter1 = 0;
453 for (unsigned int n = 0; n < try_nb_hits; n++) {
454 MTStraightLine aux_line(selected_hits[hit_index[n] - 1]->localPosition(), xhat, null, null);
455 if (std::abs(std::abs(tangents[r_case - 1].signDistFrom(aux_line)) - selected_hits[hit_index[n] - 1]->driftRadius()) <=
456 m_road_width) {
457 counter1 = counter1 + 1;
458 }
459 }
460
461 // Used to fix initial configuration of hits
462 if (m_fix_selection) counter1 = try_nb_hits;
463 // perform a straight line fit for the candidate //
464 if (counter1 == try_nb_hits) {
465 nb_candidates++;
466 aux_track = fitCandidate(r_segment, tmp_selection, tangents[r_case - 1]);
467
468 if ((best_chi2ndf == -1) || (best_chi2ndf > r_segment.chi2())) {
469 best_chi2ndf = r_segment.chi2();
470 best_aux_line = aux_track;
471 final_selection.assign(final_selection.size(), 1);
472 for (unsigned int j = 0; j < try_nb_hits; j++) { final_selection[selected_hits_index[hit_index[j] - 1]] = 0; }
473 }
474 }
475 }
476 //.............................................................................
477 }
478 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
479
481 // MAKE THE FINAL STRAIGHT SEGMENT, IF POSSIBLE //
483
485 if (nb_candidates > 0) {
486 // store track hits, rewrite hit selection //
487 for (unsigned int k = 0; k < r_selection.size(); k++) {
488 r_selection[k] = final_selection[k];
489 if (!final_selection[k]) { used_hits.push_back(r_segment.mdtHOT()[k]); }
490 }
491
492 // Final refit //
493 fitted_track = fitCandidate(r_segment, final_selection, best_aux_line);
494 fitted_track.setUsedHits(used_hits);
495
496 if (m_refine_segment) { r_segment.refineMdtSelection(r_selection); }
497
498 } else {
499 try_nb_hits = try_nb_hits - 1;
500 if (try_nb_hits < 3) { return false; }
501 }
502
503 //-----------------------------------------------------------------------------
504 }
505 //=============================================================================
506
507 return fitted_track.chi2() > 0;
508}
#define endmsg
void diff(const TrigCaloCluster &a, const TrigCaloCluster &b, std::map< std::string, double > &varChange)
#define z
void currentCombination(std::vector< unsigned int > &index_array) const
get the current combination; the result is stored in the vector index_array
unsigned int numberOfCombinations() const
get the number of combinations
void setNewParameters(const unsigned int &nb_elements, const unsigned int &wh_class)
set the number of elements = nb_elements; set the class of which the combination is = wh_class
void nextCombination(std::vector< unsigned int > &index_array)
get the next combination; the results is stored in the array index_array
void refineMdtSelection(const std::vector< unsigned int > &new_selection)
move trck hits to close hits
const Amg::Vector3D & direction() const
retrieve local direction of segment (on station level) retrieve the transformation from local chamber...
std::vector< MdtHitPtr > MdtHitVec
unsigned int hitsOnTrack() const
retrieve the sum of all XxxCalibHits assigned to the MuonCalibSegment
double chi2() const
retrieve chi2
const MdtHitVec & mdtHOT() const
retrieve the full set of MdtCalibHitBase s assigned to this segment
const Amg::Vector3D & position() const
retrieve local position of segment (on station level)
MTStraightLine fitCandidate(MuonCalibSegment &r_segment, const std::vector< unsigned int > &r_selection, const MTStraightLine &cand_line) const
MTStraightLine tangent(const Amg::Vector3D &r_w1, const double r_r1, const double r_sigma12, const Amg::Vector3D &r_w2, const double r_r2, const double r_sigma22, const int &r_case) const
Eigen::Matrix< double, 3, 1 > Vector3D
IMessageSvc * getMessageSvc(bool quiet=false)
time(flags, cells_name, *args, **kw)
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
@ driftRadius
trt, straws
Definition ParamDefs.h:53

◆ fitCandidate()

MTStraightLine StraightPatRec::fitCandidate ( MuonCalibSegment & r_segment,
const std::vector< unsigned int > & r_selection,
const MTStraightLine & cand_line ) const
private

Definition at line 153 of file StraightPatRec.cxx.

154 {
156 // VARIABLES //
158 Amg::Vector3D null(0.0, 0.0, 0.0);
159 Amg::Vector3D xhat(1.0, 0.0, 0.0);
160
161 unsigned int num_selected_hits(0);
162 for (unsigned int k : r_selection) {
163 if (!k) { num_selected_hits++; }
164 }
165 if (num_selected_hits < 3) return cand_line;
166
167 Amg::Vector3D init_dir(r_segment.direction());
168 Amg::Vector3D init_pos(r_segment.position());
170 // SET THE CORRECT SIGNED TRACK DISTANCES //
172
173 r_segment.set(r_segment.chi2(), cand_line.positionVector(), cand_line.directionVector());
174
175 for (unsigned int k = 0; k < r_segment.mdtHitsOnTrack(); k++) {
176 MTStraightLine aux_line(r_segment.mdtHOT()[k]->localPosition(), xhat, null, null);
177 r_segment.mdtHOT()[k]->setDistanceToTrack(cand_line.signDistFrom(aux_line), r_segment.mdtHOT()[k]->sigmaDriftRadius());
178 }
179
181 // Analitical fit of linearized measurements (transformation to reference frame is used) //
183 unsigned int NLC = 2; // number of fit parameters
184
185 // Normalization on z-direction
186 Amg::Vector3D dir_norm(r_segment.direction().x() / r_segment.direction().z(), r_segment.direction().y() / r_segment.direction().z(),
187 1.0);
188
189 Amg::Vector3D refTransl(r_segment.position());
190 refTransl[0] = 0;
191 Amg::Vector3D refDir(dir_norm);
192 refDir[0] = 0;
193 refDir = refDir.unit();
194
195 // Rotation Matrix for Toewr_to_track transformation
196
197 double rotAngle = Amg::angle(Amg::Vector3D::UnitZ(), refDir) * (refDir.y()) / std::abs(refDir.y());
198 Amg::AngleAxis3D RotMatr(rotAngle, Amg::Vector3D::UnitX()); // Matrix for Track reference transformation
199 Amg::AngleAxis3D RotMatr_inv(-rotAngle, Amg::Vector3D::UnitX()); // inverse
200
202 alpha.setZero();
203 Amg::VectorX betha = Amg::VectorX(NLC);
204 betha.setZero();
205 Amg::MatrixX Gamma = Amg::MatrixX(NLC, NLC);
206 Gamma.setZero();
207 // vector to store hit positions
208 std::vector<Amg::Vector3D> hit_position_track;
209
210 for (unsigned int l = 0; l < r_segment.mdtHitsOnTrack(); l++) {
211 // Transformation to track reference frame
212 Amg::Vector3D WirPosLocal = r_segment.mdtHOT()[l]->localPosition();
213 Amg::Vector3D WirPosTrack = WirPosLocal - refTransl;
214 WirPosTrack = RotMatr * WirPosTrack;
215 double signedDrifRadius =
216 std::abs(r_segment.mdtHOT()[l]->driftRadius()) *
217 (r_segment.mdtHOT()[l]->signedDistanceToTrack() / std::abs(r_segment.mdtHOT()[l]->signedDistanceToTrack()));
218 Amg::Vector3D HitPosTrack = WirPosTrack;
219 HitPosTrack[0] = HitPosTrack.y() + signedDrifRadius;
220 HitPosTrack[1] = r_segment.mdtHOT()[l]->sigma2DriftRadius(); // trick to store hit resolution
221
222 hit_position_track.push_back(HitPosTrack);
223
224 Amg::VectorX delta = Amg::VectorX(NLC);
225 delta.setZero();
226 delta[0] = 1.0;
227 delta[1] = HitPosTrack.z();
228
229 if (!r_selection[l]) {
230 double weight = 1.0 / (r_segment.mdtHOT()[l]->sigma2DriftRadius());
231 Gamma += weight * delta * delta.transpose();
232 betha += weight * HitPosTrack.y() * delta;
233 }
234 }
235
236 // solution of linear system of equations
237 Gamma = Gamma.inverse();
238 alpha = Gamma * betha;
239
240 double refit_chi2(0.0);
241 for (unsigned int j = 0; j < hit_position_track.size(); j++) {
242 double res = (alpha[0] + alpha[1] * hit_position_track[j].z() - hit_position_track[j].y());
243 if (!r_selection[j]) refit_chi2 += res * res / hit_position_track[j].x();
244 }
245
246 // Backward transformation
247 Amg::Vector3D seg_dir(0.0, alpha[1], 1.0);
248 seg_dir = RotMatr_inv * seg_dir;
249 seg_dir[1] = seg_dir.y() / seg_dir.z();
250 seg_dir[0] = init_dir.x() / init_dir.z();
251 seg_dir[2] = 1.0;
252
253 Amg::Vector3D seg_pos(0.0, alpha[0], 0.0);
254 seg_pos = RotMatr_inv * seg_pos;
255 seg_pos = seg_pos + refTransl;
256
257 seg_pos[1] = seg_pos.y() + seg_dir.y() * (init_pos.z() - seg_pos.z());
258 seg_pos[0] = init_pos.x();
259 seg_pos[2] = init_pos.z();
260
261 // Rewriting segment
262 r_segment.set(refit_chi2 / (num_selected_hits - 2), seg_pos, seg_dir);
263
264 MTStraightLine aux_line(seg_pos, seg_dir, Amg::Vector3D(0.0, 0.0, 0.0), Amg::Vector3D(0.0, 0.0, 0.0));
265
266 for (unsigned int k = 0; k < r_segment.mdtHitsOnTrack(); k++) {
267 MTStraightLine aux_t(r_segment.mdtHOT()[k]->localPosition(), xhat, null, null);
268 r_segment.mdtHOT()[k]->setDistanceToTrack(aux_line.signDistFrom(aux_t), r_segment.mdtHOT()[k]->sigmaDriftRadius());
269 }
270
271 aux_line.setNumberOfTrackHits(num_selected_hits);
272 aux_line.setChi2(refit_chi2);
273 return aux_line;
274}
std::pair< std::vector< unsigned int >, bool > res
#define y
Amg::Vector3D directionVector() const
get the direction vector of the straight line
Amg::Vector3D positionVector() const
get the position vector of the straight line
double signDistFrom(const MTStraightLine &h) const
get the signed distance of two lines (if both are parallel, dist>0)
void set(double chi2, const Amg::Vector3D &pos, const Amg::Vector3D &dir)
Eigen::AngleAxisd AngleAxis3D
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
double angle(const Amg::Vector3D &v1, const Amg::Vector3D &v2)
calculates the opening angle between two vectors
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
l
Printing final latex table to .tex output file.

◆ init() [1/2]

void StraightPatRec::init ( )
private

Definition at line 23 of file StraightPatRec.cxx.

23 {
24 init(0.5 * CLHEP::mm); // default road width = 0.5 CLHEP::mm
25 return;
26}

◆ init() [2/2]

void StraightPatRec::init ( const double r_road_width)
private

Definition at line 28 of file StraightPatRec.cxx.

28 {
29 //:::::::::::::::
30 //:: VARIABLES ::
31 //:::::::::::::::
32
33 Amg::Vector3D null_vec(0.0, 0.0, 0.0); // auxiliary 0 vector
34
35 //::::::::::::::::::
36 //:: SET TIME-OUT ::
37 //::::::::::::::::::
38
39 m_time_out = 10.0;
40
41 //::::::::::::::::::::::::::::
42 //:: SET THE MAXIMUM RADIUS ::
43 //::::::::::::::::::::::::::::
44
45 m_r_max = 15.0;
46
47 //::::::::::::::::::::::::
48 //:: SET THE ROAD WIDTH ::
49 //::::::::::::::::::::::::
50
51 m_road_width = r_road_width;
52
53 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
54 //:: INITIALIZE PRIVATE VARIABLES WHICH ARE ACCESSIBLE BY METHODS ::
55 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
56
57 // m_nb_track_hits = 0;
58 // m_chi2 = 0.0;
59 // m_track = MTStraightLine(null_vec, null_vec, null_vec, null_vec);
60
61 m_fix_selection = false;
62
63 return;
64}

◆ printLevel()

void MuonCalib::StraightPatRec::printLevel ( int )
inlinevirtual

Implements MuonCalib::IMdtSegmentFitter.

Definition at line 83 of file StraightPatRec.h.

83{}

◆ RefineSegmentFlag()

bool MuonCalib::IMdtPatRecFitter::RefineSegmentFlag ( ) const
inlineinherited

get refine segment flag

Definition at line 37 of file IMdtPatRecFitter.h.

37{ return m_refine_segment; }

◆ refit()

bool MuonCalib::IMdtPatRecFitter::refit ( ) const
inlineinherited

return refit flag

Definition at line 43 of file IMdtPatRecFitter.h.

◆ roadWidth()

double StraightPatRec::roadWidth ( ) const

get the final track in the local co-ordinate frame, i.e.

z ^ o o o o o o | ... o o o o o ... o--> y o o o o o o x

Definition at line 276 of file StraightPatRec.cxx.

276{ return m_road_width; }

◆ setFixSelection()

void StraightPatRec::setFixSelection ( bool fix_sel)

Definition at line 287 of file StraightPatRec.cxx.

287{ m_fix_selection = fix_sel; }

◆ SetRefineSegmentFlag()

void MuonCalib::IMdtPatRecFitter::SetRefineSegmentFlag ( const bool flag)
inlineinherited

number of hits selected for track

virtual unsigned int numberOfTrackHits() const = 0; get selected track hits virtual const std::vector<const MdtCalibHitBase *> &trackHits() const = 0; set refine segment flag

Parameters
flagif true the hit selection is changed in the segment

Definition at line 34 of file IMdtPatRecFitter.h.

bool flag
Definition master.py:29

◆ setRoadWidth()

void StraightPatRec::setRoadWidth ( const double r_road_width)
virtual

set the road width for the pattern recognition = r_road_width

Implements MuonCalib::IMdtPatRecFitter.

Definition at line 278 of file StraightPatRec.cxx.

278 {
279 m_road_width = std::abs(r_road_width);
280 return;
281}

◆ setTimeOut()

void StraightPatRec::setTimeOut ( const double time_out)

set the time-out for the track finding to time_out (in seconds)

Definition at line 282 of file StraightPatRec.cxx.

282 {
283 m_time_out = time_out;
284 return;
285}

◆ switchOffRefit()

void MuonCalib::IMdtPatRecFitter::switchOffRefit ( )
inlineinherited

Definition at line 41 of file IMdtPatRecFitter.h.

41{ m_refit = false; }

◆ switchOnRefit()

void MuonCalib::IMdtPatRecFitter::switchOnRefit ( )
inlineinherited

switch on/off chi^2 refit after hit selection

Definition at line 40 of file IMdtPatRecFitter.h.

40{ m_refit = true; }

◆ tangent()

MTStraightLine StraightPatRec::tangent ( const Amg::Vector3D & r_w1,
const double r_r1,
const double r_sigma12,
const Amg::Vector3D & r_w2,
const double r_r2,
const double r_sigma22,
const int & r_case ) const
private

Definition at line 66 of file StraightPatRec.cxx.

67 {
68 //:::::::::::::::
69 //:: VARIABLES ::
70 //:::::::::::::::
71
72 double sinalpha; // auxiliary sinus of an angle
73 double cosalpha; // auxiliary sinus of an angle
74 Amg::Vector3D e2prime, e3prime; // auxiliary direction vectors
75 MTStraightLine tang; // tangent to drift circles of a hit pair
76 Amg::Vector3D p1(0.0, 0.0, 0.0), p2(0.0, 0.0, 0.0); // hit points defining a tangent
77 Amg::Vector3D null_vec(0.0, 0.0, 0.0); // auxiliary 0 vector
78 double mx1 = 0, bx1 = 0, mx2 = 0, bx2 = 0; // auxiliary track parameters
79
80 //::::::::::::::::::::::::::::::::::::::::::::
81 //:: CHECK WHETHER THE SELECTED CASE EXISTS ::
82 //::::::::::::::::::::::::::::::::::::::::::::
83
84 if (r_case < 1 || r_case > 4) {
85 throw std::runtime_error(
86 Form("File: %s, Line: %d\nStraightPatRec::tangent - Illegal case %i, must be 1,2,3, or 4.!", __FILE__, __LINE__, r_case));
87 }
88
89 //:::::::::::::::::::::::::::::::::::::
90 //:: CALCULATE THE REQUESTED TANGENT ::
91 //:::::::::::::::::::::::::::::::::::::
92
93 // local coordinate axis vectors //
94 e3prime = (r_w2 - r_w1).unit();
95 e2prime = Amg::Vector3D(0.0, e3prime.z(), -e3prime.y());
96
97 // case 1 and 2 //
98 if (r_case == 1 || r_case == 2) {
99 sinalpha = std::abs(r_r2 - r_r1) / (r_w2 - r_w1).mag();
100 cosalpha = std::sqrt(1.0 - sinalpha * sinalpha);
101
102 // case 1 //
103 if (r_case == 1) {
104 p1 = r_w1 + ((1 && r_r2 >= r_r1) - (1 && r_r2 < r_r1)) * r_r1 * (cosalpha * e2prime - sinalpha * e3prime);
105 p2 = r_w2 + ((1 && r_r2 >= r_r1) - (1 && r_r2 < r_r1)) * r_r2 * (cosalpha * e2prime - sinalpha * e3prime);
106 }
107
108 // case 2 //
109 if (r_case == 2) {
110 p1 = r_w1 - ((1 && r_r2 >= r_r1) - (1 && r_r2 < r_r1)) * r_r1 * (cosalpha * e2prime + sinalpha * e3prime);
111 p2 = r_w2 - ((1 && r_r2 >= r_r1) - (1 && r_r2 < r_r1)) * r_r2 * (cosalpha * e2prime + sinalpha * e3prime);
112 }
113 }
114
115 // case 3 and 4 //
116 if (r_case == 3 || r_case == 4) {
117 sinalpha = (r_r1 + r_r2) / (r_w2 - r_w1).mag();
118 cosalpha = std::sqrt(1.0 - sinalpha * sinalpha);
119
120 // case 3 //
121 if (r_case == 3) {
122 p1 = r_w1 + r_r1 * (cosalpha * e2prime + sinalpha * e3prime);
123 p2 = r_w2 - r_r2 * (cosalpha * e2prime + sinalpha * e3prime);
124 }
125
126 // case 4 //
127 if (r_case == 4) {
128 p1 = r_w1 - r_r1 * (cosalpha * e2prime - sinalpha * e3prime);
129 p2 = r_w2 + r_r2 * (cosalpha * e2prime - sinalpha * e3prime);
130 }
131 }
132
133 // calculation of the tangent and estimation of its errors //
134 if ((p2 - p1).z() != 0.0) {
135 tang = MTStraightLine(p1, p2 - p1, null_vec, null_vec);
136 } else {
137 Amg::Vector3D direction(p2 - p1);
138 direction[2] = (1.0e-99);
139 tang = MTStraightLine(p1, direction, null_vec, null_vec);
140 }
141 mx1 = tang.a_x1();
142 bx2 = tang.b_x1();
143 mx2 = tang.a_x2();
144 bx2 = tang.b_x2();
145 tang = MTStraightLine(mx1, bx1, mx2, bx2, 1.0, 1.0, std::sqrt(r_sigma12 + r_sigma22) / std::abs(p2.z() - p1.z()),
146 std::sqrt(r_sigma12 + p1.z() * p1.z() * (r_sigma12 + r_sigma22) / std::pow(p2.z() - p1.z(), 2)));
147 // errors in mx1 and bx1 are arbitrary since they are
148 // not used at a later stage.
149
150 return tang;
151}
Scalar mag() const
mag method
detray::unit< scalar_t > unit
double b_x2() const
get the intercept of the straight line in the x2-x3 plane
double a_x2() const
get the slope of the straight line in the x2-x3 plane
double b_x1() const
get the intercept of the straight line in the x1-x3 plane
double a_x1() const
get the slope of the straight line in the x1-x3 plane
const Amg::Vector3D & direction() const
Method to retrieve the direction at the Intersection.

Member Data Documentation

◆ m_fix_selection

bool MuonCalib::StraightPatRec::m_fix_selection
private

Definition at line 97 of file StraightPatRec.h.

◆ m_r_max

double MuonCalib::StraightPatRec::m_r_max
private

Definition at line 100 of file StraightPatRec.h.

◆ m_refine_segment

bool MuonCalib::IMdtPatRecFitter::m_refine_segment
protectedinherited

flags

Definition at line 49 of file IMdtPatRecFitter.h.

◆ m_refit

bool MuonCalib::IMdtPatRecFitter::m_refit
protectedinherited

Definition at line 50 of file IMdtPatRecFitter.h.

◆ m_road_width

double MuonCalib::StraightPatRec::m_road_width
private

Definition at line 101 of file StraightPatRec.h.

◆ m_time_out

double MuonCalib::StraightPatRec::m_time_out
private

Definition at line 102 of file StraightPatRec.h.


The documentation for this class was generated from the following files: