]>
Commit | Line | Data |
---|---|---|
4ebdd20e | 1 | void HighPtDeDx_lhc10c_Data_ESDs_merge(const char *dir, Int_t stage=0) |
2 | { | |
3 | // Automatically generated merging macro executed in grid subjobs | |
4 | ||
5 | TStopwatch timer; | |
6 | timer.Start(); | |
7 | ||
8 | // Reset existing include path and add current directory first in the search | |
9 | gSystem->SetIncludePath("-I."); | |
10 | // Load analysis framework libraries | |
11 | gSystem->Load("libANALYSIS"); | |
12 | gSystem->Load("libOADB"); | |
13 | gSystem->Load("libANALYSISalice"); | |
14 | gSystem->Load("libCORRFW"); | |
15 | ||
16 | // include path | |
17 | TString intPath = gInterpreter->GetIncludePath(); | |
18 | TObjArray *listpaths = intPath.Tokenize(" "); | |
19 | TIter nextpath(listpaths); | |
20 | TObjString *pname; | |
21 | while ((pname=(TObjString*)nextpath())) { | |
22 | TString current = pname->GetName(); | |
23 | if (current.Contains("AliRoot") || current.Contains("ALICE_ROOT")) continue; | |
24 | gSystem->AddIncludePath(current); | |
25 | } | |
26 | if (listpaths) delete listpaths; | |
27 | gSystem->AddIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include "); | |
28 | gROOT->ProcessLine(".include $ALICE_ROOT/include"); | |
29 | printf("Include path: %s\n", gSystem->GetIncludePath()); | |
30 | ||
31 | // Add aditional AliRoot libraries | |
32 | ||
33 | // Analysis source to be compiled at runtime (if any) | |
34 | gROOT->ProcessLine(".L DebugClasses.C+g"); | |
35 | gROOT->ProcessLine(".L AliAnalysisTaskHighPtDeDx.cxx+g"); | |
36 | gROOT->ProcessLine(".L AliAnalysisTaskHighPtDeDxV0.cxx+g"); | |
37 | ||
38 | // fast xrootd reading enabled | |
39 | printf("!!! You requested FastRead option. Using xrootd flags to reduce timeouts. Note that this may skip some files that could be accessed !!!"); | |
40 | gEnv->SetValue("XNet.ConnectTimeout",50); | |
41 | gEnv->SetValue("XNet.RequestTimeout",50); | |
42 | gEnv->SetValue("XNet.MaxRedirectCount",2); | |
43 | gEnv->SetValue("XNet.ReconnectTimeout",50); | |
44 | gEnv->SetValue("XNet.FirstConnectMaxCnt",1); | |
45 | ||
46 | // Set temporary merging directory to current one | |
47 | gSystem->Setenv("TMPDIR", gSystem->pwd()); | |
48 | ||
49 | // Set temporary compilation directory to current one | |
50 | gSystem->SetBuildDir(gSystem->pwd(), kTRUE); | |
51 | ||
52 | // Connect to AliEn | |
53 | if (!TGrid::Connect("alien://")) return; | |
54 | TString outputDir = dir; | |
55 | TString outputFiles = "EventStat_temp.root,HighPtDeDx_Tree.root,HighPtDeDxV0_Tree.root"; | |
56 | TString mergeExcludes = " "; | |
57 | TObjArray *list = outputFiles.Tokenize(","); | |
58 | TIter *iter = new TIter(list); | |
59 | TObjString *str; | |
60 | TString outputFile; | |
61 | Bool_t merged = kTRUE; | |
62 | while((str=(TObjString*)iter->Next())) { | |
63 | outputFile = str->GetString(); | |
64 | if (outputFile.Contains("*")) continue; | |
65 | Int_t index = outputFile.Index("@"); | |
66 | if (index > 0) outputFile.Remove(index); | |
67 | // Skip already merged outputs | |
68 | if (!gSystem->AccessPathName(outputFile)) { | |
69 | printf("Output file <%s> found. Not merging again.",outputFile.Data()); | |
70 | continue; | |
71 | } | |
72 | if (mergeExcludes.Contains(outputFile.Data())) continue; | |
73 | merged = AliAnalysisAlien::MergeOutput(outputFile, outputDir, 100, stage); | |
74 | if (!merged) { | |
75 | printf("ERROR: Cannot merge %s\n", outputFile.Data()); | |
76 | return; | |
77 | } | |
78 | } | |
79 | // all outputs merged, validate | |
80 | ofstream out; | |
81 | out.open("outputs_valid", ios::out); | |
82 | out.close(); | |
83 | // read the analysis manager from file | |
84 | if (!outputDir.Contains("Stage")) return; | |
85 | AliAnalysisManager *mgr = AliAnalysisAlien::LoadAnalysisManager("HighPtDeDx_lhc10c_Data_ESDs.root"); | |
86 | if (!mgr) return; | |
87 | mgr->SetRunFromPath(mgr->GetRunFromAlienPath(dir)); | |
88 | mgr->SetSkipTerminate(kFALSE); | |
89 | mgr->PrintStatus(); | |
90 | AliLog::SetGlobalLogLevel(AliLog::kWarning); | |
91 | TTree *tree = NULL; | |
92 | mgr->StartAnalysis("gridterminate", tree); | |
93 | } | |
94 |