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.9 by loizides, Wed Mar 18 15:44:32 2009 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 28 | Line 28 | namespace mithep
28          BaseVertex(pos), fChi2(0), fNdof(0), fNTracks(0) {}
29        
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;                  }      
# Line 44 | Line 45 | namespace mithep
45      ClassDef(Vertex, 1) // Vertex class
46    };
47   }
48 +
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   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines