From 329b5744292b0c4e49dd31ac1b9ee9dcfdece5ef Mon Sep 17 00:00:00 2001 From: cvetan Date: Mon, 12 Oct 2009 13:21:10 +0000 Subject: [PATCH] Update from Mikolaj: make class sortable + small updates. --- STEER/AliRelAlignerKalman.cxx | 47 ++++++++++++++++++++++++++++++----- STEER/AliRelAlignerKalman.h | 11 +++++--- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/STEER/AliRelAlignerKalman.cxx b/STEER/AliRelAlignerKalman.cxx index 20c626a1cbf..3325ffdcd72 100644 --- a/STEER/AliRelAlignerKalman.cxx +++ b/STEER/AliRelAlignerKalman.cxx @@ -105,7 +105,7 @@ AliRelAlignerKalman::AliRelAlignerKalman(): fPMeasurementCov(new TMatrixDSym( fgkNMeasurementParams )), fPMeasurementPrediction(new TVectorD( fgkNMeasurementParams )), fOutRejSigmas(1.), - fDelta(new Double_t[fgkNSystemParams]), + //fDelta(new Double_t[fgkNSystemParams]), fNumericalParanoia(kTRUE), fRejectOutliers(kTRUE), fRequireMatchInTPC(kFALSE), @@ -125,6 +125,7 @@ AliRelAlignerKalman::AliRelAlignerKalman(): fNProcessedEvents(0), fTrackInBuffer(0), fTimeStamp(0), + fRunNumber(0), fTPCvd(2.64), fTPCZLengthA(2.4972500e02), fTPCZLengthC(2.4969799e02) @@ -151,7 +152,7 @@ AliRelAlignerKalman::AliRelAlignerKalman(const AliRelAlignerKalman& a): fPMeasurementCov(new TMatrixDSym( *a.fPMeasurementCov )), fPMeasurementPrediction(new TVectorD( *a.fPMeasurement )), fOutRejSigmas(a.fOutRejSigmas), - fDelta(new Double_t[fgkNSystemParams]), + //fDelta(new Double_t[fgkNSystemParams]), fNumericalParanoia(a.fNumericalParanoia), fRejectOutliers(a.fRejectOutliers), fRequireMatchInTPC(a.fRequireMatchInTPC), @@ -171,6 +172,7 @@ AliRelAlignerKalman::AliRelAlignerKalman(const AliRelAlignerKalman& a): fNProcessedEvents(a.fNProcessedEvents), fTrackInBuffer(a.fTrackInBuffer), fTimeStamp(a.fTimeStamp), + fRunNumber(a.fRunNumber), fTPCvd(a.fTPCvd), fTPCZLengthA(a.fTPCZLengthA), fTPCZLengthC(a.fTPCZLengthC) @@ -228,6 +230,7 @@ AliRelAlignerKalman& AliRelAlignerKalman::operator=(const AliRelAlignerKalman& a fNProcessedEvents=a.fNProcessedEvents; fTrackInBuffer=a.fTrackInBuffer; fTimeStamp=a.fTimeStamp; + fRunNumber=a.fRunNumber; //fApplyCovarianceCorrection=a.fApplyCovarianceCorrection; //fCalibrationMode=a.fCalibrationMode; //fFillHistograms=a.fFillHistograms; @@ -258,7 +261,7 @@ AliRelAlignerKalman::~AliRelAlignerKalman() if (fPH) delete fPH; if (fPMeasurement) delete fPMeasurement; if (fPMeasurementCov) delete fPMeasurementCov; - if (fDelta) delete [] fDelta; + //if (fDelta) delete [] fDelta; //if (fPMes0Hist) delete fPMes0Hist; //if (fPMes1Hist) delete fPMes1Hist; //if (fPMes2Hist) delete fPMes2Hist; @@ -293,7 +296,11 @@ Bool_t AliRelAlignerKalman::AddESDevent( const AliESDEvent* pEvent ) success = ( AddESDtrack( track ) || success ); } } - if (success) fTimeStamp = pEvent->GetTimeStamp(); + if (success) + { + fTimeStamp = pEvent->GetTimeStamp(); + fRunNumber = pEvent->GetRunNumber(); + } return success; } @@ -369,7 +376,8 @@ Bool_t AliRelAlignerKalman::AddCosmicEvent( const AliESDEvent* pEvent ) else continue; } - if (success) fTimeStamp=pEvent->GetTimeStamp(); + fTimeStamp=pEvent->GetTimeStamp(); //always update timestamp even when no update performed + fRunNumber=pEvent->GetRunNumber(); return success; } @@ -391,6 +399,7 @@ void AliRelAlignerKalman::Print(Option_t*) const if (fgkNSystemParams>6) printf(" vd corr % .5g ± (%.2g) [ vd should be %.4g (was %.4g in reco) ]\n", (*fPX)(6), TMath::Sqrt((*fPXcov)(6,6)), (*fPX)(6)*fTPCvd, fTPCvd); if (fgkNSystemParams>7) printf(" t0 % .5g ± (%.2g) us | %.4g ± (%.2g) cm [ t0_real = t0_rec+t0 ]\n",(*fPX)(7), TMath::Sqrt((*fPXcov)(7,7)), fTPCvd*(*fPX)(7), fTPCvd*TMath::Sqrt((*fPXcov)(7,7))); if (fgkNSystemParams>8) printf(" vd/dy % .5f ± (%.2f) (cm/us)/m\n", (*fPX)(8), TMath::Sqrt((*fPXcov)(8,8))); + printf(" run: %i, timestamp: %i\n", fRunNumber, fTimeStamp); printf("\n"); return; } @@ -1242,6 +1251,8 @@ void AliRelAlignerKalman::Reset() fNOutliers=0; fNTracks=0; fNProcessedEvents=0; + fRunNumber=0; + fTimeStamp=0; } //______________________________________________________________________________ @@ -1308,12 +1319,16 @@ void AliRelAlignerKalman::ResetTPCparamsCovariance( const Double_t number ) } } +//______________________________________________________________________________ Bool_t AliRelAlignerKalman::Merge( const AliRelAlignerKalman* al ) { //Merge two aligners if (!al) return kFALSE; + if (al==this) return kTRUE; if (al->fgkNSystemParams != fgkNSystemParams) return kFALSE; + if (fRunNumber != al->fRunNumber) return kFALSE; + if (al->fNUpdates == 0) return kTRUE; //no point in merging with an empty one //store the pointers to current stuff TVectorD* pmes = fPMeasurement; @@ -1349,11 +1364,31 @@ Bool_t AliRelAlignerKalman::Merge( const AliRelAlignerKalman* al ) fNTracks += al->fNTracks; fNMatchedTPCtracklets += al->fNMatchedTPCtracklets; fNMatchedCosmics += al->fNMatchedCosmics; - if (fTimeStamp < al->fTimeStamp) fTimeStamp = al->fTimeStamp; //a bit arbitrary: take the older one + if (fTimeStamp < al->fTimeStamp) fTimeStamp = al->fTimeStamp; //take the older one return success; } +//______________________________________________________________________________ +Int_t AliRelAlignerKalman::Compare(const TObject *obj) const +{ + if (this == obj) return 0; + const AliRelAlignerKalman* aobj = dynamic_cast(obj); + if (!aobj) return 0; + if (fTimeStamp < aobj->fTimeStamp) return -1; + else if (fTimeStamp > aobj->fTimeStamp) return 1; + else return 0; +} + +//______________________________________________________________________________ +//Int_t AliRelAlignerKalman::Compare(const AliRelAlignerKalman *al) const +//{ +// if (this == al) return 0; +// if (fTimeStamp > al->fTimeStamp) return -1; +// else if (fTimeStamp < al->fTimeStamp) return 1; +// else return 0; +//} + //______________________________________________________________________________ //void AliRelAlignerKalman::PrintCovarianceCorrection() //{ diff --git a/STEER/AliRelAlignerKalman.h b/STEER/AliRelAlignerKalman.h index 95c5a5d2ba1..01b0ad76408 100644 --- a/STEER/AliRelAlignerKalman.h +++ b/STEER/AliRelAlignerKalman.h @@ -114,6 +114,10 @@ public: Bool_t IsPositiveDefinite( const TMatrixD& mat ) const; void SetTimeStamp( const UInt_t ts ) { fTimeStamp = ts; } UInt_t GetTimeStamp() const {return fTimeStamp;} + void SetRunNumber( const UInt_t rn ) { fRunNumber = rn; } + UInt_t GetRunNumber() const {return fRunNumber;} + Int_t Compare(const TObject *obj) const; + Bool_t IsSortable() const { return kTRUE; } protected: Bool_t UpdateEstimateKalman(); @@ -144,7 +148,7 @@ private: TMatrixDSym* fPMeasurementCov; //!measurement vec cvariance TVectorD* fPMeasurementPrediction; //!prediction of the measurement Double_t fOutRejSigmas; //number of sigmas for outlier rejection - Double_t* fDelta; //array with differentials for calculating derivatives for every parameter(see PrepareSystemMatrix()) + Double_t fDelta[fgkNSystemParams]; //array with differentials for calculating derivatives for every parameter(see PrepareSystemMatrix()) //Control Bool_t fNumericalParanoia; //!whether to perform additional checks for numerical stability @@ -167,14 +171,15 @@ private: Int_t fNMatchedTPCtracklets;//number of cosmic events with 2 matching TPC tracklets Int_t fNProcessedEvents; //number of processed events Int_t fTrackInBuffer; //!number of tracks in buffer - UInt_t fTimeStamp; + UInt_t fTimeStamp; //time stamp + UInt_t fRunNumber; //run number //TPC stuff Double_t fTPCvd; //TPC drift velocity Double_t fTPCZLengthA; //TPC length side A Double_t fTPCZLengthC; //TPC length side C - ClassDef(AliRelAlignerKalman,1) //AliRelAlignerKalman class + ClassDef(AliRelAlignerKalman,2) //AliRelAlignerKalman class }; #endif -- 2.39.3