Lines getting the matched track moved to a method in AliCalorimeterUtils. Lines copie...
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / macros / Train / PWG2FemtoExercise1 / runBatch.C
1 void runBatch() {
2   TStopwatch timer;
3   timer.Start();
4   const char *chainlistfile="wn.xml";
5
6   printf("*** Connect to AliEn ***\n");
7 //   if (dataFromAlien)
8   TGrid::Connect("alien://");
9   gSystem->Load("libProofPlayer.so");
10
11   //____________________________________________________//
12   //_____________Setting up STEERBase.par_______________//
13   //____________________________________________________//
14   setupPar("STEERBase");
15   gSystem->Load("libSTEERBase.so");
16
17   //____________________________________________________//
18   //_____________Setting up ESD.par_____________________//
19   //____________________________________________________//
20   setupPar("ESD");
21   gSystem->Load("libVMC.so");
22   gSystem->Load("libESD.so");
23
24   //____________________________________________________//
25   //_____________Setting up AOD.par_____________________//
26   //____________________________________________________//
27   setupPar("AOD");
28   gSystem->Load("libAOD.so");
29
30   //_________________________________________________________//
31   //_____________Setting up ANALYSIS.par_____________________//
32   //_________________________________________________________//
33   setupPar("ANALYSIS");
34   gSystem->Load("libANALYSIS.so");
35
36   //_________________________________________________________//
37   //_____________Setting up ANALYSISalice.par________________//
38   //_________________________________________________________//
39   setupPar("ANALYSISalice");
40   gSystem->Load("libANALYSISalice.so");
41
42   //____________________________________________________//
43   //_____________Setting up PWG2AOD.par_________________//
44   //____________________________________________________//
45   setupPar("PWG2AOD");
46   gSystem->Load("libPWG2AOD.so");
47   
48   //____________________________________________________//
49   //_____________Setting up PWG2femtoscopy.par__________//
50   //____________________________________________________//
51   setupPar("PWG2femtoscopy");
52   gSystem->Load("libPWG2femtoscopy.so");
53   
54   //____________________________________________________//
55   //_____________Setting up PWG2femtoscopyUser.par______//
56   //____________________________________________________//
57   setupPar("PWG2femtoscopyUser");
58   gSystem->Load("libPWG2femtoscopyUser.so");
59   
60   //ANALYSIS PART
61   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");
62   gROOT->LoadMacro("ConfigFemtoAnalysis.C++");
63
64   //____________________________________________//
65   //Usage of event tags
66   AliTagAnalysis *analysis = new AliTagAnalysis();
67   TChain *chain = 0x0;
68   //  chain = analysis->GetChainFromCollection(collectionfile,"esdTree");
69
70 //   if (dataFromAlien) {
71     AliTagAnalysis *analysis = new AliTagAnalysis();
72     chain = analysis->GetChainFromCollection(chainlistfile,"esdTree");
73 //   }
74 //   else {
75 //     gROOT->LoadMacro("CreateESDChain.C");
76 //     chain = CreateESDChain(chainlistfile,500);
77 //   }
78
79   //____________________________________________//
80   // Make the analysis manager
81   AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
82   AliESDInputHandler* esdH = new AliESDInputHandler;
83   AliMCEventHandler *mcH = new AliMCEventHandler;
84
85   esdH->SetInactiveBranches("FMD CaloCluster");
86   mgr->SetInputEventHandler(esdH);  
87   mgr->SetMCtruthEventHandler(mcH);
88   //____________________________________________//
89   // 1st Pt task
90   AliAnalysisTaskFemto *task1 = new AliAnalysisTaskFemto("TaskFemto");
91
92   mgr->AddTask(task1);
93
94   // Create containers for input/output
95   //  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
96   AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("input0", 
97                                                            TTree::Class(), AliAnalysisManager::kInputContainer);
98   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist1", TList::Class(),AliAnalysisManager::kOutputContainer,"Femto.ESD.root");
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 }