]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/Macros/AliTRDFindTheCoef.C
new PID 2dLQ implementation to fix bug 54540
[u/mrichter/AliRoot.git] / TRD / Macros / AliTRDFindTheCoef.C
CommitLineData
8470c96e 1#if !defined( __CINT__) || defined(__MAKECINT__)
2
3#include <TFile.h>
4#include <TProfile2D.h>
5#include <TTree.h>
6#include <Riostream.h>
7#include <TSystem.h>
8#include "AliReconstruction.h"
8dd46aaa 9#include "../TRD/AliTRDCalibra.h"
8470c96e 10#include "AliCDBManager.h"
8dd46aaa 11#include "TStopwatch.h"
8470c96e 12
13#endif
14
15
16
17void AliTRDFindTheCoef()
18{
19 //
20 // This macro takes a 2D histo or vector in the file TRD.calibration.root
21 // tries to find the coeffficients
22 // writes the result in the form of a tree in the file coeftest.root
23
24 TStopwatch timer;
25 timer.Start();
8470c96e 26
8dd46aaa 27
28
8470c96e 29 ////Set the CDBManager(You have to use the same as during the reconstruction)*************************
30 AliCDBManager *man = AliCDBManager::Instance();
162637e4 31 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
8470c96e 32 man->SetRun(0);
33
34 ////Set the parameters of AliTRDCalibra***************
35 AliTRDCalibra *calibra = AliTRDCalibra::Instance();
8dd46aaa 36
37 ////Take the Histo2d or tree in the TRD.calibration.root file
38 TFile *file = new TFile("TRD.calibration.root","READ");
39 //TProfile2D *h = (TProfile2D *) file->Get("PRF2d");
40 TTree *h = (TTree *) file->Get("treePRF2d");
41 //h->SetDirectory(0);
42
43
44 //TProfile2D *h = (TProfile2D *) file->Get("PRF2d");
45 TTree *h1 = (TTree *) file->Get("treePH2d");
46 //h->SetDirectory(0);
47
48
49 //TProfile2D *h = (TProfile2D *) file->Get("PRF2d");
50 TTree *h2 = (TTree *) file->Get("treeCH2d");
51 //h->SetDirectory(0);
52
53
8470c96e 54 ////How many bins did you have?
55 //calibra->SetNumberBinCharge(100);
56 //calibra->SetNumberBinPRF(20);
57
58
59 ////Which method do you want to use (It is always the default method that will be put in the database)
60 //calibra->SetMeanChargeOn();
8dd46aaa 61 //calibra->SetFitChargeBisOn();
8470c96e 62 //calibra->SetFitPHOn();
63 //calibra->SetPeriodeFitPH(10);
64
65 //Some details?
66 //calibra->SetRangeFitPRF(0.5);//fit from -0.5 and 0.5 with a gaussian the PRF
67 //calibra->SetT0Shift(0.1433);//will always abstract 0.1433 mus to the result of the method for time 0
68
69 ////What do you want to see?
70 calibra->SetDebug(1);//0 (nothing to see), 1, 2, 3, or 4
71 //calibra->SetDet(0,1,14);//in case of fDebug = 3 and 4
72 //calibra->SetFitVoir(2);//in case of fDebug = 2
73
74 ////How many statistics do you want to accept?
8dd46aaa 75 calibra->SetMinEntries(10);// 1 entry at least to fit
8470c96e 76
8dd46aaa 77 ////Do you want to write the result
78 //calibra->SetWriteCoef(1);
8470c96e 79
8dd46aaa 80 ////Do you want to change the name of the file (TRD.coefficient.root)
81 //calibra->SetWriteNameCoef("coeftest.root");
8470c96e 82
8dd46aaa 83 //Set the mode on the z and rphi direction for each calibration paramaters
84 calibra->SetModeCalibrationFromTObject((TObject *)h2,0);
85 calibra->SetModeCalibrationFromTObject((TObject *)h1,1);
86 calibra->SetModeCalibrationFromTObject((TObject *)h,2);
87
88 //Fit the pad response function
89 calibra->FitPRFOnline(h);
90
91 //Fit the avreage pulse height
92 calibra->FitPHOnline(h1);
93
94 //Fit the deposited charge
95 calibra->FitCHOnline(h2);
8470c96e 96
8dd46aaa 97 file->Close();
8470c96e 98
99 timer.Stop();
100 timer.Print();
101
102}