ATLAS Offline Software
Loading...
Searching...
No Matches
ROOT::Minuit2::TileMuonTrackDistance Class Reference

Auxiliary to TileMuonFitter. More...

#include <TileMuonTrackDistance.h>

Inheritance diagram for ROOT::Minuit2::TileMuonTrackDistance:
Collaboration diagram for ROOT::Minuit2::TileMuonTrackDistance:

Public Member Functions

 TileMuonTrackDistance (const std::vector< double > &X, const std::vector< double > &Y, const std::vector< double > &Z, const std::vector< double > &E)
 Constructor.
virtual ~TileMuonTrackDistance ()
virtual double operator() (const std::vector< double > &) const override
 Provides Chi-square in function of parameter vector.
virtual double Up () const override
void Means ()
 Calculates means (weighted or not) of cell positions.
double Distance2SinglePoint (double x, double y, double z, const std::vector< double > &par) const
 Returns squared distance from point to track defined by par.
CLHEP::Hep3Vector ClosestPoint (CLHEP::Hep3Vector *dataPoint, const std::vector< double > &par) const
 Returns point in track defined by par closest to dataPoint.
double GetMeanX ()
 X mean getter.
double GetMeanY ()
 Y mean getter.
double GetMeanZ ()
 Z mean getter.
void SetWeighted (bool weight)
 Set weight/no-weight flag.
bool GetWeighted ()
 Get weight/no-weight flag.

Private Attributes

std::vector< double > m_theX
 Vector of cell center X coordinates.
std::vector< double > m_theY
 Vector of cell center Y coordinates.
std::vector< double > m_theZ
 Vector of cell center Z coordinates.
std::vector< double > m_theE
 Vector of cell energies.
bool m_doWeighted
 Weight/no-weight flag.
double m_meanX
double m_meanY
double m_meanZ

Detailed Description

Auxiliary to TileMuonFitter.

Chi-square function for Minuit.

This class is auxiliary to TileMuonFitter. Provides sum of squared orthogonal distances from cells to track. Implemented as a FCNBase in order to be called directly by Minuit.

Definition at line 42 of file TileMuonTrackDistance.h.

Constructor & Destructor Documentation

◆ TileMuonTrackDistance()

ROOT::Minuit2::TileMuonTrackDistance::TileMuonTrackDistance ( const std::vector< double > & X,
const std::vector< double > & Y,
const std::vector< double > & Z,
const std::vector< double > & E )
inline

Constructor.

Definition at line 47 of file TileMuonTrackDistance.h.

49 : m_theX(X), m_theY(Y), m_theZ(Z), m_theE(E), m_doWeighted(false), m_meanX(0.0), m_meanY(0.0), m_meanZ(0.0) {
50 }
std::vector< double > m_theX
Vector of cell center X coordinates.
std::vector< double > m_theZ
Vector of cell center Z coordinates.
std::vector< double > m_theY
Vector of cell center Y coordinates.
std::vector< double > m_theE
Vector of cell energies.

◆ ~TileMuonTrackDistance()

virtual ROOT::Minuit2::TileMuonTrackDistance::~TileMuonTrackDistance ( )
inlinevirtual

Definition at line 52 of file TileMuonTrackDistance.h.

52 {
53 }

Member Function Documentation

◆ ClosestPoint()

Hep3Vector ROOT::Minuit2::TileMuonTrackDistance::ClosestPoint ( CLHEP::Hep3Vector * dataPoint,
const std::vector< double > & par ) const

Returns point in track defined by par closest to dataPoint.

Definition at line 93 of file TileMuonTrackDistance.cxx.

93 {
94
95 double aa, bb, cc, dd;
96 double xort = 0;
97 Hep3Vector linePoint;
98
99 aa = par[0];
100 bb = par[1];
101 cc = par[2];
102 dd = par[3];
103
104 xort = dataPoint->getX() + bb * (dataPoint->getY() - aa) + dd * (dataPoint->getZ() - cc);
105 xort /= (1 + bb * bb + dd * dd);
106 linePoint.setX(xort);
107 linePoint.setY(aa + bb * xort);
108 linePoint.setZ(cc + dd * xort);
109
110 return linePoint;
111 }

◆ Distance2SinglePoint()

double ROOT::Minuit2::TileMuonTrackDistance::Distance2SinglePoint ( double x,
double y,
double z,
const std::vector< double > & par ) const

Returns squared distance from point to track defined by par.

Definition at line 84 of file TileMuonTrackDistance.cxx.

85 {
86
87 Hep3Vector dataP(x, y, z);
88 Hep3Vector lineP(ClosestPoint(&dataP, par));
89
90 return (dataP - lineP).mag2();
91 }
#define y
#define x
#define z
CLHEP::Hep3Vector ClosestPoint(CLHEP::Hep3Vector *dataPoint, const std::vector< double > &par) const
Returns point in track defined by par closest to dataPoint.

◆ GetMeanX()

double ROOT::Minuit2::TileMuonTrackDistance::GetMeanX ( )
inline

X mean getter.

Definition at line 69 of file TileMuonTrackDistance.h.

69 {
70 return m_meanX;
71 }

◆ GetMeanY()

double ROOT::Minuit2::TileMuonTrackDistance::GetMeanY ( )
inline

Y mean getter.

Definition at line 73 of file TileMuonTrackDistance.h.

73 {
74 return m_meanY;
75 }

◆ GetMeanZ()

double ROOT::Minuit2::TileMuonTrackDistance::GetMeanZ ( )
inline

Z mean getter.

Definition at line 77 of file TileMuonTrackDistance.h.

77 {
78 return m_meanZ;
79 }

◆ GetWeighted()

bool ROOT::Minuit2::TileMuonTrackDistance::GetWeighted ( )
inline

Get weight/no-weight flag.

Definition at line 86 of file TileMuonTrackDistance.h.

86 {
87 return m_doWeighted;
88 }

◆ Means()

void ROOT::Minuit2::TileMuonTrackDistance::Means ( )

Calculates means (weighted or not) of cell positions.

Definition at line 28 of file TileMuonTrackDistance.cxx.

28 {
29 m_meanX = m_meanY = m_meanZ = 0.;
30 double eSum = 0.;
31 int ncells = m_theX.size();
32
33 if (m_doWeighted) {
34 for (int i = 0; i < ncells; i++) {
35 m_meanX += m_theE[i] * m_theX[i];
36 m_meanY += m_theE[i] * m_theY[i];
37 m_meanZ += m_theE[i] * m_theZ[i];
38 eSum += m_theE[i];
39 }
40 if (eSum > 0) {
41 m_meanX /= eSum;
42 m_meanY /= eSum;
43 m_meanZ /= eSum;
44 } else {
45 m_meanX = 0;
46 m_meanY = 0;
47 m_meanZ = 0;
48 }
49 } else {
50 for (int i = 0; i < ncells; i++) {
51 m_meanX += m_theX[i];
52 m_meanY += m_theY[i];
53 m_meanZ += m_theZ[i];
54 }
55 m_meanX /= (double) (ncells);
56 m_meanY /= (double) (ncells);
57 m_meanZ /= (double) (ncells);
58 }
59
60 }

◆ operator()()

double ROOT::Minuit2::TileMuonTrackDistance::operator() ( const std::vector< double > & par) const
overridevirtual

Provides Chi-square in function of parameter vector.

Definition at line 62 of file TileMuonTrackDistance.cxx.

63 {
64 double distSum2 = 0;
65 std::vector<double> fourPar;
66
67 fourPar.push_back(m_meanY - par[0] * m_meanX);
68 fourPar.push_back(par[0]);
69 fourPar.push_back(m_meanZ - par[1] * m_meanX);
70 fourPar.push_back(par[1]);
71
72 for (int i = 0; i < (int) (m_theX.size()); i++) {
73 if (m_doWeighted) {
74 distSum2 += m_theE[i] * Distance2SinglePoint(m_theX[i], m_theY[i], m_theZ[i], fourPar);
75 } else {
76 distSum2 += Distance2SinglePoint(m_theX[i], m_theY[i], m_theZ[i], fourPar);
77 }
78 }
79
80 return distSum2;
81
82 }
double Distance2SinglePoint(double x, double y, double z, const std::vector< double > &par) const
Returns squared distance from point to track defined by par.

◆ SetWeighted()

void ROOT::Minuit2::TileMuonTrackDistance::SetWeighted ( bool weight)
inline

Set weight/no-weight flag.

Definition at line 82 of file TileMuonTrackDistance.h.

◆ Up()

virtual double ROOT::Minuit2::TileMuonTrackDistance::Up ( ) const
inlineoverridevirtual

Definition at line 57 of file TileMuonTrackDistance.h.

57 {
58 return 1.;
59 }

Member Data Documentation

◆ m_doWeighted

bool ROOT::Minuit2::TileMuonTrackDistance::m_doWeighted
private

Weight/no-weight flag.

Definition at line 101 of file TileMuonTrackDistance.h.

◆ m_meanX

double ROOT::Minuit2::TileMuonTrackDistance::m_meanX
private

Definition at line 103 of file TileMuonTrackDistance.h.

◆ m_meanY

double ROOT::Minuit2::TileMuonTrackDistance::m_meanY
private

Definition at line 104 of file TileMuonTrackDistance.h.

◆ m_meanZ

double ROOT::Minuit2::TileMuonTrackDistance::m_meanZ
private

Definition at line 105 of file TileMuonTrackDistance.h.

◆ m_theE

std::vector<double> ROOT::Minuit2::TileMuonTrackDistance::m_theE
private

Vector of cell energies.

Definition at line 98 of file TileMuonTrackDistance.h.

◆ m_theX

std::vector<double> ROOT::Minuit2::TileMuonTrackDistance::m_theX
private

Vector of cell center X coordinates.

Definition at line 92 of file TileMuonTrackDistance.h.

◆ m_theY

std::vector<double> ROOT::Minuit2::TileMuonTrackDistance::m_theY
private

Vector of cell center Y coordinates.

Definition at line 94 of file TileMuonTrackDistance.h.

◆ m_theZ

std::vector<double> ROOT::Minuit2::TileMuonTrackDistance::m_theZ
private

Vector of cell center Z coordinates.

Definition at line 96 of file TileMuonTrackDistance.h.


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