From cf5b0aa0f5c843b3fdc4365b7330bbb1ddb1f68d Mon Sep 17 00:00:00 2001 From: marian Date: Fri, 30 Apr 2010 08:33:48 +0000 Subject: [PATCH 1/1] M AliTPCcalibBase.h - make magnetic field persistent M AliTPCcalibDB.h - adding composed correction M AliTPCCorrection.h - fit the distorted track M AliTPCRecoParam.h - flag to use composed correction M AliTPCcalibDB.cxx - adding composed correction M AliTPCCorrection.cxx - fit distorted track M AliTPCRecoParam.cxx - usage of comsed correction flag M AliTPCTransform.cxx - usage of composed correction Marian --- TPC/AliTPCCorrection.cxx | 138 ++++++++++++++++++++++++++++++++++++++- TPC/AliTPCCorrection.h | 3 + TPC/AliTPCRecoParam.cxx | 1 + TPC/AliTPCRecoParam.h | 5 +- TPC/AliTPCTransform.cxx | 18 ++++- TPC/AliTPCcalibBase.h | 4 +- TPC/AliTPCcalibDB.cxx | 4 +- TPC/AliTPCcalibDB.h | 4 ++ 8 files changed, 170 insertions(+), 7 deletions(-) diff --git a/TPC/AliTPCCorrection.cxx b/TPC/AliTPCCorrection.cxx index a68bdd39be5..948c103bbc8 100644 --- a/TPC/AliTPCCorrection.cxx +++ b/TPC/AliTPCCorrection.cxx @@ -42,9 +42,19 @@ #include #include #include +#include + +#include "AliExternalTrackParam.h" +#include "AliTrackPointArray.h" +#include "TDatabasePDG.h" +#include "AliTrackerBase.h" +#include "AliTPCROC.h" + #include "AliTPCCorrection.h" +ClassImp(AliTPCCorrection) + // FIXME: the following values should come from the database const Double_t AliTPCCorrection::fgkTPC_Z0 =249.7; // nominal gating grid position const Double_t AliTPCCorrection::fgkIFCRadius= 83.06; // Mean Radius of the Inner Field Cage ( 82.43 min, 83.70 max) (cm) @@ -455,4 +465,130 @@ void AliTPCCorrection::Search( const Int_t n, const Double_t xArray[], const Dou } -ClassImp(AliTPCCorrection) + +AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(const AliExternalTrackParam * trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream){ + // + // Fit the track parameters - without and with distortion + // 1. Space points in the TPC are simulated along the trajectory + // 2. Space points distorted + // 3. Fits the non distorted and distroted track to the reference plane at refX + // 4. For visualization and debugging purposes the space points and tracks can be stored in the tree - using the TTreeSRedirector functionality + // + // trackIn - input track parameters + // refX - reference X to fit the track + // dir - direction - out=1 or in=-1 + // pcstream - debug streamer to check the results + // + AliTPCROC * roc = AliTPCROC::Instance(); + const Int_t npoints0=roc->GetNRows(0)+roc->GetNRows(36); + const Double_t kRTPC0 =roc->GetPadRowRadii(0,0); + const Double_t kRTPC1 =roc->GetPadRowRadii(36,roc->GetNRows(36)-1); + + const Double_t kMaxSnp = 0.85; + const Double_t kSigmaY=0.1; + const Double_t kSigmaZ=0.1; + const Double_t kMass = TDatabasePDG::Instance()->GetParticle("pi+")->Mass(); + + AliExternalTrackParam track(*trackIn); // + // generate points + AliTrackPointArray pointArray0(npoints0); + AliTrackPointArray pointArray1(npoints0); + Double_t xyz[3]; + AliTrackerBase::PropagateTrackTo(&track,kRTPC0,kMass,3,kTRUE,kMaxSnp); + // + // simulate the track + Int_t npoints=0; + Float_t covPoint[6]={0,0,0, kSigmaY*kSigmaY,0,kSigmaZ*kSigmaZ}; //covariance at the local frame + for (Double_t radius=kRTPC0; radius0)? 0:18; + pointArray0.GetPoint(pIn0,npoints); + pointArray1.GetPoint(pIn1,npoints); + Double_t alpha = TMath::ATan2(xyz[1],xyz[0]); + Float_t distPoint[3]={xyz[0],xyz[1],xyz[2]}; + DistortPoint(distPoint, roc); + pIn0.SetXYZ(xyz[0], xyz[1],xyz[2]); + pIn1.SetXYZ(distPoint[0], distPoint[1],distPoint[2]); + // + track.Rotate(alpha); + AliTrackPoint prot0 = pIn0.Rotate(alpha); // rotate to the local frame - non distoted point + AliTrackPoint prot1 = pIn1.Rotate(alpha); // rotate to the local frame - distorted point + prot0.SetXYZ(prot0.GetX(),prot0.GetY(), prot0.GetZ(),covPoint); + prot1.SetXYZ(prot1.GetX(),prot1.GetY(), prot1.GetZ(),covPoint); + pIn0=prot0.Rotate(-alpha); // rotate back to global frame + pIn1=prot1.Rotate(-alpha); // rotate back to global frame + pointArray0.AddPoint(npoints, &pIn0); + pointArray1.AddPoint(npoints, &pIn1); + npoints++; + if (npoints>=npoints0) break; + } + // + // refit track + // + AliExternalTrackParam *track0=0; + AliExternalTrackParam *track1=0; + AliTrackPoint point1,point2,point3; + if (dir==1) { //make seed inner + pointArray0.GetPoint(point1,1); + pointArray0.GetPoint(point2,10); + pointArray0.GetPoint(point3,20); + } + if (dir==-1){ //make seed outer + pointArray0.GetPoint(point1,npoints-20); + pointArray0.GetPoint(point2,npoints-10); + pointArray0.GetPoint(point3,npoints-1); + } + track0 = AliTrackerBase::MakeSeed(point1, point2, point3); + track1 = AliTrackerBase::MakeSeed(point1, point2, point3); + + + for (Int_t jpoint=0; jpoint0) ? ipoint: npoints-1-jpoint; + // + AliTrackPoint pIn0; + AliTrackPoint pIn1; + pointArray0.GetPoint(pIn0,ipoint); + pointArray1.GetPoint(pIn1,ipoint); + AliTrackPoint prot0 = pIn0.Rotate(track0->GetAlpha()); // rotate to the local frame - non distoted point + AliTrackPoint prot1 = pIn1.Rotate(track1->GetAlpha()); // rotate to the local frame - distorted point + // + AliTrackerBase::PropagateTrackTo(track0,prot0.GetX(),kMass,1,kFALSE,kMaxSnp); + AliTrackerBase::PropagateTrackTo(track1,prot1.GetX(),kMass,1,kFALSE,kMaxSnp); + track.GetXYZ(xyz); + // + Double_t pointPos[2]={0,0}; + Double_t pointCov[3]={0,0,0}; + pointPos[0]=prot0.GetY();//local y + pointPos[1]=prot0.GetZ();//local z + pointCov[0]=prot0.GetCov()[3];//simay^2 + pointCov[1]=prot0.GetCov()[4];//sigmayz + pointCov[2]=prot0.GetCov()[5];//sigmaz^2 + track0->Update(pointPos,pointCov); + // + pointPos[0]=prot1.GetY();//local y + pointPos[1]=prot1.GetZ();//local z + pointCov[0]=prot1.GetCov()[3];//simay^2 + pointCov[1]=prot1.GetCov()[4];//sigmayz + pointCov[2]=prot1.GetCov()[5];//sigmaz^2 + track1->Update(pointPos,pointCov); + } + + AliTrackerBase::PropagateTrackTo(track0,refX,kMass,2.,kTRUE,kMaxSnp); + track1->Rotate(track0->GetAlpha()); + AliTrackerBase::PropagateTrackTo(track1,refX,kMass,2.,kFALSE,kMaxSnp); + + if (pcstream) (*pcstream)<<"fitDistort"<< + "point0.="<<&pointArray0<< // points + "point1.="<<&pointArray1<< // distorted points + "trackIn.="<<&track<< // original track + "track0.="< class TH2F; class TCollection; +class TTreeSRedirector; +class AliExternalTrackParam; class AliTPCCorrection : public TNamed { public: @@ -67,6 +69,7 @@ public: // normally called directly in the correction classes which inherit from this class virtual void SetOmegaTauT1T2(Float_t omegaTau,Float_t t1,Float_t t2); + AliExternalTrackParam * FitDistortedTrack(const AliExternalTrackParam * trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream); protected: TH2F* CreateTH2F(const char *name,const char *title, diff --git a/TPC/AliTPCRecoParam.cxx b/TPC/AliTPCRecoParam.cxx index b06b8761a76..16cc47f8be2 100644 --- a/TPC/AliTPCRecoParam.cxx +++ b/TPC/AliTPCRecoParam.cxx @@ -86,6 +86,7 @@ AliTPCRecoParam::AliTPCRecoParam(): fBKinkFinder(kTRUE), fLastSeedRowSec(120), fUseFieldCorrection(2), // use field correction + fUseComposedCorrection(kFALSE), // use field correction fUseRPHICorrection(0), // use rphi correction fUseRadialCorrection(0), // use radial correction fUseQuadrantAlignment(0), // use quadrant alignment diff --git a/TPC/AliTPCRecoParam.h b/TPC/AliTPCRecoParam.h index 6e727af2661..93d25887c5f 100644 --- a/TPC/AliTPCRecoParam.h +++ b/TPC/AliTPCRecoParam.h @@ -70,6 +70,7 @@ class AliTPCRecoParam : public AliDetectorRecoParam // Correction setup // void SetUseFieldCorrection(Int_t flag){fUseFieldCorrection=flag;} + void SetUseComposedCorrection(Bool_t flag){fUseComposedCorrection=flag;} void SetUseRPHICorrection(Int_t flag){fUseRPHICorrection=flag;} void SetUseRadialCorrection(Int_t flag){fUseRadialCorrection=flag;} void SetUseQuadrantAlignment(Int_t flag){fUseQuadrantAlignment=flag;} @@ -81,6 +82,7 @@ class AliTPCRecoParam : public AliDetectorRecoParam void SetUseTOFCorrection(Bool_t flag) {fUseTOFCorrection = flag;} // Int_t GetUseFieldCorrection() const {return fUseFieldCorrection;} + Int_t GetUseComposedCorrection() const {return fUseComposedCorrection;} Int_t GetUseRPHICorrection() const {return fUseRPHICorrection;} Int_t GetUseRadialCorrection() const {return fUseRadialCorrection;} Int_t GetUseQuadrantAlignment() const {return fUseQuadrantAlignment;} @@ -143,6 +145,7 @@ class AliTPCRecoParam : public AliDetectorRecoParam // Correction switches // Int_t fUseFieldCorrection; // use field correction + Bool_t fUseComposedCorrection; // flag to use composed correction Int_t fUseRPHICorrection; // use rphi correction Int_t fUseRadialCorrection; // use radial correction Int_t fUseQuadrantAlignment; // use quadrant alignment @@ -168,7 +171,7 @@ public: // to be switched off for pass 0 reconstruction // Use static function, other option will be to use // additional specific storage ? - ClassDef(AliTPCRecoParam, 9) + ClassDef(AliTPCRecoParam, 10) }; diff --git a/TPC/AliTPCTransform.cxx b/TPC/AliTPCTransform.cxx index 6781ba97c48..6759286cd31 100755 --- a/TPC/AliTPCTransform.cxx +++ b/TPC/AliTPCTransform.cxx @@ -59,6 +59,7 @@ #include "TMath.h" #include "AliLog.h" #include "AliTPCExB.h" +#include "AliTPCCorrection.h" #include "TGeoMatrix.h" #include "AliTPCRecoParam.h" #include "AliTPCCalibVdrift.h" @@ -146,6 +147,7 @@ void AliTPCTransform::Transform(Double_t *x,Int_t *i,UInt_t /*time*/, AliTPCCalPad * distortionMapY = calib->GetDistortionMap(0); AliTPCCalPad * distortionMapZ = calib->GetDistortionMap(1); AliTPCParam * param = calib->GetParameters(); + AliTPCCorrection * correction = calib->GetTPCComposedCorrection(); if (!time0TPC){ AliFatal("Time unisochronity missing"); } @@ -168,9 +170,9 @@ void AliTPCTransform::Transform(Double_t *x,Int_t *i,UInt_t /*time*/, // Alignment //TODO: calib->GetParameters()->GetClusterMatrix(sector)->LocalToMaster(x,xx); RotatedGlobal2Global(sector,x); + // - // - // ExB correction + // old ExB correction // if(fCurrentRecoParam&&fCurrentRecoParam->GetUseExBCorrection()) { @@ -183,6 +185,18 @@ void AliTPCTransform::Transform(Double_t *x,Int_t *i,UInt_t /*time*/, xx[2] = x[2]; } + // + // new composed correction - will replace soon ExB correction + // + if(fCurrentRecoParam&&fCurrentRecoParam->GetUseComposedCorrection()&&correction) { + Float_t distPoint[3]={xx[0],xx[1],xx[2]}; + correction->CorrectPoint(distPoint, sector); + xx[0]=distPoint[0]; + xx[1]=distPoint[1]; + xx[2]=distPoint[2]; + } + + // // Time of flight correction // diff --git a/TPC/AliTPCcalibBase.h b/TPC/AliTPCcalibBase.h index fd826b572de..ceb1d6a9adb 100644 --- a/TPC/AliTPCcalibBase.h +++ b/TPC/AliTPCcalibBase.h @@ -56,7 +56,7 @@ protected: Int_t fEvent; //! current Event number Int_t fTime; //! current Time ULong64_t fTrigger; //! current trigger mask - Float_t fMagF; //! current magnetic field + Float_t fMagF; // current magnetic field Int_t fTriggerMaskReject; //trigger mask - non accept trigger Int_t fTriggerMaskAccept; //trigger mask - accept Bool_t fHasLaser; //flag the laser is overlayed with given event @@ -68,7 +68,7 @@ protected: private: Int_t fDebugLevel; // debug level - ClassDef(AliTPCcalibBase,1) + ClassDef(AliTPCcalibBase,2) }; #endif diff --git a/TPC/AliTPCcalibDB.cxx b/TPC/AliTPCcalibDB.cxx index 808311c58f8..59fe2e51f82 100644 --- a/TPC/AliTPCcalibDB.cxx +++ b/TPC/AliTPCcalibDB.cxx @@ -124,7 +124,7 @@ class AliTPCCalDet; #include "AliTPCCalibVdrift.h" #include "AliTPCCalibRaw.h" #include "AliTPCParam.h" - +#include "AliTPCCorrection.h" #include "AliTPCPreprocessorOnline.h" @@ -179,6 +179,7 @@ AliTPCcalibDB::AliTPCcalibDB(): fDedxGainFactor(0), fPadTime0(0), fDistortionMap(0), + fComposedCorrection(0), fPadNoise(0), fPedestals(0), fCalibRaw(0), @@ -219,6 +220,7 @@ AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& ): fDedxGainFactor(0), fPadTime0(0), fDistortionMap(0), + fComposedCorrection(0), fPadNoise(0), fPedestals(0), fCalibRaw(0), diff --git a/TPC/AliTPCcalibDB.h b/TPC/AliTPCcalibDB.h index 3ae3a0cc3b0..611f09073db 100644 --- a/TPC/AliTPCcalibDB.h +++ b/TPC/AliTPCcalibDB.h @@ -37,6 +37,7 @@ class TMap; class AliMagF; class AliTPCcalibDButil; class AliCTPTimeParams; +class AliTPCCorrection; //class AliCDBStorage; class AliTPCcalibDB : public TObject @@ -64,6 +65,8 @@ class AliTPCcalibDB : public TObject AliTPCCalPad* GetDedxGainFactor() const {return fDedxGainFactor;} AliTPCCalPad* GetPadTime0() const {return fPadTime0;} AliTPCCalPad* GetDistortionMap(Int_t i) const {return (fDistortionMap) ? (AliTPCCalPad*)fDistortionMap->At(i):0;} + AliTPCCorrection * GetTPCComposedCorrection() const { return fComposedCorrection;} + void SetTPCComposedCorrection(AliTPCCorrection *compCorr) { fComposedCorrection=compCorr;} AliTPCCalPad* GetPadNoise() const {return fPadNoise;} AliTPCCalPad* GetPedestals() const{return fPedestals;} //ALTRO config data @@ -175,6 +178,7 @@ protected: AliTPCCalPad* fDedxGainFactor; // Gain calibration entry - for dEdx AliTPCCalPad* fPadTime0; // Time0 calibration entry TObjArray *fDistortionMap; // distortion map + AliTPCCorrection *fComposedCorrection; // general space point corrections AliTPCCalPad* fPadNoise; // Noise calibration entry AliTPCCalPad* fPedestals; // Pedestal calibration entry AliTPCCalibRaw *fCalibRaw; // raw data calibration entry -- 2.43.0