]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawEvent.cxx
Removing pointless manipulations with the L1 trigger message from TPC. In the new...
[u/mrichter/AliRoot.git] / RAW / AliRawEvent.cxx
index 7cd1e8182585cbc83dd205fb4c53e274981694aa..06d97fc0a75f1211af2f5488466d2e7bf1a9852e 100644 (file)
@@ -1,4 +1,4 @@
-// @(#)alimdc:$Name$:$Id$
+// @(#) $Id$
 // Author: Fons Rademakers  26/11/99
 
 /**************************************************************************
@@ -30,8 +30,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.                //
 
 #include <TObjArray.h>
 
-#include "AliRawEventHeader.h"
-#include "AliRawEquipmentHeader.h"
-#include "AliRawData.h"
+#include "AliLog.h"
+
+#include "AliRawEventHeaderBase.h"
+#include "AliRawEquipment.h"
 
 #include "AliRawEvent.h"
 
@@ -53,66 +52,77 @@ ClassImp(AliRawEvent)
 
 
 //______________________________________________________________________________
-AliRawEvent::AliRawEvent()
+AliRawEvent::AliRawEvent():
+fNEquipments(0),
+fNSubEvents(0),
+fEvtHdr(NULL),
+fEquipments(NULL),
+fSubEvents(NULL)
 {
    // Create ALICE event object. If ownData is kFALSE we will use a static
    // raw data object, otherwise a private copy will be made.
 
-   fNSubEvents = 0;
-   fEvtHdr     = 0;
-   fEqpHdr     = 0;
-   fRawData    = 0;
-   fSubEvents  = 0;
 }
 
 //______________________________________________________________________________
-AliRawEvent::AliRawEvent(const AliRawEvent& rawEvent): TObject(rawEvent)
+AliRawEventHeaderBase *AliRawEvent::GetHeader(char*& data)
 {
-// copy constructor
-
-  Fatal("AliRawEvent", "copy constructor not implemented");
+  // Get event header part of AliRawEvent.
+  // First the DATE version is identified and then the
+  // corresponding event header version object is created
+  
+  if (!fEvtHdr) {
+    fEvtHdr = AliRawEventHeaderBase::Create(data);
+  }
+
+  return fEvtHdr;
 }
 
 //______________________________________________________________________________
-AliRawEvent& AliRawEvent::operator = (const AliRawEvent& /*rawEvent*/)
+AliRawEventHeaderBase *AliRawEvent::GetHeader()
 {
-// assignment operator
+  if (!fEvtHdr) {
+      AliFatal("Header version not yet initialized!");
+      return 0x0;
+    }
 
-  Fatal("operator =", "assignment operator not implemented");
-  return *this;
+  return fEvtHdr;
 }
 
 //______________________________________________________________________________
-AliRawEventHeader *AliRawEvent::GetHeader()
+AliRawEquipment *AliRawEvent::NextEquipment()
 {
-   // Get event header part of AliRawEvent.
+   // Returns next equipment object.
 
-   if (!fEvtHdr)
-      fEvtHdr = new AliRawEventHeader;
+   if (!fEquipments)
+      fEquipments = new TObjArray(100); // arbitrary, probably enough to prevent resizing
 
-   return fEvtHdr;
-}
+   if (fEquipments->GetSize() <= fNEquipments) {
+      fEquipments->Expand(fNEquipments+10);
+      Warning("NextEquipment", "expanded fEquipments by 10 to %d",
+              fEquipments->GetSize());
+   }
 
-//______________________________________________________________________________
-AliRawEquipmentHeader *AliRawEvent::GetEquipmentHeader()
-{
-   // Get equipment header part of AliRawEvent.
+   AliRawEquipment *eq;
+   if (!(eq = (AliRawEquipment *)fEquipments->At(fNEquipments))) {
+      eq = new AliRawEquipment;
+      fEquipments->AddAt(eq, fNEquipments);
+   }
 
-   if (!fEqpHdr)
-      fEqpHdr = new AliRawEquipmentHeader;
+   fNEquipments++;
 
-   return fEqpHdr;
+   return eq;
 }
 
 //______________________________________________________________________________
-AliRawData *AliRawEvent::GetRawData()
+AliRawEquipment *AliRawEvent::GetEquipment(Int_t index) const
 {
-   // Get raw data part of AliRawEvent.
+   // Get specified equipment. Returns 0 if equipment does not exist.
 
-   if (!fRawData)
-      fRawData = new AliRawData;
+   if (!fEquipments)
+      return 0;
 
-   return fRawData;
+   return (AliRawEquipment *) fEquipments->At(index);
 }
 
 //______________________________________________________________________________
@@ -158,9 +168,14 @@ void AliRawEvent::Reset()
    // new/delete cycle). We reset the size marker for the AliRawData
    // objects and the sub event counter.
 
+   for (int i = 0; i < fNEquipments; i++) {
+      AliRawEquipment *eq = (AliRawEquipment *)fEquipments->At(i);
+      eq->Reset();
+   }
+   fNEquipments = 0;
    for (int i = 0; i < fNSubEvents; i++) {
       AliRawEvent *ev = (AliRawEvent *)fSubEvents->At(i);
-      ev->GetRawData()->SetSize(0);
+      ev->Reset();
    }
    fNSubEvents = 0;
 }
@@ -171,8 +186,9 @@ AliRawEvent::~AliRawEvent()
    // Clean up event object. Delete also, possible, private raw data.
 
    delete fEvtHdr;
-   delete fEqpHdr;
-   delete fRawData;
+   if (fEquipments)
+      fEquipments->Delete();
+   delete fEquipments;
    if (fSubEvents)
       fSubEvents->Delete();
    delete fSubEvents;