]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
reading of run parameters from the logbook
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 6 Nov 2006 14:24:21 +0000 (14:24 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 6 Nov 2006 14:24:21 +0000 (14:24 +0000)
online offline naming conversion

STEER/AliPreprocessor.cxx
STEER/AliPreprocessor.h
STEER/AliShuttleInterface.cxx
STEER/AliShuttleInterface.h
STEER/macros/CreateESDChain.C [deleted file]

index b35ba08d0c39181baf8f8577ea855fa1b3adb20a..af3631c7514621d9884346d435b72e3a988b0843 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
 
 /*
 $Log$
+Revision 1.6  2006/10/02 12:57:48  jgrosseo
+Small interface change of function StoreReferenceData in Shuttle
+
 Revision 1.5  2006/09/04 17:42:34  hristov
 Changes required by Effective C++
 
 Revision 1.5  2006/09/04 17:42:34  hristov
 Changes required by Effective C++
 
@@ -141,7 +144,7 @@ UInt_t AliPreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TO
   //
   // The parameters are
   //   1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
   //
   // The parameters are
   //   1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
-  //         by the Preprocessor. Thus the object's path is "DET/level2/level3"
+  //         by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
   //   3) the object to be stored
   //   4) the metaData to be associated with the object
   //   5) the validity start run number w.r.t. the current run,
   //   3) the object to be stored
   //   4) the metaData to be associated with the object
   //   5) the validity start run number w.r.t. the current run,
@@ -151,7 +154,10 @@ UInt_t AliPreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TO
   //
   // The call is delegated to AliShuttleInterface
 
   //
   // The call is delegated to AliShuttleInterface
 
-  return fShuttle->Store(AliCDBPath(GetName(), pathLevel2, pathLevel3), object,
+  const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
+  if(!offlineDetName) return 0;
+
+  return fShuttle->Store(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
                metaData, validityStart, validityInfinite);
 }
 
                metaData, validityStart, validityInfinite);
 }
 
@@ -166,13 +172,16 @@ UInt_t AliPreprocessor::StoreReferenceData(const char* pathLevel2, const char* p
   //
   // The parameters are
   //   1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
   //
   // The parameters are
   //   1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
-  //         by the Preprocessor. Thus the object's path is "DET/level2/level3"
+  //         by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
   //   3) the object to be stored
   //   4) the metaData to be associated with the object
   //
   // The call is delegated to AliShuttleInterface
 
   //   3) the object to be stored
   //   4) the metaData to be associated with the object
   //
   // The call is delegated to AliShuttleInterface
 
-  return fShuttle->StoreReferenceData(AliCDBPath(GetName(), pathLevel2, pathLevel3), object,
+  const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
+  if(!offlineDetName) return 0;
+
+  return fShuttle->StoreReferenceData(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
                metaData);
 }
 
                metaData);
 }
 
@@ -207,3 +216,13 @@ void AliPreprocessor::Log(const char* message)
 
   fShuttle->Log(GetName(), message);
 }
 
   fShuttle->Log(GetName(), message);
 }
+
+//______________________________________________________________________________________________
+const char* AliPreprocessor::GetRunParameter(const char* param)
+{
+  // Return run parameter read from run logbook
+  //
+  // The call is delegated to AliShuttleInterface
+
+  return fShuttle->GetRunParameter(param);
+}
index be74ba0cdae76c5fdf253bc3a2cd694d25379f00..a43e7cd4386a405258af09d11a6283523d4862ad 100644 (file)
@@ -24,6 +24,7 @@ class AliShuttleInterface;
 class AliPreprocessor : public TNamed
 {
   public:
 class AliPreprocessor : public TNamed
 {
   public:
+
     enum { kDAQ, kDCS, kHLT };
 
     AliPreprocessor(const char* detector, AliShuttleInterface* shuttle);
     enum { kDAQ, kDCS, kHLT };
 
     AliPreprocessor(const char* detector, AliShuttleInterface* shuttle);
@@ -39,6 +40,7 @@ class AliPreprocessor : public TNamed
                AliCDBMetaData* metaData);
     const char* GetFile(Int_t system, const char* id, const char* source);
     TList* GetFileSources(Int_t system, const char* id);
                AliCDBMetaData* metaData);
     const char* GetFile(Int_t system, const char* id, const char* source);
     TList* GetFileSources(Int_t system, const char* id);
+    const char* GetRunParameter(const char* param);
     void Log(const char* message);
 
     Int_t fRun;         // current run
     void Log(const char* message);
 
     Int_t fRun;         // current run
index 6af1b0b586c4472f0faaea228a58cab073309312..b5eed909a57feee8ecf7e34b2199762c62e9faf2 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
 
 /*
 $Log$
+Revision 1.1  2006/06/02 14:14:36  hristov
+Separate library for CDB (Jan)
+
 Revision 1.2  2006/03/07 07:52:34  hristov
 New version (B.Yordanov)
 
 Revision 1.2  2006/03/07 07:52:34  hristov
 New version (B.Yordanov)
 
@@ -42,7 +45,52 @@ some docs added
 //
 
 #include "AliShuttleInterface.h"
 //
 
 #include "AliShuttleInterface.h"
+#include "AliLog.h"
+#include <TSystem.h>
 
 ClassImp(AliShuttleInterface)
 
 const char* AliShuttleInterface::fkSystemNames[3] = { "DAQ", "DCS", "HLT" };
 
 ClassImp(AliShuttleInterface)
 
 const char* AliShuttleInterface::fkSystemNames[3] = { "DAQ", "DCS", "HLT" };
+
+// names of the detectors preprocessors
+const char* AliShuttleInterface::fgkDetName[kNDetectors] = {"SPD", "SDD", "SSD", "TPC", "TRD", "TOF",
+       "PHS", "CPV", "HMP", "EMC", "MCH", "MTR", "FMD", "ZDC", "PMD", "T00", "V00"};
+
+// names of the detectors in OCDB
+const char* AliShuttleInterface::fgkOfflineDetName[kNDetectors] = {"ITS", "ITS", "ITS", "TPC", "TRD", "TOF",
+       "PHOS", "PHOS", "RICH", "EMCAL", "MUON", "MUON", "FMD", "ZDC", "PMD", "START", "VZERO"};
+
+//______________________________________________________________________________________________
+const char* AliShuttleInterface::GetOfflineDetName(const char* detName){
+// Return "offline" detector name
+
+       Int_t detPos = GetDetPos(detName);
+       if(detPos < 0) {
+               AliErrorClass(Form("Unknown detector: %s",detName));
+               return 0;
+       }
+
+       return fgkOfflineDetName[detPos];
+}
+
+//______________________________________________________________________________________________
+const char* AliShuttleInterface::GetDetName(UInt_t detPos){
+// Return detector code
+
+       if(detPos >= kNDetectors) {
+               AliErrorClass(Form("Parameter out of bound: %d", detPos));
+               return 0;
+       }
+
+       return fgkDetName[detPos];
+}
+
+//______________________________________________________________________________________________
+const Int_t AliShuttleInterface::GetDetPos(const char* detName){
+// Return detector position in the detector code array
+
+       for(UInt_t iDet=0; iDet < kNDetectors; iDet++){
+               if(!strcmp(fgkDetName[iDet], detName)) return iDet;
+       }
+       return -1;
+}
index 7fe58c6930cb0bb26d975ffcfd1c08f923db2316..258a0b73d15d9a44c10d0cf4cc3cf37d8c6e75f9 100644 (file)
@@ -20,18 +20,31 @@ class AliCDBPath;
 class AliShuttleInterface : public TObject
 {
   public:
 class AliShuttleInterface : public TObject
 {
   public:
-    enum { kDAQ = 0, kDCS, kHLT };
-    static const char* fkSystemNames[3];  // names of the systems providing data to the shuttle
+    enum System { kDAQ = 0, kDCS, kHLT };
+    enum { kNDetectors=17 }; // number of subdetectors in ALICE
 
     virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
                                Int_t validityStart = 0, Bool_t validityInfinite = kFALSE) = 0;
     virtual UInt_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData) = 0;
     virtual const char* GetFile(Int_t system, const char* detector, const char* id, const char* source) = 0;
     virtual TList* GetFileSources(Int_t system, const char* detector, const char* id) = 0;
 
     virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
                                Int_t validityStart = 0, Bool_t validityInfinite = kFALSE) = 0;
     virtual UInt_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData) = 0;
     virtual const char* GetFile(Int_t system, const char* detector, const char* id, const char* source) = 0;
     virtual TList* GetFileSources(Int_t system, const char* detector, const char* id) = 0;
+    virtual const char* GetRunParameter(const char* lbEntry) = 0;
     virtual void Log(const char* detector, const char* message) = 0;
 
     virtual void RegisterPreprocessor(AliPreprocessor* preprocessor) = 0;
 
     virtual void Log(const char* detector, const char* message) = 0;
 
     virtual void RegisterPreprocessor(AliPreprocessor* preprocessor) = 0;
 
+    static const char* GetSystemName(UInt_t system) {return (system < 3) ? fkSystemNames[system] : 0;}
+
+    static const char* GetOfflineDetName(const char* detName);
+    static const char* GetDetName(UInt_t detPos);
+    static const Int_t GetDetPos(const char* detName);
+    static const UInt_t NDetectors() {return kNDetectors;}
+
+  protected:
+    static const char* fkSystemNames[3];               // names of the systems providing data to the shuttle
+    static const char* fgkDetName[kNDetectors];        //! names of detectors' preprocessors (3-letter code convention)
+    static const char* fgkOfflineDetName[kNDetectors];  //! names of detectors in OCDB (AliRoot naming convention)
+
   private:
     ClassDef(AliShuttleInterface, 0);
 };
   private:
     ClassDef(AliShuttleInterface, 0);
 };
diff --git a/STEER/macros/CreateESDChain.C b/STEER/macros/CreateESDChain.C
deleted file mode 100644 (file)
index 7e886bd..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $Id$ */
-
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-// This helper macros creates a chain of ESD files for you. Source can be either a text
-// file with the file paths or a directory. In the latter case all ESD files in all subdirectories
-// are considered.
-//
-// Author: Jan.Fiete.Grosse-Oetringhaus@cern.ch
-
-TChain* CreateESDChain(const char* aDataDir = "ESDfiles.txt", Int_t aRuns = 20, Int_t offset = 0)
-{
-  // creates chain of files in a given directory or file containing a list.
-  // In case of directory the structure is expected as:
-  // <aDataDir>/<dir0>/AliESDs.root
-  // <aDataDir>/<dir1>/AliESDs.root
-  // ...
-
-  if (!aDataDir)
-    return 0;
-
-  Long_t id, size, flags, modtime;
-  if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
-  {
-    printf("%s not found.\n", aDataDir);
-    return 0;
-  }
-
-  TChain* chain = new TChain("esdTree");
-  TChain* chaingAlice = 0;
-
-  if (flags & 2)
-  {
-    TString execDir(gSystem->pwd());
-    TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
-    TList* dirList            = baseDir->GetListOfFiles();
-    Int_t nDirs               = dirList->GetEntries();
-    gSystem->cd(execDir);
-
-    Int_t count = 0;
-
-    for (Int_t iDir=0; iDir<nDirs; ++iDir)
-    {
-      TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
-      if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
-        continue;
-
-      if (offset > 0)
-      {
-        --offset;
-        continue;
-      }
-
-      if (count++ == aRuns)
-        break;
-
-      TString presentDirName(aDataDir);
-      presentDirName += "/";
-      presentDirName += presentDir->GetName();
-
-      chain->Add(presentDirName + "/AliESDs.root/esdTree");
-    }
-  }
-  else
-  {
-    // Open the input stream
-    ifstream in;
-    in.open(aDataDir);
-
-    Int_t count = 0;
-
-    // Read the input list of files and add them to the chain
-    TString esdfile;
-    while(in.good()) {
-      in >> esdfile;
-      if (!esdfile.Contains("root")) continue; // protection
-
-      if (offset > 0)
-      {
-        --offset;
-        continue;
-      }
-
-      if (count++ == aRuns)
-        break;
-
-        // add esd file
-      chain->Add(esdfile);
-    }
-
-    in.close();
-  }
-
-  return chain;
-}
-
-void LookupWrite(TChain* chain, const char* target)
-{
-  // looks up the chain and writes the remaining files to the text file target
-
-  chain->Lookup();
-
-  TObjArray* list = chain->GetListOfFiles();
-  TIterator* iter = list->MakeIterator();
-  TObject* obj = 0;
-
-  ofstream outfile;
-  outfile.open(target);
-
-  while ((obj = iter->Next()))
-    outfile << obj->GetTitle() << endl;
-
-  outfile.close();
-
-  delete iter;
-}