Hi Alberto, you override the wrong method, should be "IsSortable() const". -- Fons Alberto Pulvirenti wrote: > > Hi to all > > is there anyone who can explain me WHY root tells me that the object > defined in th class I attached to this email is NOT sortable? > > Thanks > > Alberto > > -------------------------------------------------------------------------------- > #ifndef ALIITSCHROMOSOME_H > #define ALIITSCHROMOSOME_H > > class AliITSglobalRecPoint; > > class AliITSchromosome : public TObject { > > public: > > AliITSchromosome(); > AliITSchromosome(AliITSglobalRecPoint *p1, AliITSglobalRecPoint *p2, > AliITSglobalRecPoint *p3, AliITSglobalRecPoint *p4, > AliITSglobalRecPoint *p5, AliITSglobalRecPoint *p6); > > virtual ~AliITSchromosome(); > > Bool_t IsSortable() {return kTRUE;} > Int_t Compare(const TObject *O) const; > > AliITSglobalRecPoint*& operator[](Int_t i); > > Double_t GetCost(); > > private: > > Int_t fStored; > Double_t fCost; > AliITSglobalRecPoint *fPoint[6]; > > ClassDef(AliITSchromosome, 1) > }; > > #endif > > -------------------------------------------------------------------------------- > #include <fstream.h> > #include <stdlib.h> > > #include <TObject.h> > #include <TROOT.h> > #include <TMath.h> > > #include "AliITSRecPoint.h" > #include "AliITSglobalRecPoint.h" > > #include "AliITSchromosome.h" > > ClassImp(AliITSchromosome) > // > // > // > AliITSchromosome::AliITSchromosome() > { > fCost = 0.0; > fStored = 0; > > fPoint[0] = fPoint[1] = fPoint[2] = 0; > fPoint[3] = fPoint[4] = fPoint[5] = 0; > } > // > // > // > AliITSchromosome::AliITSchromosome(AliITSglobalRecPoint *p0 = 0, AliITSglobalRecPoint *p1 = 0, > AliITSglobalRecPoint *p2 = 0, AliITSglobalRecPoint *p3 = 0, > AliITSglobalRecPoint *p4 = 0, AliITSglobalRecPoint *p5 = 0) > { > Int_t l; > > fPoint[0] = p0; > fPoint[1] = p1; > fPoint[2] = p2; > fPoint[3] = p3; > fPoint[4] = p4; > fPoint[5] = p5; > > fStored = 0; > for (l = 0; l < 5; l++) if (fPoint[l]) fStored++; > > if (fStored == 6) GetCost(); > } > // > // > // > AliITSchromosome::~AliITSchromosome() > { > Int_t l; > for(l = 0; l < 6; l++) > fPoint[l]=0; > } > // > // > // > AliITSglobalRecPoint*& AliITSchromosome::operator[](Int_t i) > { > if (i < 6 && i >= 0) > return fPoint[i]; > else > return fPoint[0]; > } > // > // > // > Double_t AliITSchromosome::GetCost() > { > Int_t i = 0; > fCost = 0.0; > for (i = 1; i < 6; i++) { > if (!fPoint[i]) return 0.0; > fCost += fPoint[i]->DeltaPhi(fPoint[i-1]); > } > return fCost; > } > // > // > // > Int_t AliITSchromosome::Compare(const TObject *O) const > { > AliITSchromosome *chr = (AliITSchromosome*)O; > if (chr->fCost < fCost) > return -1; > else if (chr->fCost > fCost) > return 1; > else > return 0; > } -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:05 MET