ROOT logo
#if !defined( __CINT__) || defined(__MAKECINT__)

#include <TFile.h>
#include <TProfile2D.h>
#include <TTree.h>
#include <Riostream.h>
#include <TSystem.h>
#include "AliReconstruction.h"
#include "../TRD/AliTRDCalibra.h"
#include "AliCDBManager.h"
#include "TStopwatch.h"

#endif



void AliTRDFindTheCoef() 
{
  //
  // This macro takes a 2D histo or vector in the file TRD.calibration.root
  // tries to find the coeffficients
  // writes the result in the form of a tree in the file coeftest.root
 
  TStopwatch timer;
  timer.Start();

 
  
  ////Set the CDBManager(You have to use the same as during the reconstruction)*************************
  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); 
  man->SetRun(0);

  ////Set the parameters of AliTRDCalibra***************
  AliTRDCalibra *calibra = AliTRDCalibra::Instance();
  
  ////Take the Histo2d or tree in the TRD.calibration.root file 
  TFile *file = new TFile("TRD.calibration.root","READ");
  //TProfile2D *h = (TProfile2D *) file->Get("PRF2d");
  TTree *h = (TTree *) file->Get("treePRF2d");
  //h->SetDirectory(0);
 
  
  //TProfile2D *h = (TProfile2D *) file->Get("PRF2d");
  TTree *h1 = (TTree *) file->Get("treePH2d");
  //h->SetDirectory(0);
 
  
  //TProfile2D *h = (TProfile2D *) file->Get("PRF2d");
  TTree *h2 = (TTree *) file->Get("treeCH2d");
  //h->SetDirectory(0);
 
 
  ////How many bins did you have?
  //calibra->SetNumberBinCharge(100);
  //calibra->SetNumberBinPRF(20);


  ////Which method do you want to use (It is always the default method that will be put in the database)
  //calibra->SetMeanChargeOn();
  //calibra->SetFitChargeBisOn();
  //calibra->SetFitPHOn();
  //calibra->SetPeriodeFitPH(10);

  //Some details?
  //calibra->SetRangeFitPRF(0.5);//fit from -0.5 and 0.5 with a gaussian the PRF
  //calibra->SetT0Shift(0.1433);//will always abstract 0.1433 mus to the result of the method for time 0

  ////What do you want to see?
  calibra->SetDebug(1);//0 (nothing to see), 1, 2, 3, or 4
  //calibra->SetDet(0,1,14);//in case of fDebug = 3 and 4
  //calibra->SetFitVoir(2);//in case of fDebug = 2

  ////How many statistics do you want to accept?
  calibra->SetMinEntries(10);// 1 entry at least to fit

  ////Do you want to write the result
  //calibra->SetWriteCoef(1);

  ////Do you want to change the name of the file (TRD.coefficient.root)
  //calibra->SetWriteNameCoef("coeftest.root");

  //Set the mode on the z and rphi direction for each calibration paramaters
  calibra->SetModeCalibrationFromTObject((TObject *)h2,0);
  calibra->SetModeCalibrationFromTObject((TObject *)h1,1);
  calibra->SetModeCalibrationFromTObject((TObject *)h,2);
  
  //Fit the pad response function 
  calibra->FitPRFOnline(h);  
   
  //Fit the avreage pulse height
  calibra->FitPHOnline(h1);  
  
  //Fit the deposited charge
  calibra->FitCHOnline(h2);  

  file->Close();
  
  timer.Stop();
  timer.Print();

}
 AliTRDFindTheCoef.C:1
 AliTRDFindTheCoef.C:2
 AliTRDFindTheCoef.C:3
 AliTRDFindTheCoef.C:4
 AliTRDFindTheCoef.C:5
 AliTRDFindTheCoef.C:6
 AliTRDFindTheCoef.C:7
 AliTRDFindTheCoef.C:8
 AliTRDFindTheCoef.C:9
 AliTRDFindTheCoef.C:10
 AliTRDFindTheCoef.C:11
 AliTRDFindTheCoef.C:12
 AliTRDFindTheCoef.C:13
 AliTRDFindTheCoef.C:14
 AliTRDFindTheCoef.C:15
 AliTRDFindTheCoef.C:16
 AliTRDFindTheCoef.C:17
 AliTRDFindTheCoef.C:18
 AliTRDFindTheCoef.C:19
 AliTRDFindTheCoef.C:20
 AliTRDFindTheCoef.C:21
 AliTRDFindTheCoef.C:22
 AliTRDFindTheCoef.C:23
 AliTRDFindTheCoef.C:24
 AliTRDFindTheCoef.C:25
 AliTRDFindTheCoef.C:26
 AliTRDFindTheCoef.C:27
 AliTRDFindTheCoef.C:28
 AliTRDFindTheCoef.C:29
 AliTRDFindTheCoef.C:30
 AliTRDFindTheCoef.C:31
 AliTRDFindTheCoef.C:32
 AliTRDFindTheCoef.C:33
 AliTRDFindTheCoef.C:34
 AliTRDFindTheCoef.C:35
 AliTRDFindTheCoef.C:36
 AliTRDFindTheCoef.C:37
 AliTRDFindTheCoef.C:38
 AliTRDFindTheCoef.C:39
 AliTRDFindTheCoef.C:40
 AliTRDFindTheCoef.C:41
 AliTRDFindTheCoef.C:42
 AliTRDFindTheCoef.C:43
 AliTRDFindTheCoef.C:44
 AliTRDFindTheCoef.C:45
 AliTRDFindTheCoef.C:46
 AliTRDFindTheCoef.C:47
 AliTRDFindTheCoef.C:48
 AliTRDFindTheCoef.C:49
 AliTRDFindTheCoef.C:50
 AliTRDFindTheCoef.C:51
 AliTRDFindTheCoef.C:52
 AliTRDFindTheCoef.C:53
 AliTRDFindTheCoef.C:54
 AliTRDFindTheCoef.C:55
 AliTRDFindTheCoef.C:56
 AliTRDFindTheCoef.C:57
 AliTRDFindTheCoef.C:58
 AliTRDFindTheCoef.C:59
 AliTRDFindTheCoef.C:60
 AliTRDFindTheCoef.C:61
 AliTRDFindTheCoef.C:62
 AliTRDFindTheCoef.C:63
 AliTRDFindTheCoef.C:64
 AliTRDFindTheCoef.C:65
 AliTRDFindTheCoef.C:66
 AliTRDFindTheCoef.C:67
 AliTRDFindTheCoef.C:68
 AliTRDFindTheCoef.C:69
 AliTRDFindTheCoef.C:70
 AliTRDFindTheCoef.C:71
 AliTRDFindTheCoef.C:72
 AliTRDFindTheCoef.C:73
 AliTRDFindTheCoef.C:74
 AliTRDFindTheCoef.C:75
 AliTRDFindTheCoef.C:76
 AliTRDFindTheCoef.C:77
 AliTRDFindTheCoef.C:78
 AliTRDFindTheCoef.C:79
 AliTRDFindTheCoef.C:80
 AliTRDFindTheCoef.C:81
 AliTRDFindTheCoef.C:82
 AliTRDFindTheCoef.C:83
 AliTRDFindTheCoef.C:84
 AliTRDFindTheCoef.C:85
 AliTRDFindTheCoef.C:86
 AliTRDFindTheCoef.C:87
 AliTRDFindTheCoef.C:88
 AliTRDFindTheCoef.C:89
 AliTRDFindTheCoef.C:90
 AliTRDFindTheCoef.C:91
 AliTRDFindTheCoef.C:92
 AliTRDFindTheCoef.C:93
 AliTRDFindTheCoef.C:94
 AliTRDFindTheCoef.C:95
 AliTRDFindTheCoef.C:96
 AliTRDFindTheCoef.C:97
 AliTRDFindTheCoef.C:98
 AliTRDFindTheCoef.C:99
 AliTRDFindTheCoef.C:100
 AliTRDFindTheCoef.C:101
 AliTRDFindTheCoef.C:102
 AliTRDFindTheCoef.C:103