]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/train/runPluginProof.C
Migration of PWG2/RESONANCES -> PWGLF/RESONANCES
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / train / runPluginProof.C
1 //
2 // This is an example steering macro for running RSN analysis task
3 // with the AliEn plugin on PROOF.
4 //
5 // Inputs:
6 //
7 //   - runMode     = AliEn plugin run mode
8 //   - suffix      = eventual suffix which is attached to the automatic name created for outputs
9 //   - partname    = a string which defines the resonance name (used for output)
10 //   - runList     = configuration file whith gives list of runs, pattern, prefix, options and AliEn path
11 //   - split       = corresponding JDL value
12 //   - nmerge      = number of outputs to be merged per stage
13 //
14 //   - taskList    = a string containin all the 'add-task' macros to be used
15 //   - taskPath    = the uniqu pathe where all 'add-task' macros (and all their needs) are stored
16 //
17 //   - workDirBase = path of the working directory (starting from AliEn home)
18 //   - outDir      = path of the output directory (w.r. to workDir)
19 //
20 // Notes:
21 //
22 //   - in case the source is an ESD, and if inputs are a MC production
23 //     the MC input handler is created by default
24 //
25 //
26 // In principle, the user should never modify this macro.
27 //
28 void runPluginProof
29 (
30    const char *runMode         = "full",
31    Int_t       nmix            = 0,
32    const char *dataSet         = "/alice/data/LHC10h_000137162#esdTree",
33    const char *clusterName     = "alice-caf.cern.ch",
34    const char *testFile        = "pbpb_data.txt",
35    const char *runOptions      = "esd_data_phys_cent",
36    const char *analysisOptions = "tpcpid_tofpid",
37    const char *outName         = "test_proof.root",
38    const char *taskList        = "AddRsnAnalysisTask.C",
39    //const char *taskPath        = "$(ALICE_ROOT)/PWG2/RESONANCES/macros/train"
40    const char *taskPath        = "$(HOME)/code/resonances/alice-rsn-package/PWG2resonances/RESONANCES/macros/test/pulvir"
41 )
42 {
43    //
44    // === PREPARATION ==============================================================================
45    //
46    
47    // this option is not needed when using plugin
48    // gEnv->SetValue("XSec.GSI.DelegProxy","2");
49    
50    // some options
51    TString opt(runOptions);
52    opt.ToUpper();
53    Bool_t useTender = opt.Contains("TENDER");
54    Bool_t isMC      = opt.Contains("MC") || (!opt.Contains("DATA"));
55    ::Info("runPlugin.C", "useTender = %d", useTender);
56    ::Info("runPlugin.C", "isMC      = %d", isMC     );
57    ::Info("runPlugin.C", "runOpts   = %s", runOptions);
58    ::Info("runPlugin.C", "anaOpts   = %s", analysisOptions);
59    
60    // basic configurations
61    gROOT->LoadMacro(Form("%s/AnalysisSetup.C", taskPath));
62    AnalysisSetup(isMC, nmix, runOptions, outName, taskPath);
63
64    //
65    // === PLUGIN CONFIGURATION =====================================================================
66    //
67
68    // load and execute plugin configuration macro
69    // pass to the macro, as FIRST argument, the common name
70    // which is used for the output, since it must be equal
71    // to the one defined here for the common output (for merging)
72    gROOT->LoadMacro("PluginByRunProof.C");
73
74    // build the list of arguments (for them see the 'PluginByRun.C' code)
75    TString args("PluginByRunProof(");
76    args += Form("\"%s\", ", dataSet);
77    args += Form("\"%s\", ", testFile);
78    args += Form("\"%s\") ", clusterName);
79
80    // create the plugin
81    AliAnalysisAlien *plugin = (AliAnalysisAlien*)gROOT->ProcessLine(args.Data());
82
83    // set run mode
84    plugin->SetRunMode(runMode);
85    
86    // add to manager
87    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
88    if (!mgr) return;
89    mgr->SetGridHandler(plugin);
90    
91    //
92    // === ANALYSIS EXECUTION =======================================================================
93    //
94
95    gROOT->LoadMacro(Form("%s/AddRsnAnalysisTask.C", taskPath));
96    AddRsnAnalysisTask(isMC, kFALSE, runOptions, analysisOptions);
97    
98    // initialize and start analysis
99    if (!mgr->InitAnalysis()) {
100       ::Error("runPlugin.C", "Failed to init analysis");
101       return;
102    }
103    mgr->PrintStatus();
104    mgr->StartAnalysis("proof");
105 }