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

Comparing UserCode/MitAna/DataTree/interface/SuperCluster.h (file contents):
Revision 1.12 by loizides, Wed Apr 8 10:24:33 2009 UTC vs.
Revision 1.13 by loizides, Mon Oct 26 09:48:09 2009 UTC

# Line 26 | Line 26 | namespace mithep
26        SuperCluster() : fEnergy(0), fEtaWidth(0), fPreshowerEnergy(0),
27                         fPhiWidth(0), fRawEnergy(0) {}    
28  
29 <      void                    AddCluster(const BasicCluster *c)      { fClusters.Add(c);           }
29 >      void                    AddCluster(const BasicCluster *c)          { fClusters.Add(c);       }
30        const BasicCluster     *Cluster(UInt_t i)       const { return fClusters.At(i);              }
31        UInt_t                  ClusterSize()           const { return fClusters.Entries();          }
32 +      Int_t                   Compare(const TObject *o) const;  
33        Double_t                Energy()                const { return fEnergy;                      }
34        Double_t                Eta()                   const { return fPoint.Eta();                 }
35        Double_t                EtaWidth()              const { return fEtaWidth;                    }
36 +      Bool_t                  IsSortable()            const { return kTRUE;                        }
37        EObjType                ObjType()               const { return kSuperCluster;                }
38        Double_t                Phi()                   const { return fPoint.Phi();                 }
39        Double_t                PhiWidth()              const { return fPhiWidth;                    }
# Line 62 | Line 64 | namespace mithep
64      ClassDef(SuperCluster, 1) // Super cluster class
65    };
66   }
67 +
68 + //--------------------------------------------------------------------------------------------------
69 + inline Int_t mithep::SuperCluster::Compare(const TObject *o) const
70 + {
71 +  // Default compare function for sorting according to transverse momentum.
72 +  // Returns -1 if this object is smaller than given object, 0 if objects are
73 +  // equal and 1 if this is larger than given object.
74 +
75 +  const mithep::SuperCluster *s = dynamic_cast<const mithep::SuperCluster *>(o);
76 +  if (!s)
77 +    return 1;
78 +
79 +  Double_t mye = Energy();
80 +  Double_t e   = s->Energy();
81 +  if (mye>e)
82 +    return -1;
83 +  else if (e>mye)
84 +    return +1;
85 +  return 0;
86 + }
87   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines