]>
Commit | Line | Data |
---|---|---|
45b90328 | 1 | // runLukeV0.C |
2 | // | |
3 | // Run macro for AliAnalysisTaskLukeV0.cxx/.h with physics selection & PID | |
4 | // | |
5 | // sample proof datasets: | |
6 | // "/alice/sim/LHC10f6a_000126432" (pp MC) | |
7 | // "/alice/data/LHC10c_000120821_p1" (pp) | |
8 | // | |
9 | // "/alice/data/LHC10h_000139172_p2" (PbPb pass 2) | |
10 | // "/alice/data/LHC10h_000138150_p1" (PbPb pass 1) | |
11 | // | |
12 | // Original author: Arvinder Palaha | |
13 | // Adapted by: Luke Hanratty | |
14 | // | |
15 | ||
16 | #define myRunType "proof" // local, proof or grid | |
17 | #define myGridMode "full" // full, test, offline, submit or terminate | |
889bc324 | 18 | #define mybMCtruth 1 // 0 or 1; MCEvent handler is on or off |
19 | #define mybMCphyssel 1 // 0 = real data, 1 = MC | |
20 | #define myNEntries 1234567890 //num //2000 // local and proof mode only; 1234567890 = all | |
21 | #define myFirstEntry 000//8100000 // local and proof mode only - first event | |
22 | #define myProofDataset "/alice/sim/LHC11a10a_000139510" //set path: /alice/data/LHC10h_000139172_p2 = PbPbp2, /alice/sim/LHC11a10a_000139507 = MCPbPb | |
45b90328 | 23 | #define myProofCluster "hanratty@alice-caf.cern.ch" // set proof cluster |
24 | #define myTaskName "luke_task" // set name of this task | |
25 | #define myAPIVersion "V1.1x" // set version of API | |
26 | #define myROOTVersion "v5-28-00e" // set version of Root | |
27 | #define myAliROOTVersion "v4-21-27-AN" // set version of AliRoot | |
28 | #define myLocalFiles "LocalFiles" // should be a txt file with a list of local files | |
29 | #define myNproofWorkers 0 // can limit the maximum number of workers. 0 is default 40. | |
30 | class AliAnalysisGrid; | |
31 | ||
32 | //______________________________________________________________________________ | |
33 | void runLukeV0( | |
34 | const char* runtype = myRunType, | |
35 | const char* gridmode = myGridMode, | |
36 | const bool bMCtruth = mybMCtruth, | |
37 | const bool bMCphyssel = mybMCphyssel, | |
38 | const Long64_t nentries = myNEntries, | |
39 | const Long64_t firstentry = myFirstEntry, | |
40 | const char* proofdataset = myProofDataset, | |
41 | const char* proofcluster = myProofCluster, | |
42 | const char* taskname = myTaskName | |
43 | ) | |
44 | { | |
45 | // check run type | |
46 | if(runtype != "local" && runtype != "proof" && runtype != "grid"){ | |
47 | Printf("\n\tIncorrect run option, check first argument of run macro"); | |
48 | Printf("\tint runtype = local, proof or grid\n"); | |
49 | return; | |
50 | } | |
51 | Printf("%s analysis chosen",runtype); | |
52 | ||
53 | // load libraries | |
4070f709 | 54 | gSystem->Load("libCore"); |
55 | gSystem->Load("libGeom"); | |
56 | gSystem->Load("libVMC"); | |
57 | gSystem->Load("libPhysics"); | |
58 | gSystem->Load("libTree"); | |
59 | gSystem->Load("libSTEERBase"); | |
60 | gSystem->Load("libESD"); | |
61 | gSystem->Load("libAOD"); | |
62 | gSystem->Load("libANALYSIS"); | |
63 | gSystem->Load("libANALYSISalice"); | |
45b90328 | 64 | |
65 | // add aliroot include path | |
66 | gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT"))); | |
67 | gROOT->SetStyle("Plain"); | |
68 | ||
69 | // analysis manager | |
70 | AliAnalysisManager* mgr = new AliAnalysisManager(taskname); | |
71 | ||
72 | // create the alien handler and attach it to the manager | |
73 | AliAnalysisGrid *plugin = CreateAlienHandler(taskname, gridmode, proofcluster, proofdataset); | |
74 | mgr->SetGridHandler(plugin); | |
75 | ||
76 | AliVEventHandler* esdH = new AliESDInputHandler(); | |
77 | mgr->SetInputEventHandler(esdH); | |
78 | ||
79 | // mc event handler | |
80 | if(bMCtruth) { | |
81 | AliMCEventHandler* mchandler = new AliMCEventHandler(); | |
82 | // Not reading track references | |
83 | mchandler->SetReadTR(kFALSE); | |
84 | mgr->SetMCtruthEventHandler(mchandler); | |
85 | } | |
86 | ||
87 | // === Physics Selection Task === | |
88 | // | |
89 | // In SelectCollisionCandidate(), default is kMB, so the task UserExec() | |
90 | // function is only called for these events. | |
91 | // Options are: | |
92 | // kMB Minimum Bias trigger | |
93 | // kMBNoTRD Minimum bias trigger where the TRD is not read out | |
94 | // kMUON Muon trigger | |
95 | // kHighMult High-Multiplicity Trigger | |
96 | // kUserDefined For manually defined trigger selection | |
97 | // | |
98 | // Multiple options possible with the standard AND/OR operators && and || | |
99 | // These all have the usual offline SPD or V0 selections performed. | |
100 | // | |
101 | // With a pointer to the physics selection object using physSelTask->GetPhysicsSelection(), | |
102 | // one can manually set the selected and background classes using: | |
103 | // AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL") | |
104 | // AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL"); | |
105 | // | |
106 | // One can also specify multiple classes at once, or require a class to NOT | |
107 | // trigger, for e.g. | |
108 | // AddBGTriggerClass("+CSMBA-ABCE-NOPF-ALL -CSMBB-ABCE-NOPF-ALL"); | |
109 | // | |
110 | // NOTE that manually setting the physics selection overrides the standard | |
111 | // selection, so it must be done in completeness. | |
112 | // | |
113 | // ALTERNATIVELY, one can make the physics selection inside the task | |
114 | // UserExec(). | |
115 | // For this case, comment out the task->SelectCol.... line, | |
116 | // and see AliBasicTask.cxx UserExec() function for details on this. | |
117 | ||
118 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
119 | AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel); | |
120 | if(!physSelTask) { Printf("no physSelTask"); return; } | |
121 | //AliPhysicsSelection *physSel = physSelTask->GetPhysicsSelection(); | |
122 | //physSel->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL");// #3119 #769"); | |
123 | ||
124 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); | |
125 | AliAnalysisTask *PIDTask = AddTaskPIDResponse(bMCtruth,kTRUE); | |
126 | if(!PIDTask) { Printf("no PIDtask"); return; } | |
127 | ||
128 | // create task | |
129 | gROOT->LoadMacro("AliAnalysisTaskLukeV0.cxx++g"); | |
130 | AliAnalysisTaskSE* task = new AliAnalysisTaskLukeV0(taskname); | |
131 | task->SelectCollisionCandidates(AliVEvent::kMB); // if physics selection performed in UserExec(), this line should be commented | |
132 | mgr->AddTask(task); | |
133 | ||
134 | // set output root file name for different analysis | |
135 | TString outfilename = Form("routput.%s.root",runtype); | |
136 | ||
137 | // create containers for input/output | |
138 | AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); | |
139 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("coutput1", TList::Class(), AliAnalysisManager::kOutputContainer, outfilename); | |
140 | ||
141 | // connect input/output | |
142 | mgr->ConnectInput(task, 0, cinput); | |
143 | mgr->ConnectOutput(task, 1, coutput1); | |
144 | ||
145 | // enable debug printouts | |
146 | mgr->SetDebugLevel(2); | |
147 | if (!mgr->InitAnalysis()) return; | |
148 | mgr->PrintStatus(); | |
149 | ||
150 | // start analysis | |
151 | Printf("Starting Analysis...."); | |
152 | mgr->StartAnalysis(runtype,nentries,firstentry); | |
153 | } | |
154 | ||
155 | //______________________________________________________________________________ | |
156 | AliAnalysisGrid* CreateAlienHandler(const char *taskname, const char *gridmode, const char *proofcluster, const char *proofdataset) | |
157 | { | |
158 | AliAnalysisAlien *plugin = new AliAnalysisAlien(); | |
159 | // Set the run mode (can be "full", "test", "offline", "submit" or "terminate") | |
160 | plugin->SetRunMode(gridmode); | |
161 | ||
162 | // Set versions of used packages | |
163 | plugin->SetAPIVersion(myAPIVersion); | |
164 | plugin->SetROOTVersion(myROOTVersion); | |
165 | plugin->SetAliROOTVersion(myAliROOTVersion); | |
166 | ||
167 | // Declare input data to be processed. | |
168 | ||
169 | // Method 1: Create automatically XML collections using alien 'find' command. | |
170 | // Define production directory LFN | |
171 | plugin->SetGridDataDir("/alice/data/2010/LHC10b"); | |
172 | // On real reconstructed data: | |
173 | // plugin->SetGridDataDir("/alice/data/2009/LHC09d"); | |
174 | // Set data search pattern | |
175 | //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES | |
176 | // Data pattern for reconstructed data | |
177 | plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH | |
178 | plugin->SetRunPrefix("000"); // real data | |
179 | // ...then add run numbers to be considered | |
180 | plugin->AddRunNumber(115514); | |
181 | //plugin->SetRunRange(114917,115322); | |
182 | plugin->SetNrunsPerMaster(1); | |
183 | plugin->SetOutputToRunNo(); | |
184 | // comment out the next line when using the "terminate" option, unless | |
185 | // you want separate merged files for each run | |
186 | plugin->SetMergeViaJDL(); | |
187 | ||
188 | // Method 2: Declare existing data files (raw collections, xml collections, root file) | |
189 | // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir()) | |
190 | // XML collections added via this method can be combined with the first method if | |
191 | // the content is compatible (using or not tags) | |
192 | // plugin->AddDataFile("tag.xml"); | |
193 | // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root"); | |
194 | ||
195 | // Define alien work directory where all files will be copied. Relative to alien $HOME. | |
196 | plugin->SetGridWorkingDir(taskname); | |
197 | ||
198 | // Declare alien output directory. Relative to working directory. | |
199 | plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out | |
200 | ||
201 | // Declare the analysis source files names separated by blancs. To be compiled runtime | |
202 | // using ACLiC on the worker nodes. | |
203 | plugin->SetAnalysisSource("AliAnalysisTaskLukeV0.cxx"); | |
204 | ||
205 | // Declare all libraries (other than the default ones for the framework. These will be | |
206 | // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here. | |
207 | plugin->SetAdditionalLibs("AliAnalysisTaskLukeV0.h AliAnalysisTaskLukeV0.cxx"); | |
208 | ||
209 | // Declare the output file names separated by blancs. | |
210 | // (can be like: file.root or file.root@ALICE::Niham::File) | |
211 | // To only save certain files, use SetDefaultOutputs(kFALSE), and then | |
212 | // SetOutputFiles("list.root other.filename") to choose which files to save | |
213 | plugin->SetDefaultOutputs(); | |
214 | //plugin->SetOutputFiles("list.root"); | |
215 | ||
216 | // Optionally set a name for the generated analysis macro (default MyAnalysis.C) | |
217 | plugin->SetAnalysisMacro(Form("%s.C",taskname)); | |
218 | ||
219 | // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore) | |
220 | plugin->SetSplitMaxInputFileNumber(100); | |
221 | ||
222 | // Optionally modify the executable name (default analysis.sh) | |
223 | plugin->SetExecutable(Form("%s.sh",taskname)); | |
224 | ||
225 | // set number of test files to use in "test" mode | |
226 | plugin->SetNtestFiles(10); | |
227 | ||
228 | // Optionally resubmit threshold. | |
229 | plugin->SetMasterResubmitThreshold(90); | |
230 | ||
231 | // Optionally set time to live (default 30000 sec) | |
232 | plugin->SetTTL(30000); | |
233 | ||
234 | // Optionally set input format (default xml-single) | |
235 | plugin->SetInputFormat("xml-single"); | |
236 | ||
237 | // Optionally modify the name of the generated JDL (default analysis.jdl) | |
238 | plugin->SetJDLName(Form("%s.jdl",taskname)); | |
239 | ||
240 | // Optionally modify job price (default 1) | |
241 | plugin->SetPrice(1); | |
242 | ||
243 | // Optionally modify split mode (default 'se') | |
244 | plugin->SetSplitMode("se"); | |
245 | ||
246 | //---------------------------------------------------------- | |
247 | //--- PROOF MODE SPECIFIC SETTINGS ------------ | |
248 | //---------------------------------------------------------- | |
249 | // Proof cluster | |
250 | plugin->SetProofCluster(proofcluster); | |
251 | // Dataset to be used | |
252 | plugin->SetProofDataSet(proofdataset); | |
253 | // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard | |
254 | plugin->SetProofReset(0); | |
255 | // May limit number of workers | |
256 | plugin->SetNproofWorkers(myNproofWorkers); | |
257 | // May limit the number of workers per slave | |
258 | plugin->SetNproofWorkersPerSlave(1); | |
259 | // May use a specific version of root installed in proof | |
260 | plugin->SetRootVersionForProof("current"); | |
261 | // May set the aliroot mode. Check http://aaf.cern.ch/node/83 | |
262 | plugin->SetAliRootMode("default"); // Loads AF libs by default | |
263 | // May request ClearPackages (individual ClearPackage not supported) | |
264 | plugin->SetClearPackages(kFALSE); | |
265 | // Plugin test mode works only providing a file containing test file locations, used in "local" mode also | |
266 | plugin->SetFileForTestMode(myLocalFiles); // file should contain path name to a local directory containg *ESDs.root etc | |
267 | // Request connection to alien upon connection to grid | |
268 | plugin->SetProofConnectGrid(kFALSE); | |
269 | ||
270 | return plugin; | |
271 | } | |
272 |