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