]>
Commit | Line | Data |
---|---|---|
5291a23b | 1 | // $Id$ |
2 | /* | |
3 | * Example macro to run an HLT analysis task for comparing the offline | |
4 | * with the HLT esd tree on the GRID. | |
5 | * | |
6 | * The output is a root file containing the histograms defined in the | |
7 | * analysis task. There is one output file per detector. | |
8 | * | |
9 | * Usage: | |
10 | * <pre> | |
11 | * aliroot -b -q -l compare_HLT_offline_grid.C'("full","phos")' 2>&1 | tee task.log | |
12 | * aliroot -b -q -l compare_HLT_offline_grid.C'("full","global")' 2>&1 | tee task.log | |
13 | * aliroot -b -q -l compare_HLT_offline_grid.C 2>&1 | tee task.log | |
14 | * </pre> | |
15 | * | |
16 | * If no argument is specified, ALL detector tasks are run. The GRID mode is by default 'full'. | |
17 | * | |
b71630ca | 18 | * @ingroup alihlt_qa |
5291a23b | 19 | * @author zbyin@mail.ccnu.edu.cn, Kalliopi.Kanaki@ift.uib.no |
20 | */ | |
21 | ||
22 | void compare_HLT_offline_grid(const char* mode = "full", const char* detectorTask="global"){ | |
23 | ||
24 | TStopwatch timer; | |
25 | timer.Start(); | |
26 | ||
27 | gSystem->Load("libTree.so"); | |
28 | gSystem->Load("libGeom.so"); | |
29 | gSystem->Load("libVMC.so"); | |
30 | gSystem->Load("libPhysics.so"); | |
31 | ||
32 | //----------- Loading the required libraries ---------// | |
33 | ||
34 | gSystem->Load("libSTEERBase.so"); | |
35 | gSystem->Load("libESD.so"); | |
36 | gSystem->Load("libAOD.so"); | |
37 | gSystem->Load("libANALYSIS.so"); | |
38 | gSystem->Load("libANALYSISalice.so"); | |
39 | gSystem->Load("libHLTbase.so"); | |
40 | gROOT->ProcessLine(".include $ALICE_ROOT/include"); | |
41 | ||
42 | ||
43 | Bool_t bAll=kFALSE, bTPC=kFALSE, bPHOS=kFALSE, bITS=kFALSE, bGLOBAL=kFALSE; | |
44 | ||
45 | TString allArgs = detectorTask; | |
46 | TString argument; | |
47 | ||
48 | TObjArray *pTokens = allArgs.Tokenize(" "); | |
49 | if(pTokens){ | |
50 | for(int i=0; i<pTokens->GetEntries(); i++){ | |
51 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
52 | if(argument.IsNull()) continue; | |
53 | ||
54 | if(argument.CompareTo("tpc", TString::kIgnoreCase)==0){ | |
55 | bTPC = kTRUE; | |
56 | continue; | |
57 | } | |
58 | if(argument.CompareTo("phos", TString::kIgnoreCase)==0){ | |
59 | bPHOS = kTRUE; | |
60 | continue; | |
61 | } | |
62 | if(argument.CompareTo("its", TString::kIgnoreCase)==0){ | |
63 | bITS = kTRUE; | |
64 | continue; | |
65 | } | |
66 | if(argument.CompareTo("global", TString::kIgnoreCase)==0){ | |
67 | bGLOBAL = kTRUE; | |
68 | continue; | |
69 | } | |
70 | if(argument.CompareTo("all",TString::kIgnoreCase)==0){ | |
71 | bTPC = kTRUE; | |
72 | bPHOS = kTRUE; | |
73 | bITS = kTRUE; | |
74 | bGLOBAL = kTRUE; | |
75 | bAll = kTRUE; | |
76 | continue; | |
77 | } | |
78 | else break; | |
79 | } | |
80 | } | |
81 | ||
82 | //-------- Make the analysis manager ---------------// | |
83 | ||
84 | AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); | |
85 | AliESDInputHandler *esdH = new AliESDInputHandler; | |
86 | esdH->SetReadHLT(); | |
87 | mgr->SetInputEventHandler(esdH); | |
88 | mgr->SetNSysInfo(1000); | |
89 | ||
90 | // Create and configure the alien handler plugin | |
91 | gROOT->LoadMacro("CreateAlienHandler.C"); | |
92 | AliAnalysisGrid *alienHandler = CreateAlienHandler(mode, detectorTask); | |
93 | if (!alienHandler) return; | |
94 | ||
95 | // Connect plugin to the analysis manager | |
96 | mgr->SetGridHandler(alienHandler); | |
97 | ||
98 | //-------------- Compile the analysis tasks ---------- // | |
99 | if(bTPC) gROOT->LoadMacro("AliAnalysisTaskHLTTPC.cxx+"); | |
100 | if(bPHOS) gROOT->LoadMacro("AliAnalysisTaskHLTPHOS.cxx+"); | |
101 | if(bITS) gROOT->LoadMacro("AliAnalysisTaskHLTITS.cxx+"); | |
102 | if(bGLOBAL) gROOT->LoadMacro("AliAnalysisTaskHLT.cxx+"); | |
103 | ||
104 | ||
105 | //-------------- define the tasks ------------// | |
106 | ||
107 | if(bTPC){ | |
108 | AliAnalysisTaskHLTTPC *taskTPC = new AliAnalysisTaskHLTTPC("offhlt_comparison_TPC"); | |
109 | mgr->AddTask(taskTPC); | |
110 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tpc_histograms", TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-TPC-comparison.root"); | |
111 | mgr->ConnectInput(taskTPC,0,mgr->GetCommonInputContainer()); | |
112 | mgr->ConnectOutput(taskTPC,1,coutput1); | |
113 | } | |
114 | ||
115 | if(bPHOS){ | |
116 | AliAnalysisTaskHLTPHOS *taskPHOS = new AliAnalysisTaskHLTPHOS("offhlt_comparison_PHOS"); | |
117 | mgr->AddTask(taskPHOS); | |
118 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("phos_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-PHOS-comparison.root"); | |
119 | mgr->ConnectInput(taskPHOS,0,mgr->GetCommonInputContainer()); | |
120 | mgr->ConnectOutput(taskPHOS,1,coutput2); | |
121 | } | |
122 | ||
123 | if(bITS){ | |
124 | AliAnalysisTaskHLTITS *taskITS = new AliAnalysisTaskHLTITS("offhlt_comparison_ITS"); | |
125 | mgr->AddTask(taskITS); | |
126 | AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("its_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-ITS-comparison.root"); | |
127 | mgr->ConnectInput(taskITS,0,mgr->GetCommonInputContainer()); | |
128 | mgr->ConnectOutput(taskITS,1,coutput3); | |
129 | } | |
130 | ||
131 | if(bGLOBAL){ | |
132 | AliAnalysisTaskHLT *taskGLOBAL = new AliAnalysisTaskHLT("offhlt_comparison_GLOBAL"); | |
133 | mgr->AddTask(taskGLOBAL); | |
134 | AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("global_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-GLOBAL-comparison.root"); | |
135 | mgr->ConnectInput(taskGLOBAL,0,mgr->GetCommonInputContainer()); | |
136 | mgr->ConnectOutput(taskGLOBAL,1,coutput4); | |
137 | } | |
138 | ||
139 | // Enable debug printouts | |
140 | mgr->SetDebugLevel(2); | |
141 | ||
142 | if (!mgr->InitAnalysis()) return; | |
143 | mgr->PrintStatus(); | |
144 | mgr->StartAnalysis("grid"); | |
145 | ||
146 | timer.Stop(); | |
147 | timer.Print(); | |
148 | } |