From 203967fcdaf1d9e944fba7349639fffb85e3161b Mon Sep 17 00:00:00 2001 From: abercuci Date: Thu, 27 Nov 2008 11:08:05 +0000 Subject: [PATCH] extend functionality for HLT usage and improved verbosity (Kostya Alex) --- TRD/AliTRDcluster.cxx | 66 ++++++++++++++++++++++++++ TRD/AliTRDcluster.h | 62 ++++++++++++++----------- TRD/AliTRDseedV1.cxx | 105 ++++++++++++++++++++++++++++++++++-------- TRD/AliTRDseedV1.h | 40 ++++++++-------- TRD/AliTRDtrackV1.cxx | 89 +++++++++++++++++++++++++++++++++++ TRD/AliTRDtrackV1.h | 3 ++ 6 files changed, 299 insertions(+), 66 deletions(-) diff --git a/TRD/AliTRDcluster.cxx b/TRD/AliTRDcluster.cxx index f65d1bd3024..510fa42ed52 100644 --- a/TRD/AliTRDcluster.cxx +++ b/TRD/AliTRDcluster.cxx @@ -22,6 +22,7 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include "AliLog.h" #include "AliTRDcluster.h" ClassImp(AliTRDcluster) @@ -192,6 +193,31 @@ void AliTRDcluster::AddTrackIndex(Int_t *track) } +//_____________________________________________________________________________ +void AliTRDcluster::Clear(Option_t *) +{ + // + // Reset all member to the default value + // + fPadCol=0; + fPadRow=0; + fPadTime=0; + fLocalTimeBin=0; + fNPads=0; + fClusterMasking=0; + fDetector=0; + for (Int_t i=0; i < 7; i++) fSignals[i]=0; + fQ = 0; + fCenter = 0; + for (Int_t i = 0; i < 3; i++) SetLabel(0,i); + SetX(0); + SetY(0); + SetZ(0); + SetSigmaY2(0); + SetSigmaZ2(0); + SetVolumeId(0); +} + //_____________________________________________________________________________ Float_t AliTRDcluster::GetSumS() const { @@ -208,6 +234,46 @@ Float_t AliTRDcluster::GetSumS() const } + +//_____________________________________________________________________________ +Bool_t AliTRDcluster::IsEqual(const TObject *o) const +{ + // + // Compare relevant information of this cluster with another one + // + + const AliTRDcluster *inCluster = dynamic_cast(o); + if (!o || !inCluster) return kFALSE; + + if ( AliCluster::GetX() != inCluster->GetX() ) return kFALSE; + if ( AliCluster::GetY() != inCluster->GetY() ) return kFALSE; + if ( AliCluster::GetZ() != inCluster->GetZ() ) return kFALSE; + if ( fQ != inCluster->fQ ) return kFALSE; + if ( fDetector != inCluster->fDetector ) return kFALSE; + if ( fPadCol != inCluster->fPadCol ) return kFALSE; + if ( fPadRow != inCluster->fPadRow ) return kFALSE; + if ( fPadTime != inCluster->fPadTime ) return kFALSE; + if ( fClusterMasking != inCluster->fClusterMasking ) return kFALSE; + if ( IsInChamber() != inCluster->IsInChamber() ) return kFALSE; + if ( IsShared() != inCluster->IsShared() ) return kFALSE; + if ( IsUsed() != inCluster->IsUsed() ) return kFALSE; + + return kTRUE; +} + +//_____________________________________________________________________________ +void AliTRDcluster::Print(Option_t *o) const +{ + AliInfo(Form("Det[%3d] LTrC[%7.2f %7.2f %7.2f] Q[%f] Stat[in(%c) use(%c) sh(%c)]", + fDetector, GetX(), GetY(), GetZ(), fQ, + IsInChamber() ? 'y' : 'n', IsUsed() ? 'y' : 'n', IsShared() ? 'y' : 'n')); + + if(strcmp(o, "a")!=0) return; + AliInfo(Form("LChC[c(%3d) r(%2d) t(%2d)] t-t0[%2d] Npad[%d] cen[%5.3f] mask[%d]", fPadCol, fPadRow, fPadTime, fLocalTimeBin, fNPads, fCenter, fClusterMasking)); + AliInfo(Form("Signals[%3d %3d %3d %3d %3d %3d %3d]", fSignals[0], fSignals[1], fSignals[2], fSignals[3], fSignals[4], fSignals[5], fSignals[6])); +} + + //_____________________________________________________________________________ void AliTRDcluster::SetPadMaskedPosition(UChar_t position) { diff --git a/TRD/AliTRDcluster.h b/TRD/AliTRDcluster.h index b4a5e6a9269..062e93fc1b5 100644 --- a/TRD/AliTRDcluster.h +++ b/TRD/AliTRDcluster.h @@ -18,7 +18,8 @@ class AliTRDcluster : public AliCluster { public: enum { kInChamber = BIT(14) - , kShared = BIT(15) + , kUsed = BIT(15) + , kShared = BIT(16) }; enum { kMaskedLeft = BIT(0) , kMaskedCenter= BIT(1) @@ -26,39 +27,44 @@ class AliTRDcluster : public AliCluster { }; AliTRDcluster(); - AliTRDcluster(Int_t det, Float_t q, Float_t *pos, Float_t *sig - , Int_t *tracks, Char_t npads, Short_t *signals - , UChar_t col, UChar_t row, UChar_t time - , Char_t timebin, Float_t center, UShort_t volid); + AliTRDcluster( + Int_t det, Float_t q, Float_t *pos, Float_t *sig, + Int_t *tracks, Char_t npads, Short_t *signals, + UChar_t col, UChar_t row, UChar_t time, + Char_t timebin, Float_t center, UShort_t volid); AliTRDcluster(const AliTRDcluster &c); virtual ~AliTRDcluster() {}; virtual void AddTrackIndex(Int_t *i); + void Clear(Option_t *o=""); + + Bool_t IsEqual(const TObject *otherCluster) const; + Bool_t IsInChamber() const { return TestBit(kInChamber); } + Bool_t IsMasked() const { return fClusterMasking ? kTRUE : kFALSE; } + Bool_t IsShared() const { return TestBit(kShared); } + Bool_t IsUsed() const { return TestBit(kUsed); } - Bool_t IsInChamber() const { return TestBit(kInChamber); } - Bool_t IsMasked() const { return fClusterMasking ? kTRUE : kFALSE; } - Bool_t IsShared() const { return TestBit(kShared); } - Bool_t IsUsed() const { return (fQ < 0) ? kTRUE : kFALSE; } + UChar_t GetPadMaskedPosition() const { return fClusterMasking & 7; } + UChar_t GetPadMaskedStatus() const { return fClusterMasking >> 3; } + Int_t GetDetector() const { return fDetector; } + Int_t GetLocalTimeBin() const { return fLocalTimeBin; } + Float_t GetQ() const { return fQ; } + Int_t GetNPads() const { return fNPads; } + Float_t GetCenter() const { return fCenter; } + Int_t GetPadCol() const { return fPadCol; } + Int_t GetPadRow() const { return fPadRow; } + Int_t GetPadTime() const { return fPadTime; } + Short_t *GetSignals() { return fSignals; } + Float_t GetSumS() const; + + void Print(Option_t* o="") const; - UChar_t GetPadMaskedPosition() const { return fClusterMasking & 7; } - UChar_t GetPadMaskedStatus() const { return fClusterMasking >> 3; } - Int_t GetDetector() const { return fDetector; } - Int_t GetLocalTimeBin() const { return fLocalTimeBin; } - Float_t GetQ() const { return fQ; } - Int_t GetNPads() const { return fNPads; } - Float_t GetCenter() const { return fCenter; } - Int_t GetPadCol() const { return fPadCol; } - Int_t GetPadRow() const { return fPadRow; } - Int_t GetPadTime() const { return fPadTime; } - Short_t *GetSignals() { return fSignals; } - Float_t GetSumS() const; - - void SetLocalTimeBin(Char_t t) { fLocalTimeBin = t; } - void SetInChamber(Bool_t in = kTRUE) { SetBit(kInChamber,in); } - void SetPadMaskedPosition(UChar_t position); - void SetPadMaskedStatus(UChar_t status); - void SetShared(Bool_t sh = kTRUE) { SetBit(kShared,sh); } - void Use(Int_t = 0) { fQ = -fQ; } + void SetLocalTimeBin(Char_t t) { fLocalTimeBin = t; } + void SetInChamber(Bool_t in = kTRUE) { SetBit(kInChamber,in); } + void SetPadMaskedPosition(UChar_t position); + void SetPadMaskedStatus(UChar_t status); + void SetShared(Bool_t sh = kTRUE) { SetBit(kShared,sh); } + void Use(Int_t = 0) { SetBit(kUsed, kTRUE); } protected: UChar_t fPadCol; // Central pad number in column direction diff --git a/TRD/AliTRDseedV1.cxx b/TRD/AliTRDseedV1.cxx index 72e6b18d39e..f9b7a153877 100644 --- a/TRD/AliTRDseedV1.cxx +++ b/TRD/AliTRDseedV1.cxx @@ -798,41 +798,106 @@ Bool_t AliTRDseedV1::Fit(Bool_t tilt) //___________________________________________________________________ -void AliTRDseedV1::Print(Option_t*) const +void AliTRDseedV1::Print(Option_t *o) const { // // Printing the seedstatus // - AliInfo(Form("Tracklet X0[%7.2f] Det[%d]", fX0, fDet)); - printf(" Tilt[%+6.2f] PadLength[%5.2f]\n", fTilt, fPadLength); + AliInfo(Form("Det[%3d] Tilt[%+6.2f] Pad[%5.2f]", fDet, fTilt, fPadLength)); + AliInfo(Form("Nattach[%2d] Nfit[%2d] Nuse[%2d] pads[%f]", fN, fN2, fNUsed, fMPads)); + AliInfo(Form("x[%7.2f] y[%7.2f] z[%7.2f] dydx[%5.2f] dzdx[%5.2f]", fX0, fYfit[0], fZfit[0], fYfit[1], fZfit[1])); + AliInfo(Form("Ref y[%7.2f] z[%7.2f] dydx[%5.2f] dzdx[%5.2f]", fYref[0], fZref[0], fYref[1], fZref[1])) + + + if(strcmp(o, "a")!=0) return; + AliTRDcluster* const* jc = &fClusters[0]; for(int ic=0; icGetX(), (*jc)->GetY(), (*jc)->GetZ(), - fIndexes[ic], (void*)(*jc), fUsable[ic]?"y":"n"); + (*jc)->Print(o); } - printf(" fYref[0] =%f fYref[1] =%f\n", fYref[0], fYref[1]); - printf(" fZref[0] =%f fZref[1] =%f\n", fZref[0], fZref[1]); - printf(" fYfit[0] =%f fYfit[1] =%f\n", fYfit[0], fYfit[1]); - printf(" fZfit[0] =%f fZfit[1] =%f\n", fZfit[0], fZfit[1]); - printf(" fSigmaY =%f\n", fSigmaY); +/* printf(" fSigmaY =%f\n", fSigmaY); printf(" fSigmaY2=%f\n", fSigmaY2); printf(" fMeanz =%f\n", fMeanz); printf(" fZProb =%f\n", fZProb); - printf(" fLabels[0]=%d fLabels[1]=%d\n", fLabels[0], fLabels[1]); - printf(" fN =%d\n", fN); - printf(" fN2 =%d (>4 isOK - to be redesigned)\n",fN2); - printf(" fNUsed =%d\n", fNUsed); - printf(" fFreq =%d\n", fFreq); - printf(" fNChange=%d\n", fNChange); - printf(" fMPads =%f\n", fMPads); + printf(" fLabels[0]=%d fLabels[1]=%d\n", fLabels[0], fLabels[1]);*/ - printf(" fC =%f\n", fC); +/* printf(" fC =%f\n", fC); printf(" fCC =%f\n",fCC); printf(" fChi2 =%f\n", fChi2); - printf(" fChi2Z =%f\n", fChi2Z); + printf(" fChi2Z =%f\n", fChi2Z);*/ } + +//___________________________________________________________________ +Bool_t AliTRDseedV1::IsEqual(const TObject *o) const +{ + // Checks if current instance of the class has the same essential members + // as the given one + + if(!o) return kFALSE; + const AliTRDseedV1 *inTracklet = dynamic_cast(o); + if(!inTracklet) return kFALSE; + + for (Int_t i = 0; i < 2; i++){ + if ( fYref[i] != inTracklet->GetYref(i) ) return kFALSE; + if ( fZref[i] != inTracklet->GetZref(i) ) return kFALSE; + } + + if ( fSigmaY != inTracklet->GetSigmaY() ) return kFALSE; + if ( fSigmaY2 != inTracklet->GetSigmaY2() ) return kFALSE; + if ( fTilt != inTracklet->GetTilt() ) return kFALSE; + if ( fPadLength != inTracklet->GetPadLength() ) return kFALSE; + + for (Int_t i = 0; i < knTimebins; i++){ + if ( fX[i] != inTracklet->GetX(i) ) return kFALSE; + if ( fY[i] != inTracklet->GetY(i) ) return kFALSE; + if ( fZ[i] != inTracklet->GetZ(i) ) return kFALSE; + if ( fIndexes[i] != inTracklet->GetIndexes(i) ) return kFALSE; + if ( fUsable[i] != inTracklet->IsUsable(i) ) return kFALSE; + } + + for (Int_t i=0; i < 2; i++){ + if ( fYfit[i] != inTracklet->GetYfit(i) ) return kFALSE; + if ( fZfit[i] != inTracklet->GetZfit(i) ) return kFALSE; + if ( fYfitR[i] != inTracklet->GetYfitR(i) ) return kFALSE; + if ( fZfitR[i] != inTracklet->GetZfitR(i) ) return kFALSE; + if ( fLabels[i] != inTracklet->GetLabels(i) ) return kFALSE; + } + + if ( fMeanz != inTracklet->GetMeanz() ) return kFALSE; + if ( fZProb != inTracklet->GetZProb() ) return kFALSE; + if ( fN2 != inTracklet->GetN2() ) return kFALSE; + if ( fNUsed != inTracklet->GetNUsed() ) return kFALSE; + if ( fFreq != inTracklet->GetFreq() ) return kFALSE; + if ( fNChange != inTracklet->GetNChange() ) return kFALSE; + if ( fNChange != inTracklet->GetNChange() ) return kFALSE; + + if ( fC != inTracklet->GetC() ) return kFALSE; + if ( fCC != inTracklet->GetCC() ) return kFALSE; + if ( fChi2 != inTracklet->GetChi2() ) return kFALSE; + // if ( fChi2Z != inTracklet->GetChi2Z() ) return kFALSE; + + if ( fDet != inTracklet->GetDetector() ) return kFALSE; + if ( fMom != inTracklet->GetMomentum() ) return kFALSE; + if ( fdX != inTracklet->GetdX() ) return kFALSE; + + for (Int_t iCluster = 0; iCluster < knTimebins; iCluster++){ + AliTRDcluster *curCluster = fClusters[iCluster]; + AliTRDcluster *inCluster = inTracklet->GetClusters(iCluster); + if (curCluster && inCluster){ + if (! curCluster->IsEqual(inCluster) ) { + curCluster->Print(); + inCluster->Print(); + return kFALSE; + } + } else { + // if one cluster exists, and corresponding + // in other tracklet doesn't - return kFALSE + if(curCluster || inCluster) return kFALSE; + } + } + return kTRUE; +} diff --git a/TRD/AliTRDseedV1.h b/TRD/AliTRDseedV1.h index 29545b07c2b..0c70dae8a5e 100644 --- a/TRD/AliTRDseedV1.h +++ b/TRD/AliTRDseedV1.h @@ -54,28 +54,32 @@ class AliTRDseedV1 : public AliTRDseed AliTRDseedV1(const AliTRDseedV1 &ref); AliTRDseedV1& operator=(const AliTRDseedV1 &ref); - Bool_t AttachClustersIter(AliTRDtrackingChamber *chamber, Float_t quality, Bool_t kZcorr = kFALSE - , AliTRDcluster *c=0x0); - Bool_t AttachClusters(AliTRDtrackingChamber *chamber, Bool_t kZcorr = kFALSE); - void Bootstrap(const AliTRDReconstructor *rec); - void CookdEdx(Int_t nslices); - Bool_t Fit(Bool_t tilt=kTRUE); - - Bool_t Init(AliTRDtrackV1 *track); + Bool_t AttachClustersIter( + AliTRDtrackingChamber *chamber, Float_t quality, + Bool_t kZcorr = kFALSE, AliTRDcluster *c=0x0); + Bool_t AttachClusters( + AliTRDtrackingChamber *chamber, Bool_t kZcorr = kFALSE); + void Bootstrap(const AliTRDReconstructor *rec); + void CookdEdx(Int_t nslices); + Bool_t Fit(Bool_t tilt=kTRUE); + + Bool_t Init(AliTRDtrackV1 *track); inline void Init(const AliRieman *fit); + Bool_t IsEqual(const TObject *inTracklet) const; Bool_t IsOwner() const { return TestBit(kOwner);} Bool_t IsRowCross() const { return TestBit(kRowCross);} inline Float_t GetChi2Z(const Float_t z = 999.) const; inline Float_t GetChi2Y(const Float_t y = 999.) const; void GetCovAt(Double_t x, Double_t *cov) const; - Double_t* GetCrossXYZ() { return &fCross[0];} - Double_t GetCrossSz2() const { return fCross[3];} - Float_t* GetdEdx() {return &fdEdx[0];} + Double_t* GetCrossXYZ() { return &fCross[0];} + Double_t GetCrossSz2() const { return fCross[3];} + Float_t GetdX() const { return fdX;} + Float_t* GetdEdx() { return &fdEdx[0];} Float_t GetdQdl(Int_t ic) const; - Int_t GetDetector() const {return fDet;} - Double_t GetMomentum() const {return fMom;} - Int_t GetN() const {return fN2;} + Int_t GetDetector() const { return fDet;} + Double_t GetMomentum() const { return fMom;} + Int_t GetN() const { return fN2;} Float_t GetQuality(Bool_t kZcorr) const; Int_t GetPlane() const { return AliTRDgeometry::GetLayer(fDet); } @@ -90,11 +94,11 @@ class AliTRDseedV1 : public AliTRDseed void Print(Option_t *o = "") const; inline void ResetClusterIter(Bool_t forward = kTRUE); - void SetMomentum(Double_t mom) {fMom = mom;} + void SetMomentum(Double_t mom){ fMom = mom;} void SetOwner(); - void SetDetector(Int_t d) {fDet = d; } - void SetSnp(Double_t snp) {fSnp = snp;} - void SetTgl(Double_t tgl) {fTgl = tgl;} + void SetDetector(Int_t d) { fDet = d; } + void SetSnp(Double_t snp) { fSnp = snp;} + void SetTgl(Double_t tgl) { fTgl = tgl;} void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;} protected: diff --git a/TRD/AliTRDtrackV1.cxx b/TRD/AliTRDtrackV1.cxx index 8f48bdcc565..516d335febf 100644 --- a/TRD/AliTRDtrackV1.cxx +++ b/TRD/AliTRDtrackV1.cxx @@ -15,6 +15,7 @@ /* $Id$ */ +#include "AliLog.h" #include "AliESDtrack.h" #include "AliTracker.h" @@ -386,6 +387,62 @@ Double_t AliTRDtrackV1::GetPredictedChi2(const AliTRDseedV1 *trklt) const return AliExternalTrackParam::GetPredictedChi2(p, cov); } +//_______________________________________________________________ +Bool_t AliTRDtrackV1::IsEqual(const TObject *o) const +{ + if (!o) return kFALSE; + const AliTRDtrackV1 *inTrack = dynamic_cast(o); + if (!inTrack) return kFALSE; + + if ( fPIDquality != inTrack->GetPIDquality() ) return kFALSE; + + for(Int_t i = 0; i < AliPID::kSPECIES; i++){ + if ( fPID[i] != inTrack->GetPID(i) ) return kFALSE; + } + + for (Int_t i = 0; i < 3; i++){ + if ( fBudget[i] != inTrack->GetBudget(i) ) return kFALSE; + } + if ( fDE != inTrack->GetEdep() ) return kFALSE; + if ( fFakeRatio != inTrack->GetFakeRatio() ) return kFALSE; + if ( fChi2 != inTrack->GetChi2() ) return kFALSE; + if ( fMass != inTrack->GetMass() ) return kFALSE; + if ( fLab != inTrack->GetLabel() ) return kFALSE; + if ( fN != inTrack->GetNumberOfClusters() ) return kFALSE; + if ( AliKalmanTrack::GetIntegratedLength() != inTrack->GetIntegratedLength() ) return kFALSE; + + if ( GetX() != inTrack->GetX() ) return kFALSE; + if ( GetAlpha() != inTrack->GetAlpha() ) return kFALSE; + const Double_t *inP = inTrack->GetParameter(); + const Double_t *curP = GetParameter(); + for (Int_t i = 0; i < 5; i++){ + if ( curP[i] != inP[i]) return kFALSE; + } + const Double_t *inC = inTrack->GetCovariance(); + const Double_t *curC = GetCovariance(); + for (Int_t i = 0; i < 15; i++){ + if ( curC[i] != inC[i]) return kFALSE; + } + + for (Int_t iTracklet = 0; iTracklet < kNplane; iTracklet++){ + AliTRDseedV1 *curTracklet = fTracklet[iTracklet]; + AliTRDseedV1 *inTracklet = inTrack->GetTracklet(iTracklet); + if (curTracklet && inTracklet){ + if (! curTracklet->IsEqual(inTracklet) ) { + curTracklet->Print(); + inTracklet->Print(); + return kFALSE; + } + } else { + // if one tracklet exists, and corresponding + // in other track doesn't - return kFALSE + if(inTracklet || curTracklet) return kFALSE; + } + } + + return kTRUE; +} + //_______________________________________________________________ Bool_t AliTRDtrackV1::IsElectron() const { @@ -569,6 +626,38 @@ Int_t AliTRDtrackV1::PropagateToR(Double_t r,Double_t step) } +//_____________________________________________________________________________ +void AliTRDtrackV1::Print(Option_t *o) const +{ + AliInfo(Form("PID q[%d] [%4.1f %4.1f %4.1f %4.1f %4.1f]", fPIDquality, 1.E2*fPID[0], 1.E2*fPID[1], 1.E2*fPID[2], 1.E2*fPID[3], 1.E2*fPID[4])); + AliInfo(Form("Material[%5.2f %5.2f %5.2f]", fBudget[0], fBudget[1], fBudget[2])); + + AliInfo(Form("x[%7.2f] t[%7.4f] alpha[%f] mass[%f]", GetX(), GetIntegratedLength(), GetAlpha(), fMass)); + AliInfo(Form("Ntr[%1d] Ncl[%3d] lab[%3d]", GetNumberOfTracklets(), fN, fLab)); + + if(strcmp(o, "a")!=0) return; + printf("|X| = ("); + const Double_t *curP = GetParameter(); + for (Int_t i = 0; i < 5; i++) printf("%7.2f ", curP[i]); + printf(")\n"); + + printf("|V| = \n"); + const Double_t *curC = GetCovariance(); + for (Int_t i = 0, j=4, k=0; i<15; i++, k++){ + printf("%7.2f ", curC[i]); + if(k==j){ + printf("\n"); + k=-1; j--; + } + } + + for(Int_t ip=0; ipPrint(o); + } +} + + //_____________________________________________________________________________ Bool_t AliTRDtrackV1::Rotate(Double_t alpha, Bool_t absolute) { diff --git a/TRD/AliTRDtrackV1.h b/TRD/AliTRDtrackV1.h index ec570f93ee3..35081bbc463 100644 --- a/TRD/AliTRDtrackV1.h +++ b/TRD/AliTRDtrackV1.h @@ -73,11 +73,14 @@ public: Int_t GetTrackletIndex(Int_t plane) const { return (plane>=0 && plane