3 Sequence hot to se the PWG1 analysis tasks:
6 //1. Load libraries if needed:
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");
15 AliLog::SetGlobalLogLevel(AliLog::kError);
17 //2. Make a chain e.g.:
19 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
20 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
21 AliXRDPROOFtoolkit tool;
22 TChain * chainEsd = tool.MakeChain("esd.txt","esdTree",0,5);
27 //3. Make a analysis manager with attached task:
28 .L $ALICE_ROOT/PWG1/macros/taskComp.C
30 AliAnalysisManager *mgr = MakeManager();
32 //4. Process task localy
34 mgr->SetNSysInfo(100);
35 mgr->SetDebugLevel(1);
36 mgr->StartAnalysis("local",chainEsd);
39 //4. Process task on proof
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);
51 TString path=gSystem->pwd();
52 TString execCDB="gROOT->Macro(\"";
53 execCDB+=path+"/ConfigOCDB.C\"\)";
54 gProof->Exec(execCDB->Data(),kFALSE);
56 mgr->StartAnalysis("proof",chainEsd);
57 //5. Get debug stream - if speciefied
58 TFile f("mcTaskDebug.root");
59 TTree *treeCMP = (TTree*)f.Get("RC");
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");
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);
72 chainTr->SetProof(kTRUE);
73 TChain * chainTPC = tool.MakeChain("tpc.txt","Crefit",0,50);
75 chainTr->SetProof(kTRUE);
77 TChain * chainTracking = tool.MakeChain("mctracking.txt","MCupdate",0,50);
78 chainTracking->Lookup();
79 chainTracking->SetProof(kTRUE);
83 TFile f("mcTaskDebug.root");
84 TTree *treeCMP = (TTree*)f.Get("RC");
90 void AddComparison( AliGenInfoTask * task);
94 // Init mag field and the geo manager
96 TGeoManager::Import("/u/miranov/proof/geometry.root");
97 AliGeomManager::LoadGeometry("/u/miranov/proof/geometry.root");
99 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
104 AliAnalysisManager * MakeManager(){
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);
116 AliMCEventHandler* mcHandler = new AliMCEventHandler();
117 mgr->SetMCtruthEventHandler(mcHandler);
121 AliGenInfoTask *genTask = new AliGenInfoTask("genTask");
122 genTask->SetStreamLevel(10);
123 genTask->SetDebugLevel(10);
124 genTask->SetDebugOuputhPath(Form("%s/",gSystem->pwd()));
126 // //AddComparison(genTask);
127 // mgr->AddTask(genTask);
130 // AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
131 // mgr->ConnectInput(genTask,0,cinput1);
133 // AliAnalysisDataContainer *coutput1
134 // =mgr->CreateContainer("AliComparisonRes",TObjArray::Class(),
135 // AliAnalysisManager::kOutputContainer,
137 // mgr->ConnectOutput(genTask,0,coutput1);
144 AliTPCtaskPID *pidTask = new AliTPCtaskPID("pidTask");
145 mgr->AddTask(pidTask);
146 AliAnalysisDataContainer *cinput2 = mgr->GetCommonInputContainer();
147 mgr->ConnectInput(pidTask,0,cinput2);
149 AliAnalysisDataContainer *coutput2
150 =mgr->CreateContainer("tpcTaskPID", TObjArray::Class(),
151 AliAnalysisManager::kOutputContainer,
153 mgr->ConnectOutput(pidTask,0,coutput2);
158 AliTPCtaskQA *qaTask = new AliTPCtaskQA("qaTask");
159 mgr->AddTask(qaTask);
160 AliAnalysisDataContainer *cinput3 = mgr->GetCommonInputContainer();
161 mgr->ConnectInput(qaTask,0,cinput3);
163 AliAnalysisDataContainer *coutput3
164 =mgr->CreateContainer("tpcTaskQA", TObjArray::Class(),
165 AliAnalysisManager::kOutputContainer,
167 mgr->ConnectOutput(qaTask,0,coutput3);
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);
179 AliAnalysisDataContainer *coutput4
180 =mgr->CreateContainer("mcTask", TObjArray::Class(),
181 AliAnalysisManager::kOutputContainer,
183 mgr->ConnectOutput(mcTracking,0,coutput4);
188 if (!mgr->InitAnalysis()) return 0;
192 void AddComparison( AliGenInfoTask * task){
194 // Create ESD track reconstruction cuts
195 AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts();
197 pRecInfoCuts->SetPtRange(0.15,200.0);
198 pRecInfoCuts->SetMaxAbsTanTheta(1.0);
199 pRecInfoCuts->SetMinNClustersTPC(10);
200 pRecInfoCuts->SetMinNClustersITS(2);
201 pRecInfoCuts->SetMinTPCsignalN(50);
203 pRecInfoCuts->SetHistogramsOn(kFALSE);
205 AliDebug(AliLog::kError, "ERROR: Cannot create AliRecInfoCuts object");
208 // Create MC track reconstruction cuts
209 AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts();
211 pMCInfoCuts->SetMinRowsWithDigits(50);
212 pMCInfoCuts->SetMaxR(0.001);
213 pMCInfoCuts->SetMaxVz(0.001);
214 pMCInfoCuts->SetRangeTPCSignal(0.5,1.4);
216 AliDebug(AliLog::kError, "ERROR: Cannot AliMCInfoCuts object");
220 // Create comparison objects and set cuts
224 AliComparisonRes *pCompRes = new AliComparisonRes("AliComparisonRes","AliComparisonRes");
226 AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonRes object");
228 pCompRes->SetAliRecInfoCuts(pRecInfoCuts);
229 pCompRes->SetAliMCInfoCuts(pMCInfoCuts);
232 AliComparisonEff *pCompEff = new AliComparisonEff("AliComparisonEff","AliComparisonEff");
234 AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonEff object");
236 pCompEff->SetAliRecInfoCuts(pRecInfoCuts);
237 pCompEff->SetAliMCInfoCuts(pMCInfoCuts);
240 AliComparisonDEdx *pCompDEdx = new AliComparisonDEdx("AliComparisonDEdx","AliComparisonDEdx");
242 AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDEdx object");
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
251 AliComparisonDCA *pCompDCA = new AliComparisonDCA("AliComparisonDCA","AliComparisonDCA");
253 AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDCA object");
255 pCompDCA->SetAliRecInfoCuts(pRecInfoCuts);
256 pCompDCA->SetAliMCInfoCuts(pMCInfoCuts);
260 task->AddComparisonObject( pCompRes );
261 task->AddComparisonObject( pCompEff );
262 task->AddComparisonObject( pCompDEdx );
263 task->AddComparisonObject( pCompDCA );