]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/macros/taskComp.C
removing osolete macros
[u/mrichter/AliRoot.git] / PWG1 / macros / taskComp.C
CommitLineData
e7babc5b 1/*
2
3 Sequence hot to se the PWG1 analysis tasks:
4
5
6 //1. Load libraries if needed:
7 //
8 gSystem->Load("/usr/local/grid/XRootd/GSI/lib/libXrdClient.so");
9 gSystem->Load("libANALYSIS.so");
10 gSystem->Load("libANALYSISalice.so");
11 gSystem->Load("libPWG0base.so");
12 gSystem->Load("libPWG0dep.so");
13 gSystem->Load("libPWG1.so");
14
15 AliLog::SetGlobalLogLevel(AliLog::kError);
16
17 //2. Make a chain e.g.:
18 //
19 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
20 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
21 AliXRDPROOFtoolkit tool;
0b51bf80 22 TChain * chainEsd = tool.MakeChain("esd.txt","esdTree",0,5);
e7babc5b 23 chainEsd->Lookup();
24 //
25
26
27 //3. Make a analysis manager with attached task:
0b51bf80 28 .L $ALICE_ROOT/PWG1/macros/taskComp.C
e7babc5b 29 Init();
30 AliAnalysisManager *mgr = MakeManager();
31
32 //4. Process task localy
33 //
34 mgr->SetNSysInfo(100);
35 mgr->SetDebugLevel(1);
36 mgr->StartAnalysis("local",chainEsd);
37
38 //
39 //4. Process task on proof
40 //
41 TProof::Open("");
42 .L /u/miranov/macros/ProofEnableAliRoot.C
43 ProofEnableAliRoot("/usr/local/grid/AliRoot/HEAD0108");
44 gProof->Exec("gSystem->Load(\"libANALYSIS.so\")",kTRUE);
45 gProof->Exec("gSystem->Load(\"libAOD.so\")",kTRUE);
46 gProof->Exec("gSystem->Load(\"libANALYSISalice.so\")",kTRUE);
47 gProof->Exec("gSystem->Load(\"libPWG0base.so\")",kTRUE);
48 gProof->Exec("gSystem->Load(\"libPWG0dep.so\")",kTRUE);
49 gProof->Exec("gSystem->Load(\"libPWG1.so\")",kTRUE);
0b51bf80 50
51 TString path=gSystem->pwd();
52 TString execCDB="gROOT->Macro(\"";
53 execCDB+=path+"/ConfigOCDB.C\"\)";
54 gProof->Exec(execCDB->Data(),kFALSE);
55
e7babc5b 56 mgr->StartAnalysis("proof",chainEsd);
57 //5. Get debug stream - if speciefied
58 TFile f("mcTaskDebug.root");
59 TTree *treeCMP = (TTree*)f.Get("RC");
60
61 //6. Read the analysis object
62 TFile f("Output.root");
63 TObjArray * array = (TObjArray*)f.Get("AliComparisonRes");
64 AliComparisonRes * compObj = (AliComparisonRes*)array->FindObject("AliComparisonRes");
65 //
66 //7. Get debug streamer on PROOF
67 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
68 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
69 AliXRDPROOFtoolkit tool;
70 TChain * chainTr = tool.MakeChain("cmp.txt","RC",0,1000000);
71 chainTr->Lookup();
72 chainTr->SetProof(kTRUE);
73 TChain * chainTPC = tool.MakeChain("tpc.txt","Crefit",0,50);
74 chainTPC->Lookup();
75 chainTr->SetProof(kTRUE);
76
0b51bf80 77 TChain * chainTracking = tool.MakeChain("mctracking.txt","MCupdate",0,50);
78 chainTracking->Lookup();
79 chainTracking->SetProof(kTRUE);
80
e7babc5b 81
82
83 TFile f("mcTaskDebug.root");
84 TTree *treeCMP = (TTree*)f.Get("RC");
85
86*/
87
88
89
90void AddComparison( AliGenInfoTask * task);
91
92void Init(){
93 //
94 // Init mag field and the geo manager
95 //
96 TGeoManager::Import("/u/miranov/proof/geometry.root");
97 AliGeomManager::LoadGeometry("/u/miranov/proof/geometry.root");
98
4642ac4b 99 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
e7babc5b 100
101
102}
103
104AliAnalysisManager * MakeManager(){
105 //
106 //
107 //
108 AliAnalysisManager *mgr = new AliAnalysisManager("AnalysisComponentManager");
109 mgr->SetDebugLevel(1);
110 cout << "Creating ESD event handler" << endl;
111 AliESDInputHandler* esdH = new AliESDInputHandler();
112 // set the ESDfriend branch active (my modification of AliESDInputHandler)
113 esdH->SetActiveBranches("ESDfriend");
114 mgr->SetInputEventHandler(esdH);
115
116 AliMCEventHandler* mcHandler = new AliMCEventHandler();
117 mgr->SetMCtruthEventHandler(mcHandler);
118 //
119
120
121 AliGenInfoTask *genTask = new AliGenInfoTask("genTask");
122 genTask->SetStreamLevel(10);
123 genTask->SetDebugLevel(10);
0b51bf80 124 genTask->SetDebugOuputhPath(Form("%s/",gSystem->pwd()));
e7babc5b 125
126 // //AddComparison(genTask);
127// mgr->AddTask(genTask);
128// //
129// //
130// AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
131// mgr->ConnectInput(genTask,0,cinput1);
132// //
133// AliAnalysisDataContainer *coutput1
134// =mgr->CreateContainer("AliComparisonRes",TObjArray::Class(),
135// AliAnalysisManager::kOutputContainer,
136// "Output.root");
137// mgr->ConnectOutput(genTask,0,coutput1);
138
139
0b51bf80 140
e7babc5b 141 //
142 // TPC PID task
143 //
144 AliTPCtaskPID *pidTask = new AliTPCtaskPID("pidTask");
145 mgr->AddTask(pidTask);
146 AliAnalysisDataContainer *cinput2 = mgr->GetCommonInputContainer();
147 mgr->ConnectInput(pidTask,0,cinput2);
148 //
149 AliAnalysisDataContainer *coutput2
150 =mgr->CreateContainer("tpcTaskPID", TObjArray::Class(),
151 AliAnalysisManager::kOutputContainer,
152 "OutputPID.root");
153 mgr->ConnectOutput(pidTask,0,coutput2);
154
155 //
156 // TPC QA task
157 //
158 AliTPCtaskQA *qaTask = new AliTPCtaskQA("qaTask");
159 mgr->AddTask(qaTask);
160 AliAnalysisDataContainer *cinput3 = mgr->GetCommonInputContainer();
161 mgr->ConnectInput(qaTask,0,cinput3);
162 //
163 AliAnalysisDataContainer *coutput3
164 =mgr->CreateContainer("tpcTaskQA", TObjArray::Class(),
165 AliAnalysisManager::kOutputContainer,
166 "OutputQA.root");
167 mgr->ConnectOutput(qaTask,0,coutput3);
0b51bf80 168 //
169 //
170 //
171 AliMCTrackingTestTask *mcTracking = new AliMCTrackingTestTask("mcTracking");
172 mcTracking->SetStreamLevel(10);
173 mcTracking->SetDebugLevel(10);
174 mgr->AddTask(mcTracking);
175 mcTracking->SetDebugOuputhPath(gSystem->pwd());
176 AliAnalysisDataContainer *cinput4 = mgr->GetCommonInputContainer();
177 mgr->ConnectInput(mcTracking,0,cinput4);
178 //
179 AliAnalysisDataContainer *coutput4
180 =mgr->CreateContainer("mcTask", TObjArray::Class(),
181 AliAnalysisManager::kOutputContainer,
182 "OutputMC.root");
183 mgr->ConnectOutput(mcTracking,0,coutput4);
184
185
186
e7babc5b 187 //
188 if (!mgr->InitAnalysis()) return 0;
189 return mgr;
190}
191
192void AddComparison( AliGenInfoTask * task){
193
194 // Create ESD track reconstruction cuts
195 AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts();
196 if(pRecInfoCuts) {
197 pRecInfoCuts->SetPtRange(0.15,200.0);
198 pRecInfoCuts->SetMaxAbsTanTheta(1.0);
199 pRecInfoCuts->SetMinNClustersTPC(10);
200 pRecInfoCuts->SetMinNClustersITS(2);
201 pRecInfoCuts->SetMinTPCsignalN(50);
202
203 pRecInfoCuts->SetHistogramsOn(kFALSE);
204 } else {
205 AliDebug(AliLog::kError, "ERROR: Cannot create AliRecInfoCuts object");
206 }
207
208 // Create MC track reconstruction cuts
209 AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts();
210 if(pMCInfoCuts) {
211 pMCInfoCuts->SetMinRowsWithDigits(50);
212 pMCInfoCuts->SetMaxR(0.001);
213 pMCInfoCuts->SetMaxVz(0.001);
214 pMCInfoCuts->SetRangeTPCSignal(0.5,1.4);
215 } else {
216 AliDebug(AliLog::kError, "ERROR: Cannot AliMCInfoCuts object");
217 }
218
219 //
220 // Create comparison objects and set cuts
221 //
222
223 // Resolution
224 AliComparisonRes *pCompRes = new AliComparisonRes("AliComparisonRes","AliComparisonRes");
225 if(!pCompRes) {
226 AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonRes object");
227 }
228 pCompRes->SetAliRecInfoCuts(pRecInfoCuts);
229 pCompRes->SetAliMCInfoCuts(pMCInfoCuts);
230
231 // Efficiency
232 AliComparisonEff *pCompEff = new AliComparisonEff("AliComparisonEff","AliComparisonEff");
233 if(!pCompEff) {
234 AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonEff object");
235 }
236 pCompEff->SetAliRecInfoCuts(pRecInfoCuts);
237 pCompEff->SetAliMCInfoCuts(pMCInfoCuts);
238
239 // dE/dx
240 AliComparisonDEdx *pCompDEdx = new AliComparisonDEdx("AliComparisonDEdx","AliComparisonDEdx");
241 if(!pCompDEdx) {
242 AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDEdx object");
243 }
244 pCompDEdx->SetAliRecInfoCuts(pRecInfoCuts);
245 pCompDEdx->SetAliMCInfoCuts(pMCInfoCuts);
246 pCompDEdx->SetMCPtMin(0.5);
247 pCompDEdx->SetMCAbsTanThetaMax(0.5);
248 pCompDEdx->SetMCPdgCode(pMCInfoCuts->GetPiP()); // only pi+ particles
249
250 // DCA
251 AliComparisonDCA *pCompDCA = new AliComparisonDCA("AliComparisonDCA","AliComparisonDCA");
252 if(!pCompDCA) {
253 AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDCA object");
254 }
255 pCompDCA->SetAliRecInfoCuts(pRecInfoCuts);
256 pCompDCA->SetAliMCInfoCuts(pMCInfoCuts);
257 //
258 //
259 //
260 task->AddComparisonObject( pCompRes );
261 task->AddComparisonObject( pCompEff );
262 task->AddComparisonObject( pCompDEdx );
263 task->AddComparisonObject( pCompDCA );
264}
265
266
267