Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • classes/SortableObject.h

    r341014c r3c46e17  
    2626 */
    2727
     28#include "TRef.h"
    2829#include "TObject.h"
    29 #include "TRef.h"
    3030#include "TRefArray.h"
    3131
     
    3737{
    3838public:
    39   virtual ~CompBase() {}
     39  virtual ~CompBase() { }
    4040  virtual Bool_t IsSortable(const TObject *) const { return kTRUE; }
    4141  virtual Int_t Compare(const TObject *obj1, const TObject *obj2) const = 0;
     
    4747{
    4848public:
     49
    4950  Bool_t IsSortable() const { return GetCompare() ? GetCompare()->IsSortable(this) : kFALSE; }
    5051  Int_t Compare(const TObject *obj) const { return GetCompare()->Compare(this, obj); }
     
    6364{
    6465  CompE() {}
    65 
    6666public:
    6767  static CompE *Instance()
     
    7373  Int_t Compare(const TObject *obj1, const TObject *obj2) const
    7474  {
    75     const T *t1 = static_cast<const T *>(obj1);
    76     const T *t2 = static_cast<const T *>(obj2);
     75    const T *t1 = static_cast<const T*>(obj1);
     76    const T *t2 = static_cast<const T*>(obj2);
    7777    if(t1->E > t2->E)
    7878      return -1;
     
    9090{
    9191  CompPT() {}
    92 
    9392public:
    9493  static CompPT *Instance()
     
    10099  Int_t Compare(const TObject *obj1, const TObject *obj2) const
    101100  {
    102     const T *t1 = static_cast<const T *>(obj1);
    103     const T *t2 = static_cast<const T *>(obj2);
     101    const T *t1 = static_cast<const T*>(obj1);
     102    const T *t2 = static_cast<const T*>(obj2);
    104103    if(t1->PT > t2->PT)
    105104      return -1;
     
    117116{
    118117  CompMomentumPt() {}
    119 
    120118public:
    121119  static CompMomentumPt *Instance()
     
    127125  Int_t Compare(const TObject *obj1, const TObject *obj2) const
    128126  {
    129     const T *t1 = static_cast<const T *>(obj1);
    130     const T *t2 = static_cast<const T *>(obj2);
     127    const T *t1 = static_cast<const T*>(obj1);
     128    const T *t2 = static_cast<const T*>(obj2);
    131129    if(t1->Momentum.Pt() > t2->Momentum.Pt())
    132130      return -1;
     
    144142{
    145143  CompET() {}
    146 
    147144public:
    148145  static CompET *Instance()
     
    154151  Int_t Compare(const TObject *obj1, const TObject *obj2) const
    155152  {
    156     const T *t1 = static_cast<const T *>(obj1);
    157     const T *t2 = static_cast<const T *>(obj2);
     153    const T *t1 = static_cast<const T*>(obj1);
     154    const T *t2 = static_cast<const T*>(obj2);
    158155    if(t1->ET > t2->ET)
    159156      return -1;
     
    171168{
    172169  CompSumPT2() {}
    173 
    174170public:
    175171  static CompSumPT2 *Instance()
     
    181177  Int_t Compare(const TObject *obj1, const TObject *obj2) const
    182178  {
    183     const T *t1 = static_cast<const T *>(obj1);
    184     const T *t2 = static_cast<const T *>(obj2);
     179    const T *t1 = static_cast<const T*>(obj1);
     180    const T *t2 = static_cast<const T*>(obj2);
    185181    if(t1->SumPT2 > t2->SumPT2)
    186182      return -1;
     
    197193class CompDeltaR: public CompBase
    198194{
    199   CompDeltaR(const T2 *obj = 0) :
    200     fObj(obj) {}
     195  CompDeltaR(const T2 *obj = 0) : fObj(obj) {}
    201196
    202197  Double_t DeltaPhi(Double_t phi1, Double_t phi2)
    203198  {
    204199    Double_t phi = TMath::Abs(phi1 - phi2);
    205     return (phi <= TMath::Pi()) ? phi : (2.0 * TMath::Pi()) - phi;
    206   }
    207 
    208   Double_t Sqr(Double_t x) { return x * x; }
     200    return (phi <= TMath::Pi()) ? phi : (2.0*TMath::Pi()) - phi;
     201  }
     202
     203  Double_t Sqr(Double_t x) { return x*x; }
    209204
    210205  Double_t SumSqr(Double_t a, Double_t b)
     
    212207    Double_t aAbs = TMath::Abs(a);
    213208    Double_t bAbs = TMath::Abs(b);
    214     if(aAbs > bAbs)
    215       return aAbs * TMath::Sqrt(1.0 + Sqr(bAbs / aAbs));
    216     else
    217       return (bAbs == 0) ? 0.0 : bAbs * TMath::Sqrt(1.0 + Sqr(aAbs / bAbs));
     209    if(aAbs > bAbs) return aAbs * TMath::Sqrt(1.0 + Sqr(bAbs / aAbs));
     210    else return (bAbs == 0) ? 0.0 : bAbs * TMath::Sqrt(1.0 + Sqr(aAbs / bAbs));
    218211  };
    219212
     
    221214
    222215public:
    223   static CompDeltaR *Instance(const T2 *obj = 0)
    224   {
    225     static CompDeltaR single(obj);
    226     return &single;
     216    static CompDeltaR *Instance(const T2 *obj = 0)
     217  {
     218      static CompDeltaR single(obj);
     219      return &single;
    227220  }
    228221
     
    232225  {
    233226    Double_t eta[3], phi[3], deltaR[2];
    234     const T1 *t1 = static_cast<const T1 *>(obj1);
    235     const T1 *t2 = static_cast<const T1 *>(obj2);
     227    const T1 *t1 = static_cast<const T1*>(obj1);
     228    const T1 *t2 = static_cast<const T1*>(obj2);
    236229
    237230    eta[0] = fObj->Eta;
     
    257250
    258251#endif // SortableObject_h
     252
     253
Note: See TracChangeset for help on using the changeset viewer.