]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliMDC.cxx
Remove dependecies on obsolete classes: AliTRDmcmTracklet, AliTRDarrayI or AliTRDarrayF
[u/mrichter/AliRoot.git] / RAW / AliMDC.cxx
index 06867a9ebfcdf5394a33868263ca03a380067a8c..e2bf176a0006c2d49a45c078fe5cce253040c8dc 100644 (file)
@@ -1,4 +1,4 @@
-// @(#)alimdc:$Name$:$Id$
+// @(#)alimdc:$Name:  $:$Id$
 // Author: Fons Rademakers  26/11/99
 // Updated: Dario Favretto  15/04/2003
 
@@ -50,6 +50,7 @@
 #include <TROOT.h>
 #include <TStopwatch.h>
 #include <TPluginManager.h>
+#include <TBufferFile.h>
 
 #include <sys/uio.h>
 #ifdef USE_EB
@@ -87,7 +88,8 @@ const char* const AliMDC::fgkFilterName[kNFilters] = {"AliHoughFilter"};
 //______________________________________________________________________________
 AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode, 
               Double_t maxSizeTagDB, const char* fileNameTagDB,
-              const char *guidFileFolder) :
+              const char *guidFileFolder,
+              Int_t basketsize) :
   fEvent(new AliRawEvent),
   fESD(NULL),
   fStats(NULL),
@@ -95,6 +97,7 @@ AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode,
   fTagDB(NULL),
   fEventTag(new AliRawEventTag),
   fCompress(compress),
+  fBasketSize(basketsize),
   fDeleteFiles(deleteFiles),
   fFilterMode(filterMode),
   fFilters(),
@@ -119,6 +122,12 @@ AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode,
   // 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.
+
+  // Set the maximum tree size to 19GB
+  // in order to allow big raw data files
+  TTree::SetMaxTreeSize(20000000000LL);
+
+  TBufferFile::SetGlobalReadParam(5);
  
   // This line is needed in case of a stand-alone application w/o
   // $ROOTSYS/etc/system.rootrc file
@@ -184,15 +193,15 @@ Int_t AliMDC::Open(EWriteMode mode, const char* fileName,
 // open a new raw DB file
 
   if (mode == kRFIO)
-    fRawDB = new AliRawRFIODB(fEvent, fESD, fCompress, fileName);
+    fRawDB = new AliRawRFIODB(fEvent, fESD, fCompress, fileName, fBasketSize);
   else if (mode == kROOTD)
-    fRawDB = new AliRawRootdDB(fEvent, fESD, fCompress, fileName);
+    fRawDB = new AliRawRootdDB(fEvent, fESD, fCompress, fileName, fBasketSize);
   else if (mode == kCASTOR)
-    fRawDB = new AliRawCastorDB(fEvent, fESD, fCompress, fileName);
+    fRawDB = new AliRawCastorDB(fEvent, fESD, fCompress, fileName, fBasketSize);
   else if (mode == kDEVNULL)
-    fRawDB = new AliRawNullDB(fEvent, fESD, fCompress, fileName);
+    fRawDB = new AliRawNullDB(fEvent, fESD, fCompress, fileName, fBasketSize);
   else
-    fRawDB = new AliRawDB(fEvent, fESD, fCompress, fileName);
+    fRawDB = new AliRawDB(fEvent, fESD, fCompress, fileName, fBasketSize);
   fRawDB->SetDeleteFiles(fDeleteFiles);
 
   if (fRawDB->IsZombie()) {
@@ -234,11 +243,12 @@ Int_t AliMDC::ProcessEvent(void* event, Bool_t isIovecArray)
 // or, if isIovecArray is kTRUE, a pointer to an array of iovecs with one
 // iovec per subevent (used by the event builder).
 // The return value is the number of written bytes or an error code
-  const UInt_t kFileSizeErrorLevel   = 1900000000;
+  const Long64_t kFileSizeErrorLevel   = 19000000000LL;
 
-  UInt_t currentFileSize = GetTotalSize();
+  Long64_t currentFileSize = GetTotalSize();
+  AliDebug(1,Form("current file size is %lld bytes",currentFileSize));
   if(currentFileSize > kFileSizeErrorLevel) {
-    Error("ProcessEvent", "file size (%u) exceeds the limit "
+    Error("ProcessEvent", "file size (%lu) exceeds the limit "
          , currentFileSize);
     return kErrFileSize;
   }
@@ -312,7 +322,9 @@ Int_t AliMDC::ProcessEvent(void* event, Bool_t isIovecArray)
       if (header->Get("Type") == AliRawEventHeaderBase::kPhysicsEvent ||
          header->Get("Type") == AliRawEventHeaderBase::kCalibrationEvent ||
          header->Get("Type") == AliRawEventHeaderBase::kSystemSoftwareTriggerEvent ||
-         header->Get("Type") == AliRawEventHeaderBase::kDetectorSoftwareTriggerEvent) {
+         header->Get("Type") == AliRawEventHeaderBase::kDetectorSoftwareTriggerEvent ||
+         header->Get("Type") == AliRawEventHeaderBase::kStartOfData ||
+         header->Get("Type") == AliRawEventHeaderBase::kEndOfData) {
        while (rawSize > 0) {
          AliRawEquipment &equipment = *subEvent->NextEquipment();
          AliRawEquipmentHeader &equipmentHeader = 
@@ -360,7 +372,9 @@ Int_t AliMDC::ProcessEvent(void* event, Bool_t isIovecArray)
     if (header->Get("Type") == AliRawEventHeaderBase::kPhysicsEvent ||
        header->Get("Type") == AliRawEventHeaderBase::kCalibrationEvent ||
        header->Get("Type") == AliRawEventHeaderBase::kSystemSoftwareTriggerEvent ||
-       header->Get("Type") == AliRawEventHeaderBase::kDetectorSoftwareTriggerEvent) {
+       header->Get("Type") == AliRawEventHeaderBase::kDetectorSoftwareTriggerEvent ||
+       header->Get("Type") == AliRawEventHeaderBase::kStartOfData ||
+       header->Get("Type") == AliRawEventHeaderBase::kEndOfData) {
       Bool_t result = kFALSE;
       for (Int_t iFilter = 0; iFilter < fFilters.GetEntriesFast(); iFilter++) {
        AliFilter* filter = (AliFilter*) fFilters[iFilter];
@@ -415,7 +429,7 @@ Int_t AliMDC::ProcessEvent(void* event, Bool_t isIovecArray)
 }
 
 //______________________________________________________________________________
-Int_t AliMDC::GetTotalSize()
+Long64_t AliMDC::GetTotalSize()
 {
 // return the total current raw DB file size
 
@@ -425,14 +439,14 @@ Int_t AliMDC::GetTotalSize()
 }
 
 //______________________________________________________________________________
-Int_t AliMDC::Close()
+Long64_t AliMDC::Close()
 {
 // close the current raw DB file
 
   if (!fRawDB) return -1;
 
   fRawDB->WriteStats(fStats);
-  Int_t filesize = fRawDB->Close();
+  Long64_t filesize = fRawDB->Close();
   delete fRawDB;
   fRawDB = NULL;
   delete fStats;
@@ -440,6 +454,17 @@ Int_t AliMDC::Close()
   return filesize;
 }
 
+//______________________________________________________________________________
+Long64_t AliMDC::AutoSave()
+{
+  // Auto-save the raw-data
+  // and esd (if any) trees
+
+  if (!fRawDB) return -1;
+
+  return fRawDB->AutoSave();
+}
+
 //______________________________________________________________________________
 Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
                  EWriteMode mode, Double_t maxFileSize,