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