From: agheata Date: Fri, 14 Oct 2011 06:38:16 +0000 (+0000) Subject: Improved version of AliAnalysisManager::GetRunFromAlienPath X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=ff5309f85643c39aac4703af23993d23d5916f7e;p=u%2Fmrichter%2FAliRoot.git Improved version of AliAnalysisManager::GetRunFromAlienPath --- diff --git a/ANALYSIS/AliAnalysisManager.cxx b/ANALYSIS/AliAnalysisManager.cxx index e8e49d8835d..ed79819c22c 100644 --- a/ANALYSIS/AliAnalysisManager.cxx +++ b/ANALYSIS/AliAnalysisManager.cxx @@ -234,27 +234,29 @@ Int_t AliAnalysisManager::GetRunFromAlienPath(const char *path) // alice data in alien. // sim: /alice/sim//run_no/... // data: /alice/data/year/period/000run_no/... (ESD or AOD) + TString type = "unknown"; TString s(path); + if (s.Contains("/alice/data")) type = "real"; + else if (s.Contains("/alice/sim")) type = "simulated"; TString srun; - Int_t run = 0; - Int_t index = s.Index("/alice/sim"); - if (index >= 0) { - for (Int_t i=0; i<3; i++) { - index = s.Index("/", index+1); - if (index<0) return 0; - } - srun = s(index+1,6); - run = atoi(srun); - } - index = s.Index("/alice/data"); - if (index >= 0) { - for (Int_t i=0; i<4; i++) { - index = s.Index("/", index+1); - if (index<0) return 0; + Int_t ind1, ind2; + ind1 = s.Index("/00"); + if (ind1>0) { + ind2 = s.Index("/",ind1+1); + if (ind2>0) srun = s(ind1+1, ind2-ind1-1); + } + if (srun.IsNull()) { + ind1 = s.Index("/LHC"); + if (ind1>0) { + ind1 = s.Index("/",ind1+1); + if (ind1>0) { + ind2 = s.Index("/",ind1+1); + if (ind2>0) srun = s(ind1+1, ind2-ind1-1); + } } - srun = s(index+1,9); - run = atoi(srun); - } + } + Int_t run = srun.Atoi(); + if (run>0) printf("=== GetRunFromAlienPath: run %d of %s data ===\n", run, type.Data()); return run; }