]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliMDC.cxx
New raw-data TAGS infrastructure
[u/mrichter/AliRoot.git] / RAW / AliMDC.cxx
index 879d0053d727a85fb550efdc8a129307acfed3e4..44401e418970812740870218b626dafb4021ef42 100644 (file)
@@ -33,8 +33,6 @@
 // AliRawRFIODB or via rootd using AliRawRootdDB or to CASTOR via       //
 // rootd using AliRawCastorDB (and for performance testing there is     //
 // also AliRawNullDB).                                                  //
-// The AliRunDB class provides the interface to the run and file        //
-// catalogues (AliEn or plain MySQL).                                   //
 // The AliStats class provides statics information that is added as     //
 // a single keyed object to each raw file.                              //
 // The AliTagDB provides an interface to a TAG database.                //
@@ -72,7 +70,7 @@
 #include "AliRawRootdDB.h"
 #include "AliRawNullDB.h"
 #include "AliTagDB.h"
-#include "AliRunDB.h"
+#include "AliRawEventTag.h"
 #include "AliFilter.h"
 
 #include "AliMDC.h"
@@ -85,15 +83,13 @@ const char* const AliMDC::fgkFilterName[kNFilters] = {"AliHoughFilter"};
 
 //______________________________________________________________________________
 AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode, 
-              const char* localRunDB, Bool_t rdbmsRunDB,
-              const char* alienHostRunDB, const char* alienDirRunDB,
               Double_t maxSizeTagDB, const char* fileNameTagDB) :
   fEvent(new AliRawEvent),
   fESD(NULL),
   fStats(NULL),
   fRawDB(NULL),
-  fRunDB(new AliRunDB(localRunDB, rdbmsRunDB, alienHostRunDB, alienDirRunDB)),
   fTagDB(NULL),
+  fEventTag(new AliRawEventTag),
   fCompress(compress),
   fDeleteFiles(deleteFiles),
   fFilterMode(filterMode),
@@ -111,11 +107,6 @@ AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode,
   // kFilterTransparent the algorthims will be run but no events will be
   // rejected, if it is kFilterOn the filters will be run and the event will
   // be rejected if all filters return kFALSE.
-  // localRunDB is the file name of the local run DB; if NULL no local run DB
-  // will be created.
-  // The filling of a MySQL run DB can be switch on or off with rdbmsRunDB.
-  // The host and directory name of the alien run DB can be specified by
-  // alienHostRunDB and alienDirRunDB; if NULL no alien DB will be filled.
   // If maxSizeTagDB is greater than 0 it determines the maximal size of the
   // 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
@@ -167,33 +158,17 @@ AliMDC::~AliMDC()
 
   fFilters.Delete();
   if(fTagDB) delete fTagDB;
-  delete fRunDB;
   delete fRawDB;
   delete fStats;
   delete fESD;
   delete fEvent;
+  delete fEventTag;
 }
  
 //______________________________________________________________________________
-AliMDC::AliMDC(const AliMDC& mdc): TObject(mdc)
-{
-// copy constructor
-
-  Fatal("AliMDC", "copy constructor not implemented");
-}
-
-//______________________________________________________________________________
-AliMDC& AliMDC::operator = (const AliMDC& /*mdc*/)
-{
-// assignment operator
-
-  Fatal("operator =", "assignment operator not implemented");
-  return *this;
-}
-
-
-//______________________________________________________________________________
-Int_t AliMDC::Open(EWriteMode mode, const char* fileName)
+Int_t AliMDC::Open(EWriteMode mode, const char* fileName,
+                  Double_t maxFileSize,
+                  const char* fs1, const char* fs2)
 {
 // open a new raw DB file
 
@@ -209,6 +184,12 @@ Int_t AliMDC::Open(EWriteMode mode, const char* fileName)
     fRawDB = new AliRawDB(fEvent, fESD, fCompress, fileName);
   fRawDB->SetDeleteFiles(fDeleteFiles);
 
+  if (fileName == NULL) {
+    fRawDB->SetMaxSize(maxFileSize);
+    fRawDB->SetFS(fs1, fs2);
+    fRawDB->Create();
+  }
+
   if (fRawDB->IsZombie()) {
     delete fRawDB;
     fRawDB = NULL;
@@ -375,23 +356,28 @@ Int_t AliMDC::ProcessEvent(void* event, Bool_t isIovecArray)
   // Store raw event in tree
   Int_t nBytes = fRawDB->Fill();
 
+  // Fill the event tag object
+  fEventTag->SetHeader(fEvent->GetHeader());
+  fEventTag->SetGUID(fRawDB->GetDB()->GetUUID().AsString());
+  fEventTag->SetEventNumber(fRawDB->GetEvents()-1);
+
   // Create Tag DB here only after the raw data header
   // version was already identified
   if (!fIsTagDBCreated) {
     if (fFileNameTagDB) {
       if (fMaxSizeTagDB > 0) {
-       fTagDB = new AliTagDB(fEvent->GetHeader(), NULL);
+       fTagDB = new AliTagDB(fEventTag, NULL);
        fTagDB->SetMaxSize(fMaxSizeTagDB);
        fTagDB->SetFS(fFileNameTagDB);
        fTagDB->Create();
       } else {
-       fTagDB = new AliTagDB(fEvent->GetHeader(), fFileNameTagDB);
+       fTagDB = new AliTagDB(fEventTag, fFileNameTagDB);
       }
     }
     fIsTagDBCreated = kTRUE;
   }
 
-  // Store header in tree
+  // Store event tag in tree
   if (fTagDB) fTagDB->Fill();
 
   // Make top event object ready for next event data
@@ -423,7 +409,6 @@ Int_t AliMDC::Close()
   if (!fRawDB) return -1;
 
   fRawDB->WriteStats(fStats);
-  fRunDB->Update(fStats);
   Int_t filesize = fRawDB->Close();
   delete fRawDB;
   fRawDB = NULL;
@@ -471,32 +456,8 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
 
   // Create new raw DB.
   if (fRawDB) Close();
-  if (mode == kRFIO) {
-    fRawDB = new AliRawRFIODB(fEvent, fESD, fCompress, NULL);
-  } else if (mode == kROOTD) {
-    fRawDB = new AliRawRootdDB(fEvent, fESD, fCompress, NULL);
-  } else if (mode == kCASTOR) {
-    fRawDB = new AliRawCastorDB(fEvent, fESD, fCompress, NULL);
-  } else if (mode == kDEVNULL) {
-    fRawDB = new AliRawNullDB(fEvent, fESD, fCompress, NULL);
-  } else {
-    fRawDB = new AliRawDB(fEvent, fESD, fCompress, NULL);
-  }
-  fRawDB->SetMaxSize(maxFileSize);
-  fRawDB->SetFS(fs1, fs2);
-  fRawDB->SetDeleteFiles(fDeleteFiles);
-  fRawDB->Create();
-
-  if (fRawDB->IsZombie()) {
-    delete fRawDB;
-    fRawDB = NULL;
-    return 1;
-  }
-  printf("Filling raw DB %s\n", fRawDB->GetDBName());
 
-  // Create AliStats object
-  fStats = new AliStats(fRawDB->GetDBName(), fCompress, 
-                       fFilterMode != kFilterOff);
+  if (Open(mode,NULL,maxFileSize,fs1,fs2) < 0) return 1;
 
   // Process input stream
 #ifdef USE_EB
@@ -629,7 +590,6 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
 
        // Write stats object to raw db, run db, MySQL and AliEn
        fRawDB->WriteStats(fStats);
-       if (fRunDB) fRunDB->Update(fStats);
        delete fStats;
        fStats = NULL;