M AliTPCTransform.cxx - use also radial map
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 16 May 2010 22:23:06 +0000 (22:23 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 16 May 2010 22:23:06 +0000 (22:23 +0000)
M      AliTPCcalibAlign.h        - getter for cluster delta
M      AliTPCcalibAlign.cxx      - calgrind: reuse the linear fitter
M      AliTPCcalibBase.h         - calgrind: cache friend track
M      AliTPCcalibBase.cxx       -
M      AliTPCCalPad.h            - Graphics added - Draw and MakeReport
M      AliTPCCalPad.cxx          0

M      AliTPCcalibCalib.cxx      - calgrind/valgrind - reuse the friend track
M      AliTPCcalibTime.cxx       - callgrind - do not dump env variable
M      AliTPCCorrection.cxx      - protection - for 0 field and 0 momenta algorithm crashed in AliExternaltrackParam

M      AliTPCkalmanAlign.h       - CE fits + MakeReport
M      AliTPCkalmanAlign.cxx

12 files changed:
TPC/AliTPCCalPad.cxx
TPC/AliTPCCalPad.h
TPC/AliTPCCorrection.cxx
TPC/AliTPCTransform.cxx
TPC/AliTPCcalibAlign.cxx
TPC/AliTPCcalibAlign.h
TPC/AliTPCcalibBase.cxx
TPC/AliTPCcalibBase.h
TPC/AliTPCcalibCalib.cxx
TPC/AliTPCcalibTime.cxx
TPC/AliTPCkalmanAlign.cxx
TPC/AliTPCkalmanAlign.h

index fe68f65..c330bac 100644 (file)
 #include <iostream>
 #include <AliLog.h>
 
+//graphic includes
+#include <TTree.h>
+#include <TH1.h>
+#include <TCanvas.h>
+#include <TLegend.h>
+#include <TCut.h>
+#include <TVirtualPad.h>
+
+
 ClassImp(AliTPCCalPad)
 
 //_____________________________________________________________________________
@@ -371,7 +380,7 @@ Double_t AliTPCCalPad::GetLTM(Double_t *sigma, Double_t fraction, AliTPCCalPad*
 }
 
 //_____________________________________________________________________________
-TH1F * AliTPCCalPad::MakeHisto1D(Float_t min, Float_t max,Int_t type){
+TH1F * AliTPCCalPad::MakeHisto1D(Float_t min, Float_t max,Int_t type, Int_t side){
   //
   // make 1D histo
   // type -1 = user defined range
@@ -408,6 +417,8 @@ TH1F * AliTPCCalPad::MakeHisto1D(Float_t min, Float_t max,Int_t type){
   sprintf(name,"%s Pad 1D",GetTitle());
   TH1F * his = new TH1F(name,name,100, min,max);
     for (Int_t isec = 0; isec < kNsec; isec++) {
+      if (side==1 && isec%36>18) continue;
+      if (side==-1 && isec%36<18) continue;
        if (fROC[isec]){
            for (UInt_t irow=0; irow<fROC[isec]->GetNrows(); irow++){
                UInt_t npads = (Int_t)fROC[isec]->GetNPads(irow);
@@ -677,144 +688,173 @@ AliTPCCalPad *AliTPCCalPad::CreateCalPadFit(const char* fitFormula, const TVecto
   delete arrFitFormulas;
   return pad;
 }
-/*
-void AliTPCCalPad::GlobalSidesFit(const AliTPCCalPad* PadOutliers, TVectorD &fitParamSideA, TVectorD &fitParamSideC,TMatrixD &covMatrixSideA, TMatrixD &covMatrixSideC, Float_t & chi2SideA, Float_t & chi2SideC, Int_t fitType, Bool_t robust, Double_t chi2Threshold, Double_t robustFraction){
+
+
+
+TCanvas * AliTPCCalPad::MakeReportPadSector(TTree *chain, const char* varName, const char*varTitle, const char *axisTitle, Float_t min, Float_t max, const char *cutUser){
   //
-  // Makes a  GlobalFit over each side and return fit-parameters, covariance and chi2 for each side
-  // fitType == 0: fit plane function
-  // fitType == 1: fit parabolic function
-  // PadOutliers - pads with value !=0 are not used in fitting procedure
-  // chi2Threshold: Threshold for chi2 when EvalRobust is called
-  // robustFraction: Fraction of data that will be used in EvalRobust
+  // Make a report - cal pads per sector
+  // mean valeus per sector and local X
   //
-  TLinearFitter* fitterGA = 0;
-  TLinearFitter* fitterGC = 0;
-  
-  if (fitType  == 1) {
-    fitterGA = new TLinearFitter (6,"x0++x1++x2++x3++x4++x5");
-    fitterGC = new TLinearFitter (6,"x0++x1++x2++x3++x4++x5");
-  }
-  else {
-    fitterGA = new TLinearFitter(3,"x0++x1++x2");
-    fitterGC = new TLinearFitter(3,"x0++x1++x2");
-  }
-  fitterGA->StoreData(kTRUE);   
-  fitterGC->StoreData(kTRUE);   
-  fitterGA->ClearPoints();
-  fitterGC->ClearPoints();
-  Double_t xx[6];  
-  Int_t    npointsA=0;
-  Int_t    npointsC=0;
-  
-  Float_t localXY[3] = {0}; // pad's position, needed to get the pad's position
-  Float_t lx, ly;  // pads position
-  
-  AliTPCROC* tpcROCinstance = AliTPCROC::Instance();  // to calculate the pad's position
-  
-  // loop over all sectors and pads and read data into fitterGA and fitterGC 
-  if (fitType == 1) {  
-  // parabolic fit
-    fitParamSideA.ResizeTo(6);
-    fitParamSideC.ResizeTo(6);
-    covMatrixSideA.ResizeTo(6,6);
-    covMatrixSideC.ResizeTo(6,6);
-    for (UInt_t isec = 0; isec<72; isec++){
-      for (UInt_t irow = 0; irow < GetCalROC(isec)->GetNrows(); irow++) {
-         for (UInt_t ipad = 0; ipad < GetCalROC(isec)->GetNPads(irow); ipad++) {
-            // fill fitterG
-            tpcROCinstance->GetPositionLocal(isec, irow, ipad, localXY);   // calculate position localXY by sector, pad and row number
-            lx = localXY[0];
-            ly = localXY[1];
-            xx[0] = 1;
-            xx[1] = lx;
-            xx[2] = ly;
-            xx[3] = lx*lx;
-            xx[4] = ly*ly;
-            xx[5] = lx*ly;
-            if (!PadOutliers || PadOutliers->GetCalROC(isec)->GetValue(irow, ipad) != 1) {
-            // if given pad is no outlier, add it to TLinearFitter, decide to which of both
-//                sector  0 - 17: IROC, A
-//                sector 18 - 35: IROC, C
-//                sector 36 - 53: OROC, A
-//                sector 54 - 71: CROC, C
-               if (isec <= 17 || (isec >= 36 && isec <= 53)) { // Side A
-                  npointsA++;
-                  fitterGA->AddPoint(xx, GetCalROC(isec)->GetValue(irow, ipad), 1);  
-               }
-               else { // side C
-                  npointsC++;
-                  fitterGC->AddPoint(xx, GetCalROC(isec)->GetValue(irow, ipad), 1);  
-               }
-            }
-         }
-      }
-    }
-  }
-  else {   
-  // linear fit
-    fitParamSideA.ResizeTo(3);
-    fitParamSideC.ResizeTo(3);
-    covMatrixSideA.ResizeTo(3,3);
-    covMatrixSideC.ResizeTo(3,3);
-    
-    for (UInt_t isec = 0; isec<72; isec++){
-      for (UInt_t irow = 0; irow < GetCalROC(isec)->GetNrows(); irow++) {
-         for (UInt_t ipad = 0; ipad < GetCalROC(isec)->GetNPads(irow); ipad++) {
-            // fill fitterG
-            tpcROCinstance->GetPositionLocal(isec, irow, ipad, localXY);   // calculate position localXY by sector, pad and row number
-            lx = localXY[0];
-            ly = localXY[1];
-            xx[0] = 1;
-            xx[1] = lx;
-            xx[2] = ly;
-            if (!PadOutliers || PadOutliers->GetCalROC(isec)->GetValue(irow, ipad) != 1) {
-            // if given pad is no outlier, add it to TLinearFitter, decide to which of both
-//                sector  0 - 17: IROC, A
-//                sector 18 - 35: IROC, C
-//                sector 36 - 53: OROC, A
-//                sector 54 - 71: CROC, C
-               if (isec <= 17 || (isec >= 36 && isec <= 53)) { 
-               // Side A
-                  npointsA++;
-                  fitterGA->AddPoint(xx, GetCalROC(isec)->GetValue(irow, ipad), 1);  
-               }
-               else { 
-               // side C
-                  npointsC++;
-                  fitterGC->AddPoint(xx, GetCalROC(isec)->GetValue(irow, ipad), 1);  
-               }
-            }
-         }
-      }
-    }
-  }    
-  
-  fitterGA->Eval();
-  fitterGC->Eval();
-  fitterGA->GetParameters(fitParamSideA);
-  fitterGC->GetParameters(fitParamSideC);
-  fitterGA->GetCovarianceMatrix(covMatrixSideA);
-  fitterGC->GetCovarianceMatrix(covMatrixSideC);
-  if (fitType == 1){
-    chi2SideA = fitterGA->GetChisquare()/(npointsA-6.);
-    chi2SideC = fitterGC->GetChisquare()/(npointsC-6.);
-  }
-  else {
-   chi2SideA = fitterGA->GetChisquare()/(npointsA-3.);
-   chi2SideC = fitterGC->GetChisquare()/(npointsC-3.);
-  }
-  if (robust && chi2SideA > chi2Threshold) {
-    //    std::cout << "robust fitter called... " << std::endl;
-    fitterGA->EvalRobust(robustFraction);
-    fitterGA->GetParameters(fitParamSideA);
+  TH1* his=0; 
+  TLegend *legend = 0;
+  TCanvas *canvas = new TCanvas(Form("Sector: %s",varTitle),Form("Sector: %s",varTitle),1500,1100);
+
+  canvas->Divide(2);
+  chain->SetAlias("lX","lx.fElements"); 
+  //
+  canvas->cd(1);
+  TString strDraw=varName;
+  strDraw+=":lX";
+  legend = new TLegend(0.5,0.50,0.9,0.9, Form("%s TPC A side", varTitle));
+  for (Int_t isec=-1; isec<18; isec+=1){
+    TCut cutSec=Form("sector%36==%d",isec);
+    cutSec+=cutUser;
+    if (isec==-1) cutSec="sector%36<18";
+    chain->SetMarkerColor(1+(isec+2)%5);
+    chain->SetLineColor(1+(isec+2)%5);
+    chain->SetMarkerStyle(25+(isec+2)%4);
+    //
+    chain->Draw(strDraw.Data(),cutSec,"profgoff");
+    his=(TH1*)chain->GetHistogram()->Clone();
+    delete chain->GetHistogram();
+    his->SetMaximum(max);
+    his->SetMinimum(min);
+    his->GetXaxis()->SetTitle("R (cm)");
+    his->GetYaxis()->SetTitle(axisTitle);
+    his->SetTitle(Form("%s- sector %d",varTitle, isec));
+    his->SetName(Form("%s- sector %d",varTitle, isec));
+    if (isec==-1) his->SetTitle(Form("%s A side",varTitle));
+    if (isec==-1) his->Draw();
+    his->Draw("same");
+    legend->AddEntry(his);
   }
-  if (robust && chi2SideC > chi2Threshold) {
-    //    std::cout << "robust fitter called... " << std::endl;
-    fitterGC->EvalRobust(robustFraction);
-    fitterGC->GetParameters(fitParamSideC);
+  legend->Draw();
+  canvas->cd(2);
+  //
+  legend = new TLegend(0.5,0.50,0.9,0.9, Form("%s TPC C side", varTitle));
+  for (Int_t isec=-1; isec<18; isec+=1){
+    TCut cutSec=Form("(sector+18)%36==%d",isec);
+    cutSec+=cutUser;
+    if (isec==-1) cutSec="sector%36>18";
+    chain->SetMarkerColor(1+(isec+2)%5);
+    chain->SetLineColor(1+(isec+2)%5);
+    chain->SetMarkerStyle(25+isec%4);
+    //
+    chain->Draw(strDraw.Data(),cutSec,"profgoff");
+    his=(TH1*)chain->GetHistogram()->Clone();
+    delete chain->GetHistogram();
+    his->SetMaximum(max);
+    his->SetMinimum(min);
+    his->GetXaxis()->SetTitle("R (cm)");
+    his->GetYaxis()->SetTitle(axisTitle);
+    his->SetTitle(Form("%s- sector %d",varTitle,isec));
+    his->SetName(Form("%s- sector %d",varTitle,isec));
+    if (isec==-1) his->SetTitle(Form("%s C side",varTitle));
+    if (isec==-1) his->Draw();
+    his->Draw("same");
+    legend->AddEntry(his);
   }
-  delete fitterGA;
-  delete fitterGC;
+  legend->Draw();
+  //
+  //
+  return canvas;
+}
+
+
+TCanvas * AliTPCCalPad::MakeReportPadSector2D(TTree *chain, const char* varName, const char*varTitle, const char *axisTitle, Float_t min, Float_t max, const char *cutUser){
+  //
+  // Make a report - cal pads per sector
+  // 2D view
+  // Input tree should be created using AliPreprocesorOnline before
+  // 
+  TH1* his=0; 
+  TCanvas *canvas = new TCanvas(Form("%s2D",varTitle),Form("%s2D",varTitle),1500,1100);
+  canvas->Divide(2);
+  //
+  TString strDraw=varName;
+  strDraw+=":gy.fElements:gx.fElements>>his(250,-250,250,250,-250,250)";
+  //
+  TVirtualPad * pad=0;
+  pad=canvas->cd(1);
+  pad->SetMargin(0.15,0.15,0.15,0.15);
+  TCut cut=cutUser;
+  chain->Draw(strDraw.Data(),"sector%36<18"+cut,"profgoffcolz2");
+  his=(TH1*)chain->GetHistogram()->Clone();
+  delete chain->GetHistogram();
+  his->SetMaximum(max);
+  his->SetMinimum(min);
+  his->GetXaxis()->SetTitle("x (cm)");
+  his->GetYaxis()->SetTitle("y (cm)");
+  his->GetZaxis()->SetTitle(axisTitle);
+  his->SetTitle(Form("%s A side",varTitle));
+  his->SetName(Form("%s A side",varTitle));
+  his->Draw("colz2");
+  //
+  pad=canvas->cd(2);
+  pad->SetMargin(0.15,0.15,0.15,0.15);
+
+  chain->Draw(strDraw.Data(),"sector%36>=18"+cut,"profgoffcolz2");
+  his=(TH1*)chain->GetHistogram()->Clone();
+  delete chain->GetHistogram();
+  his->SetMaximum(max);
+  his->SetMinimum(min);
+  his->GetXaxis()->SetTitle("x (cm)");
+  his->GetYaxis()->SetTitle("y (cm)");
+  his->GetZaxis()->SetTitle(axisTitle);
+  his->SetTitle(Form("%s C side",varTitle));
+  his->SetName(Form("%s C side",varTitle));
+  his->Draw("colz2");
+  //
+  //
+  return canvas;
 }
-*/
 
+void  AliTPCCalPad::Draw(Option_t* option){
+  // 
+  // Draw function - standard 2D view
+  //
+  TH1* his=0; 
+  TCanvas *canvas = new TCanvas(Form("%s2D",GetTitle()),Form("%s2D",GetTitle()),900,900);
+  canvas->Divide(2,2);
+  //
+  //
+  TVirtualPad * pad=0;
+  pad=canvas->cd(1);
+  pad->SetMargin(0.15,0.15,0.15,0.15);
+  his=MakeHisto2D(0);
+  his->GetXaxis()->SetTitle("x (cm)");
+  his->GetYaxis()->SetTitle("y (cm)");
+  his->GetZaxis()->SetTitle(GetTitle());
+  his->SetTitle(Form("%s A side",GetTitle()));
+  his->SetName(Form("%s A side",GetTitle()));
+  his->Draw(option);
+  //
+  pad=canvas->cd(2);
+  pad->SetMargin(0.15,0.15,0.15,0.15);
+  his=MakeHisto2D(1);
+  his->GetXaxis()->SetTitle("x (cm)");
+  his->GetYaxis()->SetTitle("y (cm)");
+  his->GetZaxis()->SetTitle(GetTitle());
+  his->SetTitle(Form("%s C side",GetTitle()));
+  his->SetName(Form("%s C side",GetTitle()));
+  his->Draw(option);
+  //
+  pad=canvas->cd(3);
+  pad->SetMargin(0.15,0.15,0.15,0.15);
+  his=MakeHisto1D(-8,8,0,1);
+  his->GetXaxis()->SetTitle(GetTitle());
+  his->SetTitle(Form("%s A side",GetTitle()));
+  his->SetName(Form("%s A side",GetTitle()));
+  his->Draw("err");
+  //
+  pad=canvas->cd(4);
+  pad->SetMargin(0.15,0.15,0.15,0.15);
+  his=MakeHisto1D(-8,8,0,-1);
+  his->GetXaxis()->SetTitle(GetTitle());
+  his->SetTitle(Form("%s C side",GetTitle()));
+  his->SetName(Form("%s C side",GetTitle()));
+  his->Draw("err");
+
+
+}
index 28c4311..412e236 100644 (file)
@@ -26,6 +26,8 @@ class TObjArray;
 class TGraph;
 class TH2F;
 class TH1F;
+class TCanvas;
+class TTree;
 
 class AliTPCCalPad : public TNamed {
  public:
@@ -38,7 +40,8 @@ class AliTPCCalPad : public TNamed {
   AliTPCCalPad &operator=(const AliTPCCalPad &c);
   virtual void     Copy(TObject &c) const;
   AliTPCCalROC *GetCalROC(Int_t sector) const {return fROC[sector]; };  
-  void SetCalROC(AliTPCCalROC* roc, Int_t sector = -1);
+  void SetCalROC(AliTPCCalROC* roc, Int_t sector = -1);  
+  virtual void Draw(Option_t* option = "");
   //
   // algebra
   void Add(Float_t c1);   // add constant c1 to all channels of all ROCs
@@ -54,7 +57,7 @@ class AliTPCCalPad : public TNamed {
   Double_t GetLTM(Double_t *sigma=0, Double_t fraction=0.9, AliTPCCalPad* outlierPad = 0);   // return mean of the LTM and sigma of all ROCs
   TGraph  *MakeGraph(Int_t type=0, Float_t ratio=0.7);
   TH2F    *MakeHisto2D(Int_t side=0);
-  TH1F    *MakeHisto1D(Float_t min=4, Float_t max=-4, Int_t type=0);  
+  TH1F    *MakeHisto1D(Float_t min=4, Float_t max=-4, Int_t type=0, Int_t side=0);  
 
   AliTPCCalPad* LocalFit(const char* padName, Int_t rowRadius, Int_t padRadius, AliTPCCalPad* Padoutliers = 0, Bool_t robust = kFALSE, Double_t chi2Threshold = 5, Double_t robustFraction = 0.7, Bool_t printCurrentSector = kFALSE) const;
   AliTPCCalPad* GlobalFit(const char* padName, AliTPCCalPad* Padoutliers = 0, Bool_t robust = kFALSE, Int_t fitType = 1, Double_t chi2Threshold = 5, Double_t robustFraction = 0.7, Double_t err=1, TObjArray *fitParArr=0x0, TObjArray *fitCovArr=0x0);
@@ -66,6 +69,12 @@ class AliTPCCalPad : public TNamed {
   static TObjArray *CreateFormulaArray(const char *fitFormula);
   static void EvalFormulaArray(const TObjArray &arrFitFormulas, TVectorD &results,
                                const Int_t sec, const Int_t row, const Int_t pad);
+  //
+  // default report
+  //
+  static TCanvas * MakeReportPadSector(TTree *chain, const char* varName, const char*varTitle, const char *axisTitle, Float_t min, Float_t max, const char * cutUser="");
+  static TCanvas * MakeReportPadSector2D(TTree *chain, const char* varName, const char*varTitle, const char *axisTitle, Float_t min, Float_t max, const char *cutUser="");
+
  protected:
   AliTPCCalROC *fROC[kNsec];                    //  Array of ROC objects which contain the values per pad
   ClassDef(AliTPCCalPad,1)                      //  TPC calibration class for parameters which are saved per pad
index 85561e3..496bd99 100644 (file)
@@ -51,6 +51,7 @@
 #include <AliCDBId.h>
 #include <AliCDBMetaData.h>
 
+#include  "TRandom.h"
 #include  "AliExternalTrackParam.h"
 #include  "AliTrackPointArray.h"
 #include  "TDatabasePDG.h"
@@ -524,6 +525,8 @@ AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(AliExternalTrackPara
   for (Double_t radius=kRTPC0; radius<kRTPC1; radius++){
     AliTrackerBase::PropagateTrackToBxByBz(&track,radius,kMass,3,kTRUE,kMaxSnp);
     track.GetXYZ(xyz);
+    xyz[0]+=gRandom->Gaus(0,0.001);
+    xyz[1]+=gRandom->Gaus(0,0.001);
     AliTrackPoint pIn0;                               // space point          
     AliTrackPoint pIn1;
     Int_t sector= (xyz[2]>0)? 0:18;
@@ -555,12 +558,12 @@ AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(AliExternalTrackPara
   AliTrackPoint   point1,point2,point3;
   if (dir==1) {  //make seed inner
     pointArray0.GetPoint(point1,1);
-    pointArray0.GetPoint(point2,10);
-    pointArray0.GetPoint(point3,20);
+    pointArray0.GetPoint(point2,30);
+    pointArray0.GetPoint(point3,60);
   }
   if (dir==-1){ //make seed outer
-    pointArray0.GetPoint(point1,npoints-20);
-    pointArray0.GetPoint(point2,npoints-10);
+    pointArray0.GetPoint(point1,npoints-60);
+    pointArray0.GetPoint(point2,npoints-30);
     pointArray0.GetPoint(point3,npoints-1);
   }  
   track0 = AliTrackerBase::MakeSeed(point1, point2, point3);
@@ -732,10 +735,10 @@ void AliTPCCorrection::MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t
     tPar[1]=theta*refX;
     tPar[2]=snp;
     tPar[3]=theta;
-    tPar[4]=0.001;  // should be calculated - non equal to 0
+    tPar[4]=(gRandom->Rndm()-0.5)*0.02;  // should be calculated - non equal to 0
     Double_t bz=AliTrackerBase::GetBz();
-    if (refX>10.) tPar[4]=snp/(refX*bz*kB2C*2);
-    tPar[4]+=0.001;
+    if (refX>10. && TMath::Abs(bz)>0.1 )  tPar[4]=snp/(refX*bz*kB2C*2);
+    tPar[4]+=(gRandom->Rndm()-0.5)*0.02;
     if (TMath::Abs(snp)>0.251) continue;
     (*pcstream)<<"fit"<<
       "bz="<<bz<<         // magnetic filed used
index 6759286..1c5f129 100755 (executable)
@@ -146,6 +146,7 @@ void AliTPCTransform::Transform(Double_t *x,Int_t *i,UInt_t /*time*/,
   AliTPCCalPad * time0TPC = calib->GetPadTime0(); 
   AliTPCCalPad * distortionMapY = calib->GetDistortionMap(0); 
   AliTPCCalPad * distortionMapZ = calib->GetDistortionMap(1); 
+  AliTPCCalPad * distortionMapR = calib->GetDistortionMap(2); 
   AliTPCParam  * param    = calib->GetParameters(); 
   AliTPCCorrection * correction = calib->GetTPCComposedCorrection();
   if (!time0TPC){
@@ -231,12 +232,17 @@ void AliTPCTransform::Transform(Double_t *x,Int_t *i,UInt_t /*time*/,
   //
   if (distortionMapY ){
     //can be switch on for each dimension separatelly
-    if (fCurrentRecoParam->GetUseFieldCorrection()&0x2) 
-      xx[1]-=distortionMapY->GetCalROC(sector)->GetValue(row,pad);
+    if (fCurrentRecoParam->GetUseFieldCorrection()&0x2)
+      if (distortionMapY) 
+       xx[1]-=distortionMapY->GetCalROC(sector)->GetValue(row,pad);
     if (fCurrentRecoParam->GetUseFieldCorrection()&0x4) 
-      xx[2]-=distortionMapZ->GetCalROC(sector)->GetValue(row,pad);
+      if (distortionMapZ)
+       xx[2]-=distortionMapZ->GetCalROC(sector)->GetValue(row,pad);
+    if (fCurrentRecoParam->GetUseFieldCorrection()&0x8) 
+      if (distortionMapR)
+       xx[0]-=distortionMapR->GetCalROC(sector)->GetValue(row,pad);
   }
-
+  //
 
   //
   x[0]=xx[0];x[1]=xx[1];x[2]=xx[2];
index 7e7ab56..d6e89b0 100644 (file)
@@ -793,7 +793,7 @@ void AliTPCcalibAlign::ProcessSeed(AliTPCseed *seed) {
       AliTPCTracklet *t2=static_cast<AliTPCTracklet*>(tracklets[i2]);
       AliExternalTrackParam *common1=0,*common2=0;
       if (AliTPCTracklet::PropagateToMeanX(*t1,*t2,common1,common2)){
-       ProcessTracklets(*common1,*common2,seed, t1->GetSector(),t2->GetSector());
+       ProcessTracklets(*common1,*common2,seed, t1->GetSector(),t2->GetSector());      
        UpdateAlignSector(seed,t1->GetSector());
       }
       delete common1;
@@ -947,7 +947,7 @@ void AliTPCcalibAlign::ProcessTracklets(const AliExternalTrackParam &tp1,
       if (TMath::Abs(parLine1[2])<0.8 &&TMath::Abs(parLine1[2])<0.8 ){ //angular cut
        FillHisto(parLine1,parLine2,s1,s2);  
        ProcessAlign(parLine1,parLine2,s1,s2);
-       UpdateKalman(s1,s2,par1, cov1, par2, cov2);
+       //UpdateKalman(s1,s2,par1, cov1, par2, cov2); - OBSOLETE to be removed - 50 % of time here
       }
     }
   }
@@ -1665,7 +1665,7 @@ void AliTPCcalibAlign::MakeResidualHistos(){
   binsTrack[2]=53;       xminTrack[2]=85.;        xmaxTrack[2]=245.; 
   //
   axisName[3]="kY";      axisTitle[3]="dy/dx"; 
-  binsTrack[3]=32;       xminTrack[3]=-0.16;        xmaxTrack[3]=0.16; 
+  binsTrack[3]=8;       xminTrack[3]=-0.16;        xmaxTrack[3]=0.16; 
   //
   axisName[4]="kZ";      axisTitle[4]="dz/dx"; 
   binsTrack[4]=10;       xminTrack[4]=-1.5;        xmaxTrack[4]=1.5; 
@@ -2109,8 +2109,17 @@ void AliTPCcalibAlign::Add(AliTPCcalibAlign * align){
     UpdateKalman(*fSectorParamA,*fSectorCovarA,*align->fSectorParamA,*align->fSectorCovarA);
     UpdateKalman(*fSectorParamC,*fSectorCovarC,*align->fSectorParamC,*align->fSectorCovarC);
   }
-  if (!fClusterDelta[0]) MakeResidualHistos();
+  if (!fClusterDelta[1]) MakeResidualHistos();
+
   for (Int_t i=0; i<6; i++){
+    if (i==0 || i==3){
+      delete fClusterDelta[i];   // memory problem do not fit into memory
+      fClusterDelta[i]=0;        // 
+      delete align->fClusterDelta[i];   // memory problem do not fit into memory
+      align->fClusterDelta[i]=0;        // 
+    }
+    if (i==3) continue;  // skip constrained histo z
+    if (i==0) continue;  // skip non constrained histo y
     if (align->fClusterDelta[i]) fClusterDelta[i]->Add(align->fClusterDelta[i]);
   }
 }
@@ -2406,8 +2415,8 @@ void AliTPCcalibAlign::GlobalAlign6(Int_t minPoints, Float_t sysError, Int_t nit
   //
   // full track fit parameters
   // 
-  TLinearFitter fyf(2,"pol1");
-  TLinearFitter fzf(2,"pol1");
+  static TLinearFitter fyf(2,"pol1");   // change to static - suggestion of calgrind - 30 % of time
+  static TLinearFitter fzf(2,"pol1");   // relative to time of given class
   TVectorD pyf(2), peyf(2),pzf(2), pezf(2);
   TMatrixD covY(4,4),covZ(4,4);
   Double_t chi2FacY =1;
@@ -2537,8 +2546,8 @@ void  AliTPCcalibAlign::UpdateAlignSector(const AliTPCseed * track,Int_t isec){
   //
   // full track fit parameters
   // 
-  TLinearFitter fyf(2,"pol1");
-  TLinearFitter fzf(2,"pol1");
+  static TLinearFitter fyf(2,"pol1");   // make it static - too much time for comiling of formula
+  static TLinearFitter fzf(2,"pol1");   // calgrind recomendation
   TVectorD pyf(2), peyf(2),pzf(2), pezf(2);
   TVectorD pyfc(2),pzfc(2);
   Int_t nf=0;
@@ -2547,6 +2556,7 @@ void  AliTPCcalibAlign::UpdateAlignSector(const AliTPCseed * track,Int_t isec){
   //
   for (Int_t iter=0; iter<2; iter++){
     fyf.ClearPoints();
+    fzf.ClearPoints();
     for (Int_t irow=kdrow0Fit;irow<159-kdrow1Fit;irow++) {
       AliTPCclusterMI *c=track->GetClusterPointer(irow);
       if (!c) continue;
@@ -2625,8 +2635,15 @@ void  AliTPCcalibAlign::UpdateAlignSector(const AliTPCseed * track,Int_t isec){
   // 1-4 OROC quadrants 
   //   0 IROC
   //
-  TLinearFitter *fittersY[5];
-  TLinearFitter *fittersZ[5];
+  static TLinearFitter *fittersY[5]={0,0,0,0,0};   // calgrind recomendation - fater to clear points
+  static TLinearFitter *fittersZ[5]={0,0,0,0,0};   // than create the fitter
+  if (fittersY[0]==0){
+    for (Int_t i=0;i<5;i++) {
+      fittersY[i] = new TLinearFitter(2,"pol1");
+      fittersZ[i] = new TLinearFitter(2,"pol1");
+    }
+  }
+  //
   Int_t npoints[5];
   TVectorD paramsY[5];
   TVectorD errorsY[5];
@@ -2638,14 +2655,14 @@ void  AliTPCcalibAlign::UpdateAlignSector(const AliTPCseed * track,Int_t isec){
   Double_t chi2CZ[5];
   for (Int_t i=0;i<5;i++) {
     npoints[i]=0;
-    fittersY[i] = new TLinearFitter(2,"pol1");
     paramsY[i].ResizeTo(2);
     errorsY[i].ResizeTo(2);
     covY[i].ResizeTo(2,2);
-    fittersZ[i] = new TLinearFitter(2,"pol1");
     paramsZ[i].ResizeTo(2);
     errorsZ[i].ResizeTo(2);
     covZ[i].ResizeTo(2,2);
+    fittersY[i]->ClearPoints();
+    fittersZ[i]->ClearPoints();
   }
   //
   // Update fitters
@@ -2685,14 +2702,14 @@ void  AliTPCcalibAlign::UpdateAlignSector(const AliTPCseed * track,Int_t isec){
       resVector[4]= c->GetZ()/c->GetX();
       //
       resVector[0]= c->GetY()-yfit;
-      fClusterDelta[0]->Fill(resVector);
+      //fClusterDelta[0]->Fill(resVector);
       resVector[0]= c->GetZ()-zfit;
       fClusterDelta[1]->Fill(resVector);
       //
       resVector[0]= c->GetY()-yfitC;
       fClusterDelta[2]->Fill(resVector);
       resVector[0]= c->GetZ()-zfitC;
-      fClusterDelta[3]->Fill(resVector);
+      //fClusterDelta[3]->Fill(resVector);
 
     }
     if (c->GetRow()<kdrow0Fit) continue;      
@@ -2754,11 +2771,6 @@ void  AliTPCcalibAlign::UpdateAlignSector(const AliTPCseed * track,Int_t isec){
       covZ[i](1,1)*=chi2FacZ*chi2FacZ;      
     }
   }
-  for (Int_t i=0;i<5;i++){
-    delete fittersY[i];
-    delete fittersZ[i];
-  }
-
   //
   // void UpdateSectorKalman
   //
index 33ca62b..0f13006 100644 (file)
@@ -132,7 +132,7 @@ public:
   //
   //
   void MakeResidualHistos();
-
+  THnSparse * GetClusterDelta(Int_t index) const  { return fClusterDelta[index];}
 public:
   
   void FillHisto(const Double_t *t1,
index 1bb96b1..2514c9a 100644 (file)
@@ -76,6 +76,7 @@ AliTPCcalibBase::AliTPCcalibBase():
     fTriggerClass(),
     fCurrentEvent(0),           //! current event
     fCurrentTrack(0),           //! current esd track
+    fCurrentFriendTrack(0),           //! current esd track
     fCurrentSeed(0),            //! current seed
     fDebugLevel(0)
 {
@@ -100,6 +101,7 @@ AliTPCcalibBase::AliTPCcalibBase(const char * name, const char * title):
   fTriggerClass(),
   fCurrentEvent(0),           //! current event
   fCurrentTrack(0),           //! current esd track
+  fCurrentFriendTrack(0),           //! current esd track
   fCurrentSeed(0),            //! current seed
   fDebugLevel(0)
 {
@@ -124,6 +126,7 @@ AliTPCcalibBase::AliTPCcalibBase(const AliTPCcalibBase&calib):
   fTriggerClass(calib.fTriggerClass),
   fCurrentEvent(0),           //! current event
   fCurrentTrack(0),           //! current esd track
+  fCurrentFriendTrack(0),           //! current esd track
   fCurrentSeed(0),            //! current seed
   fDebugLevel(calib.fDebugLevel)
 {
@@ -134,7 +137,7 @@ AliTPCcalibBase::AliTPCcalibBase(const AliTPCcalibBase&calib):
 
 AliTPCcalibBase &AliTPCcalibBase::operator=(const AliTPCcalibBase&calib){
   //
-  //
+  // operator=
   //
   ((TNamed *)this)->operator=(calib);
   fDebugStreamer=0;
index ceb1d6a..88f557e 100644 (file)
@@ -13,6 +13,7 @@
 class AliTPCseed;
 class AliESDEvent;
 class AliESDtrack;
+class AliESDfriendTrack;
 class TCollection;
 class TTreeSRedirector;
 class TGraph;
@@ -64,6 +65,7 @@ protected:
   TObjString fTriggerClass;             // trigger class
   AliESDEvent  *fCurrentEvent;          //! current event
   AliESDtrack *fCurrentTrack;           //! current esd track
+  AliESDfriendTrack *fCurrentFriendTrack;     //! current friend track
   AliTPCseed   *fCurrentSeed;           //! current seed
 private:
   Int_t  fDebugLevel;                   //  debug level
index e31fc7f..cbdc154 100644 (file)
@@ -153,7 +153,8 @@ void     AliTPCcalibCalib::Process(AliESDEvent *event){
     AliESDtrack *track = event->GetTrack(i);     
     AliESDfriendTrack *friendTrack = (AliESDfriendTrack*) ESDfriend->GetTrack(i);
     if (!friendTrack) continue;
-    track->SetFriendTrack(friendTrack);
+    //track->SetFriendTrack(friendTrack);
+    fCurrentFriendTrack=friendTrack;
     const AliExternalTrackParam * trackIn  = track->GetInnerParam();
     const AliExternalTrackParam * trackOut = track->GetOuterParam();
     AliExternalTrackParam * tpcOut   = (AliExternalTrackParam *)friendTrack->GetTPCOut();
@@ -180,7 +181,9 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
   //
   // 0 - Setup transform object
   //
-  AliESDfriendTrack *friendTrack = (AliESDfriendTrack *)track->GetFriendTrack();
+  static Int_t streamCounter=0;
+  streamCounter++;
+  AliESDfriendTrack *friendTrack = fCurrentFriendTrack;
 
   AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ;
   AliTPCParam     *param     = AliTPCcalibDB::Instance()->GetParameters();
@@ -239,7 +242,8 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
 
 
 
-    if (fStreamLevel>2){
+    if (fStreamLevel>2 && streamCounter<20*fStreamLevel ){
+      // dump debug info if required
       TTreeSRedirector *cstream = GetDebugStreamer();
       if (cstream){
        (*cstream)<<"Clusters"<<
@@ -253,8 +257,6 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
          "cl.="<<cluster<<
          "cy="<<dy<<
          "cz="<<dz<<
-         //      "cY="<<corrclY<<
-         //      "cR="<<corrR<<
          "\n";
       }
     }
@@ -413,7 +415,7 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
   trackOut.PropagateTo(trackOutOld->GetX(),bz);
   
 
-  if (fStreamLevel>0){
+  if (fStreamLevel>0 && streamCounter<100*fStreamLevel){
     TTreeSRedirector *cstream = GetDebugStreamer();
     if (cstream){
       (*cstream)<<"Tracks"<<
index 033f61d..c4284b7 100644 (file)
@@ -406,36 +406,12 @@ void AliTPCcalibTime::ProcessLaser(AliESDEvent *event){
     TTreeSRedirector *cstream = GetDebugStreamer();
     if (cstream){
       TTimeStamp tstamp(fTime);
-      Float_t valuePressure0 = AliTPCcalibDB::GetPressure(tstamp,fRun,0);
-      Float_t valuePressure1 = AliTPCcalibDB::GetPressure(tstamp,fRun,1);
-      Double_t ptrelative0   = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
-      Double_t ptrelative1   = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
-      Double_t temp0         = AliTPCcalibDB::GetTemperature(tstamp,fRun,0);
-      Double_t temp1         = AliTPCcalibDB::GetTemperature(tstamp,fRun,1);
-      Double_t vdcorr        = AliTPCcalibDB::Instance()->GetVDriftCorrectionTime(tstamp,fRun,0,1);
-      TVectorD vecGoofie(20);
-      AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(fRun);
-      if (goofieArray){
-       for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){
-         AliDCSSensor *gsensor = goofieArray->GetSensor(isensor);
-         if (gsensor) vecGoofie[isensor]=gsensor->GetValue(tstamp);
-       }
-      }
       (*cstream)<<"laserInfo"<<
        "run="<<fRun<<              //  run number
        "event="<<fEvent<<          //  event number
        "time="<<fTime<<            //  time stamp of event
        "trigger="<<fTrigger<<      //  trigger
        "mag="<<fMagF<<             //  magnetic field
-       // Environment values
-       "press0="<<valuePressure0<<
-       "press1="<<valuePressure1<<
-       "pt0="<<ptrelative0<<
-       "pt1="<<ptrelative1<<
-       "temp0="<<temp0<<
-       "temp1="<<temp1<<
-       "vecGoofie.="<<&vecGoofie<<
-       "vdcorr="<<vdcorr<<
        //laser
        "rejectA="<<isReject[0]<<
        "rejectC="<<isReject[1]<<
@@ -743,22 +719,6 @@ void AliTPCcalibTime::ProcessCosmic(const AliESDEvent *const event){
   if (fStreamLevel>0){
     TTreeSRedirector *cstream = GetDebugStreamer();
     if (cstream){
-      TTimeStamp tstamp(fTime);
-      Float_t valuePressure0 = AliTPCcalibDB::GetPressure(tstamp,fRun,0);
-      Float_t valuePressure1 = AliTPCcalibDB::GetPressure(tstamp,fRun,1);
-      Double_t ptrelative0   = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
-      Double_t ptrelative1   = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
-      Double_t temp0         = AliTPCcalibDB::GetTemperature(tstamp,fRun,0);
-      Double_t temp1         = AliTPCcalibDB::GetTemperature(tstamp,fRun,1);
-      Double_t vdcorr        = AliTPCcalibDB::Instance()->GetVDriftCorrectionTime(tstamp,fRun,0,1);
-      TVectorD vecGoofie(20);
-      AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(fRun);
-      if (goofieArray){
-       for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){
-         AliDCSSensor *gsensor = goofieArray->GetSensor(isensor);
-         if (gsensor) vecGoofie[isensor]=gsensor->GetValue(tstamp);
-       }
-      }
       (*cstream)<<"timeInfo"<<
        "run="<<fRun<<              //  run number
        "event="<<fEvent<<          //  event number
@@ -766,14 +726,6 @@ void AliTPCcalibTime::ProcessCosmic(const AliESDEvent *const event){
        "trigger="<<fTrigger<<      //  trigger
        "mag="<<fMagF<<             //  magnetic field
        // Environment values
-       "press0="<<valuePressure0<<
-       "press1="<<valuePressure1<<
-       "pt0="<<ptrelative0<<
-       "pt1="<<ptrelative1<<
-       "temp0="<<temp0<<
-       "temp1="<<temp1<<
-       "vecGoofie.=<<"<<&vecGoofie<<
-       "vdcorr="<<vdcorr<<
        //
        // accumulated values
        //
@@ -1146,18 +1098,12 @@ void  AliTPCcalibTime::ProcessSame(AliESDtrack *const track, AliESDfriendTrack *
     TVectorD gxyz(3);
     trackIn.GetXYZ(gxyz.GetMatrixArray());
     TTimeStamp tstamp(fTime);
-    Double_t ptrelative0 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
-    Double_t ptrelative1 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
-    Double_t vdcorr        = AliTPCcalibDB::Instance()->GetVDriftCorrectionTime(tstamp,fRun,0,1);
     (*cstream)<<"tpctpc"<<
       "run="<<fRun<<              //  run number
       "event="<<fEvent<<          //  event number
       "time="<<fTime<<            //  time stamp of event
       "trigger="<<fTrigger<<      //  trigger
       "mag="<<fMagF<<             //  magnetic field
-      "ptrel0.="<<ptrelative0<<
-      "ptrel1.="<<ptrelative1<<
-      "vdcorr="<<vdcorr<<        // drift correction applied
       //
       "xyz.="<<&gxyz<<             // global position
       "tIn.="<<&trackIn<<         // refitterd track in 
@@ -1306,7 +1252,7 @@ void  AliTPCcalibTime::ProcessAlignITS(AliESDtrack *const track, AliESDfriendTra
   // 3. Update alignment
   //
   Int_t htime = fTime/3600; //time in hours
-  if (fAlignITSTPC->GetEntries()<htime){
+  if (fAlignITSTPC->GetEntriesFast()<htime){
     fAlignITSTPC->Expand(htime*2+20);
   }
   AliRelAlignerKalman* align =  (AliRelAlignerKalman*)fAlignITSTPC->At(htime);
@@ -1338,43 +1284,18 @@ void  AliTPCcalibTime::ProcessAlignITS(AliESDtrack *const track, AliESDfriendTra
   align->SetRejectOutliers(kFALSE);
   TTreeSRedirector *cstream = GetDebugStreamer();  
   if (cstream && align->GetState() && align->GetState()->GetNrows()>2 ){
-    TTimeStamp tstamp(fTime);
-    Float_t valuePressure0 = AliTPCcalibDB::GetPressure(tstamp,fRun,0);
-    Float_t valuePressure1 = AliTPCcalibDB::GetPressure(tstamp,fRun,1);
-    Double_t ptrelative0   = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
-    Double_t ptrelative1   = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
-    Double_t temp0         = AliTPCcalibDB::GetTemperature(tstamp,fRun,0);
-    Double_t temp1         = AliTPCcalibDB::GetTemperature(tstamp,fRun,1);
-    TVectorD vecGoofie(20);
-    AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(fRun);
-    if (goofieArray){
-      for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){
-       AliDCSSensor *gsensor = goofieArray->GetSensor(isensor);
-       if (gsensor) vecGoofie[isensor]=gsensor->GetValue(tstamp);
-      }
-    }
     TVectorD gpTPC(3), gdTPC(3);
     TVectorD gpITS(3), gdITS(3);
     pTPC.GetXYZ(gpTPC.GetMatrixArray());
     pTPC.GetDirection(gdTPC.GetMatrixArray());
     pITS.GetXYZ(gpITS.GetMatrixArray());
     pITS.GetDirection(gdITS.GetMatrixArray());
-    Double_t vdcorr        = AliTPCcalibDB::Instance()->GetVDriftCorrectionTime(tstamp,fRun,0,1);
     (*cstream)<<"itstpc"<<
       "run="<<fRun<<              //  run number
       "event="<<fEvent<<          //  event number
       "time="<<fTime<<            //  time stamp of event
       "trigger="<<fTrigger<<      //  trigger
       "mag="<<fMagF<<             //  magnetic field
-      // Environment values
-      "press0="<<valuePressure0<<
-      "press1="<<valuePressure1<<
-      "pt0="<<ptrelative0<<
-      "pt1="<<ptrelative1<<
-      "temp0="<<temp0<<
-      "temp1="<<temp1<<
-      "vecGoofie.="<<&vecGoofie<<
-      "vdcorr="<<vdcorr<<        // drift correction applied
       //
       "hasAlone="<<hasAlone<<    // has ITS standalone ?
       "track.="<<track<<  // track info
@@ -1481,7 +1402,7 @@ void  AliTPCcalibTime::ProcessAlignTRD(AliESDtrack *const track, AliESDfriendTra
   // 3. Update alignment
   //
   Int_t htime = fTime/3600; //time in hours
-  if (fAlignTRDTPC->GetEntries()<htime){
+  if (fAlignTRDTPC->GetEntriesFast()<htime){
     fAlignTRDTPC->Expand(htime*2+20);
   }
   AliRelAlignerKalman* align =  (AliRelAlignerKalman*)fAlignTRDTPC->At(htime);
@@ -1507,43 +1428,18 @@ void  AliTPCcalibTime::ProcessAlignTRD(AliESDtrack *const track, AliESDfriendTra
   align->SetRejectOutliers(kFALSE);
   TTreeSRedirector *cstream = GetDebugStreamer();  
   if (cstream && align->GetState() && align->GetState()->GetNrows()>2 ){
-    TTimeStamp tstamp(fTime);
-    Float_t valuePressure0 = AliTPCcalibDB::GetPressure(tstamp,fRun,0);
-    Float_t valuePressure1 = AliTPCcalibDB::GetPressure(tstamp,fRun,1);
-    Double_t ptrelative0   = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
-    Double_t ptrelative1   = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
-    Double_t temp0         = AliTPCcalibDB::GetTemperature(tstamp,fRun,0);
-    Double_t temp1         = AliTPCcalibDB::GetTemperature(tstamp,fRun,1);
-    TVectorD vecGoofie(20);
-    AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(fRun);
-    if (goofieArray){
-      for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){
-       AliDCSSensor *gsensor = goofieArray->GetSensor(isensor);
-       if (gsensor) vecGoofie[isensor]=gsensor->GetValue(tstamp);
-      }
-    }
     TVectorD gpTPC(3), gdTPC(3);
     TVectorD gpTRD(3), gdTRD(3);
     pTPC.GetXYZ(gpTPC.GetMatrixArray());
     pTPC.GetDirection(gdTPC.GetMatrixArray());
     pTRD.GetXYZ(gpTRD.GetMatrixArray());
     pTRD.GetDirection(gdTRD.GetMatrixArray());
-    Double_t vdcorr        = AliTPCcalibDB::Instance()->GetVDriftCorrectionTime(tstamp,fRun,0,1);
     (*cstream)<<"trdtpc"<<
       "run="<<fRun<<              //  run number
       "event="<<fEvent<<          //  event number
       "time="<<fTime<<            //  time stamp of event
       "trigger="<<fTrigger<<      //  trigger
       "mag="<<fMagF<<             //  magnetic field
-      // Environment values
-      "press0="<<valuePressure0<<
-      "press1="<<valuePressure1<<
-      "pt0="<<ptrelative0<<
-      "pt1="<<ptrelative1<<
-      "temp0="<<temp0<<
-      "temp1="<<temp1<<
-      "vecGoofie.="<<&vecGoofie<<
-      "vdcorr="<<vdcorr<<        // drift correction applied
       //
       "nmed="<<kglast<<        // number of entries to define median and RMS
       "vMed.="<<&vecMedian<<    // median of deltas
@@ -1667,7 +1563,7 @@ void  AliTPCcalibTime::ProcessAlignTOF(AliESDtrack *const track, AliESDfriendTra
   // 3. Update alignment
   //
   Int_t htime = fTime/3600; //time in hours
-  if (fAlignTOFTPC->GetEntries()<htime){
+  if (fAlignTOFTPC->GetEntriesFast()<htime){
     fAlignTOFTPC->Expand(htime*2+20);
   }
   AliRelAlignerKalman* align =  (AliRelAlignerKalman*)fAlignTOFTPC->At(htime);
@@ -1692,43 +1588,18 @@ void  AliTPCcalibTime::ProcessAlignTOF(AliESDtrack *const track, AliESDfriendTra
   align->SetRejectOutliers(kFALSE);
   TTreeSRedirector *cstream = GetDebugStreamer();  
   if (cstream && align->GetState() && align->GetState()->GetNrows()>2 ){
-    TTimeStamp tstamp(fTime);
-    Float_t valuePressure0 = AliTPCcalibDB::GetPressure(tstamp,fRun,0);
-    Float_t valuePressure1 = AliTPCcalibDB::GetPressure(tstamp,fRun,1);
-    Double_t ptrelative0   = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
-    Double_t ptrelative1   = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
-    Double_t temp0         = AliTPCcalibDB::GetTemperature(tstamp,fRun,0);
-    Double_t temp1         = AliTPCcalibDB::GetTemperature(tstamp,fRun,1);
-    TVectorD vecGoofie(20);
-    AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(fRun);
-    if (goofieArray){
-      for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){
-       AliDCSSensor *gsensor = goofieArray->GetSensor(isensor);
-       if (gsensor) vecGoofie[isensor]=gsensor->GetValue(tstamp);
-      }
-    }
     TVectorD gpTPC(3), gdTPC(3);
     TVectorD gpTOF(3), gdTOF(3);
     pTPC.GetXYZ(gpTPC.GetMatrixArray());
     pTPC.GetDirection(gdTPC.GetMatrixArray());
     pTOF.GetXYZ(gpTOF.GetMatrixArray());
     pTOF.GetDirection(gdTOF.GetMatrixArray());
-    Double_t vdcorr        = AliTPCcalibDB::Instance()->GetVDriftCorrectionTime(tstamp,fRun,0,1);
     (*cstream)<<"toftpc"<<
       "run="<<fRun<<              //  run number
       "event="<<fEvent<<          //  event number
       "time="<<fTime<<            //  time stamp of event
       "trigger="<<fTrigger<<      //  trigger
       "mag="<<fMagF<<             //  magnetic field
-      // Environment values
-      "press0="<<valuePressure0<<
-      "press1="<<valuePressure1<<
-      "pt0="<<ptrelative0<<
-      "pt1="<<ptrelative1<<
-      "temp0="<<temp0<<
-      "temp1="<<temp1<<
-      "vecGoofie.="<<&vecGoofie<<
-      "vdcorr="<<vdcorr<<        // drift correction applied
       //
       "nmed="<<kglast<<        // number of entries to define median and RMS
       "vMed.="<<&vecMedian<<    // median of deltas
index a24e145..6e21e82 100644 (file)
@@ -31,8 +31,9 @@
   gSystem->Load("libANALYSIS");
   gSystem->Load("libTPCcalib");
   //
-  Int_t run=117092;
+  Int_t run=117220;
   .x ConfigCalibTrain.C(run)
+  calibDB = AliTPCcalibDB::Instance()
 
   AliTPCkalmanAlign kalmanAlign("TPC align", "TPC align");  // create the object
   kalmanAlign.ReadAlign("CalibObjects.root");               // read the calibration form file         
 #include "TGraphErrors.h"
 #include "TVectorD.h"
 #include "TClonesArray.h"
+#include "TCut.h"
+#include "TChain.h"
+#include "AliXRDPROOFtoolkit.h"
+#include "TLegend.h"
+#include "TCanvas.h"
 
 #include "AliTPCcalibDB.h"
 #include "AliTPCCalROC.h"
 #include "TH1.h"
 #include "AliTPCCalPad.h"
 #include "AliTPCkalmanAlign.h"
-#include "TLegend.h"
-#include "TCanvas.h"
+#include "TStatToolkit.h"
+#include "AliTPCPreprocessorOnline.h"
+#include "TPostScript.h"
 
 AliTPCkalmanAlign::AliTPCkalmanAlign():
   TNamed(),
   fCalibAlign(0),     // kalman alignnmnt
   fOriginalAlign(0),   // original alignment 0 read for the OCDB
-  fNewAlign(0)
+  fNewAlign(0),
+  fPadTime0(0),
+  fFitCEGlobal(0),
+  fFitCELocal(0)
 {
   //
   // Default constructor
@@ -87,7 +97,10 @@ AliTPCkalmanAlign::AliTPCkalmanAlign(const char* name, const char* title):
   TNamed(name,title),
   fCalibAlign(0),     // kalman alignnmnt
   fOriginalAlign(0),   // original alignment 0 read for the OCDB
-  fNewAlign(0)     // kalman alignnmnt
+  fNewAlign(0),
+  fPadTime0(0),
+  fFitCEGlobal(0),
+  fFitCELocal(0) 
 {
   //
   // Default constructor
@@ -96,6 +109,12 @@ AliTPCkalmanAlign::AliTPCkalmanAlign(const char* name, const char* title):
     fDelta1D[i]=0;
     fCovar1D[i]=0;
   }
+  fFitCEGlobal = new TObjArray(6); 
+  fFitCELocal  = new TObjArray(6); 
+  for (Int_t ipar=0; ipar<6;ipar++){
+    fFitCEGlobal->AddAt(new TVectorD(36),ipar);
+    fFitCELocal->AddAt(new TVectorD(36),ipar);
+  }
 }
 
 void AliTPCkalmanAlign::ReadAlign(const char *fname){
@@ -189,6 +208,8 @@ void AliTPCkalmanAlign::MakeGlobalAlign(){
   AliTPCCalPad *padTime0 = AliTPCcalibDB::Instance()->GetPadTime0();
   TVectorD paramCE[72];
   TMatrixD covarCE[72];
+  Int_t  statUpDown=0;   // statistic up down
+  Int_t  statLeftRight=0;   // statistic left-right
   Float_t chi2;
   for (Int_t isec=0; isec<72; isec++){
     AliTPCCalROC * roc0  = padTime0->GetCalROC(isec);
@@ -244,6 +265,8 @@ void AliTPCkalmanAlign::MakeGlobalAlign(){
       rms[3]=his->GetRMS();
       stat[3]=his->GetEntries();
       kalmanAlign.UpdateAlign1D(his->GetMean(),his->GetRMS(),is0,is1, vec[3],cov[3]);
+      if (is1==is0+36) statUpDown+=Int_t(stat[0]);
+      if (is1==is0+35) statLeftRight+=Int_t(stat[0]);
     }  
 
   fDelta1D[0] = (TMatrixD*)vec[0].Clone();
@@ -255,9 +278,10 @@ void AliTPCkalmanAlign::MakeGlobalAlign(){
   fCovar1D[1] = (TMatrixD*)cov[1].Clone();
   fCovar1D[2] = (TMatrixD*)cov[2].Clone();
   fCovar1D[3] = (TMatrixD*)cov[3].Clone();
-
+  statUpDown/=36;
+  statLeftRight/=36;
   MakeNewAlignment(kTRUE);
-
+  //FitCE();
   for (Int_t is0=0;is0<72;is0++)
     for (Int_t is1=0;is1<72;is1++){
       Bool_t isPair=kFALSE;
@@ -296,6 +320,11 @@ void AliTPCkalmanAlign::MakeGlobalAlign(){
       }
       Int_t run = AliCDBManager::Instance()->GetRun();
       Float_t bz = AliTracker::GetBz();
+      TVectorD fceG[6],fceL[6];
+      for (Int_t ipar=0; ipar<6;ipar++){
+       fceG[ipar]=*((TVectorD*)fFitCEGlobal->At(ipar));
+       fceL[ipar]=*((TVectorD*)fFitCELocal->At(ipar));
+      }
       (*pcstream)<<"kalmanAlignDebug"<<
        "run="<<run<<
        "bz="<<bz<<
@@ -312,8 +341,30 @@ void AliTPCkalmanAlign::MakeGlobalAlign(){
        "pceOut0.="<<&paramCE[is0%36+36]<<
        "pceIn1.="<<&paramCE[is1%36]<<
        "pceOut1.="<<&paramCE[is1%36+36]<<
+       "fceG0.="<<&fceG[0]<<  // global fit of CE
+       "fceG1.="<<&fceG[1]<<  // global fit of CE
+       "fceG2.="<<&fceG[2]<<  // global fit of CE
+       "fceG3.="<<&fceG[3]<<  // global fit of CE
+       "fceG4.="<<&fceG[4]<<  // global fit of CE
+       "fceL5.="<<&fceG[5]<<  // global fit of CE
+       "fceL0.="<<&fceL[0]<<  // global fit of CE
+       "fceL1.="<<&fceL[1]<<  // global fit of CE
+       "fceL2.="<<&fceL[2]<<  // global fit of CE
+       "fceL3.="<<&fceL[3]<<  // global fit of CE
+       "fceL4.="<<&fceL[4]<<  // global fit of CE
+       "fceL5.="<<&fceL[5]<<  // global fit of CE
        "\n";
     }
+  
+  Int_t run = AliCDBManager::Instance()->GetRun();
+  Float_t bz = AliTracker::GetBz();
+  (*pcstream)<<"runSummary"<<
+    "run="<<run<<                      // run number 
+    "bz="<<bz<<                        // bz field
+    "statUpDown="<<statUpDown<<        // stat up-down
+    "statLeftRight="<<statLeftRight<<  // stat left-right
+    "\n";
+
   delete pcstream;
 }
 
@@ -516,11 +567,20 @@ void AliTPCkalmanAlign::DrawDeltaAlign(){
   canvasDz->Write();
   canvasDtheta->Write();
   canvasDphi->Write();
-  //
-  canvasDy->SaveAs("alignDy.pdf");
-  canvasDz->SaveAs("alignDz.pdf");
-  canvasDtheta->SaveAs("alignDtheta.pdf");
-  canvasDphi->SaveAs("alignDphi.pdf");
+  //  
+  //
+  //
+  TPostScript *ps = new TPostScript("alignReport.ps", 112); 
+  ps->NewPage();
+  canvasDy->Draw();
+  ps->NewPage();
+  canvasDz->Draw();
+  ps->NewPage();
+  canvasDtheta->Draw();
+  ps->NewPage();
+  canvasDphi->Draw();
+  ps->Close();
+  delete ps;
 }
 
 
@@ -614,6 +674,221 @@ void AliTPCkalmanAlign::MakeNewAlignment(Bool_t badd, TTreeSRedirector * pcstrea
       "ngR.="<<&globalRotNew<<
       "\n";
   }
+}
+
+
+
+void AliTPCkalmanAlign::DrawAlignmentTrends(){
+  //
+  // Draw trends of alingment variables
+  //
+  /*
+  */
+  AliXRDPROOFtoolkit toolkit;
+  TChain * chain = toolkit.MakeChainRandom("align.list.Good","kalmanAlignDebug",0,2000);
+  TChain * chainRef = toolkit.MakeChainRandom("alignRef.list","kalmanAlignDebug",0,2000);
+  chain->AddFriend(chainRef,"R");
+  chainRef->AddFriend(chainRef,"T");
+  //cuts
+  TCut cutS="stat.fElements[0]>200&&stat.fElements[1]>200&&stat.fElements[3]>200&&stat.fElements[3]>200";   //statistic in the bin
+  TCut cutST="T.stat.fElements[0]>200&&T.stat.fElements[1]>200&&T.stat.fElements[3]>200&&T.stat.fElements[3]>200";   //statistic in the bin
+  //  TTree *tree  = chain->CopyTree(cutS);
+  //TTree *treeR = chainRef->CopyTree(cutST);
+
+  TCanvas * canvasDy= new TCanvas("canvasDy","canvasDy");
+  TH1 *his=0;
+  TLegend *legend = 0;
+  //  Int_t grcol[3]={2,1,4};
   
+  legend = new TLegend(0.7,0.6,0.9,0.9, "Alignment #Delta_{y}- Up-Down");
+  for (Int_t isec=0; isec<18; isec+=2){
+    chain->SetMarkerColor(1+(isec%5));
+    chain->SetMarkerStyle(isec+20);
+    chain->Draw("10*(delta.fElements[0]-R.delta.fElements[0]):run",cutS+Form("is1==is0+36&&is0==%d",isec),"profgoff");
+    his = (TH1*)(chain->GetHistogram()->Clone());
+    his->SetName(Form("#Delta_{Y} sector %d",isec));
+    his->SetTitle(Form("#Delta_{Y} sector %d",isec));
+    his->SetMaximum(1.);
+    his->SetMinimum(-1.);
+    his->GetYaxis()->SetTitle("#Delta_{y} (mm)");
+    his->GetXaxis()->SetTitle("run Number");
+    if (isec==0) his->Draw("");
+    if (isec>0) his->Draw("same");
+    legend->AddEntry(his);
+  }
+  legend->Draw();
+  canvasDy->Draw();
+}
+
+
+
+
+
+
+void AliTPCkalmanAlign::FitCE(){
+  //
+  // fit CE 
+  // 1. Global fit - gy and gx
+  // 2. Local X fit common 
+  // 3. Sector fit 
+  //
+  AliTPCPreprocessorOnline * preprocesor = new AliTPCPreprocessorOnline;
+  //
+  AliTPCCalPad *padTime0 = AliTPCcalibDB::Instance()->GetPadTime0();
+  AliTPCCalPad *padNoise = AliTPCcalibDB::Instance()->GetPadNoise();
+  AliTPCCalPad * ceTmean = AliTPCcalibDB::Instance()->GetCETmean();  // CE information
+  AliTPCCalPad * ceTrms  = AliTPCcalibDB::Instance()->GetCETrms();
+  AliTPCCalPad * ceQmean = AliTPCcalibDB::Instance()->GetCEQmean();  
+  AliTPCCalPad * pulserTmean = AliTPCcalibDB::Instance()->GetPulserTmean(); //
+  AliTPCCalPad * pulserTrms = AliTPCcalibDB::Instance()->GetPulserTrms();
+  AliTPCCalPad * pulserQmean = AliTPCcalibDB::Instance()->GetPulserQmean();
+  AliTPCCalPad * dmap0  = AliTPCcalibDB::Instance()->GetDistortionMap(0);   // distortion maps
+  AliTPCCalPad * dmap1  = AliTPCcalibDB::Instance()->GetDistortionMap(1);
+  AliTPCCalPad * dmap2  = AliTPCcalibDB::Instance()->GetDistortionMap(2);
+  pulserTmean->Add(-pulserTmean->GetMean());
+  //
+  preprocesor->AddComponent(padTime0->Clone());
+  preprocesor->AddComponent(padNoise->Clone());
+  preprocesor->AddComponent(pulserTmean->Clone());
+  preprocesor->AddComponent(pulserQmean->Clone());
+  preprocesor->AddComponent(pulserTrms->Clone());
+  preprocesor->AddComponent(ceTmean->Clone());
+  preprocesor->AddComponent(ceQmean->Clone());
+  preprocesor->AddComponent(ceTrms->Clone());
+  preprocesor->AddComponent(dmap0->Clone());
+  preprocesor->AddComponent(dmap1->Clone());
+  preprocesor->AddComponent(dmap2->Clone());
+  preprocesor->DumpToFile("cetmean.root");
+
+  TCut cutNoise="abs(PadNoise.fElements/PadNoise_Median-1)<0.3";
+  TCut cutPulserT="abs(PulserTrms.fElements/PulserTrms_Median-1)<0.2";
+  TCut cutPulserQ="abs(PulserQmean.fElements/PulserQmean_Median-1)<0.2";
+  TCut cutCEQ="CEQmean.fElements>50";
+  TCut cutCET="abs(CETmean.fElements)<2";
+  TCut cutAll=cutNoise+cutPulserT+cutPulserQ+cutCEQ+cutCET;
+  //
+  //
+  TFile * f = new TFile("cetmean.root");
+  TTree * chain = (TTree*) f->Get("calPads");
+  Int_t entries = chain->Draw("1",cutAll,"goff");
+  if (entries<200000) return;  // no calibration available - pulser or CE or noise
+
+  TStatToolkit toolkit;
+  Double_t chi2=0;
+  Int_t    npoints=0;
+  TVectorD param;
+  TMatrixD covar;
+  //
+  // make a aliases
+  AliTPCkalmanAlign::MakeAliasCE(chain);
+  TString  fstringG="";              // global part
+  //
+  fstringG+="Gy++";                  // par 1 - global y
+  fstringG+="Gx++";                  // par 2 - global x
+  // 
+  fstringG+="isin++";                // delta IROC-OROC offset
+  fstringG+="Lx++";                  // common slope 
+  fstringG+="Lx*isin++";             // delta slope 
+  fstringG+="Ly++";                  // common slope 
+  fstringG+="Ly*isin++";             // delta slope 
+  TVectorD vecG[2];
+  TString * strFitG=0;
+  TString * strFitLX=0;
+  //
+  strFitG = TStatToolkit::FitPlane(chain,"deltaT", fstringG.Data(),"sideA"+cutAll, chi2,npoints,vecG[0],covar,-1,0, 10000000, kFALSE);
+  chain->SetAlias("tfitGA",strFitG->Data());
+  strFitG->Tokenize("++")->Print();
+  printf("chi2=%f\n",TMath::Sqrt(chi2/npoints));
+  //
+  strFitG = TStatToolkit::FitPlane(chain,"deltaT", fstringG.Data(),"sideC"+cutAll, chi2,npoints,vecG[1],covar,-1,0, 10000000, kFALSE);
+  chain->SetAlias("tfitGC",strFitG->Data());
+  strFitG->Tokenize("++")->Print();
+  printf("chi2=%f\n",TMath::Sqrt(chi2/npoints));
+  //
+  AliTPCCalPad *padFitG =AliTPCCalPad::CreateCalPadFit("1++gy/500.++gx/500.++0+++0++0++0++0",vecG[0],vecG[1]);
+  AliTPCCalPad *padFitLX=AliTPCCalPad::CreateCalPadFit("0++0++0++(sector<36)++(lx-133)/100++(sector<36)*(lx-133)/100.++(ly)/100++(sector<36)*(ly)/100.",vecG[0],vecG[1]);
+  // swap a side and c side
+  AliTPCCalPad *padFitGSwap =AliTPCCalPad::CreateCalPadFit("1++gy/500.++gx/500.++0+++0++0++0++0",vecG[1],vecG[0]);
+  AliTPCCalPad *padFitLXSwap=AliTPCCalPad::CreateCalPadFit("0++0++0++(sector<36)++(lx-133)/100++(sector<36)*(lx-133)/100.++(ly)/100++(sector<36)*(ly)/100.",vecG[1],vecG[0]);
+  padFitG->SetName("CEG");
+  padFitLX->SetName("CELX");
+  padFitGSwap->SetName("CEGS");
+  padFitLXSwap->SetName("CELXS");
+  preprocesor->AddComponent(padFitG->Clone());
+  preprocesor->AddComponent(padFitLX->Clone());
+  preprocesor->AddComponent(padFitGSwap->Clone());
+  preprocesor->AddComponent(padFitLXSwap->Clone());
+  preprocesor->DumpToFile("cetmean.root");   // add it to the file
+  //
+  // make local fits
+  //
+  f = new TFile("cetmean.root");
+  chain = (TTree*) f->Get("calPads");
+  AliTPCkalmanAlign::MakeAliasCE(chain);
+  TString  fstringL="";              // local fit
+  //                                 // 0. delta common
+  fstringL+="isin++";                // 1. delta IROC-OROC offset
+  fstringL+="Lx++";                  // 2. common slope 
+  fstringL+="Lx*isin++";             // 3. delta slope 
+  fstringL+="Ly++";                  // 2. common slope 
+  fstringL+="Ly*isin++";             // 3. delta slope 
+  TVectorD vecL[36];
+  TVectorD dummy(6);
+  AliTPCCalPad *padFitLCE = new AliTPCCalPad("LocalCE","LocalCE");
+  AliTPCCalPad *padFitTmpCE;
+  for (Int_t isec=0; isec<36; isec++){
+    TCut cutSector=Form("(sector%36)==%d",isec);
+    strFitLX = TStatToolkit::FitPlane(chain,"deltaT-CEG.fElements-CELX.fElements", fstringL.Data(),cutSector+cutAll+"abs(deltaT-CEG.fElements-CELX.fElements)<0.4", chi2,npoints,vecL[isec],covar,-1,0, 10000000, kFALSE);
+    printf("sec=%d\tchi2=%f\n",isec,TMath::Sqrt(chi2/npoints));
+    //
+    TString fitL=Form("((sector%36)==%d)++((sector%36)==%d)*(sector<36)++((sector%36)==%d)*(lx-133)/100.++((sector%36)==%d)*(sector<36)*(lx-133)/100.++((sector%36)==%d)*(ly)/100.++((sector%36)==%d)*(sector<36)*(ly)/100.",isec,isec,isec,isec);
+    if (isec<18) padFitTmpCE=AliTPCCalPad::CreateCalPadFit(fitL.Data(),vecL[isec],dummy);
+    if (isec>=18) padFitTmpCE=AliTPCCalPad::CreateCalPadFit(fitL.Data(),dummy,vecL[isec]);
+    padFitLCE->Add(padFitTmpCE);
+  }
+  //
+  padFitLCE->SetName("CELocal");
+  preprocesor->AddComponent(padFitLCE->Clone());
+  preprocesor->DumpToFile("cetmean.root");   // add it to the file
+  //
+  // write data to array
+  //
+  fFitCEGlobal = new TObjArray(6); 
+  fFitCELocal  = new TObjArray(6); 
+  for (Int_t ipar=0; ipar<6;ipar++){
+    fFitCEGlobal->AddAt(new TVectorD(36),ipar);
+    fFitCELocal->AddAt(new TVectorD(36),ipar);
+    //
+    TVectorD &fvecG = *((TVectorD*)fFitCEGlobal->At(ipar));
+    TVectorD &fvecL = *((TVectorD*)fFitCELocal->At(ipar));
+    //
+    for (Int_t isec=0; isec<36;isec++){      
+      fvecL[isec]=vecL[isec][ipar];
+      if (ipar>0){
+       if (isec<18)  fvecG[isec]=vecG[0][ipar+2];
+       if (isec>=18) fvecG[isec]=vecG[1][ipar+2];
+      }
+    }
+  }
+  //
+  // 
+  //
+}
 
+void AliTPCkalmanAlign::MakeAliasCE(TTree * chain){
+  //
+  // make a aliases of pad variables
+  //
+  chain->SetAlias("side","(-1+(sector%36<18)*2)");
+  chain->SetAlias("sideA","(sector%36<18)");
+  chain->SetAlias("sideC","(sector%36>=18)");
+  chain->SetAlias("isin","(sector<36)");
+  chain->SetAlias("deltaT","CETmean.fElements-PulserTmean.fElements");
+  chain->SetAlias("timeP","PulserTmean.fElements");
+  chain->SetAlias("Gy","(gy.fElements/500.)");
+  chain->SetAlias("Gx","(gx.fElements/500.)");
+  chain->SetAlias("Lx","(lx.fElements-133)/100.");   // lx in meters
+  chain->SetAlias("Ly","(ly.fElements)/100.");
+  chain->SetAlias("La","(ly.fElements/lx.fElements/0.155)");
+  chain->SetAlias("deltaT","(CETmean.fElements-PulserTmean.fElements)");
 }
index c01805f..16e5d42 100644 (file)
@@ -10,6 +10,9 @@ class TTreeSRedirector;
 class TObjArray;
 class AliTPCcalibAlign;
 class TTreeSRedirector;
+class TTree;
+class AliTPCCalPad;
+
 
 class AliTPCkalmanAlign: public TNamed{
 public:
@@ -23,10 +26,19 @@ public:
   static void BookAlign1D(TMatrixD &param, TMatrixD &covar, Double_t sigma, Double_t mean);
   void DumpOldAlignment(TTreeSRedirector *pcstream);
   void MakeNewAlignment(Bool_t add,TTreeSRedirector *pcstream=0);
+  void DrawAlignmentTrends();
+  void FitCE();
+  static void MakeAliasCE(TTree * chain);
 public:
   AliTPCcalibAlign * fCalibAlign;    // kalman alignemnt
   TClonesArray     *fOriginalAlign;  // original alignment objects
   TClonesArray     *fNewAlign;       // new alignment objects
+  //
+  AliTPCCalPad     *fPadTime0;       // pad time0 - for z alignment
+  //                                 // time offset parameterization
+  TObjArray       *fFitCEGlobal;    // vector of parameter of the CE fits
+  TObjArray       *fFitCELocal;     // vector of parameter delta to global
+  //
   TMatrixD * fDelta1D[4];            // deltas
   TMatrixD * fCovar1D[4];            // covariance
 private: