3 // run macro for central diffractive example analysis
5 // Author: Felix Reidt <felix.reidt@cern.ch>
9 // Template run macro for AliBasicTask.cxx/.h with example layout of
10 // physics selections and options, in macro and task.
12 // Author: Arvinder Palaha
14 class AliAnalysisGrid;
16 //______________________________________________________________________________
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
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");
34 Printf("%s analysis chosen",runtype);
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");
58 gSystem->Load("libTENDER");
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");
110 gSystem->Load("libTPCfast");
111 gSystem->Load("libITSbase");
112 gSystem->Load("libITSsim");
113 gSystem->Load("libITSrec");
114 gSystem->Load("libTRDbase");
115 gSystem->Load("libTRDsim");
116 gSystem->Load("libTRDrec");
117 gSystem->Load("libTOFbase");
118 gSystem->Load("libTOFrec");
119 gSystem->Load("libTOFsim");
120 gSystem->Load("libHLTbase");
121 gSystem->Load("libHLTinterface");
122 gSystem->Load("libHLTsim");
123 gSystem->Load("libHLTrec");
124 gSystem->Load("libPWGPP");
126 // add aliroot include path
127 gROOT->ProcessLine(Form(".include %s/include",
128 gSystem->ExpandPathName("$ALICE_ROOT")));
129 gROOT->ProcessLine(Form(".include $ALICE_ROOT/include",
130 gSystem->ExpandPathName("$ALICE_ROOT")));
131 gROOT->ProcessLine(Form(".include $ALICE_ROOT/ITS",
132 gSystem->ExpandPathName("$ALICE_ROOT")));
133 gROOT->ProcessLine(Form(".include $ALICE_ROOT/PWGPP/ITS",
134 gSystem->ExpandPathName("$ALICE_ROOT")));
136 gROOT->SetStyle("Plain");
138 // create the alien handler and attach it to the manager
139 AliAnalysisGrid *plugin =
140 CreateAlienHandler(taskname, gridmode, proofcluster, proofdataset);
143 AliAnalysisManager* mgr = new AliAnalysisManager("CDMeson-Manager");
144 mgr->SetGridHandler(plugin);
146 AliESDInputHandler* esdH = new AliESDInputHandler();
147 mgr->SetInputEventHandler(esdH);
149 // === Physics Selection Task ===
150 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
151 AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel);
152 if(!physSelTask) { Printf("no physSelTask"); return; }
154 // === create user task ===
155 gROOT->LoadMacro("AliCDMesonBaseStripped.cxx+g");
156 gROOT->LoadMacro("AliCDMesonTracks.cxx+g");
157 gROOT->LoadMacro("AliCDMesonUtilsStripped.cxx+g");
158 gROOT->LoadMacro("AliAnalysisTaskCDex.cxx+g");
160 AliAnalysisTaskSE* task = new AliAnalysisTaskCDex(taskname);
161 task->SelectCollisionCandidates(AliVEvent::kMB);
164 // INPUT ---------------------------------------------------------------------
165 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
166 mgr->ConnectInput(task, 0, cinput );
168 // OUTPUT --------------------------------------------------------------------
170 Char_t foutname[100];
171 sprintf(foutname,"freidt_%s.root",taskname);
174 // in AnalysisTaskSE, slot 0 reserved, must start from 1
175 AliAnalysisDataContainer* output =
176 mgr->CreateContainer("freidt_Hist", TList::Class(),
177 AliAnalysisManager::kOutputContainer,foutname);
178 task->ConnectOutput(1, output);
180 // enable debug printouts
181 mgr->SetDebugLevel(2);
182 //mgr->SetNSysInfo(100);
183 if (!mgr->InitAnalysis()) return;
187 Printf("Starting Analysis....");
188 mgr->StartAnalysis(runtype); //,nentries,firstentry);
191 //______________________________________________________________________________
192 AliAnalysisGrid* CreateAlienHandler(const char *taskname,
193 const char *gridmode,
194 const char *proofcluster,
195 const char *proofdataset)
197 AliAnalysisAlien *plugin = new AliAnalysisAlien();
198 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
199 plugin->SetOverwriteMode();
200 plugin->SetRunMode(gridmode);
202 plugin->SetMergeViaJDL(kTRUE);
204 // Set versions of used packages
205 plugin->SetAPIVersion("V1.1x");
206 plugin->SetROOTVersion("v5-33-02b");
207 plugin->SetAliROOTVersion("v5-02-Rev-09");
209 // Declare input data to be processed.
210 //plugin->SetCheckCopy(kFALSE);
212 // Method 1: Create automatically XML collections using alien 'find' command.
213 // Define production directory LFN
214 plugin->SetGridDataDir("/alice/data/2010/LHC10b");
215 // On real reconstructed data:
216 // plugin->SetGridDataDir("/alice/data/2009/LHC09d");
217 // Set data search pattern
218 //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES
219 // Data pattern for reconstructed data
220 plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
221 // plugin->SetDataPattern("ESDs/pass2/AOD038/*AliAOD.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
222 plugin->SetRunPrefix("000"); // real data
223 // ...then add run numbers to be considered
225 //Int_t runlist[15]={117039, 146859, 146858, 146856, 146824, 146817, 146806, 146805, 146804, 146803, 146802, 146801, 146748, 146747, 146746};
226 //for (Int_t ind=0; ind<1; ind++) {
227 // plugin->AddRunNumber(runlist[ind]);
229 //plugin->SetRunRange(114917,115322);
230 plugin->AddRunNumber(117050);
232 plugin->SetNrunsPerMaster(1);
234 // Define alien work directory where all files will be copied. Relative to alien $HOME.
235 plugin->SetGridWorkingDir(taskname);
237 // Declare alien output directory. Relative to working directory.
238 plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out
240 // Declare the analysis source files names separated by blancs. To be compiled runtime
241 // using ACLiC on the worker nodes.
242 plugin->SetAnalysisSource("AliCDMesonBaseStripped.cxx AliCDMesonTracks.cxx AliCDMesonUtilsStripped.cxx AliAnalysisTaskCDex.cxx");
244 // Declare all libraries (other than the default ones for the framework. These will be
245 // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
246 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");
248 plugin->AddIncludePath("-I$ALICE_ROOT/ITS -I$ALICE_ROOT/PWGPP/ITS");
250 // Declare the output file names separated by blancs.
251 // (can be like: file.root or file.root@ALICE::Niham::File)
252 // To only save certain files, use SetDefaultOutputs(kFALSE), and then
253 // SetOutputFiles("list.root other.filename") to choose which files to save
254 plugin->SetDefaultOutputs();
256 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
257 plugin->SetAnalysisMacro("CDMeson.C");
259 // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
260 plugin->SetSplitMaxInputFileNumber(100);
262 // Optionally modify the executable name (default analysis.sh)
263 plugin->SetExecutable("CDMeson.sh");
265 // set number of test files to use in "test" mode
266 plugin->SetNtestFiles(1);
268 // Optionally resubmit threshold.
269 //plugin->SetMasterResubmitThreshold(90);
271 // Optionally set time to live (default 30000 sec)
272 //plugin->SetTTL(30000);
274 // Optionally set input format (default xml-single)
275 //plugin->SetInputFormat("xml-single");
277 // Optionally modify the name of the generated JDL (default analysis.jdl)
278 plugin->SetJDLName("CDMeson.jdl");
280 // Optionally modify job price (default 1)
283 // Optionally modify split mode (default 'se')
284 plugin->SetSplitMode("se");
286 //----------------------------------------------------------
287 //--- PROOF MODE SPECIFIC SETTINGS ------------
288 //----------------------------------------------------------
290 plugin->SetProofCluster(proofcluster);
291 // Dataset to be used
292 plugin->SetProofDataSet(proofdataset);
293 // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard
294 plugin->SetProofReset(0);
295 // May limit number of workers
296 plugin->SetNproofWorkers(0);
297 // May limit the number of workers per slave
298 plugin->SetNproofWorkersPerSlave(1);
299 // May use a specific version of root installed in proof
300 plugin->SetRootVersionForProof("current");
301 // May set the aliroot mode. Check http://aaf.cern.ch/node/83
302 plugin->SetAliRootMode("default"); // Loads AF libs by default
303 // May request ClearPackages (individual ClearPackage not supported)
304 plugin->SetClearPackages(kFALSE);
305 // Plugin test mode works only providing a file containing test file locations, used in "local" mode also
306 plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root etc
307 // Request connection to alien upon connection to grid
308 plugin->SetProofConnectGrid(kFALSE);
309 // Other PROOF specific parameters
310 plugin->SetProofParameter("PROOF_UseMergers","-1");
311 printf("Using: PROOF_UseMergers : %s\n", plugin->GetProofParameter("PROOF_UseMergers"));