TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / TakuAlberica / single / runTakuMC.C
1 //char *gridMode="";
2 char *gridMode = "full"; // "" for local
3 char *workingDir = "takuv2c123456_rev3_2_mc";
4 TString commonOutputFileName = Form("Results%s",workingDir);
5
6 class AliAnalysisAlien;
7 class AliAnalysisGrid;
8 void runTakuMC() {
9
10
11   gSystem->Setenv("alien_CLOSE_SE", "ALICE::GSI::SE");
12   cout << "alien_CLOSE_SE: " << gSystem->Getenv("alien_CLOSE_SE") << endl;
13   TGrid::Connect("alien://");
14
15
16   TStopwatch timer; timer.Start();
17   LoadLibraries();
18   if(gridMode!="")
19     AliAnalysisGrid *alienHandler = CreateAlienHandler();
20   else {
21     TChain *chain = new TChain("esdTree");
22     for(int i=1; i!=10; ++i)
23       chain->Add( Form("/home/gunji/softwares/dielectron/data/esd138740_mc/%d0/AliESDs.root",i) );
24   }
25   AliAnalysisManager *mgr = new AliAnalysisManager("DielectronAnalysisManager");
26   AliESDInputHandler *esdH = new AliESDInputHandler();
27   mgr->SetInputEventHandler(esdH);
28   if(gridMode!="")
29     mgr->SetGridHandler(alienHandler);
30
31
32   AliMCEventHandler *MC = new AliMCEventHandler;
33   mgr->SetMCtruthEventHandler(MC);
34
35   gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
36   AliPhysicsSelectionTask* physicsSelTask = AddTaskPhysicsSelection(kTRUE);
37   physicsSelTask->GetPhysicsSelection()->SetAnalyzeMC();
38
39
40   gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
41   AliCentralitySelectionTask *taskCentrality =AddTaskCentrality();
42   ///taskCentrality->SetPass(2);
43   taskCentrality->SetMCInput();
44
45   gROOT->LoadMacro("AliDielectronDebugTreeTaku.cxx++");
46   gROOT->LoadMacro("AliDielectronHistosTaku.cxx++");
47   gROOT->LoadMacro("AliDielectronTaku.cxx++");
48   gROOT->LoadMacro("AliAnalysisTaskMultiDielectronNewTaku.cxx++");
49
50   LoadAddLibraries();
51   
52   TString configFile("./ConfigJpsi2eeDataTaku.C");
53   //Bool_t hasMC=(mgr->GetMCtruthEventHandler()!=0x0);
54   //if (hasMC){
55   //configFile="$ALICE_ROOT/PWG3/dielectron/macros/ConfigJpsi2eeEff.C";
56   //}
57   gROOT->LoadMacro(configFile.Data());
58
59   gROOT->LoadMacro("AddTaskDielectronTaku.C");
60   
61
62   
63   AddTaskDielectronTaku( 0, 99, commonOutputFileName.Data(), "CENT1" );
64   /*
65   AddTaskDielectronTaku( 10, 20, commonOutputFileName.Data(), "CENT2" );
66   AddTaskDielectronTaku( 20, 30, commonOutputFileName.Data(), "CENT3" );
67   AddTaskDielectronTaku( 30, 40, commonOutputFileName.Data(), "CENT4" );
68   AddTaskDielectronTaku( 40, 50, commonOutputFileName.Data(), "CENT5" );  
69   AddTaskDielectronTaku( 50, 60, commonOutputFileName.Data(), "CENT6" );
70   AddTaskDielectronTaku( 60, 70, commonOutputFileName.Data(), "CENT7" );
71   AddTaskDielectronTaku( 70, 80, commonOutputFileName.Data(), "CENT8" );
72   AddTaskDielectronTaku( 80, 99, commonOutputFileName.Data(), "CENT9" );
73   */
74
75   mgr->SetDebugLevel(2);
76   mgr->SetDebugLevel(0);
77   if(!mgr->InitAnalysis()) return;
78   mgr->PrintStatus();
79   if(gridMode!="")
80     mgr->StartAnalysis("grid");
81   else
82     mgr->StartAnalysis("local",chain);
83   timer.Stop();
84   timer.Print();  
85
86 }
87
88 AliAnalysisGrid* CreateAlienHandler() {
89   AliAnalysisAlien *plugin = new AliAnalysisAlien();
90   plugin->SetRunMode(gridMode);
91   plugin->SetNtestFiles(1);
92   plugin->SetAPIVersion("V1.1x");
93
94   plugin->SetROOTVersion("v5-28-00d");
95   plugin->SetAliROOTVersion("v4-21-25-AN");
96   //  plugin->SetRunPrefix("000");
97   gROOT->LoadMacro("AddRunsPbPbMC.C");
98   AddRunsPbPbMC(plugin);
99   plugin->SetOutputToRunNo();  
100   plugin->SetGridWorkingDir(workingDir);
101   plugin->SetGridOutputDir("output");
102   plugin->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS -I$ALICE_ROOT/PWG2/FLOW/AliFlowCommon -I$ALICE_ROOT/PWG2/FLOW/AliFlowTasks -I$ALICE_ROOT/PWG3/dielectron/ -g");
103   plugin->SetAnalysisSource("AliDielectronHistosTaku.cxx AliDielectronDebugTreeTaku.cxx AliDielectronTaku.cxx AliAnalysisTaskMultiDielectronNewTaku.cxx");
104   //  plugin->SetAdditionalLibs("libCORRFW libPWG3base libPWG3dielectron libPWG3hfe libTender libTenderSupplies  AliAnalysisTaskMultiDielectronNew.h AliAnalysisTaskMultiDielectronNew.cxx");
105   plugin->SetAdditionalLibs("libCORRFW libPWG3base libPWG3dielectron libPWG3hfe libPWG2flowCommon libPWG2flowTasks AliDielectronHistosTaku.h AliDielectronHistosTaku.cxx AliDielectronDebugTreeTaku.h AliDielectronDebugTreeTaku.cxx AliDielectronTaku.h AliDielectronTaku.cxx AliAnalysisTaskMultiDielectronNewTaku.h AliAnalysisTaskMultiDielectronNewTaku.cxx");
106   plugin->SetDefaultOutputs(kTRUE);
107   plugin->SetAnalysisMacro(Form("%s.C",workingDir));
108   plugin->SetExecutable(Form("%s.sh",workingDir));
109   plugin->SetSplitMaxInputFileNumber(100);
110   plugin->SetOverwriteMode(kTRUE);
111   plugin->SetMaxInitFailed(20);
112   plugin->SetTTL(90000);
113   plugin->SetOutputToRunNo(kTRUE);
114   plugin->SetMasterResubmitThreshold(90);
115   plugin->SetInputFormat("xml-single");
116   plugin->SetJDLName(Form("%s.jdl",workingDir));
117   plugin->SetPrice(1);      
118   plugin->SetSplitMode("se");
119   plugin->SetKeepLogs(kTRUE);
120   plugin->SetExecutableCommand("aliroot -b -q ");
121   return plugin;
122 }
123
124 void LoadLibraries()
125 {
126   gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/build/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS -I$ALICE_ROOT/PWG2/FLOW/AliFlowCommon -I$ALICE_ROOT/PWG2/FLOW/AliFlowTasks -I$ALICE_ROOT/PWG3/dielectron/ -g");
127   gSystem->Load("libCore");// no
128   gSystem->Load("libTree");
129   gSystem->Load("libGeom");
130   gSystem->Load("libVMC");
131   gSystem->Load("libXMLIO");// no
132   gSystem->Load("libPhysics");
133   gSystem->Load("libXMLParser");
134   gSystem->Load("libProof");
135   gSystem->Load("libMinuit");
136
137   gSystem->Load("libSTEERBase");
138   gSystem->Load("libCDB");
139   gSystem->Load("libRAWDatabase");
140   gSystem->Load("libRAWDatarec");
141   gSystem->Load("libESD");
142   gSystem->Load("libAOD");
143   gSystem->Load("libSTEER");
144   gSystem->Load("libANALYSIS");
145   gSystem->Load("libANALYSISalice");
146   gSystem->Load("libTOFbase");
147   gSystem->Load("libTOFrec");
148   gSystem->Load("libT0base");
149   gSystem->Load("libT0rec");
150   gSystem->Load("libPWG2flowCommon");
151   gSystem->Load("libPWG2flowTasks");
152
153   gSystem->Load("libTender");
154   gSystem->Load("libTenderSupplies");
155
156
157
158   gSystem->Load("libCORRFW");
159   gSystem->Load("libPWG3base");
160   gSystem->Load("libPWG3dielectron");
161   gSystem->Load("libPWG3hfe");
162
163 }
164
165 void LoadAddLibraries(){
166   gSystem->Load("./AliDielectronHistosTaku_cxx.so");
167   gSystem->Load("./AliDielectronDebugTreeTaku_cxx.so");
168   gSystem->Load("./AliDielectronTaku_cxx.so");
169
170
171 }