]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
M AliTPCcalibDB.h - GetDistortion not inline function
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 May 2010 12:38:11 +0000 (12:38 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 May 2010 12:38:11 +0000 (12:38 +0000)
M      AliTPCcalibDB.cxx        - Bug fix - proper path to the OCDB entry
M      AliTPCCorrection.h       - MakeDistortionMap out of residual histograms
M      AliTPCCorrection.cxx
M      AliTPCGGVoltError.cxx    - Init transformation in Init and Update function

Marian.

TPC/AliTPCCorrection.cxx
TPC/AliTPCCorrection.h
TPC/AliTPCGGVoltError.cxx
TPC/AliTPCcalibDB.cxx
TPC/AliTPCcalibDB.h

index a88eb2a158e1ac97f6f741229f70ba4062ac1883..8e72cbce576f82af10d9fd6e38065116b521746c 100644 (file)
@@ -56,6 +56,7 @@
 #include  "TDatabasePDG.h"
 #include  "AliTrackerBase.h"
 #include  "AliTPCROC.h"
+#include  "THnSparse.h"
 
 
 #include "AliTPCCorrection.h"
@@ -515,13 +516,13 @@ AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(AliExternalTrackPara
   AliTrackPointArray pointArray0(npoints0);
   AliTrackPointArray pointArray1(npoints0);
   Double_t xyz[3];
-  AliTrackerBase::PropagateTrackTo(&track,kRTPC0,kMass,3,kTRUE,kMaxSnp);
+  AliTrackerBase::PropagateTrackToBxByBz(&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; radius<kRTPC1; radius++){
-    AliTrackerBase::PropagateTrackTo(&track,radius,kMass,3,kTRUE,kMaxSnp);
+    AliTrackerBase::PropagateTrackToBxByBz(&track,radius,kMass,3,kTRUE,kMaxSnp);
     track.GetXYZ(xyz);
     AliTrackPoint pIn0;                               // space point          
     AliTrackPoint pIn1;
@@ -567,7 +568,7 @@ AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(AliExternalTrackPara
 
 
   for (Int_t jpoint=0; jpoint<npoints; jpoint++){
-    Int_t ipoint= (dir>0) ? ipoint: npoints-1-jpoint;
+    Int_t ipoint= (dir>0) ? jpoint: npoints-1-jpoint;
     //
     AliTrackPoint pIn0;
     AliTrackPoint pIn1;
@@ -576,9 +577,9 @@ AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(AliExternalTrackPara
     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);
+    AliTrackerBase::PropagateTrackToBxByBz(track0,prot0.GetX(),kMass,1,kFALSE,kMaxSnp);
+    AliTrackerBase::PropagateTrackToBxByBz(track1,prot0.GetX(),kMass,1,kFALSE,kMaxSnp);
+    track.GetXYZ(xyz);  // distorted track also propagated to the same reference radius
     //
     Double_t pointPos[2]={0,0};
     Double_t pointCov[3]={0,0,0};
@@ -589,15 +590,19 @@ AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(AliExternalTrackPara
     pointCov[2]=prot0.GetCov()[5];//sigmaz^2
     track0->Update(pointPos,pointCov);
     //
-    pointPos[0]=prot1.GetY();//local y
-    pointPos[1]=prot1.GetZ();//local z
+    Double_t deltaX=prot1.GetX()-prot0.GetX();   // delta X 
+    Double_t deltaYX=deltaX*TMath::Tan(TMath::ASin(track1->GetSnp()));  // deltaY due  delta X
+    Double_t deltaZX=deltaX*track1->GetTgl();                           // deltaZ due  delta X
+
+    pointPos[0]=prot1.GetY()-deltaYX;//local y
+    pointPos[1]=prot1.GetZ()-deltaZX;//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);
+  AliTrackerBase::PropagateTrackToBxByBz(track0,refX,kMass,2.,kTRUE,kMaxSnp);
   track1->Rotate(track0->GetAlpha());
   track1->PropagateTo(track0->GetX(),AliTrackerBase::GetBz());
 
@@ -697,6 +702,7 @@ void AliTPCCorrection::MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t
   // corrArray - array with partial corrections
   // step      - skipe entries  - if 1 all entries processed - it is slow
   // debug     0 if debug on also space points dumped - it is slow
+  const Double_t kB2C=-0.299792458e-3;
   const Int_t kMinEntries=50;
   Double_t phi,theta, snp, mean,rms, entries;
   tinput->SetBranchAddress("theta",&theta);
@@ -715,7 +721,7 @@ void AliTPCCorrection::MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t
   Double_t refX=0;
   Int_t dir=0;
   if (dtype==0) {refX=85; dir=-1;}
-  if (dtype==1) {refX=245; dir=1;}
+  if (dtype==1) {refX=275; dir=1;}
   if (dtype==2) {refX=0; dir=-1;}
   //
   for (Int_t ientry=0; ientry<nentries; ientry+=step){
@@ -724,20 +730,25 @@ void AliTPCCorrection::MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t
     tPar[1]=theta*refX;
     tPar[2]=snp;
     tPar[3]=theta;
-    tPar[4]=0.00001;  // should be calculated - non equal to 0
-    cout<<endl<<endl;
-    cout<<"Entry\n\n"<<ientry<<endl;
-    cout<<"dtype="<<dtype<<   // detector match type
-      "ptype="<<ptype<<   // parameter type
-      "theta="<<theta<<   // theta
-      "phi="<<phi<<       // phi 
-      "snp="<<phi<<       // snp
-      "mean="<<mean<<     // mean dist value
-      "rms="<<rms<<       // rms
-      "entries="<<entries<<endl; // number of entries in bin      
-    
+    tPar[4]=0.001;  // 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 (gRandom->Rndm()<0.1) {
+//       cout<<endl<<endl;
+//       cout<<"Entry\n\n"<<ientry<<endl;
+//       cout<<"dtype="<<dtype<<   // detector match type
+//     "ptype="<<ptype<<   // parameter type
+//     "theta="<<theta<<   // theta
+//     "phi="<<phi<<       // phi 
+//     "snp="<<phi<<       // snp
+//     "mean="<<mean<<     // mean dist value
+//     "rms="<<rms<<       // rms
+//     "entries="<<entries<<endl; // number of entries in bin      
+//     }
     if (TMath::Abs(snp)>0.251) continue;
     (*pcstream)<<"fit"<<
+      "bz="<<bz<<         // magnetic filed used
       "dtype="<<dtype<<   // detector match type
       "ptype="<<ptype<<   // parameter type
       "theta="<<theta<<   // theta
@@ -769,6 +780,78 @@ void AliTPCCorrection::MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t
 
 
 
+void   AliTPCCorrection::MakeDistortionMap(THnSparse * his0, TTreeSRedirector *pcstream, const char* hname, Int_t run){
+  //
+  // make a distortion map out ou fthe residual histogram
+  // Results are written to the debug streamer - pcstream
+  // Parameters:
+  //   his0       - input (4D) residual histogram
+  //   pcstream   - file to write the tree
+  //   run        - run number
+  // marian.ivanov@cern.ch
+  const Int_t kMinEntries=50;
+  Int_t nbins1=his0->GetAxis(1)->GetNbins();
+  Int_t first1=his0->GetAxis(1)->GetFirst();
+  Int_t last1 =his0->GetAxis(1)->GetLast();
+  //
+  Double_t bz=AliTrackerBase::GetBz();
+  Int_t idim[4]={0,1,2,3};
+  for (Int_t ibin1=first1; ibin1<last1; ibin1++){   //axis 1 - theta
+    //
+    his0->GetAxis(1)->SetRange(TMath::Max(ibin1,1),TMath::Min(ibin1,nbins1));
+    Double_t       x1= his0->GetAxis(1)->GetBinCenter(ibin1);
+    THnSparse * his1 = his0->Projection(4,idim);  // projected histogram according range1
+    Int_t nbins3     = his1->GetAxis(3)->GetNbins();
+    Int_t first3     = his1->GetAxis(3)->GetFirst();
+    Int_t last3      = his1->GetAxis(3)->GetLast();
+    //
+
+    for (Int_t ibin3=first3-1; ibin3<last3; ibin3+=1){   // axis 3 - local angle
+      his1->GetAxis(3)->SetRange(TMath::Max(ibin3-1,1),TMath::Min(ibin3+1,nbins3));
+      Double_t      x3= his1->GetAxis(3)->GetBinCenter(ibin3);
+      if (ibin3<first3) {
+       his1->GetAxis(3)->SetRangeUser(-1,1);
+       x3=0;
+      }
+      THnSparse * his3= his1->Projection(4,idim);         //projected histogram according selection 3
+      Int_t nbins2    = his3->GetAxis(2)->GetNbins();
+      Int_t first2    = his3->GetAxis(2)->GetFirst();
+      Int_t last2     = his3->GetAxis(2)->GetLast();
+      //
+      for (Int_t ibin2=first2; ibin2<last2; ibin2+=1){
+       his3->GetAxis(2)->SetRange(TMath::Max(ibin2-1,1),TMath::Min(ibin2+1,nbins2));
+       Double_t x2= his3->GetAxis(2)->GetBinCenter(ibin2);
+       TH1 * hisDelta = his3->Projection(0);
+       //
+       Double_t entries = hisDelta->GetEntries();
+       Double_t mean=0, rms=0;
+       if (entries>kMinEntries){
+         mean    = hisDelta->GetMean(); 
+         rms = hisDelta->GetRMS(); 
+       }
+       (*pcstream)<<hname<<
+         "run="<<run<<
+         "bz="<<bz<<
+         "theta="<<x1<<
+         "phi="<<x2<<
+         "snp="<<x3<<
+         "entries="<<entries<<
+         "mean="<<mean<<
+         "rms="<<rms<<
+         "\n";
+       delete hisDelta;
+       printf("%f\t%f\t%f\t%f\t%f\n",x1,x3,x2, entries,mean);
+      }
+      delete his3;
+    }
+    delete his1;
+  }
+}
+
+
+
+
+
 void AliTPCCorrection::StoreInOCDB(Int_t startRun, Int_t endRun, const char *comment){
   //
   // Store object in the OCDB
index 44ad4aa827ee7cf18cbc37d3b04cbaa6798452d6..eab8bafb08d4931e6d8521c74137352c6e44b712 100644 (file)
@@ -38,6 +38,7 @@ class TCollection;
 class TTreeSRedirector;
 class AliExternalTrackParam;
 class TTree;
+class THnSparse;
 
 class AliTPCCorrection : public TNamed {
 public:
@@ -70,7 +71,7 @@ public:
   TH2F* CreateHistoDRinZR   (Float_t phi=0.,Int_t nZ=100,Int_t nR=100);
   TH2F* CreateHistoDRPhiinZR(Float_t phi=0.,Int_t nZ=100,Int_t nR=100);
   TTree* CreateDistortionTree(Double_t step=5);
-
+  static void  MakeDistortionMap(THnSparse * his0, TTreeSRedirector *pcstream, const char* hname, Int_t run);
   // 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(AliExternalTrackParam & trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream);
index a2f0a0f0948f363950b0a8cd5ba6e505034300dc..edf22649bc1bb7316169703462f88444ebc72824 100644 (file)
@@ -74,7 +74,7 @@ void AliTPCGGVoltError::Init() {
   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
   //
   SetOmegaTauT1T2(wt,fT1,fT2);
-
+  InitGGVoltErrorDistortion();
   //SetDeltaVGGA(0.0);//  ideally from the database
   //SetDeltaVGGC(0.0);//  ideally from the database
 }
@@ -92,8 +92,8 @@ void AliTPCGGVoltError::Update(const TTimeStamp &/*timeStamp*/) {
   Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
 
   SetOmegaTauT1T2(wt,fT1,fT2);
+  InitGGVoltErrorDistortion();
 }
 
 
index 8bc88111e7cda185603bac00c251502aa8a4741c..4de9c718f07883bac5acaf63a6846e878c0644e2 100644 (file)
@@ -271,7 +271,12 @@ AliTPCcalibDB::~AliTPCcalibDB()
   //
   
 }
-
+AliTPCCalPad* AliTPCcalibDB::GetDistortionMap(Int_t i) const {
+  //
+  // get distortion map - due E field distortions
+  //
+  return (fDistortionMap) ? (AliTPCCalPad*)fDistortionMap->At(i):0;
+}
 
 //_____________________________________________________________________________
 AliCDBEntry* AliTPCcalibDB::GetCDBEntry(const char* cdbPath)
@@ -351,11 +356,11 @@ void AliTPCcalibDB::Update(){
     AliFatal("TPC - Missing calibration entry")
   }
 
-  entry          = GetCDBEntry("TPC/Calib/PadTime0");
+  entry          = GetCDBEntry("TPC/Calib/Distortion");
   if (entry){
     //if (fPadTime0) delete fPadTime0;
     entry->SetOwner(kTRUE);
-    fDistortionMap =(TObjArray*)entry->GetObject();
+    fDistortionMap =dynamic_cast<TObjArray*>(entry->GetObject());
   }else{
     //AliFatal("TPC - Missing calibration entry")
   }
index 611f09073dbceb218685165e885e31384fda222e..8db23f00da7b0ca25f0a8346aed4d548caf03331 100644 (file)
@@ -64,7 +64,7 @@ class AliTPCcalibDB : public TObject
   AliTPCCalPad* GetPadGainFactor() const {return fPadGainFactor;}
   AliTPCCalPad* GetDedxGainFactor() const {return fDedxGainFactor;}
   AliTPCCalPad* GetPadTime0() const {return fPadTime0;}
-  AliTPCCalPad* GetDistortionMap(Int_t i) const {return (fDistortionMap) ? (AliTPCCalPad*)fDistortionMap->At(i):0;}
+  AliTPCCalPad* GetDistortionMap(Int_t i) const;
   AliTPCCorrection * GetTPCComposedCorrection() const { return fComposedCorrection;}
   void          SetTPCComposedCorrection(AliTPCCorrection *compCorr) { fComposedCorrection=compCorr;}
   AliTPCCalPad* GetPadNoise() const {return fPadNoise;}