ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Vertex.h
(Generate patch)

Comparing UserCode/MitAna/DataTree/interface/Vertex.h (file contents):
Revision 1.5 by loizides, Tue Oct 14 05:27:54 2008 UTC vs.
Revision 1.11 by loizides, Thu Nov 26 21:42:30 2009 UTC

# Line 3 | Line 3
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   //--------------------------------------------------------------------------------------------------
# Line 12 | Line 12
12   #define MITANA_DATATREE_VERTEX_H
13  
14   #include <TMath.h>
15 < #include "MitAna/DataTree/interface/DataObject.h"
15 > #include "MitAna/DataTree/interface/BaseVertex.h"
16  
17   namespace mithep
18   {
19 <  class Vertex : public DataObject
19 >  class Vertex : public BaseVertex
20    {
21      public:
22 <      Vertex() :
23 <        fPosition(0,0,0), fXErr(0.0), fYErr(0.0), fZErr(0.0), 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 <        fPosition(x,y,z), fXErr(0.0), fYErr(0.0), fZErr(0.0), fChi2(0.0), fNdof(0), fNTracks(0) {}
26 <
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 <        fPosition(x,y,z), fXErr(xErr), fYErr(yErr), fZErr(zErr), fChi2(0.0), fNdof(0), fNTracks(0) {}
27 <      Vertex(const ThreeVector &pos) :
28 <        fPosition(pos), fXErr(0.0), fYErr(0.0), fZErr(0.0), fChi2(0.0), fNdof(0), fNTracks(0) {}
31 <      ~Vertex() {}
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) {}
29        
30 <      Double_t            Chi2()      const { return fChi2; }
31 <      UInt_t              Ndof()      const { return fNdof; }
32 <      UInt_t              NTracks()   const { return fNTracks; }
33 <      Double_t            Phi()       const { return fPosition.Phi();  }
34 <      const ThreeVector  &Position()  const { return fPosition;        }
38 <      Double_t            Rho()       const { return fPosition.Rho();  }
39 <      Double_t            X()         const { return fPosition.X();    }
40 <      Double_t            XErr()      const { return fXErr; }
41 <      Double_t            Y()         const { return fPosition.Y();    }
42 <      Double_t            YErr()      const { return fYErr; }
43 <      Double_t            Z()         const { return fPosition.Z();    }
44 <      Double_t            ZErr()      const { return fZErr; }
30 >      Double_t            Chi2()      const { return fChi2;                    }
31 >      Int_t               Compare(const TObject *o) const;
32 >      UShort_t            Ndof()      const { return fNdof;                    }
33 >      UInt_t              NTracks()   const { return fNTracks;                 }
34 >      EObjType            ObjType()   const { return kVertex;                  }      
35        Double_t            Prob()      const { return TMath::Prob(fChi2,fNdof); }
36 <      void                SetChi2(Double_t chi2)              { fChi2 = chi2; }
37 <      void                SetErrors(Double_t xErr, Double_t yErr, Double_t zErr);
38 <      void                SetNdof(UInt_t nDof)                { fNdof = nDof; }
49 <      void                SetPosition(const ThreeVector &pos) { fPosition = pos; }
50 <      void                SetPosition(Double_t x, Double_t y, Double_t z);
51 <      void                SetNTracks(UInt_t ntrks)            { fNTracks = ntrks; }
36 >      void                SetChi2(Double_t chi2)     { fChi2 = chi2;     }
37 >      void                SetNdof(UShort_t nDof)     { fNdof = nDof;     }
38 >      void                SetNTracks(UShort_t ntrks) { fNTracks = ntrks; }
39              
40      protected:
41 <      ThreeVector         fPosition; //point in space
42 <      Double32_t          fXErr;     //error in x
43 <      Double32_t          fYErr;     //error in y
57 <      Double32_t          fZErr;     //error in z
58 <      Double32_t          fChi2;     //chi squared of conversion vertex fit
59 <      UInt_t              fNdof;     //number of degrees of freedom of conversion vertex fit
60 <      UInt_t              fNTracks;  //number of tracks used for the fit
41 >      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          
45      ClassDef(Vertex, 1) // Vertex class
46    };
47   }
48  
49   //--------------------------------------------------------------------------------------------------
50 < inline void mithep::Vertex::SetErrors(Double_t xErr, Double_t yErr, Double_t zErr)
51 < {
52 <  // Set uncertainties on vertex position.
53 <
54 <  fXErr = xErr;
55 <  fYErr = yErr;
56 <  fZErr = zErr;
57 < }
58 <
59 < //--------------------------------------------------------------------------------------------------
60 < inline void mithep::Vertex::SetPosition(Double_t x, Double_t y, Double_t z)
61 < {
62 <  // Set vertex position.
63 <
64 <  fPosition.SetXYZ(x,y,z);
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   }
83
76   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines