X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TPC%2FAliTPCcalibAlign.h;h=0f130061c7ba980b2ed7e2d511b200712f36eec2;hb=69c38808a8d99603b91605031a84ddd020c35dd6;hp=398b4d25e3125e9541e95bd1de161382b96b0fd5;hpb=e149f26d407820ef44f91c64500151d9c8150369;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCcalibAlign.h b/TPC/AliTPCcalibAlign.h index 398b4d25e31..0f130061c7b 100644 --- a/TPC/AliTPCcalibAlign.h +++ b/TPC/AliTPCcalibAlign.h @@ -8,80 +8,217 @@ //// //// -#include "TObject.h" -#include "TObjArray.h" -#include "TLinearFitter.h" -#include "AliTPCcalibBase.h" -#include "TH1.h" +class TFile; +class TGraphErrors; +class TH1; +class THnSparse; +#include +#include +class TObjArray; +class TTree; +#include "AliTPCcalibBase.h" +class AliExternalComparison; class AliExternalTrackParam; +class AliTPCPointCorrection; class AliTPCseed; class AliTPCcalibAlign:public AliTPCcalibBase { public: + enum HistoType {kY=0, kZ =1, kPhi=2, kTheta=3, + kYPhi=4, kZTheta=5, + kYz=6,kZz=7,kPhiZ=8,kThetaZ=9}; + enum FitType{ k6=0, k9=1, k12=2}; AliTPCcalibAlign(); AliTPCcalibAlign(const Text_t *name, const Text_t *title); - + AliTPCcalibAlign(const AliTPCcalibAlign &align); + // virtual ~AliTPCcalibAlign(); - - virtual void Process(AliTPCseed *track); - + void Process(AliESDEvent *event); + virtual void ProcessSeed(AliTPCseed *track); + virtual void Process(AliTPCseed */*track*/){ return ;} + virtual void Analyze(); + virtual void Terminate(); + virtual Long64_t Merge(TCollection* const list); + void ExportTrackPoints(AliESDEvent *event); + // + // + void MakeReportDy(TFile *output); + void MakeReportDyPhi(TFile *output); + // + void UpdatePointCorrection(AliTPCPointCorrection * correction); + // + virtual void EvalFitters(Int_t minPoints=20); + TH1 * GetHisto(HistoType type, Int_t s1, Int_t s2, Bool_t force=kFALSE); + void MakeTree(const char *fname="alignTree.root", Int_t minPoints=20); + TGraphErrors * MakeGraph(Int_t sec0, Int_t sec1, Int_t dsec, + Int_t i0, Int_t i1, FitType type); + Int_t RefitLinear(const AliTPCseed * seed, Int_t isec, Double_t *fitParam, Int_t refSector, TMatrixD ¶m, TMatrixD&covar, Double_t xRef, Bool_t both=kFALSE); + void ProcessTracklets(const AliExternalTrackParam &t1, const AliExternalTrackParam &t2, + const AliTPCseed * seed, Int_t s1,Int_t s2); - void Eval(); - TLinearFitter* GetFitter12(Int_t s1,Int_t s2) { - return static_cast(fFitterArray12[s1*72+s2]); - } - TLinearFitter* GetFitter9(Int_t s1,Int_t s2) { - return static_cast(fFitterArray9[s1*72+s2]); - } - TLinearFitter* GetFitter6(Int_t s1,Int_t s2) { - return static_cast(fFitterArray6[s1*72+s2]); - } + + void UpdateAlignSector(const AliTPCseed * seed,Int_t isec); + Int_t GetIndex(Int_t s1,Int_t s2) const {return 72*s1+s2;} + // + inline const TMatrixD * GetTransformation(Int_t s1,Int_t s2, Int_t fitType); + // + inline TLinearFitter* GetFitter12(Int_t s1,Int_t s2); + inline TLinearFitter* GetFitter9(Int_t s1,Int_t s2); + inline TLinearFitter* GetFitter6(Int_t s1,Int_t s2); + // Bool_t GetTransformation12(Int_t s1,Int_t s2,TMatrixD &a); Bool_t GetTransformation9(Int_t s1,Int_t s2,TMatrixD &a); Bool_t GetTransformation6(Int_t s1,Int_t s2,TMatrixD &a); + Int_t AcceptTracklet(const AliExternalTrackParam &tp1, + const AliExternalTrackParam &tp2) const; + Int_t AcceptTracklet(const Double_t *t1, + const Double_t *t2) const; + + void ProcessDiff(const AliExternalTrackParam &t1, + const AliExternalTrackParam &t2, + const AliTPCseed *seed, + Int_t s1,Int_t s2); + void ProcessAlign(Double_t * t1, Double_t * t2, Int_t s1,Int_t s2); + +// Bool_t GetTransformationCovar12(Int_t s1,Int_t s2,TMatrixD &a, Bool_t norm=kFALSE); +// Bool_t GetTransformationCovar9(Int_t s1,Int_t s2,TMatrixD &a, Bool_t norm=kFALSE); +// Bool_t GetTransformationCovar6(Int_t s1,Int_t s2,TMatrixD &a, Bool_t norm=kFALSE); + void Add(AliTPCcalibAlign * align); + const Int_t *GetPoints() const {return fPoints;} + void Process(AliESDtrack *const track, Int_t runNo=-1){AliTPCcalibBase::Process(track,runNo);}; + TLinearFitter* GetOrMakeFitter12(Int_t s1,Int_t s2); + TLinearFitter* GetOrMakeFitter9(Int_t s1,Int_t s2); + TLinearFitter* GetOrMakeFitter6(Int_t s1,Int_t s2); + void Process12(const Double_t *t1, const Double_t *t2, + TLinearFitter *fitter) const; + void Process9(const Double_t *const t1, const Double_t *const t2, TLinearFitter *fitter) const; + void Process6(const Double_t *const t1, const Double_t *const t2, TLinearFitter *fitter) const; + void ProcessTree(TTree * tree, AliExternalComparison *comp=0); + void GlobalAlign6(Int_t minPoints, Float_t sysError, Int_t niter); + // + // Cluster comparison Part + // + // + // For visualization and test purposes + // + Double_t Correct(Int_t type, Int_t value, Int_t s1, Int_t s2, Double_t x, Double_t y, Double_t z, Double_t phi,Double_t theta); + static Double_t SCorrect(Int_t type, Int_t value, Int_t s1, Int_t s2, Double_t x, Double_t y, Double_t z, Double_t phi,Double_t theta){return Instance()->Correct(type,value,s1,s2,x,y,z,phi,theta);} + static AliTPCcalibAlign* Instance(); + void SetInstance(AliTPCcalibAlign* const param){fgInstance = param;} + static void Constrain1Pt(AliExternalTrackParam &t1, const AliExternalTrackParam &t2, Bool_t noField); + void SetNoField(Bool_t noField){ fNoField=noField;} + + // + // Kalman fileter for sectors + // + void MakeSectorKalman(); + void UpdateSectorKalman(Int_t sector, Int_t quadrant0, Int_t quadrant1, TMatrixD *const p0, TMatrixD *const c0, TMatrixD *const p1, TMatrixD *const c1); + void UpdateSectorKalman(TMatrixD &par0, TMatrixD &cov0, TMatrixD ¶1, TMatrixD &cov1); + Double_t GetCorrectionSector(Int_t coord, Int_t sector, Double_t lx, Double_t ly, Double_t lz); + static Double_t SGetCorrectionSector(Int_t coord, Int_t sector, Double_t lx, Double_t ly, Double_t lz); - TObjArray fDphiHistArray; - TObjArray fDthetaHistArray; - TObjArray fDyHistArray; - TObjArray fDzHistArray; + // + // Kalman filter for full TPC + // + void MakeKalman(); + void UpdateKalman(Int_t sector0, Int_t sector1, TMatrixD &p0, TMatrixD &c0, TMatrixD &p1, TMatrixD &c1); + void UpdateKalman(TMatrixD &par0, TMatrixD &cov0, TMatrixD ¶1, TMatrixD &cov1); + // + //private: + static Int_t CheckCovariance(TMatrixD &covar); + // + // + void MakeResidualHistos(); + THnSparse * GetClusterDelta(Int_t index) const { return fClusterDelta[index];} +public: + + void FillHisto(const Double_t *t1, + const Double_t *t2, + Int_t s1,Int_t s2); + +protected: + THnSparse *fClusterDelta[6]; //clusters residuals + TObjArray fDphiHistArray; // array of residual histograms phi -kPhi + TObjArray fDthetaHistArray; // array of residual histograms theta -kTheta + TObjArray fDyHistArray; // array of residual histograms y -kY + TObjArray fDzHistArray; // array of residual histograms z -kZ + // + TObjArray fDyPhiHistArray; // array of residual histograms y -kYPhi + TObjArray fDzThetaHistArray; // array of residual histograms z-z -kZTheta + // + TObjArray fDphiZHistArray; // array of residual histograms phi -kPhiz + TObjArray fDthetaZHistArray; // array of residual histograms theta -kThetaz + TObjArray fDyZHistArray; // array of residual histograms y -kYz + TObjArray fDzZHistArray; // array of residual histograms z -kZz + // + // + TObjArray fFitterArray12; // array of fitters + TObjArray fFitterArray9; // array of fitters + TObjArray fFitterArray6; // array of fitters + // + TObjArray fMatrixArray12; // array of transnformtation matrix + TObjArray fMatrixArray9; // array of transnformtation matrix + TObjArray fMatrixArray6; // array of transnformtation matrix + // + // + // + // + TObjArray fCombinedMatrixArray6; // array combeined transformation matrix + // + AliExternalComparison *fCompTracklet; //tracklet comparison + // + Int_t fPoints[72*72]; // number of points in the fitter + Bool_t fNoField; // flag - no field data + // refernce x + Double_t fXIO; // OROC-IROC boundary + Double_t fXmiddle; // center of the TPC sector local X + Double_t fXquadrant; // x quadrant + // + // Kalman filter for sector internal alignemnt + // + TObjArray fArraySectorIntParam; // array of sector alignment parameters + TObjArray fArraySectorIntCovar; // array of sector alignment covariances + // + // Kalman filter for global alignment + // + TMatrixD *fSectorParamA; // Kalman parameter for A side + TMatrixD *fSectorCovarA; // Kalman covariance for A side + TMatrixD *fSectorParamC; // Kalman parameter for A side + TMatrixD *fSectorCovarC; // Kalman covariance for A side + // + // + // + Bool_t fUseInnerOuter; // flag- use Inner Outer sector for left righ alignment + + static AliTPCcalibAlign* fgInstance; //! Instance of this class (singleton implementation) private: - void Process12(Double_t *t1, - Double_t *t2, - TLinearFitter *fitter); - void Process9(Double_t *t1, - Double_t *t2, - TLinearFitter *fitter); - void Process6(Double_t *t1, - Double_t *t2, - TLinearFitter *fitter); - TLinearFitter* GetOrMakeFitter12(Int_t s1,Int_t s2) { - //get or make fitter - if (!fFitterArray12[s1*72+s2]) - fFitterArray12[s1*72+s2]=new TLinearFitter(12,"x0++x1++x2++x3++x4++x5++x6++x7++x8++x9++x10++x11"); - return GetFitter12(s1,s2); - } - TLinearFitter* GetOrMakeFitter9(Int_t s1,Int_t s2) { - //get or make fitter - if (!fFitterArray9[s1*72+s2]) - fFitterArray9[s1*72+s2]=new TLinearFitter(9,"x0++x1++x2++x3++x4++x5++x6++x7++x8"); - return GetFitter9(s1,s2); - } - TLinearFitter* GetOrMakeFitter6(Int_t s1,Int_t s2) { - //get or make fitter - if (!fFitterArray6[s1*72+s2]) - fFitterArray6[s1*72+s2]=new TLinearFitter(6,"x0++x1++x2++x3++x4++x5"); - return GetFitter6(s1,s2); - } - TObjArray fFitterArray12; - TObjArray fFitterArray9; - TObjArray fFitterArray6; - Int_t fPoints[72*72]; - - ClassDef(AliTPCcalibAlign,1) + AliTPCcalibAlign& operator=(const AliTPCcalibAlign&);// not implemented + + ClassDef(AliTPCcalibAlign,3) }; + +TLinearFitter* AliTPCcalibAlign::GetFitter12(Int_t s1,Int_t s2) { + return static_cast(fFitterArray12[GetIndex(s1,s2)]); +} +TLinearFitter* AliTPCcalibAlign::GetFitter9(Int_t s1,Int_t s2) { + return static_cast(fFitterArray9[GetIndex(s1,s2)]); +} +TLinearFitter* AliTPCcalibAlign::GetFitter6(Int_t s1,Int_t s2) { + return static_cast(fFitterArray6[GetIndex(s1,s2)]); +} + +const TMatrixD * AliTPCcalibAlign::GetTransformation(Int_t s1,Int_t s2, Int_t fitType){ + if (fitType==0) return static_cast(fMatrixArray6[GetIndex(s1,s2)]); + if (fitType==1) return static_cast(fMatrixArray9[GetIndex(s1,s2)]); + if (fitType==2) return static_cast(fMatrixArray12[GetIndex(s1,s2)]); + return 0; +} + + + #endif