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