]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCcalibAlign.h
Updated list of files
[u/mrichter/AliRoot.git] / TPC / AliTPCcalibAlign.h
index 006438780a282839d6803bd160fad1df2ef0fd1b..adda3b17fd189b98e5ec47c9ddccce3a0baee3c0 100644 (file)
 #include "TH1.h"
 
 class AliExternalTrackParam;
+class AliExternalComparison;
 class AliTPCseed;
 class TGraphErrors;
+class TTree;
+class THnSparse;
+class AliTPCPointCorrection;
+class TFile;
 
 class AliTPCcalibAlign:public AliTPCcalibBase {
 public:
-  enum HistoType {kY=0, kZ =1, kPhi=2, kTheta=3};
-  enum FitType{ k6=0, k9=1, k12};
+  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();
+  void     Process(AliESDEvent *event);
   virtual void Process(AliTPCseed *track);
   virtual void Analyze();
   virtual void Terminate();  
+  virtual Long64_t Merge(TCollection* list);
+  //
+  //
+  void MakeReportDy(TFile *output); 
+  void MakeReportDyPhi(TFile *output);
+  //
+  void UpdatePointCorrection(AliTPCPointCorrection * correction);
   //
-  virtual void EvalFitters();
+  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");
+  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 &param, 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 UpdateAlignSector(const AliTPCseed * seed,Int_t isec); 
   inline Int_t GetIndex(Int_t s1,Int_t s2){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);
@@ -47,37 +70,121 @@ public:
   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);
+  Int_t  AcceptTracklet(const Double_t *t1,
+                       const Double_t *t2);
+
   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);
-
-private:
-  void FillHisto(const AliExternalTrackParam &t1,
-                       const AliExternalTrackParam &t2,
-                       Int_t s1,Int_t s2);
-
+  void Add(AliTPCcalibAlign * align);
+  Int_t *GetPoints() {return fPoints;}
+  void     Process(AliESDtrack *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);
   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);
-  TLinearFitter* GetOrMakeFitter9(Int_t s1,Int_t s2);
-  TLinearFitter* GetOrMakeFitter6(Int_t s1,Int_t s2);
-  TObjArray fDphiHistArray;    // array of residual histograms  phi
-  TObjArray fDthetaHistArray;  // array of residual histograms  theta
-  TObjArray fDyHistArray;      // array of residual histograms  y
-  TObjArray fDzHistArray;      // array of residual histograms  z
+  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*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 *p0, TMatrixD *c0, TMatrixD *p1, TMatrixD *c1);
+  void UpdateSectorKalman(TMatrixD &par0, TMatrixD &cov0, TMatrixD &para1, 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); 
+
+  //
+  // 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 &para1, TMatrixD &cov1);
+  //
+  //private:
+  static Int_t CheckCovariance(TMatrixD &covar);
+public:
+  
+  void FillHisto(const Double_t *t1,
+                const Double_t *t2,
+                Int_t s1,Int_t s2);
+
+  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
-  Int_t fPoints[72*72];        // number of points in the fitter
-  ClassDef(AliTPCcalibAlign,1)
+  //
+  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 
+
+
+  static AliTPCcalibAlign*   fgInstance; //! Instance of this class (singleton implementation)
+private:
+  AliTPCcalibAlign&  operator=(const AliTPCcalibAlign&);// not implemented
+
+  ClassDef(AliTPCcalibAlign,2)
 };
 
 
@@ -91,7 +198,12 @@ TLinearFitter* AliTPCcalibAlign::GetFitter6(Int_t s1,Int_t s2) {
   return static_cast<TLinearFitter*>(fFitterArray6[GetIndex(s1,s2)]);
 }
 
-
+const TMatrixD * AliTPCcalibAlign::GetTransformation(Int_t s1,Int_t s2, Int_t fitType){
+  if (fitType==0) return static_cast<TMatrixD*>(fMatrixArray6[GetIndex(s1,s2)]);
+  if (fitType==1) return static_cast<TMatrixD*>(fMatrixArray9[GetIndex(s1,s2)]);
+  if (fitType==2) return static_cast<TMatrixD*>(fMatrixArray12[GetIndex(s1,s2)]);
+  return 0;
+}