1 /****************************************************************
3 Lunch the Analysis Task for Fluctuation Study
8 Running in Local = analmode = local, proof, grid
10 *******************************************************************/
13 TString tasktype = "MF"; //OF, MF, MFT, CF
16 TString dataset = "/alice/data/LHC10h_000137162_p1_3plus";
17 TString proofCluster = "alice-caf.cern.ch";
18 TString alirootVer = "VO_ALICE@AliRoot::v4-21-12-AN";
21 Bool_t UsePar = kFALSE; // Do you want to use par
22 Bool_t UseTrigger = kFALSE; // activate trigger seletction
23 Bool_t UseCentrality = kFALSE; // activate centrality slection
26 void runFluctuationTask(TString analmode = "local")
29 if(analmode.CompareTo("local") == 0 ) {
30 if(!LoadLibraries(analmode)) {
31 printf("Library Not loaded\n");
34 runLocal("file.txt",1000);
37 else if(analmode.CompareTo("proof") == 0) {
38 if(!LoadLibraries(analmode)) return;
41 else printf("load error\n");
44 //___________________________________________________________________________________
45 Bool_t LoadLibraries(TString mode = "local")
48 if(mode.CompareTo("local") == 0) {
49 gSystem->Load("libSTEERBase.so");
50 gSystem->Load("libVMC.so");
51 gSystem->Load("libESD.so");
52 gSystem->Load("libAOD.so");
53 gSystem->Load("libANALYSIS.so");
54 gSystem->Load("libANALYSISalice.so");
55 // gSystem->Load("libPWG2ebye.so");
56 gSystem->AddIncludePath("-I$ALICE_ROOT/include");
57 printf("Library is Loaded \n");
60 else if(mode.CompareTo("proof") == 0) {
61 gEnv->SetValue("XSec.GSI.DelegProxy","2");
62 TProof *p = TProof::Open(proofCluster.Data());
64 p->EnablePackage(alirootVer.Data());
67 else if(mode.CompareTo("proof") == 0) {
68 printf("Satya FIXME \n");
71 printf(" ERROR: Give proper running mode \n");
77 //______________________________________________________________________
78 Bool_t LoadIfParAnalysis(TString mode = "local") {
79 // FIXME: For par file upload methods..
85 //______________________________________________________________________
87 void runLocal(TString input,int nfile)
90 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
91 TChain* chain = CreateESDChain(input, nfile);
93 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis");
94 AliVEventHandler* esdH = new AliESDInputHandler();
95 mgr->SetInputEventHandler(esdH);
98 // gROOT->LoadMacro("AddTaskPhysicsSelection.C");
99 // gROOT->LoadMacro("AddTaskCentrality.C");
101 // AliPhysicsSelectionTask* physicsSelTask = AddTaskPhysicsSelection();
102 // AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
105 if(!UsePar) gROOT->LoadMacro("../AliEbyEEventBase.cxx++g");
107 if(tasktype.CompareTo("CF") == 0) {
109 gROOT->LoadMacro("../AliEbyEMultiplicityFluctuationAnalysis.cxx++g");
110 gROOT->LoadMacro("../AliEbyEChargeFluctuationAnalysis.cxx++g");
113 gROOT->LoadMacro("AddFluctuationTask.C");
116 else if(tasktype.CompareTo("MF") == 0) {
118 gROOT->LoadMacro("../AliEbyEMultiplicityFluctuationAnalysis.cxx++g");
119 gROOT->LoadMacro("../AliEbyEMFAnalysisTask.cxx++g");
121 gROOT->LoadMacro("AddFluctuationTask.C");
124 else if(tasktype.CompareTo("OF") == 0) {
126 gROOT->LoadMacro("../AliEbyEFluctuationAnalysis.cxx++g");
127 gROOT->LoadMacro("../AliEbyEFluctuationTask.cxx++g");
129 gROOT->LoadMacro("AddFluctuationTask.C");
132 else if (tasktype.CompareTo("MFT") == 0) {
134 gROOT->LoadMacro("../AliEbyEMultiplicityFluctuationAnalysis.cxx++g");
135 gROOT->LoadMacro("../AliEbyEMFAnalysisTaskT.cxx++g");
137 gROOT->LoadMacro("AddFluctuationTask.C");
145 mgr->SetDebugLevel(0);
146 if (!mgr->InitAnalysis()) return;
148 mgr->StartAnalysis("local", chain);
154 //________________________________________________________
157 void runproof(TString dataset)
160 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
161 if (!mgr) mgr = new AliAnalysisManager("FirstCheck");
163 AliVEventHandler* esdH = new AliESDInputHandler();
164 mgr->SetInputEventHandler(esdH);
167 gProof->Load("AddTaskPhysicsSelection.C");
168 AliPhysicsSelectionTask* physicsSelTask = AddTaskPhysicsSelection();
172 gProof->Load("AddTaskCentrality.C");
173 AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
176 if(!UsePar) gProof->Load("../AliEbyEEventBase.cxx++g");
178 if(tasktype.CompareTo("CF") == 0) {
180 gProof->Load("../AliEbyEMultiplicityFluctuationAnalysis.cxx++g");
181 gProof->Load("../AliEbyEChargeFluctuationAnalysis.cxx++g");
183 gProof->Load("AddFluctuationTask.C");
186 else if(tasktype.CompareTo("MF") == 0) {
188 gProof->Load("../AliEbyEMultiplicityFluctuationAnalysis.cxx++g");
189 gProof->Load("../AliEbyEMFAnalysisTask.cxx++g");
191 gProof->Load("AddFluctuationTask.C");
195 else if(tasktype.CompareTo("OF") == 0) {
197 gProof->Load("../AliEbyEFluctuationAnalysis.cxx++g");
198 gProof->Load("../AliEbyEAnalysisTask.cxx++g");
200 gProof->Load("AddFluctuationTask.C");
204 else if (tasktype.CompareTo("MFT") == 0) {
206 gProof->Load("../AliEbyEMultiplicityFluctuationAnalysis.cxx++g");
207 gProof->Load("../AliEbyEMFAnalysisTaskT.cxx++g");
209 gProof->Load("AddFluctuationTask.C");
214 mgr->SetDebugLevel(0);
215 if (!mgr->InitAnalysis())
220 mgr->StartAnalysis("proof",dataset.Data());
225 //______________________________________________________________________________
226 AliAnalysisGrid* CreateAlienHandler(const char *taskname, const char *gridmode,
227 const char *proofcluster, const char *proofdataset)
229 AliAnalysisAlien *plugin = new AliAnalysisAlien();
230 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
231 plugin->SetRunMode(gridmode);
233 // Set versions of used packages
234 plugin->SetAPIVersion("V1.1x");
235 plugin->SetROOTVersion("v5-27-06b");
236 plugin->SetAliROOTVersion("v4-21-08-AN");
238 // Declare input data to be processed.
240 // Method 1: Create automatically XML collections using alien 'find' command.
241 // Define production directory LFN
242 plugin->SetGridDataDir("/alice/data/2010/LHC10b");
243 // On real reconstructed data:
244 // plugin->SetGridDataDir("/alice/data/2009/LHC09d");
245 // Set data search pattern
246 //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES
247 // Data pattern for reconstructed data
248 plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
249 plugin->SetRunPrefix("000"); // real data, comment out for MC
250 // ...then add run numbers to be considered
251 plugin->AddRunNumber(115514);
252 //plugin->SetRunRange(114917,115322);
253 plugin->SetNrunsPerMaster(1);
254 plugin->SetOutputToRunNo();
255 // comment out the next line when using the "terminate" option, unless
256 // you want separate merged files for each run
257 plugin->SetMergeViaJDL();
259 // Method 2: Declare existing data files (raw collections, xml collections, root file)
260 // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
261 // XML collections added via this method can be combined with the first method if
262 // the content is compatible (using or not tags)
263 // plugin->AddDataFile("tag.xml");
264 // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
266 // Define alien work directory where all files will be copied. Relative to alien $HOME.
267 plugin->SetGridWorkingDir(taskname);
269 // Declare alien output directory. Relative to working directory.
270 plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out
272 // Declare the analysis source files names separated by blancs. To be compiled runtime
273 // using ACLiC on the worker nodes.
274 plugin->SetAnalysisSource("AliAnalysisTaskEx01.cxx");
276 // Declare all libraries (other than the default ones for the framework. These will be
277 // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
278 plugin->SetAdditionalLibs("AliAnalysisTaskEx01.h AliAnalysisTaskEx01.cxx");
280 // Declare the output file names separated by blancs.
281 // (can be like: file.root or file.root@ALICE::Niham::File)
282 // To only save certain files, use SetDefaultOutputs(kFALSE), and then
283 // SetOutputFiles("list.root other.filename") to choose which files to save
284 plugin->SetDefaultOutputs();
285 //plugin->SetOutputFiles("list.root");
287 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
288 plugin->SetAnalysisMacro(Form("%s.C",taskname));
290 // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
291 plugin->SetSplitMaxInputFileNumber(100);
293 // Optionally modify the executable name (default analysis.sh)
294 plugin->SetExecutable(Form("%s.sh",taskname));
296 // set number of test files to use in "test" mode
297 plugin->SetNtestFiles(10);
299 // Optionally resubmit threshold.
300 plugin->SetMasterResubmitThreshold(90);
302 // Optionally set time to live (default 30000 sec)
303 plugin->SetTTL(30000);
305 // Optionally set input format (default xml-single)
306 plugin->SetInputFormat("xml-single");
308 // Optionally modify the name of the generated JDL (default analysis.jdl)
309 plugin->SetJDLName(Form("%s.jdl",taskname));
311 // Optionally modify job price (default 1)
314 // Optionally modify split mode (default 'se')
315 plugin->SetSplitMode("se");
317 //----------------------------------------------------------
318 //--- PROOF MODE SPECIFIC SETTINGS ------------
319 //----------------------------------------------------------
321 plugin->SetProofCluster(proofcluster);
322 // Dataset to be used
323 plugin->SetProofDataSet(proofdataset);
324 // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard
325 plugin->SetProofReset(0);
326 // May limit number of workers
327 plugin->SetNproofWorkers(0);
328 // May limit the number of workers per slave
329 plugin->SetNproofWorkersPerSlave(1);
330 // May use a specific version of root installed in proof
331 plugin->SetRootVersionForProof("current");
332 // May set the aliroot mode. Check http://aaf.cern.ch/node/83
333 plugin->SetAliRootMode("default"); // Loads AF libs by default
334 // May request ClearPackages (individual ClearPackage not supported)
335 plugin->SetClearPackages(kFALSE);
336 // Plugin test mode works only providing a file containing test file locations, used in "local" mode also
337 plugin->SetFileForTestMode("file1.text"); // file should contain path name to a local directory containg *ESDs.root etc
338 // Request connection to alien upon connection to grid
339 plugin->SetProofConnectGrid(kFALSE);