]>
Commit | Line | Data |
---|---|---|
1 | // run.C | |
2 | // | |
3 | // Template run macro for AliAnalysisTaskLukeAOD.cxx/.h with example layout of | |
4 | // physics selections and options, in macro and task. | |
5 | // | |
6 | // Author: Arvinder Palaha | |
7 | // Edited by Luke Hanratty for AODSExAOD | |
8 | // | |
9 | class AliAnalysisGrid; | |
10 | ||
11 | //______________________________________________________________________________ | |
12 | void runExAOD( | |
13 | const char* runtype = "proof", // local, proof or grid | |
14 | const char *gridmode = "full", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & Test work for proof | |
15 | const bool bMCtruth = 1, // 1 = MCEvent handler is on (MC truth), 0 = MCEvent handler is off (MC reconstructed/real data) | |
16 | const bool bMCphyssel = 1, // 1 = looking at MC truth or reconstructed, 0 = looking at real data | |
17 | const Long64_t nentries = 1000, // for local and proof mode, ignored in grid mode. Set to 1234567890 for all events. | |
18 | const Long64_t firstentry = 0, // for local and proof mode, ignored in grid mode | |
19 | const char *proofdataset = "/alice/sim/LHC11a10a_000138662_AOD048", //"/alice/sim/LHC11a10a_000138795_AOD048", //"/alice/data/LHC10h_000139507_p2_AOD049", //"/alice/data/LHC10e_000130375_p2", //"/alice/data/LHC10c_000120821_p1", // path to dataset on proof cluster, for proof analysis | |
20 | const char *proofcluster = "hanratty@alice-caf.cern.ch", //"alice-caf.cern.ch", //"hanratty@skaf.saske.sk", //"alice-caf.cern.ch", // which proof cluster to use in proof mode | |
21 | const char *taskname = "AOD_AllCent_1" // sets name of grid generated macros | |
22 | ) | |
23 | { | |
24 | // check run type | |
25 | if(runtype != "local" && runtype != "proof" && runtype != "grid"){ | |
26 | Printf("\n\tIncorrect run option, check first argument of run macro"); | |
27 | Printf("\tint runtype = local, proof or grid\n"); | |
28 | return; | |
29 | } | |
30 | Printf("%s analysis chosen",runtype); | |
31 | ||
32 | // load libraries | |
33 | gSystem->Load("libCore.so"); | |
34 | gSystem->Load("libGeom.so"); | |
35 | gSystem->Load("libVMC.so"); | |
36 | gSystem->Load("libPhysics.so"); | |
37 | gSystem->Load("libTree.so"); | |
38 | gSystem->Load("libSTEERBase.so"); | |
39 | gSystem->Load("libESD.so"); | |
40 | gSystem->Load("libAOD.so"); | |
41 | gSystem->Load("libANALYSIS.so"); | |
42 | gSystem->Load("libANALYSISalice.so"); | |
43 | ||
44 | // add aliroot indlude path | |
45 | gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT"))); | |
46 | gROOT->SetStyle("Plain"); | |
47 | ||
48 | // analysis manager | |
49 | AliAnalysisManager* mgr = new AliAnalysisManager(taskname); | |
50 | ||
51 | // create the alien handler and attach it to the manager | |
52 | AliAnalysisGrid *plugin = CreateAlienHandler(taskname, gridmode, proofcluster, proofdataset); | |
53 | mgr->SetGridHandler(plugin); | |
54 | ||
55 | AliVEventHandler* aodH = new AliAODInputHandler(); | |
56 | mgr->SetInputEventHandler(aodH); | |
57 | ||
58 | // mc event handler | |
59 | /*if(bMCtruth) { | |
60 | AliMCEventHandler* mchandler = new AliMCEventHandler(); | |
61 | // Not reading track references | |
62 | mchandler->SetReadTR(kFALSE); | |
63 | mgr->SetMCtruthEventHandler(mchandler); | |
64 | }*/ | |
65 | ||
66 | //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
67 | //AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel); | |
68 | //if(!physSelTask) { Printf("no physSelTask"); return; } | |
69 | //AliPhysicsSelection *physSel = physSelTask->GetPhysicsSelection(); | |
70 | //physSel->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL");// #3119 #769"); | |
71 | ||
72 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
73 | AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel); | |
74 | if(!physSelTask) { Printf("no physSelTask"); return; } | |
75 | ||
76 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); | |
77 | AliAnalysisTask *PIDTask = AddTaskPIDResponse(bMCtruth,kTRUE); | |
78 | if(!PIDTask) { Printf("no PIDtask"); return; } | |
79 | ||
80 | /*gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C"); | |
81 | AliCentralitySelectionTask *centralityTask = AddTaskCentrality(); | |
82 | if(!centralityTask) { Printf("no centralityTask"); return; } | |
83 | */ | |
84 | ||
85 | // create task | |
86 | gROOT->LoadMacro("AliAnalysisTaskLukeAOD.cxx++g"); | |
87 | AliAnalysisTaskSE* task = new AliAnalysisTaskLukeAOD(taskname); | |
88 | task->SelectCollisionCandidates(AliVEvent::kMB); // if physics selection performed in UserExec(), this line should be commented | |
89 | mgr->AddTask(task); | |
90 | ||
91 | // set output root file name for different analysis | |
92 | TString outfilename = Form("list.%s.root",runtype); | |
93 | ||
94 | // create containers for input/output | |
95 | AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); | |
96 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("coutput1", TList::Class(), AliAnalysisManager::kOutputContainer, outfilename); | |
97 | ||
98 | // connect input/output | |
99 | mgr->ConnectInput(task, 0, cinput); | |
100 | mgr->ConnectOutput(task, 1, coutput1); | |
101 | //mgr->ConnectInput (centralityTask,0, mgr->GetCommonInputContainer()); | |
102 | ||
103 | // enable debug printouts | |
104 | mgr->SetDebugLevel(2); | |
105 | if (!mgr->InitAnalysis()) return; | |
106 | mgr->PrintStatus(); | |
107 | ||
108 | // start analysis | |
109 | Printf("Starting Analysis...."); | |
110 | mgr->StartAnalysis(runtype,nentries,firstentry); | |
111 | } | |
112 | ||
113 | //______________________________________________________________________________ | |
114 | AliAnalysisGrid* CreateAlienHandler(const char *taskname, const char *gridmode, const char *proofcluster, const char *proofdataset) | |
115 | { | |
116 | AliAnalysisAlien *plugin = new AliAnalysisAlien(); | |
117 | // Set the run mode (can be "full", "test", "offline", "submit" or "terminate") | |
118 | plugin->SetRunMode(gridmode); | |
119 | ||
120 | // Set versions of used packages | |
121 | plugin->SetAPIVersion("V1.1X"); | |
122 | plugin->SetROOTVersion("v5-30-03"); | |
123 | plugin->SetAliROOTVersion("v5-02-16-AN"); | |
124 | ||
125 | // Declare input data to be processed. | |
126 | ||
127 | // Method 1: Create automatically XML collections using alien 'find' command. | |
128 | // Define production directory LFN | |
129 | plugin->SetGridDataDir("/alice/data/2010/LHC10h"); | |
130 | // On real reconstructed data: | |
131 | // plugin->SetGridDataDir("/alice/data/2009/LHC09d"); | |
132 | // Set data search pattern | |
133 | //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES | |
134 | // Data pattern for reconstructed data | |
135 | plugin->SetDataPattern("*ESDs/pass2/*AOD.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH | |
136 | plugin->SetRunPrefix("000"); // real data | |
137 | // ...then add run numbers to be considered | |
138 | plugin->AddRunNumber(139507); | |
139 | //plugin->SetRunRange(114917,115322); | |
140 | plugin->SetNrunsPerMaster(1); | |
141 | plugin->SetOutputToRunNo(); | |
142 | // comment out the next line when using the "terminate" option, unless | |
143 | // you want separate merged files for each run | |
144 | plugin->SetMergeViaJDL(); | |
145 | ||
146 | // Method 2: Declare existing data files (raw collections, xml collections, root file) | |
147 | // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir()) | |
148 | // XML collections added via this method can be combined with the first method if | |
149 | // the content is compatible (using or not tags) | |
150 | // plugin->AddDataFile("tag.xml"); | |
151 | // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root"); | |
152 | ||
153 | // Define alien work directory where all files will be copied. Relative to alien $HOME. | |
154 | plugin->SetGridWorkingDir(taskname); | |
155 | ||
156 | // Declare alien output directory. Relative to working directory. | |
157 | plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out | |
158 | ||
159 | // Declare the analysis source files names separated by blancs. To be compiled runtime | |
160 | // using ACLiC on the worker nodes. | |
161 | plugin->SetAnalysisSource("AliAnalysisTaskLukeAOD.cxx"); | |
162 | ||
163 | // Declare all libraries (other than the default ones for the framework. These will be | |
164 | // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here. | |
165 | plugin->SetAdditionalLibs("AliAnalysisTaskLukeAOD.h AliAnalysisTaskLukeAOD.cxx"); | |
166 | ||
167 | // Declare the output file names separated by blancs. | |
168 | // (can be like: file.root or file.root@ALICE::Niham::File) | |
169 | // To only save certain files, use SetDefaultOutputs(kFALSE), and then | |
170 | // SetOutputFiles("list.root other.filename") to choose which files to save | |
171 | plugin->SetDefaultOutputs(); | |
172 | //plugin->SetOutputFiles("list.root"); | |
173 | ||
174 | // Optionally set a name for the generated analysis macro (default MyAnalysis.C) | |
175 | plugin->SetAnalysisMacro(Form("%s.C",taskname)); | |
176 | ||
177 | // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore) | |
178 | plugin->SetSplitMaxInputFileNumber(100); | |
179 | ||
180 | // Optionally modify the executable name (default analysis.sh) | |
181 | plugin->SetExecutable(Form("%s.sh",taskname)); | |
182 | ||
183 | // set number of test files to use in "test" mode | |
184 | plugin->SetNtestFiles(10); | |
185 | ||
186 | // Optionally resubmit threshold. | |
187 | plugin->SetMasterResubmitThreshold(90); | |
188 | ||
189 | // Optionally set time to live (default 30000 sec) | |
190 | plugin->SetTTL(30000); | |
191 | ||
192 | // Optionally set input format (default xml-single) | |
193 | plugin->SetInputFormat("xml-single"); | |
194 | ||
195 | // Optionally modify the name of the generated JDL (default analysis.jdl) | |
196 | plugin->SetJDLName(Form("%s.jdl",taskname)); | |
197 | ||
198 | // Optionally modify job price (default 1) | |
199 | plugin->SetPrice(1); | |
200 | ||
201 | // Optionally modify split mode (default 'se') | |
202 | plugin->SetSplitMode("se"); | |
203 | ||
204 | //---------------------------------------------------------- | |
205 | //--- PROOF MODE SPECIFIC SETTINGS ------------ | |
206 | //---------------------------------------------------------- | |
207 | // Proof cluster | |
208 | plugin->SetProofCluster(proofcluster); | |
209 | // Dataset to be used | |
210 | plugin->SetProofDataSet(proofdataset); | |
211 | // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard | |
212 | plugin->SetProofReset(0); | |
213 | // May limit number of workers | |
214 | plugin->SetNproofWorkers(10); | |
215 | // May limit the number of workers per slave | |
216 | plugin->SetNproofWorkersPerSlave(1); | |
217 | // May use a specific version of root installed in proof | |
218 | plugin->SetRootVersionForProof("VO_ALICE@ROOT::v5-30-03-1"); | |
219 | // May set the aliroot mode. Check http://aaf.cern.ch/node/83 | |
220 | plugin->SetAliRootMode("default"); // Loads AF libs by default | |
221 | // May request ClearPackages (individual ClearPackage not supported) | |
222 | plugin->SetClearPackages(kFALSE); | |
223 | // Plugin test mode works only providing a file containing test file locations, used in "local" mode also | |
224 | plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root etc | |
225 | // Request connection to alien upon connection to grid | |
226 | plugin->SetProofConnectGrid(kFALSE); | |
227 | ||
228 | return plugin; | |
229 | } | |
230 |