]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/STRANGENESS/Correlations/macros/runV0ChCorrelations.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / Correlations / macros / runV0ChCorrelations.C
1 // runV0ChCorrelations.C
2 //
3 // Running macro for AliAnalysisTaskV0ChCorrelations task
4 // Example of usage:  .L runV0ChCorrelations.C
5 //                     runV0ChCorrelations("proof","full)
6 //
7 class AliAnalysisGrid;
8
9 //______________________________________________________________________________
10 void runV0ChCorrelations(
11          const char* runtype = "proof", // local, proof or grid
12          const char *gridmode = "full", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & Test work for proof
13          const bool bMCtruth = 0, // 1 = MCEvent handler is on (MC truth), 0 = MCEvent handler is off (MC reconstructed/real data)
14          const bool bMCphyssel = 0, // 1 = looking at MC truth or reconstructed, 0 = looking at real data
15          const Long64_t nentries = 1234567890, // for local and proof mode, ignored in grid mode. Set to 1234567890 for all events.
16          const Long64_t firstentry = 0, // for local and proof mode, ignored in grid mode
17          //const char *proofdataset = "/alice/data/LHC10h_000138534_p2_AOD049", // path to dataset on proof cluster, for proof analysis
18          const char *proofdataset = "/alice/data/LHC11h_2_000169858_p2_AOD095", // path to dataset on proof cluster, for proof analysis
19
20                  const char *proofcluster = "alice-caf.cern.ch", // which proof cluster to use in proof mode
21          const char *taskname = "V0ChCorrelations_task" // sets name of grid generated macros
22          )
23 {
24     // check run type
25     if(runtype != "local" && runtype != "proof" && runtype != "grid"){
26         Printf("\n\tIncorrect run option, check first argument of run macro");
27         Printf("\tint runtype = local, proof or grid\n");
28         return;
29     }
30     Printf("%s analysis chosen",runtype);
31   
32     // load libraries
33     gSystem->Load("libCore");
34     gSystem->Load("libGeom");
35     gSystem->Load("libVMC");
36     gSystem->Load("libPhysics");
37     gSystem->Load("libTree");
38     gSystem->Load("libSTEERBase");
39     gSystem->Load("libESD");
40     gSystem->Load("libAOD");
41     gSystem->Load("libANALYSIS");
42     gSystem->Load("libOADB");
43     gSystem->Load("libANALYSISalice");
44   
45     // add aliroot indlude path
46     gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));
47     gROOT->SetStyle("Plain");
48         
49     // analysis manager
50     AliAnalysisManager* mgr = new AliAnalysisManager(taskname);
51     
52     // create the alien handler and attach it to the manager
53     AliAnalysisGrid *plugin = CreateAlienHandler(taskname, gridmode, proofcluster, proofdataset); 
54     mgr->SetGridHandler(plugin);
55     
56     //AliVEventHandler* iH = new AliESDInputHandler();
57     AliAODInputHandler* iH = new AliAODInputHandler();
58     mgr->SetInputEventHandler(iH);
59         
60     // mc event handlerrunEx01.C
61     /*if(bMCtruth) {
62         AliMCEventHandler* mchandler = new AliMCEventHandler();
63         // Not reading track references
64         mchandler->SetReadTR(kFALSE);
65         mgr->SetMCtruthEventHandler(mchandler);
66     } */  
67
68         gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
69         AliAnalysisTask *pidtask = AddTaskPIDResponse(kFALSE,kTRUE);
70
71     // create task
72     gROOT->LoadMacro("AliAnalysisTaskV0ChCorrelations.cxx+g");
73     gROOT->LoadMacro("AddTaskV0ChCorrelations.C");
74         AliAnalysisTaskV0ChCorrelations *taskV0 = AddTaskV0ChCorrelations(kFALSE);
75         
76     // enable debug printouts
77     mgr->SetDebugLevel(2);
78     mgr->SetNSysInfo(100);
79     if (!mgr->InitAnalysis()) return;
80     mgr->PrintStatus();
81   
82     // start analysis
83     Printf("Starting Analysis....");
84     mgr->StartAnalysis(runtype,nentries,firstentry);
85 }
86
87 //______________________________________________________________________________
88 AliAnalysisGrid* CreateAlienHandler(const char *taskname, const char *gridmode, const char *proofcluster, const char *proofdataset)
89 {
90     AliAnalysisAlien *plugin = new AliAnalysisAlien();
91     // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
92     plugin->SetRunMode(gridmode);
93
94     // Set versions of used packages
95     plugin->SetAPIVersion("V1.1x");
96     plugin->SetROOTVersion("v5-34-01-1");
97     plugin->SetAliROOTVersion("v5-03-66-AN");
98
99
100     // Method 1: Create automatically XML collections using alien 'find' command.
101     // Define production directory LFN
102     //plugin->SetGridDataDir("/alice/data/2010/LHC10h");
103     plugin->SetGridDataDir("/alice/data/2011/LHC11h_2");
104     // On real reconstructed data:
105     // plugin->SetGridDataDir("/alice/data/2009/LHC09d");
106     // Data pattern for reconstructed data
107     plugin->SetDataPattern("*ESDs/pass2/AOD095/*AOD.root"); // LHC11h data
108     //    plugin->SetDataPattern("ESDs/pass2/AOD038/*AliAOD.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
109     plugin->SetRunPrefix("000");   // real data
110     // ...then add run numbers to be considered
111
112     //plugin->AddRunNumber(139038);
113     plugin->AddRunNumber(169858);
114     //plugin->SetRunRange(146686,146860);
115
116     plugin->SetNrunsPerMaster(1); // 1
117     plugin->SetOutputToRunNo();
118     // comment out the next line when using the "terminate" option, unless
119     // you want separate merged files for each run
120     //plugin->SetMergeViaJDL();
121
122     // Method 2: Declare existing data files (raw collections, xml collections, root file)
123     // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
124     // XML collections added via this method can be combined with the first method if
125     // the content is compatible (using or not tags)
126     //   plugin->AddDataFile("tag.xml");
127     //   plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
128
129     // Define alien work directory where all files will be copied. Relative to alien $HOME.
130     plugin->SetGridWorkingDir(taskname);
131
132     // Declare alien output directory. Relative to working directory.
133     plugin->SetGridOutputDir("outLHC11h"); // In this case will be $HOME/taskname/out
134
135     // Declare the analysis source files names separated by blancs. To be compiled runtime
136     // using ACLiC on the worker nodes.
137     plugin->SetAnalysisSource("AliAnalysisTaskV0ChCorrelations.cxx");
138
139     // Declare all libraries (other than the default ones for the framework. These will be
140     // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
141     plugin->SetAdditionalLibs("AliAnalysisTaskV0ChCorrelations.h AliAnalysisTaskV0ChCorrelations.cxx");
142
143     // Declare the output file names separated by blancs.
144     // (can be like: file.root or file.root@ALICE::Niham::File)
145     // To only save certain files, use SetDefaultOutputs(kFALSE), and then
146     // SetOutputFiles("list.root other.filename") to choose which files to save
147     plugin->SetDefaultOutputs(kFALSE);
148     plugin->SetOutputFiles("list.grid.v0ch.root");
149
150     // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
151     plugin->SetAnalysisMacro(Form("%s.C",taskname));
152
153     // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
154     plugin->SetSplitMaxInputFileNumber(100);
155
156     // Optionally modify the executable name (default analysis.sh)
157     plugin->SetExecutable(Form("%s.sh",taskname));
158
159     // set number of test files to use in "test" mode
160     plugin->SetNtestFiles(10);
161
162     // Optionally resubmit threshold.
163     plugin->SetMasterResubmitThreshold(90);
164
165     // Optionally set time to live (default 30000 sec)
166     plugin->SetTTL(30000);
167
168     // Optionally set input format (default xml-single)
169     plugin->SetInputFormat("xml-single");
170
171     // Optionally modify the name of the generated JDL (default analysis.jdl)
172     plugin->SetJDLName(Form("%s.jdl",taskname));
173
174     // Optionally modify job price (default 1)
175     plugin->SetPrice(1);      
176
177     // Optionally modify split mode (default 'se')    
178     plugin->SetSplitMode("se");
179     
180     //----------------------------------------------------------
181     //---      PROOF MODE SPECIFIC SETTINGS         ------------
182     //---------------------------------------------------------- 
183     // Proof cluster
184     plugin->SetProofCluster(proofcluster);
185     // Dataset to be used   
186     plugin->SetProofDataSet(proofdataset);
187     // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard
188     plugin->SetProofReset(0);
189     // May limit number of workers
190     plugin->SetNproofWorkers(0);
191     // May limit the number of workers per slave
192     plugin->SetNproofWorkersPerSlave(1);   
193     // May use a specific version of root installed in proof
194     //plugin->SetRootVersionForProof("current");
195     plugin->SetRootVersionForProof("VO_ALICE@ROOT::v5-34-01-1");
196     // May set the aliroot mode. Check http://aaf.cern.ch/node/83 
197     plugin->SetAliRootMode("default"); // Loads AF libs by default
198     // May request ClearPackages (individual ClearPackage not supported)
199     plugin->SetClearPackages(kFALSE);
200     // Plugin test mode works only providing a file containing test file locations, used in "local" mode also
201     plugin->SetFileForTestMode("LocalData_PbPb_LHC10h.txt"); // file should contain path name to a local directory containg *ESDs.root etc
202     // Request connection to alien upon connection to grid
203     plugin->SetProofConnectGrid(kFALSE);
204     // Other PROOF specific parameters
205     plugin->SetProofParameter("PROOF_UseMergers","-1");
206     printf("Using: PROOF_UseMergers   : %s\n", plugin->GetProofParameter("PROOF_UseMergers"));
207     return plugin;
208 }
209