ATLAS Offline Software
TGCDQAUtils.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // Package : TGCDQAUtils
7 // Author: A.Ishikawa(Kobe)
8 // Oct. 2008
9 //
10 // DESCRIPTION:
11 // Subject: Helper classes for TGC DQA
13 
14 #ifndef TGCDQAUtils_H
15 #define TGCDQAUtils_H
16 
18 {
19  //y = a*x + b
20  private:
21  double m_a;
22  double m_b;
23  double m_chi2;
24  int m_ndf;
25  int m_nLayer;
27 
28  public:
30  m_a=m_b=m_chi2=0.;
32  }
34  LinearTrack(double a,
35  double b,
36  double chi2,
37  int ndf,
38  int nLayer,
39  int nStation)
40  :m_a(a),
41  m_b(b),
42  m_chi2(chi2),
43  m_ndf(ndf),
46  {
47  }
48 
49  double a(){return m_a;}
50  double b(){return m_b;}
51  double chi2(){return m_chi2;}
52  int ndf(){return m_ndf;}
53  int nLayer(){return m_nLayer;}
54  int nStation(){return m_nStation;}
55 
56  double chi2OverNdf(){return m_chi2/m_ndf;}
57  double y(double x){return m_a*x+m_b;}
58  double x(double y){return (y-m_b)/m_a;}
59 
60  void a(double a){m_a=a;}
61  void b(double b){m_b=b;}
62  void chi2(double chi2){m_chi2=chi2;}
63  void ndf(int ndf){m_ndf=ndf;}
66 
67 };
68 
70 {
71  private:
72  double m_x;
73  double m_y;
74  double m_sigma;
75  double m_pchi2;
76  int m_signchi;
77 
78  double m_X;
79  double m_XX;
80  double m_XY;
81  double m_Y;
82  double m_YY;
83  double m_SS;
84 
85 
86  int m_layer;
87  bool m_used;
88  bool m_usable;
89 
90  int m_type;
91 
92  public:
95  XYPosition(double x,
96  double y,
97  double sigma,
98  int layer)
99  :m_x(x),
100  m_y(y),
101  m_sigma(sigma),
102  m_pchi2(0.0),
103  m_signchi(0),
104  m_layer(layer),
105  m_used(true),
106  m_usable(true),
107  m_type(0)
108  {
109  m_SS = 1./(sigma*sigma);
110  m_X = x*m_SS;
111  m_XX = x*m_X;
112  m_XY = y*m_X;
113  m_Y = y*m_SS;
114  m_YY = y*m_Y;
115  }
116 
117  XYPosition(double x,
118  double y,
119  double sigma,
120  int layer,
121  int type)
122  :m_x(x),
123  m_y(y),
124  m_sigma(sigma),
125  m_pchi2(0.0),
126  m_signchi(0),
127  m_layer(layer),
128  m_used(true),
129  m_usable(true),
130  m_type(type)
131  {
132  m_SS = 1./(sigma*sigma);
133  m_X = x*m_SS;
134  m_XX = x*m_X;
135  m_XY = y*m_X;
136  m_Y = y*m_SS;
137  m_YY = y*m_Y;
138  }
139 
140 
141 
142  double x(){return m_x;}
143  double y(){return m_y;}
144  double sigma(){return m_sigma;}
145  double pchi2(){return m_pchi2;}
146  int signchi(){return m_signchi;}
147 
148  double X(){return m_X;}
149  double XX(){return m_XX;}
150  double XY(){return m_XY;}
151  double Y(){return m_Y;}
152  double YY(){return m_YY;}
153  double SS(){return m_SS;}
154 
155  int layer(){return m_layer;}
156  bool used(){return m_used;}
157  bool usable(){return m_usable;}
158 
159  int type(){return m_type;}
160 
161  void x(double x){m_x=x;}
162  void y(double y){m_y=y;}
163  void sigma(double sigma){m_sigma=sigma;}
164  void pchi2(double pchi2){m_pchi2=pchi2;}
166 
167  void X(double X){m_X=X;}
168  void XX(double XX){m_XX=XX;}
169  void XY(double XY){m_XY=XY;}
170  void Y(double Y){m_Y=Y;}
171  void YY(double YY){m_YY=YY;}
172  void SS(double SS){m_SS=SS;}
173 
174  void layer(int layer){m_layer=layer;}
175  void used(bool used){m_used=used;}
177 
178  friend std::ostream &operator << (std::ostream &s, XYPosition &xy) {
179  s <<"x y sigma signchi*pchi2 layer used usable type : "<<xy.x()<<" "<<xy.y()<<" "<<xy.sigma()<<" "<<std::setw(9)<<std::setprecision(2)<<xy.signchi()*xy.pchi2()<<" "<<xy.layer()<<" "<<xy.used()<<" "<<xy.usable()<<" "<<xy.type();
180  //s <<"x y sigma X XX SS pchi2 layer used usable : "<<xy.x()<<" "<<xy.y()<<" "<<xy.sigma()<<" "<<xy.X()<<" "<<xy.XX()<<" "<<xy.SS()<<" "<<xy.pchi2()<<" "<<xy.layer()<<" "<<xy.used()<<" "<<xy.usable();
181  return s;
182  }
183 
184  friend bool operator<(XYPosition& xy0, XYPosition& xy1) {
185  if( xy0.layer() < xy1.layer() )
186  return true;
187  else if(xy0.layer() == xy1.layer())
188  return xy0.x()<xy1.x();
189  else
190  return false;
191  }
192  friend bool operator>(XYPosition& xy0, XYPosition& xy1) {
193  if( xy0.layer() > xy1.layer() )
194  return true;
195  else if(xy0.layer() == xy1.layer())
196  return xy0.x()>xy1.x();
197  else
198  return false;
199  }
200 
201 };
202 
203 #endif
used
XYPosition::m_signchi
int m_signchi
Definition: TGCDQAUtils.h:76
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
XYPosition::type
int type()
Definition: TGCDQAUtils.h:159
XYPosition::usable
void usable(bool usable)
Definition: TGCDQAUtils.h:176
XYPosition::XYPosition
XYPosition(double x, double y, double sigma, int layer)
Definition: TGCDQAUtils.h:95
XYPosition::operator>
friend bool operator>(XYPosition &xy0, XYPosition &xy1)
Definition: TGCDQAUtils.h:192
LinearTrack::chi2
double chi2()
Definition: TGCDQAUtils.h:51
LinearTrack::chi2
void chi2(double chi2)
Definition: TGCDQAUtils.h:62
XYPosition::~XYPosition
~XYPosition()
Definition: TGCDQAUtils.h:94
XYPosition::YY
double YY()
Definition: TGCDQAUtils.h:152
XYPosition::m_XX
double m_XX
Definition: TGCDQAUtils.h:79
XYPosition::pchi2
double pchi2()
Definition: TGCDQAUtils.h:145
XYPosition::SS
void SS(double SS)
Definition: TGCDQAUtils.h:172
XYPosition::m_YY
double m_YY
Definition: TGCDQAUtils.h:82
XYPosition::sigma
double sigma()
Definition: TGCDQAUtils.h:144
XYPosition::m_type
int m_type
Definition: TGCDQAUtils.h:90
LinearTrack::m_a
double m_a
Definition: TGCDQAUtils.h:21
XYPosition::m_usable
bool m_usable
Definition: TGCDQAUtils.h:88
LinearTrack::x
double x(double y)
Definition: TGCDQAUtils.h:58
LinearTrack::m_nLayer
int m_nLayer
Definition: TGCDQAUtils.h:25
XYPosition::usable
bool usable()
Definition: TGCDQAUtils.h:157
LinearTrack::y
double y(double x)
Definition: TGCDQAUtils.h:57
LinearTrack::m_ndf
int m_ndf
Definition: TGCDQAUtils.h:24
XYPosition::XX
double XX()
Definition: TGCDQAUtils.h:149
LinearTrack::ndf
int ndf()
Definition: TGCDQAUtils.h:52
LinearTrack::m_b
double m_b
Definition: TGCDQAUtils.h:22
XYPosition::x
void x(double x)
Definition: TGCDQAUtils.h:161
LinearTrack::~LinearTrack
~LinearTrack()
Definition: TGCDQAUtils.h:33
XYPosition::XYPosition
XYPosition()
Definition: TGCDQAUtils.h:93
XYPosition::used
void used(bool used)
Definition: TGCDQAUtils.h:175
LinearTrack::chi2OverNdf
double chi2OverNdf()
Definition: TGCDQAUtils.h:56
XYPosition::m_used
bool m_used
Definition: TGCDQAUtils.h:87
XYPosition::m_Y
double m_Y
Definition: TGCDQAUtils.h:81
LinearTrack::ndf
void ndf(int ndf)
Definition: TGCDQAUtils.h:63
XYPosition::YY
void YY(double YY)
Definition: TGCDQAUtils.h:171
XYPosition::XY
void XY(double XY)
Definition: TGCDQAUtils.h:169
XYPosition::layer
void layer(int layer)
Definition: TGCDQAUtils.h:174
XYPosition::m_SS
double m_SS
Definition: TGCDQAUtils.h:83
XYPosition::XYPosition
XYPosition(double x, double y, double sigma, int layer, int type)
Definition: TGCDQAUtils.h:117
XYPosition::layer
int layer()
Definition: TGCDQAUtils.h:155
LinearTrack::b
double b()
Definition: TGCDQAUtils.h:50
XYPosition::m_sigma
double m_sigma
Definition: TGCDQAUtils.h:74
LinearTrack::m_chi2
double m_chi2
Definition: TGCDQAUtils.h:23
LinearTrack::nStation
void nStation(int nStation)
Definition: TGCDQAUtils.h:65
XYPosition::m_X
double m_X
Definition: TGCDQAUtils.h:78
LinearTrack::LinearTrack
LinearTrack()
Definition: TGCDQAUtils.h:29
XYPosition::pchi2
void pchi2(double pchi2)
Definition: TGCDQAUtils.h:164
LinearTrack::nStation
int nStation()
Definition: TGCDQAUtils.h:54
LinearTrack::nLayer
void nLayer(int nLayer)
Definition: TGCDQAUtils.h:64
LinearTrack::nLayer
int nLayer()
Definition: TGCDQAUtils.h:53
XYPosition::X
double X()
Definition: TGCDQAUtils.h:148
XYPosition::m_XY
double m_XY
Definition: TGCDQAUtils.h:80
XYPosition::XX
void XX(double XX)
Definition: TGCDQAUtils.h:168
LinearTrack::a
double a()
Definition: TGCDQAUtils.h:49
XYPosition::y
double y()
Definition: TGCDQAUtils.h:143
LinearTrack::LinearTrack
LinearTrack(double a, double b, double chi2, int ndf, int nLayer, int nStation)
Definition: TGCDQAUtils.h:34
XYPosition::used
bool used()
Definition: TGCDQAUtils.h:156
LinearTrack::b
void b(double b)
Definition: TGCDQAUtils.h:61
XYPosition::m_pchi2
double m_pchi2
Definition: TGCDQAUtils.h:75
XYPosition
Definition: TGCDQAUtils.h:70
XYPosition::Y
double Y()
Definition: TGCDQAUtils.h:151
XYPosition::signchi
void signchi(int signchi)
Definition: TGCDQAUtils.h:165
XYPosition::m_x
double m_x
Definition: TGCDQAUtils.h:72
XYPosition::operator<<
friend std::ostream & operator<<(std::ostream &s, XYPosition &xy)
Definition: TGCDQAUtils.h:178
XYPosition::X
void X(double X)
Definition: TGCDQAUtils.h:167
XYPosition::m_layer
int m_layer
Definition: TGCDQAUtils.h:86
XYPosition::Y
void Y(double Y)
Definition: TGCDQAUtils.h:170
XYPosition::operator<
friend bool operator<(XYPosition &xy0, XYPosition &xy1)
Definition: TGCDQAUtils.h:184
XYPosition::sigma
void sigma(double sigma)
Definition: TGCDQAUtils.h:163
XYPosition::signchi
int signchi()
Definition: TGCDQAUtils.h:146
XYPosition::y
void y(double y)
Definition: TGCDQAUtils.h:162
XYPosition::XY
double XY()
Definition: TGCDQAUtils.h:150
LinearTrack
Definition: TGCDQAUtils.h:18
XYPosition::x
double x()
Definition: TGCDQAUtils.h:142
LinearTrack::a
void a(double a)
Definition: TGCDQAUtils.h:60
LinearTrack::m_nStation
int m_nStation
Definition: TGCDQAUtils.h:26
XYPosition::SS
double SS()
Definition: TGCDQAUtils.h:153
XYPosition::m_y
double m_y
Definition: TGCDQAUtils.h:73