-// @(#)alimdc:$Name$:$Id$
+// @(#) $Id$
// Author: Fons Rademakers 26/11/99
/**************************************************************************
// 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"
//______________________________________________________________________________
-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);
}
//______________________________________________________________________________
// 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;
}
// 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;