Extacting the OCDB in a separate module. The detectors have write permission in the...
[u/mrichter/AliRoot.git] / TPC / CalibMacros / CalibClParamNew.C
... / ...
CommitLineData
1/*
2// Pseudo code
3// 1. Load Calibration from DB
4
5 .x $ALICE_ROOT/TPC/macros/ConfigOCDB.C
6
7//
8//2. Load Calibration components
9//
10.x ~/UliStyle.C
11gSystem->Load("libANALYSIS");
12gSystem->Load("libSTAT");
13gSystem->Load("libTPCcalib");
14TFile fcalib("CalibObjects.root");
15TObjArray * array = (TObjArray*)fcalib.Get("TPCCalib");
16AliTPCcalibTracksGain * gain = ( AliTPCcalibTracksGain *)array->FindObject("calibTracksGain");
17
18//
19//3.
20//
21AliTPCClusterParam * paramCl = AliTPCcalibDB::Instance()->GetClusterParam();
22gain->UpdateClusterParam(paramCl);
23
24//
25//4. Test - visulaize results
26//
27TF1 fdr("fdr","AliTPCClusterParam::SQnorm(0,0,x,0,0)",0,1);
28
29//
30//5. Update the ClusterParam in your OCDB
31//
32//
33Int_t runNumber = 0; //61725
34AliCDBMetaData *metaData= new AliCDBMetaData();
35metaData->SetObjectClassName("AliTPCClusterParam");
36metaData->SetResponsible("Marian Ivanov");
37metaData->SetBeamPeriod(1);
38metaData->SetAliRootVersion("05-06-00"); //root version
39metaData->SetComment("October runs calibration");
40AliCDBId id1("TPC/Calib/ClusterParam", runNumber, AliCDBRunRange::Infinity());
41gStorage = AliCDBManager::Instance()->GetStorage("local://$ALICE_ROOT/OCDB");
42gStorage->Put(paramCl, id1, metaData);
43
44
45//
46// 6. dEdx matching - Currently only debug streamers
47// Load Proof with OCDB
48 See pseudo code TestChainCosmicdEdx
49*/
50
51
52
53
54
55void TestChainCosmicDedx(){
56 //
57 // pseudo cose
58 //
59 gSystem->Load("libANALYSIS");
60 gSystem->Load("libSTAT");
61 gSystem->Load("libTPCcalib");
62
63 //e.g
64 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
65 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
66 AliXRDPROOFtoolkit tool;
67 TChain * chainCosmic = tool.MakeChain("cosmic.txt","Track0",0,1000000);
68 chainCosmic->Lookup();
69
70
71
72 TCut cutT("cutT","abs(Tr1.fP[3]+Tr0.fP[3])<0.01"); // OK
73 TCut cutD("cutD","abs(Tr0.fP[0]+Tr1.fP[0])<2"); // OK
74 TCut cutP1("cutP1","abs(Tr0.fP[1]-Tr1.fP[1])<3"); // OK
75 TCut cutPt("cutPt","abs(Tr1.fP[4]+Tr0.fP[4])<0.1&&abs(Tr0.fP[4])+abs(Tr1.fP[4])<10");
76 TCut cutN("cutN","min(Orig0.fTPCncls,Orig1.fTPCncls)>100");
77 TCut cutA=cutT+cutD+cutPt+cutN+cutP1;
78
79 TCut cutS("cutS","Orig0.fIp.fP[1]*Orig1.fIp.fP[1]>0");
80
81 if (gProof) chainCosmic->SetProof(kTRUE);
82 //
83 //
84 //
85 //
86
87 //
88 // Q normalization - short - medium - long
89 //
90
91 TVectorD paramT(3);
92 TVectorD paramM(3);
93 TH1 * hisRatio =0;
94
95 chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,0,0,64,0,kFALSE)/Seed0.CookdEdxNorm(0.01,0.65,0,0,159,0,kFALSE)>>hisRatio(100,0.5,1.5)","min(Orig0.fTPCncls,Orig1.fTPCncls)>130","");
96 hisRatio = (TH1*)gROOT->FindObject("hisRatio");
97 hisRatio->Fit("gaus");
98 paramT[0]=hisRatio->GetFunction("gaus")->GetParameter(1);
99 //
100 chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,0,64,127,0,kFALSE)/Seed0.CookdEdxNorm(0.01,0.65,0,0,159,0,kFALSE)>>hisRatio(100,0.5,1.5)","min(Orig0.fTPCncls,Orig1.fTPCncls)>130","");
101 hisRatio = (TH1*)gROOT->FindObject("hisRatio");
102 hisRatio->Fit("gaus");
103 paramT[1]=hisRatio->GetFunction("gaus")->GetParameter(1);
104 //
105 chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,0,127,159,0,kFALSE)/Seed0.CookdEdxNorm(0.01,0.65,0,0,159,0,kFALSE)>>hisRatio(100,0.5,1.5)","min(Orig0.fTPCncls,Orig1.fTPCncls)>130","");
106 hisRatio = (TH1*)gROOT->FindObject("hisRatio");
107 hisRatio->Fit("gaus");
108 paramT[2]=hisRatio->GetFunction("gaus")->GetParameter(1);
109 //
110 chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,1,0,64,0,kFALSE)/Seed0.CookdEdxNorm(0.01,0.65,1,0,159,0,kFALSE)>>hisRatio(100,0.5,1.5)","min(Orig0.fTPCncls,Orig1.fTPCncls)>130","");
111 hisRatio = (TH1*)gROOT->FindObject("hisRatio");
112 hisRatio->Fit("gaus");
113 paramM[0]=hisRatio->GetFunction("gaus")->GetParameter(1);
114 //
115 chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,1,64,127,0,kFALSE)/Seed0.CookdEdxNorm(0.01,0.65,1,0,159,0,kFALSE)>>hisRatio(100,0.5,1.5)","min(Orig0.fTPCncls,Orig1.fTPCncls)>130","");
116 hisRatio = (TH1*)gROOT->FindObject("hisRatio");
117 hisRatio->Fit("gaus");
118 paramM[1]=hisRatio->GetFunction("gaus")->GetParameter(1);
119 //
120 chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,1,127,159,0,kFALSE)/Seed0.CookdEdxNorm(0.01,0.65,1,0,159,0,kFALSE)>>hisRatio(100,0.5,1.5)","min(Orig0.fTPCncls,Orig1.fTPCncls)>130","");
121 hisRatio = (TH1*)gROOT->FindObject("hisRatio");
122 hisRatio->Fit("gaus");
123 paramM[2]=hisRatio->GetFunction("gaus")->GetParameter(1);
124 //
125
126
127
128
129
130 paramCl->fQpadTnorm=(TVectorD*)paramT->Clone();
131 paramCl->fQpadMnorm=(TVectorD*)paramM->Clone();
132
133
134 //check
135
136
137}
138
139
140
141
142
143