AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalibTime.C
Go to the documentation of this file.
1 
15 gSystem->Load("libANALYSIS");
16 gSystem->Load("libSTAT");
17 gSystem->Load("libTPCcalib");
18 
19 TFile f("CalibObjects.root");
20 AliTPCcalibTime *calibTime = (AliTPCcalibTime *)f->Get("TPCCalib")->FindObject("calibTime");
21 
22 TPair * addPair= calibTime->GetMapDz()->FindObject(" D0SCO ");
23 THnSparse* addHist=dynamic_cast<THnSparseF*>(addPair->Value());
24 
25 TGraph * gr = AliTPCcalibBase::FitSlices(addHist,2,0,100,100);
26 gr->SetMarkerColor(2);
27 gr->Draw("same*");
28 //Make Fit
29 
30 AliSplineFit fit;
31 fit.SetGraph(gr)
32 fit->SetMinPoints(gr->GetN()+1);
33 fit->InitKnots(gr,2,0,0.001)
34 fit.SplineFit(0)
35 TGraph * grfit = fit.MakeGraph(gr->GetX()[0],gr->GetX()[gr->GetN()-1],50000,0);
36 gr->SetMarkerStyle(25);
37 //gr->Draw("alp");
38 grfit->SetLineColor(2);
39 grfit->Draw("lu");
40 
41 //
42 // Chain Based analysis
43 //
44 
45 
46 TChain * chainLaser=0, *chainDz=0, *chaindEdx=0;
47 
48 void Init(){
50 
51  gSystem->Load("libANALYSIS");
52  gSystem->Load("libSTAT");
53  gSystem->Load("libTPCcalib");
54  gROOT->Macro("~/NimStyle.C");
55  gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
56  gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
57 }
58 
59 void InitChains(){
60  AliXRDPROOFtoolkit tool;
61  //load debug streams
62  chainLaser = tool.MakeChain("time.txt","laserInfo",0,10200);
63  chainLaser->Lookup();
64  // cosmic dZ - drfit velocity part
65  chainDz = tool.MakeChain("time.txt","cosmicDz",0,10200);
66  chainDz->Lookup();
67  //
68  // cosmic dE - drift velocity part
69  chaindEdx = tool.MakeChain("time.txt","cosmicdEdx",0,10200);
70  chaindEdx->Lookup();
71  //
72  // Set Alias
73  //
74  chaindEdx->SetAlias("side","(-1+(p0.fP[1]>0)*2)");
75  chaindEdx->SetAlias("der","side*(dedx0-dedx1)/(dedx0+dedx1)");
76  chaindEdx->SetAlias("derIO","side*(dedx0Out-dedx0In)/(dedx0In+dedx0Out)");
77  chaindEdx->SetAlias("dr","(1-abs(p0.fP[1]/250))");
78  chaindEdx->SetAlias("isOK","dedx0In>0&&dedx0Out>0&&dedx1In>0&&dedx1Out>0");
79  chaindEdx->SetAlias("dedxM","(dedx0+dedx1)*0.5");
80 
81 }
82 
83 
86 
87  TStatToolkit toolkit;
88  Double_t chi2=0;
89  Int_t npoints=0;
90  TVectorD fitParamC,fitParamIO;
91  TMatrixD covMatrix;
92  //
93  // dedx delta
94  //
95  TString fstring="";
96  fstring+="side++";
97  fstring+="p0.fP[3]++";
98  //fstring+="p0.fP[3]*dr++";
99  TString *strTheta = toolkit.FitPlane(chaindEdx,"der",fstring->Data(), "isOK", chi2,npoints,fitParamC,covMatrix);
100  chaindEdx->SetAlias("derc",strTheta.Data());
101  strTheta->Tokenize("+")->Print();
102  //
103  // dedx delta
104  //
105  fstring="";
106  fstring+="side++";
107  fstring+="p0.fP[3]++";
108  //fstring+="p0.fP[3]*dr++";
109  TString *strTheta = toolkit.FitPlane(chaindEdx,"derIO",fstring->Data(), "isOK", chi2,npoints,fitParamIO,covMatrix);
110  chaindEdx->SetAlias("derIOc",strTheta.Data());
111  strTheta->Tokenize("+")->Print();
112  //
113  // Make Plot
114  //
115  chaindEdx->Draw("der:p0.fP[3]>>his(20,-0.5,0.5)","","prof");
116  chaindEdx->Draw("der-derc:p0.fP[3]>>hisC(20,-0.5,0.5)","","prof");
117  his->SetXTitle("tan(#theta)");
118  his->SetYTitle("(Q_{u}-Q_{d})/(Q_{u}+Q_{d})");
119  his->Draw("");
120  hisC->Draw("same");
121 }
122 
123 
124 void MakeTglFitCosmic(){
126 
127  TStatToolkit toolkit;
128  Double_t chi2=0;
129  Int_t npoints=0;
130  TVectorD fitParamC,fitParamIO;
131  TMatrixD covMatrix;
132  TString fstring="";
133  fstring="";
134  fstring+="ppit++";
135  fstring+="(trigger==1)++";
136  fstring+="(trigger==2)++";
137  fstring+="(trigger==4)++";
138  fstring+="(trigger==8)++";
139  TString *strPress = toolkit.FitPlane(chaindEdx,"(dedx0+dedx1)*0.5",fstring->Data(), "isOK", chi2,npoints,fitParamIO,covMatrix);
140  //
141  //
142  chaindEdx->SetAlias("de",strTheta.Data());
143  strTheta->Tokenize("+")->Print();
144 
145 
146 }
TOOLKIT for chain manipulation:
AliRunLoader * Init()
TFile f("CalibObjects.root")
TROOT * gROOT
void MakeTglFitCosmic()
Definition: CalibTime.C:84
npoints
Definition: driftITSTPC.C:85
AliSplineFit fit
Definition: CalibTime.C:30
Double_t chi2
Definition: AnalyzeLaser.C:7
TGraph * gr
Definition: CalibTime.C:25
TPair * addPair
Definition: CalibTime.C:22
AliTPCcalibTime * calibTime
Definition: CalibTime.C:20
TStatToolkit toolkit
Definition: gainCalib.C:18
THnSparse * addHist
Definition: CalibTime.C:23
void InitChains()
Definition: CalibTime.C:59
static TChain * MakeChain(const char *fileIn, const char *treeName, const char *fName=0, Int_t maxFiles=-1, Int_t startFile=0)