]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/examples/runEx02.C
the initial version of the calibration interface
[u/mrichter/AliRoot.git] / ANALYSIS / examples / runEx02.C
1 // run.C
2 //
3 // Template run macro for producer/consumer tasks
4 //
5 // Author: Andrei Gheata
6 //
7 void CreateAlienHandler();
8
9 //______________________________________________________________________________
10 void runEx02()
11 {
12     // load libraries
13     gSystem->Load("libCore.so");        
14     gSystem->Load("libGeom.so");
15     gSystem->Load("libVMC.so");
16     gSystem->Load("libPhysics.so");
17     gSystem->Load("libTree.so");
18     gSystem->Load("libSTEERBase.so");
19     gSystem->Load("libESD.so");
20     gSystem->Load("libAOD.so");
21     gSystem->Load("libANALYSIS.so");
22     gSystem->Load("libOADB.so");
23     gSystem->Load("libANALYSISalice.so");
24   
25     // add aliroot indlude path
26     gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));
27     gROOT->SetStyle("Plain");
28         
29     // analysis manager
30     AliAnalysisManager* mgr = new AliAnalysisManager("example for using producer/consumer tasks");
31     mgr->SetCommonFileName("output.root");
32
33     // create the alien handler and attach it to the manager
34     AliAnalysisGrid *plugin = CreateAlienHandler(); 
35     mgr->SetGridHandler(plugin);
36     
37     // create the alien handler and attach it to the manager
38     
39     AliVEventHandler* iH = new AliESDInputHandler();
40     mgr->SetInputEventHandler(iH);        
41                 
42     // create 2 producer tasks
43     gROOT->LoadMacro("TaskExchange.cxx+g");
44     gROOT->LoadMacro("AddTaskProducer.C");
45     TaskProducer *prod1 = AddTaskProducer("producer1");
46     TaskProducer *prod2 = AddTaskProducer("producer2");
47     if (!prod1 || !prod2) return;
48     
49     // Create 1 consumer task
50     gROOT->LoadMacro("AddTaskConsumer.C");
51     TaskConsumer *task = AddTaskConsumer("consumer", "producer1", "producer2");
52         
53     // enable debug printouts
54     mgr->SetDebugLevel(2);
55     if (!mgr->InitAnalysis()) return;
56     mgr->PrintStatus();
57   
58     // start analysis
59     Printf("Starting analysis example for producer/consumers...");
60     mgr->StartAnalysis("local",3);
61 }
62
63 //______________________________________________________________________________
64 AliAnalysisGrid* CreateAlienHandler()
65 {
66     AliAnalysisAlien *plugin = new AliAnalysisAlien();
67     // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
68     plugin->SetRunMode("test");
69     // Plugin test mode works only providing a file containing test file locations, used in "local" mode also
70     plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root etc
71     return plugin;
72 }