Use the inteface from AliTPCcalibBase (Magnus)
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Apr 2008 12:55:20 +0000 (12:55 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Apr 2008 12:55:20 +0000 (12:55 +0000)
TPC/AliTPCcalibAlign.cxx
TPC/AliTPCcalibAlign.h

index 25f9d44246b06759a8c02d97910f6336d538a052..40d8eda8aefe8cf7411eb3bd35f90bc0f7932bdb 100644 (file)
 #include "TLinearFitter.h"
 #include "AliTPCcalibAlign.h"
 #include "AliExternalTrackParam.h"
+#include "AliTPCTracklet.h"
+#include "TH1D.h"
 
 #include <iostream>
+#include <sstream>
 using namespace std;
 
 ClassImp(AliTPCcalibAlign)
 
 AliTPCcalibAlign::AliTPCcalibAlign()
-  :fFitterArray12(72*72),fFitterArray9(72*72),fFitterArray6(72*72)
+  :  fDphiHistArray(72*72),
+     fDthetaHistArray(72*72),
+     fDyHistArray(72*72),
+     fDzHistArray(72*72),
+     fFitterArray12(72*72),
+     fFitterArray9(72*72),
+     fFitterArray6(72*72)
 {
   //
   // Constructor
@@ -54,9 +63,91 @@ AliTPCcalibAlign::~AliTPCcalibAlign() {
   //
 }
 
-void AliTPCcalibAlign::Process(const AliExternalTrackParam &tp1,
-                              const AliExternalTrackParam &tp2,
-                              Int_t s1,Int_t s2) {
+void AliTPCcalibAlign::Process(AliTPCseed *seed) {
+  TObjArray tracklets=
+    AliTPCTracklet::CreateTracklets(seed,AliTPCTracklet::kKalman,
+                                   kFALSE,20,2);
+  TObjArray trackletsL=
+    AliTPCTracklet::CreateTracklets(seed,AliTPCTracklet::kLinear,
+                                   kFALSE,20,2);
+  TObjArray trackletsQ=
+    AliTPCTracklet::CreateTracklets(seed,AliTPCTracklet::kQuadratic,
+                                   kFALSE,20,2);
+  TObjArray trackletsR=
+    AliTPCTracklet::CreateTracklets(seed,AliTPCTracklet::kRiemann,
+                                   kFALSE,20,2);
+  tracklets.SetOwner();
+  if (tracklets.GetEntries()==2) {
+    AliTPCTracklet *t1=static_cast<AliTPCTracklet*>(tracklets[0]);
+    AliTPCTracklet *t2=static_cast<AliTPCTracklet*>(tracklets[1]);
+    if (t1->GetSector()>t2->GetSector()) {
+      AliTPCTracklet* tmp=t1;
+      t1=t2;
+      t2=tmp;
+    }
+    AliExternalTrackParam *common1=0,*common2=0;
+    if (AliTPCTracklet::PropagateToMeanX(*t1,*t2,common1,common2))
+      ProcessTracklets(*common1,*common2,t1->GetSector(),t2->GetSector());
+    delete common1;
+    delete common2;
+  }
+
+}
+
+void AliTPCcalibAlign::ProcessTracklets(const AliExternalTrackParam &tp1,
+                                       const AliExternalTrackParam &tp2,
+                                       Int_t s1,Int_t s2) {
+
+  if (s2-s1==36) {//only inner-outer
+    if (!fDphiHistArray[s1*72+s2]) {
+      stringstream name;
+      stringstream title;
+      name<<"hist_phi_"<<s1<<"_"<<s2;
+      title<<"Phi Missalignment for sectors "<<s1<<" and "<<s2;
+      fDphiHistArray[s1*72+s2]=new TH1D(name.str().c_str(),title.str().c_str(),1024,-0.01,0.01); // +/- 10 mrad
+      ((TH1D*)fDphiHistArray[s1*72+s2])->SetDirectory(0);
+    }
+    if (!fDthetaHistArray[s1*72+s2]) {
+      stringstream name;
+      stringstream title;
+      name<<"hist_theta_"<<s1<<"_"<<s2;
+      title<<"Theta Missalignment for sectors "<<s1<<" and "<<s2;
+      fDthetaHistArray[s1*72+s2]=new TH1D(name.str().c_str(),title.str().c_str(),1024,-0.01,0.01); // +/- 10 mrad
+      ((TH1D*)fDthetaHistArray[s1*72+s2])->SetDirectory(0);
+    }
+    if (!fDyHistArray[s1*72+s2]) {
+      stringstream name;
+      stringstream title;
+      name<<"hist_y_"<<s1<<"_"<<s2;
+      title<<"Y Missalignment for sectors "<<s1<<" and "<<s2;
+      fDyHistArray[s1*72+s2]=new TH1D(name.str().c_str(),title.str().c_str(),1024,-0.3,0.3); // +/- 3 mm
+      ((TH1D*)fDyHistArray[s1*72+s2])->SetDirectory(0);
+    }
+    if (!fDzHistArray[s1*72+s2]) {
+      stringstream name;
+      stringstream title;
+      name<<"hist_z_"<<s1<<"_"<<s2;
+      title<<"Z Missalignment for sectors "<<s1<<" and "<<s2;
+      fDzHistArray[s1*72+s2]=new TH1D(name.str().c_str(),title.str().c_str(),1024,-0.3,0.3); // +/- 3 mm
+      ((TH1D*)fDzHistArray[s1*72+s2])->SetDirectory(0);
+    }
+    static_cast<TH1D*>(fDphiHistArray[s1*72+s2])
+      ->Fill(TMath::ASin(tp1.GetSnp())
+            -TMath::ASin(tp2.GetSnp()));
+    static_cast<TH1D*>(fDthetaHistArray[s1*72+s2])
+      ->Fill(TMath::ATan(tp1.GetTgl())
+            -TMath::ATan(tp2.GetTgl()));
+    static_cast<TH1D*>(fDyHistArray[s1*72+s2])
+      ->Fill(tp1.GetY()
+            -tp2.GetY());
+    static_cast<TH1D*>(fDzHistArray[s1*72+s2])
+      ->Fill(tp1.GetZ()
+            -tp2.GetZ());
+  }
+  return;
+
+
+
   //
   // Process function to fill fitters
   //
index 192e37604132c1a9051148023ae41d31cde9d25d..937a5530b8f498f138e0e27ca814f088bd24df66 100644 (file)
 #include "TObject.h"
 #include "TObjArray.h"
 #include "TLinearFitter.h"
+#include "AliTPCcalibBase.h"
+#include "TH1.h"
 
 class AliExternalTrackParam;
+class AliTPCseed;
 
-class AliTPCcalibAlign:public TObject {
+class AliTPCcalibAlign:public AliTPCcalibBase {
 public:
   AliTPCcalibAlign();
 
   virtual ~AliTPCcalibAlign();
 
-  void Process(const AliExternalTrackParam &t1,
-              const AliExternalTrackParam &t2,
-              Int_t s1,Int_t s2);
+  virtual void Process(AliTPCseed *track);
+
+  void ProcessTracklets(const AliExternalTrackParam &t1,
+                       const AliExternalTrackParam &t2,
+                       Int_t s1,Int_t s2);
   void Eval();
   TLinearFitter* GetFitter12(Int_t s1,Int_t s2) {
     return static_cast<TLinearFitter*>(fFitterArray12[s1*72+s2]);
@@ -36,6 +41,12 @@ 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);
+
+  TObjArray fDphiHistArray;
+  TObjArray fDthetaHistArray;
+  TObjArray fDyHistArray;
+  TObjArray fDzHistArray;
+
 private:
   void Process12(Double_t *t1,
                 Double_t *t2,