]>
Commit | Line | Data |
---|---|---|
ff8c4f30 | 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 | ||
53e8ea6f | 22 | void GetTimes(UInt_t run, Int_t* startTime = 0, Int_t* endTime = 0) |
c8d3e441 | 23 | { |
24 | gSystem->Load("libXMLParser"); | |
25 | gSystem->Load("libXMLIO"); | |
26 | gSystem->Load("libCDB"); | |
27 | gSystem->Load("libSTEER"); | |
28 | ||
29 | AliCDBManager * man = AliCDBManager::Instance(); | |
61899827 | 30 | man->SetDefaultStorage("alien://folder=/alice/data/2009/OCDB"); |
31 | //man->SetRun(run); | |
c8d3e441 | 32 | AliCDBPath cdb("GRP", "GRP", "Data"); |
61899827 | 33 | obj = man->Get(cdb, run); |
c8d3e441 | 34 | grp = (AliGRPObject*) obj->GetObject(); |
35 | ||
36 | if (startTime) | |
37 | *startTime = grp->GetTimeStart(); | |
38 | if (endTime) | |
39 | *endTime = grp->GetTimeEnd(); | |
40 | ||
41 | Printf("Got start and endtime from OCDB: %d, %d", grp->GetTimeStart(), grp->GetTimeEnd()); | |
42 | } | |
43 | ||
53e8ea6f | 44 | void run(const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Int_t aProof = kFALSE, Int_t startTime = 0, Int_t endTime = 0, const char* option = "") |
ff8c4f30 | 45 | { |
46 | // aProof option: 0 no proof | |
47 | // 1 proof with chain | |
48 | // 2 proof with dataset | |
49 | // | |
50 | // option is passed to the task(s) | |
c8d3e441 | 51 | |
52 | /* | |
53 | .x run.C("/PWG0/jgrosseo/ERP_run98097", -1, 0, kFALSE, 2, 1258045012, 1258045458) | |
54 | .x run.C("/PWG0/jgrosseo/ERP_run98576", -1, 0, kFALSE, 2, 1258123911, 1258124103) | |
55 | .x run.C("/PWG0/jgrosseo/ERP_run98569", -1, 0, kFALSE, 2, 1258122187, 1258122524) | |
c01a136b | 56 | .x run.C("/PWG0/jgrosseo/run101235", -1, 0, kFALSE, 2, 1258821541, 1258822595) |
57 | .x run.C("/PWG0/jgrosseo/bgRuns_101424to102689_allITS_2", -1, 0, kFALSE, 2, 1258950519, 1259567587) | |
58 | .x run.C("/PWG0/jgrosseo/run000102556", -1, 0, kFALSE, 2, 1259481473, 1259494364) | |
c2fff146 | 59 | |
60 | timestamps: | |
c01a136b | 61 | .x run.C("/ALIREC/aliprod/run101498", -1, 0, kFALSE, 2, 1258990726, 1258993311) |
c2fff146 | 62 | orbits: |
c01a136b | 63 | .x run.C("/ALIREC/aliprod/run101498", -1, 0, kFALSE, 2, 13587, 16749493) |
64 | ||
65 | .x run.C("/ALIREC/aliprod/run104044", -1, 0, 1, 2, 1260078397, 1260082975) | |
66 | ||
67 | .x run.C("/ALIREC/aliprod/run104065", -1, 0, 1, 2, 1260084071, 1260084250) | |
68 | .x run.C("/ALIREC/aliprod/run104065", -1, 0, 1, 2, 1353, 1504) | |
69 | ||
70 | .x run.C("/ALIREC/aliprod/run104321", -1, 0, 1, 2, 1260237771, 1260249377) | |
71 | ||
c8d3e441 | 72 | */ |
ff8c4f30 | 73 | |
74 | if (nRuns < 0) | |
75 | nRuns = 1234567890; | |
76 | ||
77 | if (aProof) | |
78 | { | |
53e8ea6f | 79 | //TProof::Mgr("alicecaf")->SetROOTVersion("v5-24-00a"); |
ff8c4f30 | 80 | TProof::Open("alicecaf"); |
81 | //gProof->SetParallel(1); | |
82 | ||
83 | // Enable the needed package | |
53e8ea6f | 84 | if (1) |
ff8c4f30 | 85 | { |
86 | gProof->UploadPackage("$ALICE_ROOT/STEERBase"); | |
87 | gProof->EnablePackage("$ALICE_ROOT/STEERBase"); | |
88 | gProof->UploadPackage("$ALICE_ROOT/ESD"); | |
89 | gProof->EnablePackage("$ALICE_ROOT/ESD"); | |
90 | gProof->UploadPackage("$ALICE_ROOT/AOD"); | |
91 | gProof->EnablePackage("$ALICE_ROOT/AOD"); | |
92 | gProof->UploadPackage("$ALICE_ROOT/ANALYSIS"); | |
93 | gProof->EnablePackage("$ALICE_ROOT/ANALYSIS"); | |
94 | gProof->UploadPackage("$ALICE_ROOT/ANALYSISalice"); | |
95 | gProof->EnablePackage("$ALICE_ROOT/ANALYSISalice"); | |
96 | } | |
97 | else | |
98 | { | |
c01a136b | 99 | gProof->UploadPackage("$ALICE_ROOT/AF-v4-18-12-AN.par"); |
100 | gProof->EnablePackage("AF-v4-18-12-AN"); | |
ff8c4f30 | 101 | } |
102 | ||
103 | gProof->UploadPackage("$ALICE_ROOT/PWG0base"); | |
104 | gProof->EnablePackage("$ALICE_ROOT/PWG0base"); | |
105 | } | |
106 | else | |
107 | { | |
108 | gSystem->AddIncludePath("-I${ALICE_ROOT}/include/ -I${ALICE_ROOT}/PWG0/ -I${ALICE_ROOT}/PWG0/dNdEta/"); | |
109 | gSystem->Load("libVMC"); | |
110 | gSystem->Load("libTree"); | |
111 | gSystem->Load("libProof"); | |
112 | gSystem->Load("libSTEERBase"); | |
113 | gSystem->Load("libESD"); | |
114 | gSystem->Load("libAOD"); | |
115 | gSystem->Load("libANALYSIS"); | |
116 | gSystem->Load("libANALYSISalice"); | |
117 | gSystem->Load("libPWG0base"); | |
118 | } | |
c8d3e441 | 119 | |
120 | if (startTime == endTime && startTime > 0) | |
121 | { | |
122 | // get times from OCDB, startTime must be run number | |
123 | ||
124 | // WARNING only works if your par files loaded above are compatible with the libraries loaded here... | |
125 | GetTimes(startTime, &startTime, &endTime); | |
126 | } | |
ff8c4f30 | 127 | |
128 | // Create the analysis manager | |
129 | mgr = new AliAnalysisManager; | |
130 | ||
131 | // Add ESD handler | |
132 | AliESDInputHandler* esdH = new AliESDInputHandler; | |
133 | esdH->SetInactiveBranches("AliESDACORDE ALIESDTZERO AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks Kinks Cascades AliESDTZERO ALIESDACORDE MuonTracks TrdTracks CaloClusters"); | |
134 | mgr->SetInputEventHandler(esdH); | |
135 | ||
136 | cInput = mgr->GetCommonInputContainer(); | |
137 | ||
138 | Load("AliTriggerTask", aDebug); | |
139 | TString optStr(option); | |
c01a136b | 140 | |
141 | // remove SAVE option if set | |
142 | Bool_t save = kFALSE; | |
143 | if (optStr.Contains("SAVE")) | |
144 | { | |
145 | optStr = optStr(0,optStr.Index("SAVE")) + optStr(optStr.Index("SAVE")+4, optStr.Length()); | |
146 | save = kTRUE; | |
147 | } | |
148 | ||
ff8c4f30 | 149 | task = new AliTriggerTask(optStr); |
c8d3e441 | 150 | task->SetTimes(startTime, endTime); |
c2fff146 | 151 | //task->SetUseOrbits(kTRUE); |
53e8ea6f | 152 | |
153 | physicsSelection = new AliPhysicsSelection; | |
154 | if (startTime == -1) | |
155 | physicsSelection->SetAnalyzeMC(); | |
156 | task->SetPhysicsSelection(physicsSelection); | |
157 | AliBackgroundSelection* backgroundSelection = new AliBackgroundSelection; | |
158 | physicsSelection->AddBackgroundIdentification(backgroundSelection); | |
ff8c4f30 | 159 | |
160 | mgr->AddTask(task); | |
161 | ||
162 | // Attach input | |
163 | mgr->ConnectInput(task, 0, cInput); | |
164 | ||
165 | // Attach output | |
166 | cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer); | |
167 | mgr->ConnectOutput(task, 0, cOutput); | |
168 | ||
169 | // Enable debug printouts | |
170 | if (aDebug) | |
171 | mgr->SetDebugLevel(2); | |
172 | ||
173 | // Run analysis | |
174 | mgr->InitAnalysis(); | |
175 | mgr->PrintStatus(); | |
176 | ||
177 | if (aProof == 2) | |
178 | { | |
179 | // process dataset | |
180 | ||
181 | mgr->StartAnalysis("proof", data, nRuns, offset); | |
c01a136b | 182 | |
183 | if (save) | |
184 | { | |
185 | TString path("maps/"); | |
186 | path += TString(data).Tokenize("/")->Last()->GetName(); | |
187 | ||
188 | gSystem->mkdir(path, kTRUE); | |
189 | gSystem->Rename("trigger.root", path + "/trigger.root"); | |
190 | ||
191 | Printf(">>>>> Moved files to %s", path.Data()); | |
192 | } | |
ff8c4f30 | 193 | } |
194 | else if (aProof == 3) | |
195 | { | |
196 | gROOT->ProcessLine(".L CreateChainFromDataSet.C"); | |
197 | ds = gProof->GetDataSet(data)->GetStagedSubset(); | |
53e8ea6f | 198 | chain = CreateChainFromDataSet(ds, "esdTree", nRuns); |
ff8c4f30 | 199 | mgr->StartAnalysis("local", chain, nRuns, offset); |
200 | } | |
201 | else | |
202 | { | |
203 | // Create chain of input files | |
204 | gROOT->LoadMacro("../CreateESDChain.C"); | |
205 | ||
206 | chain = CreateESDChain(data, nRuns, offset); | |
207 | //chain = CreateChain("TE", data, nRuns, offset); | |
208 | ||
209 | mgr->StartAnalysis((aProof > 0) ? "proof" : "local", chain); | |
210 | } | |
c01a136b | 211 | |
ff8c4f30 | 212 | } |