]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
The folder which should be used to store the guid files is added as an option to...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Feb 2007 13:59:31 +0000 (13:59 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Feb 2007 13:59:31 +0000 (13:59 +0000)
RAW/AliMDC.cxx
RAW/AliMDC.h
RAW/AliRawDB.cxx
RAW/AliRawDB.h
RAW/mdc.cxx
RAW/mdc.h

index 44401e418970812740870218b626dafb4021ef42..8e618ee9d36e1d13ead42963e3d9b1a44cfc5907 100644 (file)
@@ -83,7 +83,8 @@ const char* const AliMDC::fgkFilterName[kNFilters] = {"AliHoughFilter"};
 
 //______________________________________________________________________________
 AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode, 
 
 //______________________________________________________________________________
 AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode, 
-              Double_t maxSizeTagDB, const char* fileNameTagDB) :
+              Double_t maxSizeTagDB, const char* fileNameTagDB,
+              const char *guidFileFolder) :
   fEvent(new AliRawEvent),
   fESD(NULL),
   fStats(NULL),
   fEvent(new AliRawEvent),
   fESD(NULL),
   fStats(NULL),
@@ -97,7 +98,8 @@ AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode,
   fStop(kFALSE),
   fIsTagDBCreated(kFALSE),
   fMaxSizeTagDB(maxSizeTagDB),
   fStop(kFALSE),
   fIsTagDBCreated(kFALSE),
   fMaxSizeTagDB(maxSizeTagDB),
-  fFileNameTagDB(fileNameTagDB)
+  fFileNameTagDB(fileNameTagDB),
+  fGuidFileFolder(guidFileFolder)
 {
   // Create MDC processor object.
   // compress is the file compression mode.
 {
   // Create MDC processor object.
   // compress is the file compression mode.
@@ -111,6 +113,9 @@ AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode,
   // tag DB and then fileNameTagDB is the directory name for the tag DB.
   // Otherwise fileNameTagDB is the file name of the tag DB. If it is NULL
   // no tag DB will be created.
   // tag DB and then fileNameTagDB is the directory name for the tag DB.
   // Otherwise fileNameTagDB is the file name of the tag DB. If it is NULL
   // no tag DB will be created.
+  // Optional 'guidFileFolder' specifies the folder in which *.guid files
+  // will be stored. In case this option is not given, the *.guid files
+  // will be written to the same folder as the raw-data files.
  
 
   if (fFilterMode != kFilterOff) {
  
 
   if (fFilterMode != kFilterOff) {
@@ -130,6 +135,15 @@ AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode,
 //     }
 //   }
 
 //     }
 //   }
 
+  // Create the guid files folder if it does not exist
+  if (fGuidFileFolder) {
+    gSystem->ResetErrno();
+    gSystem->MakeDirectory(fGuidFileFolder);
+    if (gSystem->GetErrno() && gSystem->GetErrno() != EEXIST) {
+      SysError("AliMDC", "mkdir %s", fGuidFileFolder);
+    }
+  }
+
   // install SIGUSR1 handler to allow clean interrupts
   gSystem->AddSignalHandler(new AliMDCInterruptHandler(this));
 
   // install SIGUSR1 handler to allow clean interrupts
   gSystem->AddSignalHandler(new AliMDCInterruptHandler(this));
 
@@ -190,6 +204,8 @@ Int_t AliMDC::Open(EWriteMode mode, const char* fileName,
     fRawDB->Create();
   }
 
     fRawDB->Create();
   }
 
+  if (fGuidFileFolder) fRawDB->SetGuidFileFolder(fGuidFileFolder);
+
   if (fRawDB->IsZombie()) {
     delete fRawDB;
     fRawDB = NULL;
   if (fRawDB->IsZombie()) {
     delete fRawDB;
     fRawDB = NULL;
index 10b3bb1bcc88dd652af360614f7cb5b7c786a1f5..1c8e76d170c0c1260bea3c46b09c2b50355bacf2 100644 (file)
@@ -53,7 +53,8 @@ public:
 
    AliMDC(Int_t compress, Bool_t deleteFiles, 
          EFilterMode filterMode = kFilterTransparent, 
 
    AliMDC(Int_t compress, Bool_t deleteFiles, 
          EFilterMode filterMode = kFilterTransparent, 
-         Double_t maxSizeTagDB = -1, const char* fileNameTagDB = NULL);
+         Double_t maxSizeTagDB = -1, const char* fileNameTagDB = NULL,
+         const char* guidFileFolder = NULL);
    virtual ~AliMDC();
 
    Int_t      Open(EWriteMode mode, const char* fileName,
    virtual ~AliMDC();
 
    Int_t      Open(EWriteMode mode, const char* fileName,
@@ -98,6 +99,7 @@ private:
    Bool_t       fIsTagDBCreated; // is tag db already created
    Double_t     fMaxSizeTagDB;// max size of the tag DB
    const char*  fFileNameTagDB;// tag DB file name
    Bool_t       fIsTagDBCreated; // is tag db already created
    Double_t     fMaxSizeTagDB;// max size of the tag DB
    const char*  fFileNameTagDB;// tag DB file name
+   const char*  fGuidFileFolder; // guid files folder
 
    // Filter names
    enum {kNFilters = 1};
 
    // Filter names
    enum {kNFilters = 1};
index 00d2d204c952e3c42da6ea4f629091a417836edb..1839761e5cf4d1014aa17ae97e88a95c417b1b0e 100644 (file)
@@ -34,6 +34,8 @@
 #include <TSystem.h>
 #include <TKey.h>
 
 #include <TSystem.h>
 #include <TKey.h>
 
+#include <TObjString.h>
+
 #include "AliESD.h"
 #include "AliRawEvent.h"
 #include "AliRawEventHeaderBase.h"
 #include "AliESD.h"
 #include "AliRawEvent.h"
 #include "AliRawEventHeaderBase.h"
@@ -61,7 +63,8 @@ AliRawDB::AliRawDB(AliRawEvent *event,
   fFS1(""),
   fFS2(""),
   fDeleteFiles(kFALSE),
   fFS1(""),
   fFS2(""),
   fDeleteFiles(kFALSE),
-  fStop(kFALSE)
+  fStop(kFALSE),
+  fGuidFileFolder(NULL)
 {
    // Create a new raw DB
 
 {
    // Create a new raw DB
 
@@ -286,12 +289,8 @@ Int_t AliRawDB::Close()
    }
 
    // Write a text file with file GUID
    }
 
    // Write a text file with file GUID
-   TString guidFileName = fRawDB->GetName();
-   guidFileName += ".guid";
-   ofstream fguid(guidFileName.Data());
-   TString guid = fRawDB->GetUUID().AsString();
-   fguid << "guid: \t" << guid.Data();
-   fguid.close();
+   // in the specified folder
+   WriteGuidFile();
 
    delete fRawDB;
    fRawDB = 0;
 
    delete fRawDB;
    fRawDB = 0;
@@ -420,3 +419,31 @@ const char *AliRawDB::GetAliRootTag()
 
   return version.Data();
 }
 
   return version.Data();
 }
+
+//______________________________________________________________________________
+void AliRawDB::WriteGuidFile()
+{
+  // Write the guid file
+  // in the specified folder
+
+   TString guidFileName;
+   if (fGuidFileFolder) {
+     guidFileName = fGuidFileFolder;
+
+     TString pathStr = fRawDB->GetName();
+     TObjArray *pathArr = pathStr.Tokenize('/');
+     guidFileName.Append("/");
+     guidFileName.Append(((TObjString *)pathArr->Last())->String());
+     pathArr->Delete();
+     delete pathArr;
+   }
+   else
+     guidFileName = fRawDB->GetName();
+
+   guidFileName += ".guid";
+
+   ofstream fguid(guidFileName.Data());
+   TString guid = fRawDB->GetUUID().AsString();
+   fguid << "guid: \t" << guid.Data();
+   fguid.close();
+}
index d798c6f1ea9bb84af191f3a451ee7f551632b689..8573777ca11457971d65d08c2dd1159cf207c585 100644 (file)
@@ -56,6 +56,8 @@ public:
    void         SetMaxSize(Double_t maxSize) { fMaxSize = maxSize; }
    void         SetFS(const char* fs1, const char* fs2 = NULL);
    void         SetDeleteFiles(Bool_t deleteFiles = kTRUE) { fDeleteFiles = deleteFiles; }
    void         SetMaxSize(Double_t maxSize) { fMaxSize = maxSize; }
    void         SetFS(const char* fs1, const char* fs2 = NULL);
    void         SetDeleteFiles(Bool_t deleteFiles = kTRUE) { fDeleteFiles = deleteFiles; }
+   void         SetGuidFileFolder(const char* guidFileFolder)
+     { fGuidFileFolder = guidFileFolder; }
 
    Bool_t       NextFile(const char* fileName = NULL);
 
 
    Bool_t       NextFile(const char* fileName = NULL);
 
@@ -81,13 +83,15 @@ protected:
    TString        fFS2;           // second raw DB file system location
    Bool_t         fDeleteFiles;   // flag for deletion of files
    Bool_t         fStop;          // stop execution (triggered by SIGUSR1)
    TString        fFS2;           // second raw DB file system location
    Bool_t         fDeleteFiles;   // flag for deletion of files
    Bool_t         fStop;          // stop execution (triggered by SIGUSR1)
-
+   const char *fGuidFileFolder;   // folder which contains guid files
    static const char  *fgkAliRootTag; // string with the aliroot tag id
 
    virtual const char *GetFileName() const;
    virtual Bool_t      FSHasSpace(const char *fs) const;
    virtual void        MakeTree();
 
    static const char  *fgkAliRootTag; // string with the aliroot tag id
 
    virtual const char *GetFileName() const;
    virtual Bool_t      FSHasSpace(const char *fs) const;
    virtual void        MakeTree();
 
+   void WriteGuidFile();
+
 private:
    AliRawDB(const AliRawDB& rawDB);
    AliRawDB& operator = (const AliRawDB& rawDB);
 private:
    AliRawDB(const AliRawDB& rawDB);
    AliRawDB& operator = (const AliRawDB& rawDB);
index 1c75ea368f67f6ee1f6050e5b0103631608cd976..b32735d69c7c1432c0f211d258e9b7b0f3065f96 100644 (file)
 #include "AliLog.h"
 
 void* alimdcCreate(int compress, int filterMode, 
 #include "AliLog.h"
 
 void* alimdcCreate(int compress, int filterMode, 
-                  double maxSizeTagDB, const char* fileNameTagDB)
+                  double maxSizeTagDB, const char* fileNameTagDB,
+                  const char* guidFileFolder)
 {
 // create an AliMDC object
 
   return new AliMDC(compress, kFALSE, AliMDC::EFilterMode(filterMode), 
 {
 // create an AliMDC object
 
   return new AliMDC(compress, kFALSE, AliMDC::EFilterMode(filterMode), 
-                   maxSizeTagDB, fileNameTagDB);
+                   maxSizeTagDB, fileNameTagDB,
+                   guidFileFolder);
 
 }
 
 
 }
 
index 62ca6528f3981332780913fb4bdd7bfe0a01a20b..1801f88aeed787904e1e0b3593e26d4350ab66e0 100644 (file)
--- a/RAW/mdc.h
+++ b/RAW/mdc.h
@@ -16,7 +16,8 @@ extern "C" {
 #endif
 
 void* alimdcCreate(int compress, int filterMode, 
 #endif
 
 void* alimdcCreate(int compress, int filterMode, 
-                  double maxSizeTagDB, const char* fileNameTagDB);
+                  double maxSizeTagDB, const char* fileNameTagDB,
+                  const char* guidFileFolder);
 int   alimdcOpen(void* alimdc, int mode, const char* fileName);
 int   alimdcProcessEvent(void* alimdc, void* event, int isIovecArray);
 int   alimdcGetTotalFileSize(void* alimdc);
 int   alimdcOpen(void* alimdc, int mode, const char* fileName);
 int   alimdcProcessEvent(void* alimdc, void* event, int isIovecArray);
 int   alimdcGetTotalFileSize(void* alimdc);