3 |
|
// |
4 |
|
// Vertex |
5 |
|
// |
6 |
< |
// Vertex class implemented as holding a 3d vector as a point in space with fit information. |
6 |
> |
// Vertex class derived from BaseVertex holding additional fit information. |
7 |
|
// |
8 |
|
// Authors: J.Bendavid |
9 |
|
//-------------------------------------------------------------------------------------------------- |
19 |
|
class Vertex : public BaseVertex |
20 |
|
{ |
21 |
|
public: |
22 |
< |
Vertex() : |
23 |
< |
fChi2(0.0), fNdof(0), fNTracks(0) {} |
22 |
> |
Vertex() : fChi2(0), fNdof(0), fNTracks(0) {} |
23 |
|
Vertex(Double_t x, Double_t y, Double_t z) : |
24 |
|
BaseVertex(x,y,z), fChi2(0), fNdof(0), fNTracks(0) {} |
25 |
|
Vertex(Double_t x, Double_t y, Double_t z, Double_t xErr, Double_t yErr, Double_t zErr) : |
26 |
< |
BaseVertex(x,y,z,xErr,yErr,zErr), fChi2(0.0), fNdof(0), fNTracks(0) {} |
27 |
< |
Vertex(const ThreeVector &pos) : |
26 |
> |
BaseVertex(x,y,z,xErr,yErr,zErr), fChi2(0), fNdof(0), fNTracks(0) {} |
27 |
> |
Vertex(const ThreeVector &pos) : |
28 |
|
BaseVertex(pos), fChi2(0), fNdof(0), fNTracks(0) {} |
30 |
– |
~Vertex() {} |
29 |
|
|
30 |
< |
Double_t Chi2() const { return fChi2; } |
31 |
< |
UInt_t Ndof() const { return fNdof; } |
32 |
< |
UInt_t NTracks() const { return fNTracks; } |
33 |
< |
EObjType ObjType() const { return kVertex; } |
34 |
< |
Double_t Prob() const { return TMath::Prob(fChi2,fNdof); } |
30 |
> |
Double_t Chi2() const { return fChi2; } |
31 |
> |
Int_t Compare(const TObject *o) const; |
32 |
> |
Bool_t IsSortable() const { return kTRUE; } |
33 |
> |
UShort_t Ndof() const { return fNdof; } |
34 |
> |
UInt_t NTracks() const { return fNTracks; } |
35 |
> |
EObjType ObjType() const { return kVertex; } |
36 |
> |
Double_t Prob() const { return TMath::Prob(fChi2,fNdof); } |
37 |
|
void SetChi2(Double_t chi2) { fChi2 = chi2; } |
38 |
< |
void SetNdof(UInt_t nDof) { fNdof = nDof; } |
39 |
< |
void SetNTracks(UInt_t ntrks) { fNTracks = ntrks; } |
38 |
> |
void SetNdof(UShort_t nDof) { fNdof = nDof; } |
39 |
> |
void SetNTracks(UShort_t ntrks) { fNTracks = ntrks; } |
40 |
|
|
41 |
|
protected: |
42 |
< |
Double32_t fChi2; //chi squared of conversion vertex fit |
43 |
< |
UInt_t fNdof; //number of degrees of freedom of conversion vertex fit |
44 |
< |
UInt_t fNTracks; //number of tracks used for the fit |
42 |
> |
Double32_t fChi2; //[0,0,12]chi squared of conversion vertex fit |
43 |
> |
UShort_t fNdof; //number of degrees of freedom of conversion vertex fit |
44 |
> |
UShort_t fNTracks; //number of tracks used for the fit |
45 |
|
|
46 |
|
ClassDef(Vertex, 1) // Vertex class |
47 |
|
}; |
48 |
|
} |
49 |
+ |
|
50 |
+ |
//-------------------------------------------------------------------------------------------------- |
51 |
+ |
inline Int_t mithep::Vertex::Compare(const TObject *o) const |
52 |
+ |
{ |
53 |
+ |
// Default compare function for sorting according to transverse momentum. |
54 |
+ |
// Returns -1 if this object is smaller than given object, 0 if objects are |
55 |
+ |
// equal and 1 if this is larger than given object. |
56 |
+ |
|
57 |
+ |
const mithep::Vertex *v = dynamic_cast<const mithep::Vertex *>(o); |
58 |
+ |
if (!v) |
59 |
+ |
return 1; |
60 |
+ |
|
61 |
+ |
Int_t myn = NTracks(); |
62 |
+ |
Int_t n = v->NTracks(); |
63 |
+ |
if (myn>n) |
64 |
+ |
return -1; |
65 |
+ |
else if (n>myn) |
66 |
+ |
return +1; |
67 |
+ |
|
68 |
+ |
Double_t myd = Chi2(); |
69 |
+ |
Double_t d = v->Chi2(); |
70 |
+ |
if (myd<d) |
71 |
+ |
return -1; |
72 |
+ |
else if (d<myd) |
73 |
+ |
return +1; |
74 |
+ |
|
75 |
+ |
return 0; |
76 |
+ |
} |
77 |
|
#endif |