1 const char *anatype = "ESD";
5 // Analysis using ESD data
6 // Automatically generated analysis steering macro executed in grid subjobs
11 // Set temporary merging directory to current one
12 gSystem->Setenv("TMPDIR", gSystem->pwd());
14 // Set temporary compilation directory to current one
15 gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
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");
25 gSystem->Load("libMinuit");
27 // Load analysis framework libraries
28 gSystem->Load("libSTEERBase");
29 gSystem->Load("libESD");
30 gSystem->Load("libAOD");
31 gSystem->Load("libANALYSIS");
32 gSystem->Load("libANALYSISalice");
33 gSystem->Load("libCORRFW");
36 TString intPath = gInterpreter->GetIncludePath();
37 TObjArray *listpaths = intPath.Tokenize(" ");
38 TIter nextpath(listpaths);
40 while ((pname=(TObjString*)nextpath())) {
41 TString current = pname->GetName();
42 if (current.Contains("AliRoot") || current.Contains("ALICE_ROOT")) continue;
43 gSystem->AddIncludePath(current);
45 if (listpaths) delete listpaths;
46 gROOT->ProcessLine(".include $ALICE_ROOT/include");
47 printf("Include path: %s\n", gSystem->GetIncludePath());
49 // Add aditional AliRoot libraries
51 // analysis source to be compiled at runtime (if any)
52 gROOT->ProcessLine(".L AliAnalysisCentralitySelector.cxx+g");
53 gROOT->ProcessLine(".L AliAnalysisTaskPerformanceStrange.cxx+g");
55 // connect to AliEn and make the chain
56 if (!TGrid::Connect("alien://")) return;
57 // read the analysis manager from file
58 TFile *file = TFile::Open("analysis.root");
60 TIter nextkey(file->GetListOfKeys());
61 AliAnalysisManager *mgr = 0;
63 while ((key=(TKey*)nextkey())) {
64 if (!strcmp(key->GetClassName(), "AliAnalysisManager"))
65 mgr = (AliAnalysisManager*)file->Get(key->GetName());
68 ::Error("AnalysisStrange", "No analysis manager found in file analysis.root");
73 AliLog::SetGlobalLogLevel(AliLog::kError);
74 TChain *chain = CreateChain("wn.xml", anatype);
76 mgr->StartAnalysis("localfile", chain);
81 //________________________________________________________________________________
82 TChain* CreateChain(const char *xmlfile, const char *type="ESD")
84 // Create a chain using url's from xml file
87 TString treename = type;
90 printf("***************************************\n");
91 printf(" Getting chain of trees %s\n", treename.Data());
92 printf("***************************************\n");
93 TAlienCollection *coll = TAlienCollection::Open(xmlfile);
95 ::Error("CreateChain", "Cannot create an AliEn collection from %s", xmlfile);
98 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
99 TChain *chain = new TChain(treename);
101 while (coll->Next()) {
102 filename = coll->GetTURL();
104 Int_t nrun = AliAnalysisManager::GetRunFromAlienPath(filename);
105 if (nrun && nrun != run) {
106 printf("### Run number detected from chain: %d\n", nrun);
107 mgr->SetRunFromPath(nrun);
111 chain->Add(filename);
113 if (!chain->GetNtrees()) {
114 ::Error("CreateChain", "No tree found from collection %s", xmlfile);