]>
Commit | Line | Data |
---|---|---|
296dd262 | 1 | void Load(const char* taskName, Bool_t debug) |
2 | { | |
3 | TString compileTaskName; | |
4 | compileTaskName.Form("%s.cxx++", taskName); | |
5 | if (debug) | |
6 | compileTaskName += "g"; | |
7 | ||
8 | if (gProof) { | |
9 | gProof->Load(compileTaskName); | |
10 | } else | |
11 | gROOT->Macro(compileTaskName); | |
12 | ||
13 | // Enable debug printouts | |
14 | if (debug) | |
15 | { | |
16 | AliLog::SetClassDebugLevel(taskName, AliLog::kDebug+2); | |
17 | } | |
18 | else | |
19 | AliLog::SetClassDebugLevel(taskName, AliLog::kWarning); | |
20 | } | |
21 | ||
22 | void run(const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Int_t aProof = kFALSE, const char* option = "") | |
23 | { | |
24 | // aProof option: 0 no proof | |
25 | // 1 proof with chain | |
26 | // 2 proof with dataset | |
27 | // | |
28 | // option is passed to the task(s) | |
29 | ||
30 | if (nRuns < 0) | |
31 | nRuns = 1234567890; | |
32 | ||
33 | if (aProof > 0) | |
34 | { | |
5c860273 | 35 | //TProof::Mgr("alicecaf")->SetROOTVersion("v5-24-00a"); |
36 | //TProof::Open("alicecaf", "valgrind=workers#4"); | |
296dd262 | 37 | TProof::Open("alicecaf"); |
38 | //gProof->SetParallel(2); | |
39 | ||
40 | // Enable the needed package | |
41 | if (1) | |
42 | { | |
43 | gProof->UploadPackage("$ALICE_ROOT/STEERBase"); | |
44 | gProof->EnablePackage("$ALICE_ROOT/STEERBase"); | |
45 | gProof->UploadPackage("$ALICE_ROOT/ESD"); | |
46 | gProof->EnablePackage("$ALICE_ROOT/ESD"); | |
47 | gProof->UploadPackage("$ALICE_ROOT/AOD"); | |
48 | gProof->EnablePackage("$ALICE_ROOT/AOD"); | |
49 | gProof->UploadPackage("$ALICE_ROOT/ANALYSIS"); | |
50 | gProof->EnablePackage("$ALICE_ROOT/ANALYSIS"); | |
51 | gProof->UploadPackage("$ALICE_ROOT/ANALYSISalice"); | |
52 | gProof->EnablePackage("$ALICE_ROOT/ANALYSISalice"); | |
53 | } | |
54 | else | |
55 | { | |
56 | gProof->UploadPackage("$ALICE_ROOT/AF-v4-18-12-AN.par"); | |
57 | gProof->EnablePackage("AF-v4-18-12-AN"); | |
58 | } | |
296dd262 | 59 | } |
60 | else | |
61 | { | |
62 | gSystem->AddIncludePath("-I${ALICE_ROOT}/include/ -I${ALICE_ROOT}/PWG0/ -I${ALICE_ROOT}/PWG0/dNdEta/"); | |
63 | gSystem->Load("libVMC"); | |
64 | gSystem->Load("libTree"); | |
65 | gSystem->Load("libProof"); | |
66 | gSystem->Load("libSTEERBase"); | |
67 | gSystem->Load("libESD"); | |
68 | gSystem->Load("libAOD"); | |
69 | gSystem->Load("libANALYSIS"); | |
70 | gSystem->Load("libANALYSISalice"); | |
71 | gSystem->Load("libPWG0base"); | |
72 | gSystem->Load("libPWG0dep"); | |
73 | } | |
74 | ||
75 | // Create the analysis manager | |
76 | mgr = new AliAnalysisManager; | |
77 | ||
78 | // Add ESD handler | |
79 | AliESDInputHandler* esdH = new AliESDInputHandler; | |
80 | esdH->SetInactiveBranches("AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks Kinks Cascades AliESDTZERO MuonTracks TrdTracks CaloClusters"); | |
81 | mgr->SetInputEventHandler(esdH); | |
82 | ||
83 | cInput = mgr->GetCommonInputContainer(); | |
84 | ||
85 | Load("AliEventStatsTask", aDebug); | |
86 | TString optStr(option); | |
87 | ||
88 | // remove SAVE option if set | |
89 | Bool_t save = kFALSE; | |
90 | if (optStr.Contains("SAVE")) | |
91 | { | |
92 | optStr = optStr(0,optStr.Index("SAVE")) + optStr(optStr.Index("SAVE")+4, optStr.Length()); | |
93 | save = kTRUE; | |
94 | } | |
95 | ||
96 | task = new AliEventStatsTask(optStr); | |
b43e01ed | 97 | physicsSelection = new AliPhysicsSelection; |
f4ca8f20 | 98 | if (aDebug) |
99 | AliLog::SetClassDebugLevel("AliPhysicsSelection", AliLog::kDebug); | |
b43e01ed | 100 | task->SetPhysicsSelection(physicsSelection); |
f4ca8f20 | 101 | //AliBackgroundSelection* background = new AliBackgroundSelection("AliBackgroundSelection", "AliBackgroundSelection"); |
102 | //physicsSelection->AddBackgroundIdentification(background); | |
b43e01ed | 103 | |
296dd262 | 104 | mgr->AddTask(task); |
105 | ||
106 | // Attach input | |
107 | mgr->ConnectInput(task, 0, cInput); | |
108 | ||
109 | // Attach output | |
110 | cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer); | |
111 | mgr->ConnectOutput(task, 1, cOutput); | |
112 | ||
113 | // Enable debug printouts | |
114 | if (aDebug) | |
115 | mgr->SetDebugLevel(2); | |
116 | ||
117 | // Run analysis | |
118 | mgr->InitAnalysis(); | |
119 | mgr->PrintStatus(); | |
120 | ||
121 | if (aProof == 2) | |
122 | { | |
123 | // process dataset | |
124 | ||
125 | mgr->StartAnalysis("proof", data, nRuns, offset); | |
126 | ||
127 | if (save) | |
128 | { | |
129 | TString path("maps/"); | |
130 | path += TString(data).Tokenize("/")->Last()->GetName(); | |
131 | ||
132 | gSystem->mkdir(path, kTRUE); | |
133 | gSystem->Rename("event_stats.root", path + "/event_stats.root"); | |
134 | ||
135 | Printf(">>>>> Moved files to %s", path.Data()); | |
136 | } | |
137 | } | |
138 | else if (aProof == 3) | |
139 | { | |
140 | gROOT->ProcessLine(".L CreateChainFromDataSet.C"); | |
141 | ds = gProof->GetDataSet(data)->GetStagedSubset(); | |
142 | file = TFile::Open("dataset.root", "RECREATE"); | |
143 | ds->Write("dataset"); | |
144 | file->Close(); | |
145 | chain = CreateChainFromDataSet(ds); | |
146 | mgr->StartAnalysis("local", chain, nRuns, offset); | |
147 | } | |
148 | else if (aProof == -1) | |
149 | { | |
150 | gROOT->ProcessLine(".L CreateChainFromDataSet.C"); | |
151 | TFile::Open("dataset.root"); | |
152 | ds = (TFileCollection*) gFile->Get("dataset"); | |
153 | chain = CreateChainFromDataSet(ds); | |
154 | mgr->StartAnalysis("local", chain, nRuns, offset); | |
155 | } | |
156 | else | |
157 | { | |
158 | // Create chain of input files | |
159 | gROOT->LoadMacro("../CreateESDChain.C"); | |
160 | ||
161 | chain = CreateESDChain(data, nRuns, offset); | |
162 | //chain = CreateChain("TE", data, nRuns, offset); | |
163 | ||
164 | mgr->StartAnalysis((aProof > 0) ? "proof" : "local", chain); | |
165 | } | |
166 | ||
167 | } |