]>
Commit | Line | Data |
---|---|---|
35d81915 | 1 | /// \file CalibClParam.C |
2 | /// | |
3 | /// Procedures to create a cluster parametererization | |
4 | /// Currently only pseudo code - once will be stable - to be updated as a "normal" macro | |
325500ed | 5 | |
6 | void PseudoCode(){ | |
35d81915 | 7 | /// That rough sequence to update a Cluster param calibration using debug streamers |
325500ed | 8 | |
9 | // | |
10 | //0. Load libraries | |
11 | gSystem->Load("libANALYSIS"); | |
12 | gSystem->Load("libSTAT"); | |
13 | gSystem->Load("libTPCcalib"); | |
14 | ||
15 | ||
16 | //1. Load Parameters to be modified: | |
17 | //e.g: | |
162637e4 | 18 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
325500ed | 19 | AliCDBManager::Instance()->SetRun(0) ; |
20 | AliTPCClusterParam * param = AliTPCcalibDB::Instance()->GetClusterParam(); | |
21 | // | |
22 | //2. Load chain from debug streamers | |
23 | // | |
24 | //e.g | |
25 | gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros"); | |
26 | gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+"); | |
27 | AliXRDPROOFtoolkit tool; | |
28 | TChain * chainres = tool.MakeChain("tracks.txt","ResolCl",0,10200); | |
29 | chainres->Lookup(); | |
30 | TChain * chainGain = tool.MakeChain("gain.txt","dEdx",0,1000000); | |
31 | chainGain->Lookup(); | |
32 | TChain * chainCosmic = tool.MakeChain("cosmic.txt","Track0",0,1000000); | |
33 | chainCosmic->Lookup(); | |
34 | // | |
35 | // 3. Do fits - pos correction | |
36 | // | |
37 | AliTPCcalibTracks::MakeQPosNormAll(chainres,param,200000,0) ; | |
38 | ||
39 | // | |
40 | //4. Do fits gain | |
41 | // | |
42 | param->fPosQTnorm[0] = AliTPCcalibTracksGain::MakeQPosNorm(chainGain,0,kFALSE,200000,kTRUE); | |
43 | param->fPosQTnorm[1] = AliTPCcalibTracksGain::MakeQPosNorm(chainGain,1,kFALSE,200000,kTRUE); | |
44 | param->fPosQTnorm[2] = AliTPCcalibTracksGain::MakeQPosNorm(chainGain,2,kFALSE,200000,kTRUE); | |
45 | // | |
46 | param->fPosQMnorm[0] = AliTPCcalibTracksGain::MakeQPosNorm(chainGain,0,kTRUE,200000,kTRUE); | |
47 | param->fPosQMnorm[1] = AliTPCcalibTracksGain::MakeQPosNorm(chainGain,1,kTRUE,200000,kTRUE); | |
48 | param->fPosQMnorm[2] = AliTPCcalibTracksGain::MakeQPosNorm(chainGain,2,kTRUE,200000,kTRUE); | |
49 | // | |
50 | //5. Store results | |
51 | // | |
52 | TFile f("paramout.root","recreate"); | |
53 | param->Write("clusterParam"); | |
54 | f.Close(); | |
55 | ||
56 | ||
57 | //6. Verification | |
58 | TFile f2("paramout.root"); | |
59 | AliTPCClusterParam *param2 = (AliTPCClusterParam*)f2.Get("clusterParam"); | |
60 | param2->SetInstance(param2); | |
61 | // | |
62 | // position correction | |
63 | chainres->Draw("AliTPCClusterParam::SPosCorrection(1,0,Cl.fPad,Cl.fTimeBin,Cl.fZ,Cl.fSigmaY2,Cl.fSigmaZ2,Cl.fMax)","Cl.fDetector<36","",10000); // should be line | |
64 | // gain correction | |
65 | TCut cutA("dedge>3&&fraction2<0.7"); | |
66 | chainGain->Draw("(Cl.fMax/gain/dedxM.fElements[2]):AliTPCClusterParam::SQnormPos(0,1,Cl.fPad,Cl.fTimeBin,Cl.fZ,Cl.fSigmaY2,Cl.fSigmaZ2,Cl.fMax,Cl.fQ)","IPad==0"+cutA,"prof",100000); | |
67 | ||
68 | ||
69 | } | |
70 | ||
71 | ||
72 | void UpdateParam(){ | |
35d81915 | 73 | /// Pseudo code -to update cluster params |
74 | ||
325500ed | 75 | .L $ALICE_ROOT/TPC/Cal/AliTPCCreateDummyCDB.C |
76 | TFile f2("paramout.root"); | |
77 | AliTPCClusterParam *param2 = (AliTPCClusterParam*)f2.Get("clusterParam"); | |
78 | AliCDBManager *man = AliCDBManager::Instance(); | |
79 | gStorLoc = man->GetStorage(gCDBpath); | |
80 | metaData = CreateMetaObject("AliTPCClusterParam"); | |
81 | StoreObject("TPC/Calib/ClusterParam/", param2, metaData); | |
82 | ||
83 | } | |
84 | ||
85 | ||
86 | void TestChainCosmicDedx(){ | |
35d81915 | 87 | /// pseudo cose |
88 | ||
325500ed | 89 | gSystem->Load("libANALYSIS"); |
90 | gSystem->Load("libSTAT"); | |
91 | gSystem->Load("libTPCcalib"); | |
162637e4 | 92 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
325500ed | 93 | AliCDBManager::Instance()->SetRun(0) ; |
94 | AliTPCClusterParam * param = AliTPCcalibDB::Instance()->GetClusterParam(); | |
95 | param->SetInstance(param); | |
96 | //e.g | |
97 | gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros"); | |
98 | gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+"); | |
99 | AliXRDPROOFtoolkit tool; | |
100 | TChain * chainCosmic = tool.MakeChain("cosmic.txt","Track0",0,1000000); | |
101 | chainCosmic->Lookup(); | |
102 | ||
103 | ||
104 | ||
105 | TCut cutT("cutT","abs(Tr1.fP[3]+Tr0.fP[3])<0.01"); // OK | |
106 | TCut cutD("cutD","abs(Tr0.fP[0]+Tr1.fP[0])<2"); // OK | |
107 | TCut cutP1("cutP1","abs(Tr0.fP[1]-Tr1.fP[1])<3"); // OK | |
108 | TCut cutPt("cutPt","abs(Tr1.fP[4]+Tr0.fP[4])<0.1&&abs(Tr0.fP[4])+abs(Tr1.fP[4])<10"); | |
109 | TCut cutN("cutN","min(Orig0.fTPCncls,Orig1.fTPCncls)>100"); | |
110 | TCut cutA=cutT+cutD+cutPt+cutN+cutP1; | |
111 | ||
112 | TCut cutS("cutS","Orig0.fIp.fP[1]*Orig1.fIp.fP[1]>0"); | |
113 | ||
114 | if (gProof) chainCosmic->SetProof(kTRUE); | |
115 | // | |
116 | // | |
117 | // | |
118 | // | |
119 | chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,1,0,159,0)/Seed1.CookdEdxNorm(0.01,0.65,1,0,159,0)","min(Orig0.fTPCncls,Orig1.fTPCncls)>120","",10000); | |
120 | ||
121 | // | |
122 | // Q normalization - short - medium - long | |
123 | // | |
124 | ||
125 | TVectorD paramT(3); | |
126 | TVectorD paramM(3); | |
127 | TH1F * his =0; | |
128 | chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,0,0,64,0,kTRUE)/Seed0.CookdEdxNorm(0.01,0.65,0,0,159,0,kTRUE)>>his(100,0.5,1.5)","min(Orig0.fTPCncls,Orig1.fTPCncls)>140","",100000); | |
129 | TH1 * his = (TH1*)gROOT->FindObject("his"); | |
130 | paramT[0]=his->GetMean(); | |
131 | // | |
132 | chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,0,64,129,0,kTRUE)/Seed0.CookdEdxNorm(0.01,0.65,0,0,159,0,kTRUE)>>his(100,0.5,1.5)","min(Orig0.fTPCncls,Orig1.fTPCncls)>140","",100000); | |
133 | TH1 * his = (TH1*)gROOT->FindObject("his"); | |
134 | paramT[1]=his->GetMean(); | |
135 | // | |
136 | chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,0,129,159,0,kTRUE)/Seed0.CookdEdxNorm(0.01,0.65,0,0,159,0,kTRUE)>>his(100,0.5,2.0)","min(Orig0.fTPCncls,Orig1.fTPCncls)>140","",100000); | |
137 | TH1 * his = (TH1*)gROOT->FindObject("his"); | |
138 | paramT[2]=his->GetMean(); | |
139 | // | |
140 | // | |
141 | chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,1,0,64,0,kTRUE)/Seed0.CookdEdxNorm(0.01,0.65,1,0,159,0,kTRUE)>>his(100,0.5,1.5)","min(Orig0.fTPCncls,Orig1.fTPCncls)>140","",100000); | |
142 | TH1 * his = (TH1*)gROOT->FindObject("his"); | |
143 | paramM[0]=his->GetMean(); | |
144 | // | |
145 | chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,1,64,129,0,kTRUE)/Seed0.CookdEdxNorm(0.01,0.65,1,0,159,0,kTRUE)>>his(100,0.5,1.5)","min(Orig0.fTPCncls,Orig1.fTPCncls)>140","",100000); | |
146 | TH1 * his = (TH1*)gROOT->FindObject("his"); | |
147 | paramM[1]=his->GetMean(); | |
148 | // | |
149 | chainCosmic->Draw("Seed0.CookdEdxNorm(0.01,0.65,1,129,159,0,kTRUE)/Seed0.CookdEdxNorm(0.01,0.65,1,0,159,0,kTRUE)>>his(100,0.5,2.0)","min(Orig0.fTPCncls,Orig1.fTPCncls)>140","",100000); | |
150 | TH1 * his = (TH1*)gROOT->FindObject("his"); | |
151 | paramM[2]=his->GetMean(); | |
152 | ||
153 | param->fQpadTnorm=(TVectorD*)paramT->Clone(); | |
154 | param->fQpadMnorm=(TVectorD*)paramM->Clone(); | |
155 | ||
156 | TFile f("paramout.root","recreate"); | |
157 | param->Write("clusterParam"); | |
158 | f.Close(); | |
159 | ||
160 | } | |
ee59d24d | 161 | |
162 | ||
163 | void dedxDemo(){ | |
164 | chainCosmic->Draw("(Seed0.CookdEdxNorm(0.01,0.65,1,0,159,0,kTRUE,kTRUE)+Seed1.CookdEdxNorm(0.01,0.65,1,0,159,0,kTRUE,kTRUE))*0.5:log(Tr0.P())>>his2(100,-2,5,500,0,200)","min(Orig0.fTPCncls,Orig1.fTPCncls)>110"); | |
165 | } |