1 |
loizides |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
loizides |
1.11 |
// $Id: Vertex.h,v 1.10 2009/09/25 08:37:38 loizides Exp $
|
3 |
loizides |
1.1 |
//
|
4 |
|
|
// Vertex
|
5 |
|
|
//
|
6 |
loizides |
1.10 |
// Vertex class derived from BaseVertex holding additional fit information.
|
7 |
loizides |
1.1 |
//
|
8 |
|
|
// Authors: J.Bendavid
|
9 |
|
|
//--------------------------------------------------------------------------------------------------
|
10 |
|
|
|
11 |
loizides |
1.5 |
#ifndef MITANA_DATATREE_VERTEX_H
|
12 |
|
|
#define MITANA_DATATREE_VERTEX_H
|
13 |
loizides |
1.1 |
|
14 |
bendavid |
1.4 |
#include <TMath.h>
|
15 |
bendavid |
1.6 |
#include "MitAna/DataTree/interface/BaseVertex.h"
|
16 |
loizides |
1.1 |
|
17 |
|
|
namespace mithep
|
18 |
|
|
{
|
19 |
bendavid |
1.6 |
class Vertex : public BaseVertex
|
20 |
loizides |
1.1 |
{
|
21 |
|
|
public:
|
22 |
loizides |
1.9 |
Vertex() : fChi2(0), fNdof(0), fNTracks(0) {}
|
23 |
loizides |
1.5 |
Vertex(Double_t x, Double_t y, Double_t z) :
|
24 |
loizides |
1.7 |
BaseVertex(x,y,z), fChi2(0), fNdof(0), fNTracks(0) {}
|
25 |
bendavid |
1.4 |
Vertex(Double_t x, Double_t y, Double_t z, Double_t xErr, Double_t yErr, Double_t zErr) :
|
26 |
loizides |
1.9 |
BaseVertex(x,y,z,xErr,yErr,zErr), fChi2(0), fNdof(0), fNTracks(0) {}
|
27 |
loizides |
1.8 |
Vertex(const ThreeVector &pos) :
|
28 |
loizides |
1.7 |
BaseVertex(pos), fChi2(0), fNdof(0), fNTracks(0) {}
|
29 |
loizides |
1.1 |
|
30 |
loizides |
1.7 |
Double_t Chi2() const { return fChi2; }
|
31 |
loizides |
1.11 |
Int_t Compare(const TObject *o) const;
|
32 |
loizides |
1.9 |
UShort_t Ndof() const { return fNdof; }
|
33 |
loizides |
1.7 |
UInt_t NTracks() const { return fNTracks; }
|
34 |
|
|
EObjType ObjType() const { return kVertex; }
|
35 |
bendavid |
1.4 |
Double_t Prob() const { return TMath::Prob(fChi2,fNdof); }
|
36 |
loizides |
1.7 |
void SetChi2(Double_t chi2) { fChi2 = chi2; }
|
37 |
loizides |
1.9 |
void SetNdof(UShort_t nDof) { fNdof = nDof; }
|
38 |
|
|
void SetNTracks(UShort_t ntrks) { fNTracks = ntrks; }
|
39 |
loizides |
1.1 |
|
40 |
|
|
protected:
|
41 |
loizides |
1.9 |
Double32_t fChi2; //[0,0,12]chi squared of conversion vertex fit
|
42 |
|
|
UShort_t fNdof; //number of degrees of freedom of conversion vertex fit
|
43 |
|
|
UShort_t fNTracks; //number of tracks used for the fit
|
44 |
loizides |
1.1 |
|
45 |
|
|
ClassDef(Vertex, 1) // Vertex class
|
46 |
|
|
};
|
47 |
|
|
}
|
48 |
loizides |
1.11 |
|
49 |
|
|
//--------------------------------------------------------------------------------------------------
|
50 |
|
|
inline Int_t mithep::Vertex::Compare(const TObject *o) const
|
51 |
|
|
{
|
52 |
|
|
// Default compare function for sorting according to transverse momentum.
|
53 |
|
|
// Returns -1 if this object is smaller than given object, 0 if objects are
|
54 |
|
|
// equal and 1 if this is larger than given object.
|
55 |
|
|
|
56 |
|
|
const mithep::Vertex *v = dynamic_cast<const mithep::Vertex *>(o);
|
57 |
|
|
if (!v)
|
58 |
|
|
return 1;
|
59 |
|
|
|
60 |
|
|
Int_t myn = NTracks();
|
61 |
|
|
Int_t n = v->NTracks();
|
62 |
|
|
if (myn>n)
|
63 |
|
|
return -1;
|
64 |
|
|
else if (n>myn)
|
65 |
|
|
return +1;
|
66 |
|
|
|
67 |
|
|
Double_t myd = Chi2();
|
68 |
|
|
Double_t d = v->Chi2();
|
69 |
|
|
if (myd<d)
|
70 |
|
|
return -1;
|
71 |
|
|
else if (d<myd)
|
72 |
|
|
return +1;
|
73 |
|
|
|
74 |
|
|
return 0;
|
75 |
|
|
}
|
76 |
loizides |
1.1 |
#endif
|