]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
add a robust run number guessing scheme that works also on the lego train where the...
authormkrzewic <mkrzewic@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 Nov 2013 17:24:46 +0000 (17:24 +0000)
committermkrzewic <mkrzewic@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 Nov 2013 17:24:46 +0000 (17:24 +0000)
PWGPP/TPC/AliTaskConfigOCDB.cxx
PWGPP/TPC/AliTaskConfigOCDB.h

index 4d069f0aaca13da67171f2b1d3c1d7000938518b..bc8170a4a7022806b65c6e823802f931c47c463d 100644 (file)
@@ -19,6 +19,7 @@
 #include <TFile.h>
 #include <TGeoGlobalMagField.h>
 #include "TGeoManager.h"
+#include <TRegexp.h>
  
 #include "AliAnalysisManager.h"
 #include "AliGeomManager.h"
@@ -173,6 +174,31 @@ void AliTaskConfigOCDB::Exec(Option_t* /*option*/)
 //______________________________________________________________________________
 void AliTaskConfigOCDB::Terminate(Option_t *)
 {
-// Initialize CDB also in Terminate
-//   CreateOutputObjects();
+  // Initialize CDB also in Terminate
+  //   CreateOutputObjects();
 }
+
+Int_t AliTaskConfigOCDB::guessRunNumber(TString path)
+{
+  //guess the runnumber from datapath
+  //works also on the LEGO train where the data path looks like this:
+  //workdir/testdata/__alice__data__2010__LHC10b__000114924__ESDs__pass2_root_archive_AliESDs_2/10000114924018.100/root_archive.zip
+  TObjArray* a = path.Tokenize("/_");
+  TRegexp r("^000[0-9][0-9][0-9][0-9][0-9][0-9]$");
+  TString sub;
+  for (Int_t i=0; i<a->GetEntries();i++)
+  {
+    TObjString* subobj = (TObjString*)a->At(i);
+    TString subtmp = subobj->GetString();
+    if (subtmp.Contains(r)) 
+    {
+      sub=subtmp;
+      break;
+    }
+  }
+  Int_t runNumber=sub.Atoi();
+  AliInfo(Form("guessed run: %i\n",runNumber));
+  a->Delete();
+  delete a;
+  return runNumber;
+}       
index 393de3b3197e60b51998c8e83ac091939d707613..e93c9d2c711a0950f6c9376fa2bec9ee51dff5e1 100644 (file)
@@ -42,6 +42,7 @@ public:
   virtual Bool_t            Notify();
   virtual void              Exec(Option_t *option);
   virtual void              Terminate(Option_t *option);
+  Int_t guessRunNumber(TString path);
     
   ClassDef(AliTaskConfigOCDB,1)  // Class giving CDB connectivity
 };