TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGUD / DIFFRACTIVE / example / runEx.C
CommitLineData
784b6a81 1// runEx.C
2//
3// run macro for central diffractive example analysis
4//
5// Author: Felix Reidt <felix.reidt@cern.ch>
6//
7// based on:
8// ---
9// Template run macro for AliBasicTask.cxx/.h with example layout of
10// physics selections and options, in macro and task.
11//
12// Author: Arvinder Palaha
13//
14class AliAnalysisGrid;
15
16//______________________________________________________________________________
17void runEx(
18 const char* runtype = "proof", // local, proof or grid
19 const char *gridmode = "full", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & Test work for proof
20 const bool bMCphyssel = 0, // 1 = looking at MC truth or reconstructed, 0 = looking at real data
21 const Long64_t nentries = 2000, // for local and proof mode, ignored in grid mode. Set to 1234567890 for all events.
22 const Long64_t firstentry = 0, // for local and proof mode, ignored in grid mode
23 const char *proofdataset = "/alice/data/LHC10c_000120821_p1", // path to dataset on proof cluster, for proof analysis
24 const char *proofcluster = "alice-caf.cern.ch", // which proof cluster to use in proof mode
25 const char *taskname = "CDex" // sets name of grid generated macros
26 )
27{
28 // check run type
29 if(runtype != "local" && runtype != "proof" && runtype != "grid"){
30 Printf("\n\tIncorrect run option, check first argument of run macro");
31 Printf("\tint runtype = local, proof or grid\n");
32 return;
33 }
34 Printf("%s analysis chosen",runtype);
35
36 // load libraries (to be optimized)
37 gSystem->Load("libCore.so");
38 gSystem->Load("libTree.so");
39 gSystem->Load("libPhysics");
40 gSystem->Load("libMinuit");
41 gSystem->Load("libProof");
42 gSystem->Load("libmicrocern");
43 gSystem->Load("liblhapdf");
44 gSystem->Load("libpythia6");
45 gSystem->Load("libEG");
46 gSystem->Load("libGeom");
47 gSystem->Load("libVMC");
48 gSystem->Load("libEGPythia6");
49 gSystem->Load("libSTEERBase");
50 gSystem->Load("libESD");
51 gSystem->Load("libCDB");
52 gSystem->Load("libRAWDatabase");
53 gSystem->Load("libRAWDatarec");
54 gSystem->Load("libAOD");
55 gSystem->Load("libANALYSIS");
56 gSystem->Load("libANALYSISalice");
57 gSystem->Load("libSTEER");
af472fff 58 gSystem->Load("libTender");
784b6a81 59 gSystem->Load("libRAWDatasim");
60 gSystem->Load("libFASTSIM");
61 gSystem->Load("libEVGEN");
62 gSystem->Load("libAliPythia6");
63 gSystem->Load("libSTAT");
64 gSystem->Load("libhijing");
65 gSystem->Load("libTHijing");
66 gSystem->Load("libSTRUCT");
67 gSystem->Load("libPHOSUtils");
68 gSystem->Load("libPHOSbase");
69 gSystem->Load("libPHOSsim");
70 gSystem->Load("libPHOSrec");
71 gSystem->Load("libMUONcore");
72 gSystem->Load("libMUONmapping");
73 gSystem->Load("libMUONgeometry");
74 gSystem->Load("libMUONcalib");
75 gSystem->Load("libMUONraw");
76 gSystem->Load("libMUONtrigger");
77 gSystem->Load("libMUONbase");
78 gSystem->Load("libMUONsim");
79 gSystem->Load("libMUONrec");
80 gSystem->Load("libMUONevaluation");
81 gSystem->Load("libFMDbase");
82 gSystem->Load("libFMDsim");
83 gSystem->Load("libFMDrec");
84 gSystem->Load("libPMDbase");
85 gSystem->Load("libPMDsim");
86 gSystem->Load("libPMDrec");
87 gSystem->Load("libHMPIDbase");
88 gSystem->Load("libHMPIDsim");
89 gSystem->Load("libHMPIDrec");
90 gSystem->Load("libT0base");
91 gSystem->Load("libT0sim");
92 gSystem->Load("libT0rec");
93 gSystem->Load("libZDCbase");
94 gSystem->Load("libZDCsim");
95 gSystem->Load("libZDCrec");
96 gSystem->Load("libACORDEbase");
97 gSystem->Load("libACORDErec");
98 gSystem->Load("libACORDEsim");
99 gSystem->Load("libVZERObase");
100 gSystem->Load("libVZEROrec");
101 gSystem->Load("libVZEROsim");
102 gSystem->Load("libEMCALraw");
103 gSystem->Load("libEMCALUtils");
104 gSystem->Load("libEMCALbase");
105 gSystem->Load("libEMCALsim");
106 gSystem->Load("libEMCALrec");
107 gSystem->Load("libTPCbase");
108 gSystem->Load("libTPCrec");
109 gSystem->Load("libTPCsim");
784b6a81 110 gSystem->Load("libITSbase");
111 gSystem->Load("libITSsim");
112 gSystem->Load("libITSrec");
113 gSystem->Load("libTRDbase");
114 gSystem->Load("libTRDsim");
115 gSystem->Load("libTRDrec");
116 gSystem->Load("libTOFbase");
117 gSystem->Load("libTOFrec");
118 gSystem->Load("libTOFsim");
119 gSystem->Load("libHLTbase");
120 gSystem->Load("libHLTinterface");
121 gSystem->Load("libHLTsim");
122 gSystem->Load("libHLTrec");
123 gSystem->Load("libPWGPP");
124
125 // add aliroot include path
126 gROOT->ProcessLine(Form(".include %s/include",
127 gSystem->ExpandPathName("$ALICE_ROOT")));
128 gROOT->ProcessLine(Form(".include $ALICE_ROOT/include",
129 gSystem->ExpandPathName("$ALICE_ROOT")));
130 gROOT->ProcessLine(Form(".include $ALICE_ROOT/ITS",
131 gSystem->ExpandPathName("$ALICE_ROOT")));
132 gROOT->ProcessLine(Form(".include $ALICE_ROOT/PWGPP/ITS",
133 gSystem->ExpandPathName("$ALICE_ROOT")));
134
135 gROOT->SetStyle("Plain");
136
137 // create the alien handler and attach it to the manager
138 AliAnalysisGrid *plugin =
139 CreateAlienHandler(taskname, gridmode, proofcluster, proofdataset);
140
141 // analysis manager
142 AliAnalysisManager* mgr = new AliAnalysisManager("CDMeson-Manager");
143 mgr->SetGridHandler(plugin);
144
145 AliESDInputHandler* esdH = new AliESDInputHandler();
146 mgr->SetInputEventHandler(esdH);
147
148 // === Physics Selection Task ===
149 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
150 AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel);
151 if(!physSelTask) { Printf("no physSelTask"); return; }
152
153 // === create user task ===
154 gROOT->LoadMacro("AliCDMesonBaseStripped.cxx+g");
155 gROOT->LoadMacro("AliCDMesonTracks.cxx+g");
156 gROOT->LoadMacro("AliCDMesonUtilsStripped.cxx+g");
157 gROOT->LoadMacro("AliAnalysisTaskCDex.cxx+g");
158
159 AliAnalysisTaskSE* task = new AliAnalysisTaskCDex(taskname);
160 task->SelectCollisionCandidates(AliVEvent::kMB);
161 mgr->AddTask(task);
162
163 // INPUT ---------------------------------------------------------------------
164 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
165 mgr->ConnectInput(task, 0, cinput );
166
167 // OUTPUT --------------------------------------------------------------------
168 // output filename
169 Char_t foutname[100];
649e06c4 170 sprintf(foutname,"diffExample_%s.root",taskname);
784b6a81 171
172 // output containers
173 // in AnalysisTaskSE, slot 0 reserved, must start from 1
174 AliAnalysisDataContainer* output =
649e06c4 175 mgr->CreateContainer("diffExample_Hist", TList::Class(),
784b6a81 176 AliAnalysisManager::kOutputContainer,foutname);
177 task->ConnectOutput(1, output);
178
179 // enable debug printouts
180 mgr->SetDebugLevel(2);
181 //mgr->SetNSysInfo(100);
182 if (!mgr->InitAnalysis()) return;
183 mgr->PrintStatus();
184
185 // start analysis
186 Printf("Starting Analysis....");
187 mgr->StartAnalysis(runtype); //,nentries,firstentry);
188}
189
190//______________________________________________________________________________
191AliAnalysisGrid* CreateAlienHandler(const char *taskname,
192 const char *gridmode,
193 const char *proofcluster,
194 const char *proofdataset)
195{
196 AliAnalysisAlien *plugin = new AliAnalysisAlien();
197 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
198 plugin->SetOverwriteMode();
199 plugin->SetRunMode(gridmode);
200
201 plugin->SetMergeViaJDL(kTRUE);
202
203 // Set versions of used packages
204 plugin->SetAPIVersion("V1.1x");
205 plugin->SetROOTVersion("v5-33-02b");
206 plugin->SetAliROOTVersion("v5-02-Rev-09");
207
208 // Declare input data to be processed.
209 //plugin->SetCheckCopy(kFALSE);
210
211 // Method 1: Create automatically XML collections using alien 'find' command.
212 // Define production directory LFN
213 plugin->SetGridDataDir("/alice/data/2010/LHC10b");
214 // On real reconstructed data:
215 // plugin->SetGridDataDir("/alice/data/2009/LHC09d");
216 // Set data search pattern
217 //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES
218 // Data pattern for reconstructed data
219 plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
220 // plugin->SetDataPattern("ESDs/pass2/AOD038/*AliAOD.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
221 plugin->SetRunPrefix("000"); // real data
222 // ...then add run numbers to be considered
223
224 //Int_t runlist[15]={117039, 146859, 146858, 146856, 146824, 146817, 146806, 146805, 146804, 146803, 146802, 146801, 146748, 146747, 146746};
225 //for (Int_t ind=0; ind<1; ind++) {
226 // plugin->AddRunNumber(runlist[ind]);
227 //}
228 //plugin->SetRunRange(114917,115322);
229 plugin->AddRunNumber(117050);
230
231 plugin->SetNrunsPerMaster(1);
232
233 // Define alien work directory where all files will be copied. Relative to alien $HOME.
234 plugin->SetGridWorkingDir(taskname);
235
236 // Declare alien output directory. Relative to working directory.
237 plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out
238
239 // Declare the analysis source files names separated by blancs. To be compiled runtime
240 // using ACLiC on the worker nodes.
241 plugin->SetAnalysisSource("AliCDMesonBaseStripped.cxx AliCDMesonTracks.cxx AliCDMesonUtilsStripped.cxx AliAnalysisTaskCDex.cxx");
242
243 // Declare all libraries (other than the default ones for the framework. These will be
244 // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
245 plugin->SetAdditionalLibs("libGui.so libCore.so libTree.so libPhysics.so libMinuit.so libProof.so libmicrocern.so liblhapdf.so libpythia6.so libEG.so libGeom.so libVMC.so libEGPythia6.so libSTEERBase.so libESD.so libRAWDatabase.so libRAWDatarec.so libAOD.so libANALYSIS.so libANALYSISalice.so libCDB.so libSTEER.so libRAWDatasim.so libFASTSIM.so libEVGEN.so libAliPythia6.so libSTAT.so libhijing.so libTHijing.so libSTRUCT.so libPHOSUtils.so libPHOSbase.so libPHOSsim.so libPHOSrec.so libMUONcore.so libMUONmapping.so libMUONgeometry.so libMUONcalib.so libMUONraw.so libMUONtrigger.so libMUONbase.so libMUONsim.so libMUONrec.so libMUONevaluation.so libFMDbase.so libFMDsim.so libFMDrec.so libPMDbase.so libPMDsim.so libPMDrec.so libHMPIDbase.so libHMPIDsim.so libHMPIDrec.so libT0base.so libT0sim.so libT0rec.so libZDCbase.so libZDCsim.so libZDCrec.so libACORDEbase.so libACORDErec.so libACORDEsim.so libVZERObase.so libVZEROrec.so libVZEROsim.so libEMCALraw.so libEMCALUtils.so libEMCALbase.so libEMCALsim.so libEMCALrec.so libTPCbase.so libTPCrec.so libTPCsim.so libTPCfast.so libITSbase.so libITSsim.so libITSrec.so libTRDbase.so libTRDsim.so libTRDrec.so libTOFbase.so libTOFrec.so libTOFsim.so libHLTbase.so libHLTinterface.so libHLTsim.so libHLTrec.so AliCDMesonBaseStripped.h AliCDMesonBaseStripped.cxx AliCDMesonTracks.h AliCDMesonTracks.cxx AliCDMesonUtilsStripped.h AliCDMesonUtilsStripped.cxx AliAnalysisTaskCDex.h AliAnalysisTaskCDex.cxx");
246
247 plugin->AddIncludePath("-I$ALICE_ROOT/ITS -I$ALICE_ROOT/PWGPP/ITS");
248
249 // Declare the output file names separated by blancs.
250 // (can be like: file.root or file.root@ALICE::Niham::File)
251 // To only save certain files, use SetDefaultOutputs(kFALSE), and then
252 // SetOutputFiles("list.root other.filename") to choose which files to save
253 plugin->SetDefaultOutputs();
254
255 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
256 plugin->SetAnalysisMacro("CDMeson.C");
257
258 // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
259 plugin->SetSplitMaxInputFileNumber(100);
260
261 // Optionally modify the executable name (default analysis.sh)
262 plugin->SetExecutable("CDMeson.sh");
263
264 // set number of test files to use in "test" mode
265 plugin->SetNtestFiles(1);
266
267 // Optionally resubmit threshold.
268 //plugin->SetMasterResubmitThreshold(90);
269
270 // Optionally set time to live (default 30000 sec)
271 //plugin->SetTTL(30000);
272
273 // Optionally set input format (default xml-single)
274 //plugin->SetInputFormat("xml-single");
275
276 // Optionally modify the name of the generated JDL (default analysis.jdl)
277 plugin->SetJDLName("CDMeson.jdl");
278
279 // Optionally modify job price (default 1)
280 plugin->SetPrice(1);
281
282 // Optionally modify split mode (default 'se')
283 plugin->SetSplitMode("se");
284
285 //----------------------------------------------------------
286 //--- PROOF MODE SPECIFIC SETTINGS ------------
287 //----------------------------------------------------------
288 // Proof cluster
289 plugin->SetProofCluster(proofcluster);
290 // Dataset to be used
291 plugin->SetProofDataSet(proofdataset);
292 // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard
293 plugin->SetProofReset(0);
294 // May limit number of workers
295 plugin->SetNproofWorkers(0);
296 // May limit the number of workers per slave
297 plugin->SetNproofWorkersPerSlave(1);
298 // May use a specific version of root installed in proof
299 plugin->SetRootVersionForProof("current");
300 // May set the aliroot mode. Check http://aaf.cern.ch/node/83
301 plugin->SetAliRootMode("default"); // Loads AF libs by default
302 // May request ClearPackages (individual ClearPackage not supported)
303 plugin->SetClearPackages(kFALSE);
304 // Plugin test mode works only providing a file containing test file locations, used in "local" mode also
305 plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root etc
306 // Request connection to alien upon connection to grid
307 plugin->SetProofConnectGrid(kFALSE);
308 // Other PROOF specific parameters
309 plugin->SetProofParameter("PROOF_UseMergers","-1");
310 printf("Using: PROOF_UseMergers : %s\n", plugin->GetProofParameter("PROOF_UseMergers"));
311
312 return plugin;
313}