]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/macros/BatchMC/runBatch.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / macros / BatchMC / runBatch.C
1 void runBatch() {
2   TStopwatch timer;
3   timer.Start();
4
5   printf("*** Connect to AliEn ***\n");
6   TGrid::Connect("alien://");
7   gSystem->Load("libProofPlayer");
8   gSystem->Load("libVMC");
9
10   // Use precompiled libraries for the analysis framework
11   gSystem->Load("libSTEERBase");
12   gSystem->Load("libVMC");
13   gSystem->Load("libESD");
14   gSystem->Load("libAOD");
15   gSystem->Load("libANALYSIS");
16   gSystem->Load("libANALYSISalice");
17
18   // Use par files only for PWG2 code
19
20   //____________________________________________________//
21   //_____________Setting up PWG2AOD.par_________________//
22   //____________________________________________________//
23   setupPar("PWG2AOD");
24   gSystem->Load("libPWG2AOD");
25   
26   //____________________________________________________//
27   //_____________Setting up PWG2femtoscopy.par__________//
28   //____________________________________________________//
29   setupPar("PWG2femtoscopy");
30   gSystem->Load("libPWG2femtoscopy");
31   
32   //____________________________________________________//
33   //_____________Setting up PWG2femtoscopyUser.par______//
34   //____________________________________________________//
35   setupPar("PWG2femtoscopyUser");
36   gSystem->Load("libPWG2femtoscopyUser");
37   
38   //ANALYSIS PART
39   const char *collectionfile="wn.xml";
40
41   //____________________________________________//
42   //Usage of event tags
43   AliTagAnalysis *analysis = new AliTagAnalysis();
44   TChain *chain = 0x0;
45   chain = analysis->GetChainFromCollection(collectionfile,"esdTree");
46
47   //____________________________________________//
48   // Make the analysis manager
49   AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
50   AliESDInputHandler* esdH = new AliESDInputHandler;
51   esdH->SetInactiveBranches("FMD CaloCluster");
52   mgr->SetInputEventHandler(esdH);  
53
54   AliMCEventHandler *mcH = new AliMCEventHandler;
55   mgr->SetMCtruthEventHandler(mcH);
56
57   //____________________________________________//
58   // 1st Pt task
59   gROOT->LoadMacro("AddTaskFemto.C");
60   AliAnalysisTaskFemto *taskfemto = AddTaskFemto();
61
62   //____________________________________________//
63   // Run the analysis
64   if (!mgr->InitAnalysis()) return;
65   mgr->PrintStatus();
66   mgr->StartAnalysis("local",chain);
67
68   timer.Stop();
69   timer.Print();
70 }
71
72 Int_t setupPar(const char* pararchivename) {
73   ///////////////////
74   // Setup PAR File//
75   ///////////////////
76   if (pararchivename) {
77     char processline[1024];
78     sprintf(processline,".! tar xvzf %s.par",pararchivename);
79     gROOT->ProcessLine(processline);
80     const char* ocwd = gSystem->WorkingDirectory();
81     gSystem->ChangeDirectory(pararchivename);
82
83     // check for BUILD.sh and execute
84     if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
85       printf("*******************************\n");
86       printf("*** Building PAR archive    ***\n");
87       printf("*******************************\n");
88
89       if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
90         Error("runProcess","Cannot Build the PAR Archive! - Abort!");
91         return -1;
92       }
93     }
94     // check for SETUP.C and execute
95     if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
96       printf("*******************************\n");
97       printf("*** Setup PAR archive       ***\n");
98       printf("*******************************\n");
99       gROOT->Macro("PROOF-INF/SETUP.C");
100     }
101     
102     gSystem->ChangeDirectory("../");
103   }
104
105   return 1;
106 }