]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCcalibDB.cxx
Enable back Time 0 correction using AliTPCCalPad.
[u/mrichter/AliRoot.git] / TPC / AliTPCcalibDB.cxx
index c1d95fcba7953ae138df734f7515a3ad4317454f..37f96be3ac02f00588794810b4cb6b4057e22f91 100644 (file)
@@ -243,7 +243,7 @@ AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& ):
   fVoltageArray(0),
   fTemperatureArray(0),   //! array of temperature sensors - per run - Just for calibration studies
   fVdriftArray(0),         //! array of v drift interfaces
-  fDriftCorrectionArray(0),         //! array of v drift interfaces
+  fDriftCorrectionArray(0), //! array of v drift corrections
   fRunList(0),              //! run list - indicates try to get the run param 
   fDButil(0),
   fCTPTimeParams(0)
@@ -323,6 +323,7 @@ void AliTPCcalibDB::Update(){
   AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache
   fDButil = new AliTPCcalibDButil;   
   //
+
   entry          = GetCDBEntry("TPC/Calib/PadGainFactor");
   if (entry){
     //if (fPadGainFactor) delete fPadGainFactor;
@@ -1002,12 +1003,15 @@ void AliTPCcalibDB::UpdateRunInformations( Int_t run, Bool_t force){
     fDButil->FilterSensor(press,kMinP,kMaxP,kMaxdP,kSigmaCut);
     if (press->GetFit()==0) accept=kFALSE;
   }
+
   if (press && temp &&accept){
     AliTPCCalibVdrift * vdrift = new AliTPCCalibVdrift(temp, press,0);
     fVdriftArray.AddAt(vdrift,run);
   }
+
   fDButil->FilterCE(120., 3., 4.,0);
   fDButil->FilterTracks(run, 10.,0);
+
 }
 
 
@@ -1311,9 +1315,9 @@ Float_t AliTPCcalibDB::GetDCSSensorMeanValue(AliDCSSensorArray *arr, const char
     }
   }
   if (sigDigits>=0){
-    val/=10;
+    // val/=10;
     val=(Float_t)TMath::Floor(val * TMath::Power(10., sigDigits) + .5) / TMath::Power(10., sigDigits);
-    val*=10;
+    //    val*=10;
   }
   return val;
 }
@@ -1697,7 +1701,7 @@ Bool_t AliTPCcalibDB::CreateGUITree(const char* filename){
   
   //
   TString file(filename);
-  if (file.IsNull()) file=Form("guiTreeRun_%d.root",fRun);
+  if (file.IsNull()) file=Form("guiTreeRun_%lld.root",fRun);
   prep.DumpToFile(file.Data());
   return kTRUE;
 }
@@ -1777,6 +1781,9 @@ Double_t AliTPCcalibDB::GetVDriftCorrectionTime(Int_t timeStamp, Int_t run, Int_
   if (mode==1) {
     const Double_t kEpsilon=0.00000000001;
     const Double_t kdeltaT=360.; // 10 minutes
+    if(TMath::Abs(deltaITS) < 12*kdeltaT) {
+      result = driftITS;
+    } else {
     wITS  = 64.*kdeltaT/(deltaITS +kdeltaT);
     wLT   = 16.*kdeltaT/(deltaLT  +kdeltaT);
     wP    = 0. *kdeltaT/(deltaP   +kdeltaT);
@@ -1789,6 +1796,9 @@ Double_t AliTPCcalibDB::GetVDriftCorrectionTime(Int_t timeStamp, Int_t run, Int_
     if (TMath::Abs(driftCE)<kEpsilon) wCE=0;  // invalid calibration
     if (wP+wITS+wLT+wCE<kEpsilon) return 0;
     result = (driftP*wP+driftITS*wITS+driftLT*wLT+driftCE*wCE)/(wP+wITS+wLT+wCE);
+   }
+   
+
   }
 
   return result;
@@ -1829,9 +1839,9 @@ Double_t AliTPCcalibDB::GetVDriftCorrectionGy(Int_t timeStamp, Int_t run, Int_t
   //
   // Get global y correction drift velocity correction factor
   // additive factor        vd = vdnom*(1+GetVDriftCorrectionGy *gy)
-  // Value etracted combining the vdrift correction using laser tracks and CE
+  // Value etracted combining the vdrift correction using laser tracks and CE or TPC-ITS
   // Arguments:
-  // mode determines the algorith how to combine the Laser Track, LaserCE
+  // mode determines the algorith how to combine the Laser Track, LaserCE or TPC-ITS
   // timestamp - timestamp
   // run       - run number
   // side      - the drift velocity gy correction per side (CE and Laser tracks)
@@ -1842,10 +1852,25 @@ Double_t AliTPCcalibDB::GetVDriftCorrectionGy(Int_t timeStamp, Int_t run, Int_t
   UpdateRunInformations(run,kFALSE);
   TObjArray *array =AliTPCcalibDB::Instance()->GetTimeVdriftSplineRun(run);
   if (!array) return 0;
+  Double_t result=0;
+
+  // use TPC-ITS if present
+  TGraphErrors *gr= (TGraphErrors*)array->FindObject("ALIGN_ITSB_TPC_VDGY");
+  if(gr) { 
+    result = AliTPCcalibDButil::EvalGraphConst(gr,timeStamp);
+
+    // transform from [(cm/mus)/ m] to [1/cm]
+    result /= (fParam->GetDriftV()/1000000.);
+    result /= 100.;
+
+    //printf("result %e \n", result);
+    return result; 
+  }
+
+  // use laser if ITS-TPC not present
   TGraphErrors *laserA= (TGraphErrors*)array->FindObject("GRAPH_MEAN_GLOBALYGRADIENT_LASER_ALL_A");
   TGraphErrors *laserC= (TGraphErrors*)array->FindObject("GRAPH_MEAN_GLOBALYGRADIENT_LASER_ALL_C");
   
-  Double_t result=0;
   if (laserA && laserC){
    result= (laserA->Eval(timeStamp)+laserC->Eval(timeStamp))*0.5;
   }
@@ -1855,6 +1880,8 @@ Double_t AliTPCcalibDB::GetVDriftCorrectionGy(Int_t timeStamp, Int_t run, Int_t
   if (laserC &&side==1){
     result = (laserC->Eval(timeStamp));
   }
+  //printf("laser result %e \n", -result/250.);
+
   return -result/250.; //normalized before
 }