]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/STRANGENESS/LambdaK0PbPb/MainStreamAnalysis/AnalysisStrange.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / LambdaK0PbPb / MainStreamAnalysis / AnalysisStrange.C
CommitLineData
9d9613cc 1const char *anatype = "ESD";
2
3void AnalysisStrange()
4{
5// Analysis using ESD data
6// Automatically generated analysis steering macro executed in grid subjobs
7
8 TStopwatch timer;
9 timer.Start();
10
11// Set temporary merging directory to current one
12 gSystem->Setenv("TMPDIR", gSystem->pwd());
13
14// Set temporary compilation directory to current one
15 gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
16
17// Reset existing include path and add current directory first in the search
18 gSystem->SetIncludePath("-I.");
19// load base root libraries
20 gSystem->Load("libTree");
21 gSystem->Load("libGeom");
22 gSystem->Load("libVMC");
23 gSystem->Load("libPhysics");
24
25 gSystem->Load("libMinuit");
26
27// Load analysis framework libraries
28 gSystem->Load("libSTEERBase");
29 gSystem->Load("libESD");
30 gSystem->Load("libAOD");
31 gSystem->Load("libANALYSIS");
32 gSystem->Load("libOADB");
33 gSystem->Load("libANALYSISalice");
34 gSystem->Load("libCORRFW");
35
36// include path
37 TString intPath = gInterpreter->GetIncludePath();
38 TObjArray *listpaths = intPath.Tokenize(" ");
39 TIter nextpath(listpaths);
40 TObjString *pname;
41 while ((pname=(TObjString*)nextpath())) {
42 TString current = pname->GetName();
43 if (current.Contains("AliRoot") || current.Contains("ALICE_ROOT")) continue;
44 gSystem->AddIncludePath(current);
45 }
46 if (listpaths) delete listpaths;
47 gROOT->ProcessLine(".include $ALICE_ROOT/include");
48 printf("Include path: %s\n", gSystem->GetIncludePath());
49
50// Add aditional AliRoot libraries
51
52// analysis source to be compiled at runtime (if any)
53 gROOT->ProcessLine(".L AliAnalysisCentralitySelector.cxx+g");
54 gROOT->ProcessLine(".L AliAnalysisTaskPerformanceStrange.cxx+g");
55
56// connect to AliEn and make the chain
57 if (!TGrid::Connect("alien://")) return;
58// read the analysis manager from file
59 AliAnalysisManager *mgr = AliAnalysisAlien::LoadAnalysisManager("analysis.root");
60 if (!mgr) return;
61 mgr->PrintStatus();
62 AliLog::SetGlobalLogLevel(AliLog::kError);
63 TChain *chain = CreateChain("wn.xml", anatype);
64
65 mgr->StartAnalysis("localfile", chain);
66 timer.Stop();
67 timer.Print();
68}
69
70//________________________________________________________________________________
71TChain* CreateChain(const char *xmlfile, const char *type="ESD")
72{
73// Create a chain using url's from xml file
74 TString filename;
75 Int_t run = 0;
76 TString treename = type;
77 treename.ToLower();
78 treename += "Tree";
79 printf("***************************************\n");
80 printf(" Getting chain of trees %s\n", treename.Data());
81 printf("***************************************\n");
82 TAlienCollection *coll = TAlienCollection::Open(xmlfile);
83 if (!coll) {
84 ::Error("CreateChain", "Cannot create an AliEn collection from %s", xmlfile);
85 return NULL;
86 }
87 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
88 TChain *chain = new TChain(treename);
89 coll->Reset();
90 while (coll->Next()) {
91 filename = coll->GetTURL();
92 if (mgr) {
93 Int_t nrun = AliAnalysisManager::GetRunFromAlienPath(filename);
94 if (nrun && nrun != run) {
95 printf("### Run number detected from chain: %d\n", nrun);
96 mgr->SetRunFromPath(nrun);
97 run = nrun;
98 }
99 }
100 chain->Add(filename);
101 }
102 if (!chain->GetNtrees()) {
103 ::Error("CreateChain", "No tree found from collection %s", xmlfile);
104 return NULL;
105 }
106 return chain;
107}
108