Lines getting the matched track moved to a method in AliCalorimeterUtils. Lines copie...
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / macros / Batch / runBatch.C
1 void runBatch(const char *chainlistfile) {
2   TStopwatch timer;
3   timer.Start();
4
5   printf("*** Connect to AliEn ***\n");
6   TGrid::Connect("alien://");
7   gSystem->Load("libProofPlayer.so");
8
9   //____________________________________________________//
10   //_____________Setting up STEERBase.par_______________//
11   //____________________________________________________//
12   setupPar("STEERBase");
13   gSystem->Load("libSTEERBase.so");
14
15   //____________________________________________________//
16   //_____________Setting up ESD.par_____________________//
17   //____________________________________________________//
18   setupPar("ESD");
19   gSystem->Load("libVMC.so");
20   gSystem->Load("libESD.so");
21
22   //____________________________________________________//
23   //_____________Setting up AOD.par_____________________//
24   //____________________________________________________//
25   setupPar("AOD");
26   gSystem->Load("libAOD.so");
27
28   //_________________________________________________________//
29   //_____________Setting up ANALYSIS.par_____________________//
30   //_________________________________________________________//
31   setupPar("ANALYSIS");
32   gSystem->Load("libANALYSIS.so");
33
34   //_________________________________________________________//
35   //_____________Setting up ANALYSISalice.par________________//
36   //_________________________________________________________//
37   setupPar("ANALYSISalice");
38   gSystem->Load("libANALYSISalice.so");
39
40   //____________________________________________________//
41   //_____________Setting up PWG2AOD.par_________________//
42   //____________________________________________________//
43   setupPar("PWG2AOD");
44   gSystem->Load("libPWG2AOD.so");
45   
46   //____________________________________________________//
47   //_____________Setting up PWG2femtoscopy.par__________//
48   //____________________________________________________//
49   setupPar("PWG2femtoscopy");
50   gSystem->Load("libPWG2femtoscopy.so");
51   
52   //____________________________________________________//
53   //_____________Setting up PWG2femtoscopyUser.par______//
54   //____________________________________________________//
55   setupPar("PWG2femtoscopyUser");
56   gSystem->Load("libPWG2femtoscopyUser.so");
57   
58   //ANALYSIS PART
59   gSystem->SetIncludePath("-I$ROOTSYS/include  -I\"/usr/local/CERN/root/include\" -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I./ESD -I./AOD -I./ANALYSIS -I./PWG2AOD/AOD");
60   //  gROOT->LoadMacro("ConfigFemtoAnalysis.C++");
61   //  gROOT->LoadMacro("AliAnalysisTaskFemto.cxx+");
62   //  const char *collectionfile = "wn.xml";
63
64   //____________________________________________//
65   //Usage of event tags
66   AliTagAnalysis *analysis = new AliTagAnalysis();
67   TChain *chain = 0x0;
68   chain = analysis->GetChainFromCollection(chainlistfile,"esdTree");
69
70   //____________________________________________//
71   // Make the analysis manager
72   AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
73   AliESDInputHandler* esdH = new AliESDInputHandler;
74   esdH->SetInactiveBranches("FMD CaloCluster");
75   mgr->SetInputEventHandler(esdH);  
76
77   AliMCEventHandler *mcH = new AliMCEventHandler;
78   mgr->SetMCtruthEventHandler(mcH);
79
80   mgr->SetCommonFileName("Femto.ESD.root");
81   //____________________________________________//
82   // 1st Pt task
83 //   AliAnalysisTaskFemto *task1 = new AliAnalysisTaskFemto("TaskFemto");
84
85 //   mgr->AddTask(task1);
86
87 //   // Create containers for input/output
88 //   //  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
89 //   AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("input0", 
90 //                                                         TTree::Class(), AliAnalysisManager::kInputContainer);
91 //   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist1", TList::Class(),AliAnalysisManager::kOutputContainer,"Femto.ESD.root");
92   
93   gROOT->LoadMacro("AddTaskFemto.C");
94   AliAnalysisTaskFemto *taskfemto = AddTaskFemto("$ALICE_ROOT/PWG2/FEMTOSCOPY/macros/Batch/ConfigFemtoAnalysis.C");
95
96 //   cout << "What ???" << endl;
97 //   int deb;
98 //   cin >> deb;
99
100   //____________________________________________//
101   //  cinput1->SetData(chain);
102 //   mgr->ConnectInput(task1,0,cinput1);
103 //   mgr->ConnectOutput(task1,0,coutput1);
104
105   if (!mgr->InitAnalysis()) return;
106   mgr->PrintStatus();
107   mgr->StartAnalysis("local",chain);
108
109   timer.Stop();
110   timer.Print();
111 }
112
113 Int_t setupPar(const char* pararchivename) {
114   ///////////////////
115   // Setup PAR File//
116   ///////////////////
117   if (pararchivename) {
118     char processline[1024];
119     sprintf(processline,".! tar xvzf %s.par",pararchivename);
120     gROOT->ProcessLine(processline);
121     const char* ocwd = gSystem->WorkingDirectory();
122     gSystem->ChangeDirectory(pararchivename);
123
124     // check for BUILD.sh and execute
125     if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
126       printf("*******************************\n");
127       printf("*** Building PAR archive    ***\n");
128       printf("*******************************\n");
129
130       if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
131         Error("runProcess","Cannot Build the PAR Archive! - Abort!");
132         return -1;
133       }
134     }
135     // check for SETUP.C and execute
136     if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
137       printf("*******************************\n");
138       printf("*** Setup PAR archive       ***\n");
139       printf("*******************************\n");
140       gROOT->Macro("PROOF-INF/SETUP.C");
141     }
142     
143     gSystem->ChangeDirectory("../");
144   }
145
146   return 1;
147 }