]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/EBYE/Fluctuations/macro/runTaskMF.C
1ce0d2b3ea05a8ecce5ffab49dcaf1807188ec10
[u/mrichter/AliRoot.git] / PWG2 / EBYE / Fluctuations / macro / runTaskMF.C
1 /****************************************************************
2
3 Lunch the Analysis Task for Multiplicity Fluctuation 
4 Author: Satyajit Jena
5 Email:  sjena@cern.ch
6
7 Running in Local = analmode = local, 
8 input list of files, number of esds
9 useMC and format
10
11 and AFF = analmode = "proof" and
12 data set.
13
14 *******************************************************************/
15
16 void runTaskMF(TString analmode = "local")
17 {
18
19  TString dataset = "/PMD/sjena/LHC10a10_2360Gev_pythia";
20  Bool_t  useMC = kFALSE;
21  TString format="esd";
22  TString output = "test.root";
23
24
25  if(analmode.CompareTo("local") == 0)
26     {
27       if(!LoadLibraries(analmode))
28         {
29           printf("Library Not loaded\n");
30           return;
31         }
32       runLocal("file.txt",5, useMC, format, output);
33       
34     }
35  else  if(analmode.CompareTo("proof") == 0)
36    {
37      if(!LoadLibraries(analmode)) return;
38      runproof(dataset, useMC);
39           
40      
41    }
42  else printf("load error\n");
43
44 }
45
46 //___________________________________________________________________________________
47 Bool_t LoadLibraries(TString mode = "local")
48 {
49
50   if(mode.CompareTo("local") == 0)
51     {
52       gSystem->Load("libSTEERBase.so");
53       gSystem->Load("libVMC.so");
54       gSystem->Load("libESD.so");
55       gSystem->Load("libAOD.so");
56       gSystem->Load("libANALYSIS.so");
57       gSystem->Load("libANALYSISalice.so");
58       gSystem->Load("libPWG2ebye.so");
59       gSystem->AddIncludePath("-I$ALICE_ROOT/include");
60       printf("Library is Loaded \n");
61
62       return kTRUE;
63
64     }
65   else if(mode.CompareTo("proof") == 0)
66     {
67       TString proofCluster="alice-caf.cern.ch";
68       TString alirootVer = "VO_ALICE@AliRoot::v4-20-11-AN";
69       
70       gEnv->SetValue("XSec.GSI.DelegProxy","2");
71       TProof *p = TProof::Open(proofCluster.Data());
72       
73       p->ShowPackages();
74       p->EnablePackage(alirootVer.Data());
75      
76       return kTRUE;
77       
78     }
79   else 
80     {
81       printf(" ERROR: Give proper running mode \n");
82       return kFALSE;
83     }
84   
85 }
86 //______________________________________________________________________
87 // Running local
88 void runLocal(TString input,int nfile,  Bool_t useMC,  TString format,TString OutPutFile)
89 {
90
91   gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
92   TChain* chain = CreateESDChain(input, nfile);
93   
94   AliAnalysisManager *mgr = new AliAnalysisManager("Analysis");
95   AliVEventHandler* esdH = new AliESDInputHandler();
96   mgr->SetInputEventHandler(esdH);
97
98 //  gROOT->LoadMacro("$ALICE_ROOT/PWG2/EBYE/Fluctuations/AliEbyEEventSelector.cxx++g");  
99 //  gROOT->LoadMacro("$ALICE_ROOT/PWG2/EBYE/Fluctuations/AliEbyEMultiplicityFluctuationAnalysis.cxx++g");  
100 //  gROOT->LoadMacro("$ALICE_ROOT/PWG2/EBYE/Fluctuations/AliEbyEMFAnalysisTask.cxx++g");  
101   gROOT->LoadMacro("$ALICE_ROOT/PWG2/EBYE/Fluctuations/macro/AddTaskMF.C");
102   AddTaskMF();
103
104   mgr->SetDebugLevel(0);
105   
106   if (!mgr->InitAnalysis()) return;
107   mgr->PrintStatus();
108
109   mgr->InitAnalysis();
110   mgr->StartAnalysis("local", chain);
111
112
113 }
114
115
116 //________________________________________________________
117 //Running in proof
118
119 void runproof(TString dataset, Bool_t useMC)
120 {
121
122      AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
123      if (!mgr) mgr = new AliAnalysisManager("FirstCheck");
124      
125      AliVEventHandler* esdH = new AliESDInputHandler();
126      mgr->SetInputEventHandler(esdH);
127
128      gProof->LoadMacro("$ALICE_ROOT/PWG2/EBYE/Fluctuations/AliEbyEEventSelector.cxx++g");  
129      gProof->LoadMacro("$ALICE_ROOT/PWG2/EBYE/Fluctuations/AliEbyEMFAnalysisTask.cxx++g");  
130      gProof->LoadMacro("$ALICE_ROOT/PWG2/EBYE/Fluctuations/macro/AddTaskMF.C");
131      AddTaskMF();
132   
133      mgr->SetDebugLevel(0);
134      
135      if (!mgr->InitAnalysis()) 
136     return;
137      
138      mgr->PrintStatus();
139      mgr->InitAnalysis();
140      
141      mgr->StartAnalysis("proof",dataset.Data());
142   
143 }
144
145 //_________________
146 //Runningin grid