cerr << "Error getting RAW tree" << endl;
return(1);
}
- AliRawEvent *rootEvent=NULL;
+ AliRawVEvent *rootEvent=NULL;
t->SetBranchAddress("rawevent", &rootEvent);
UInt_t eventSize = 10000000; // 10MB by default
unsigned char *dateEvent = new unsigned char[eventSize];
for(Long_t gdcCounter=0; gdcCounter<t->GetEntries(); gdcCounter++) {
- rootEvent=new AliRawEvent;
+ rootEvent=NULL;
t->GetEntry(gdcCounter);
if (rootEvent->GetHeader()->GetEventSize() > eventSize) {
delete [] dateEvent;
#include "root2date.h"
-int Root2Date(AliRawEvent *gdcRootEvent, unsigned char *gdcDateEvent, char *ddlDir) {
+int Root2Date(AliRawVEvent *gdcRootEvent, unsigned char *gdcDateEvent, char *ddlDir) {
unsigned char *p=gdcDateEvent;
int ldcCounter, equipmentCounter, chunkSize;
- AliRawEquipment *aliEquipment=NULL;
+ AliRawVEquipment *aliEquipment=NULL;
AliRawEquipmentHeader *aliEquipmentHeader=NULL;
AliRawEventHeaderBase *aliHeader=NULL;
- AliRawEvent *ldcRootEvent=NULL;
+ AliRawVEvent *ldcRootEvent=NULL;
aliHeader=gdcRootEvent->GetHeader();
#ifndef ROOT2DATE_H
#define ROOT2DATE_H
-#include "AliRawData.h"
-#include "AliRawEvent.h"
+#include "AliRawVEvent.h"
#include "AliRawEventHeaderBase.h"
-#include "AliRawEquipment.h"
+#include "AliRawVEquipment.h"
#include "AliRawEquipmentHeader.h"
#include "AliRawData.h"
#include "AliDAQ.h"
#include <Riostream.h>
-int Root2Date(AliRawEvent *gdcRootEvent, unsigned char *gdcDateEvent, char *ddlDir);
+int Root2Date(AliRawVEvent *gdcRootEvent, unsigned char *gdcDateEvent, char *ddlDir);
#endif
#include <AliLog.h>
-#include <AliRawEvent.h>
+#include <AliRawVEvent.h>
#include <AliRawReaderRoot.h>
#include <AliRawEventHeaderBase.h>
#include <AliTPCRawStream.h>
// TODO explain this
//
-class AliRawEvent;
+class AliRawVEvent;
class TTree;
class AliTPCParamSR;
class AliTPCRawHistograms;
virtual void Terminate();
protected:
- AliRawEvent* fRawEvent;
+ AliRawVEvent* fRawEvent;
TTree* fTree;
AliTPCParamSR* fParam; // TPC hardware params
#include <TObject.h>
-class AliRawEvent;
+class AliRawVEvent;
class AliESDEvent;
class AliFilter: public TObject {
public:
- virtual Bool_t Filter(AliRawEvent* event, AliESDEvent* esd) = 0;
+ virtual Bool_t Filter(AliRawVEvent* event, AliESDEvent* esd) = 0;
private:
ClassDef(AliFilter, 0) // base class for high level filter algorithms
}
//_____________________________________________________________________________
-Bool_t AliHoughFilter::Filter(AliRawEvent* event, AliESDEvent* esd)
+Bool_t AliHoughFilter::Filter(AliRawVEvent* event, AliESDEvent* esd)
{
// Run fast online reconstruction
// based on the HLT tracking algorithms
}
//_____________________________________________________________________________
-void AliHoughFilter::RunITSclusterer(AliRawEvent* event, TTree *treeClusters)
+void AliHoughFilter::RunITSclusterer(AliRawVEvent* event, TTree *treeClusters)
{
// Run ITS Clusterer
// The clusters are stored in a tree
}
//_____________________________________________________________________________
-void AliHoughFilter::RunTPCtracking(AliRawEvent* event, AliESDEvent* esd)
+void AliHoughFilter::RunTPCtracking(AliRawVEvent* event, AliESDEvent* esd)
{
// Run hough transform tracking in TPC
// The z of the vertex is taken from the ESD
public:
AliHoughFilter();
- virtual Bool_t Filter(AliRawEvent* event, AliESDEvent* esd);
+ virtual Bool_t Filter(AliRawVEvent* event, AliESDEvent* esd);
- void RunITSclusterer(AliRawEvent* event, TTree *treeClusters);
+ void RunITSclusterer(AliRawVEvent* event, TTree *treeClusters);
void RunITSvertexer(AliESDEvent* esd, TTree *treeClusters);
- void RunTPCtracking(AliRawEvent* event, AliESDEvent* esd);
+ void RunTPCtracking(AliRawVEvent* event, AliESDEvent* esd);
void RunITStracking(AliESDEvent* esd, TTree *treeClusters);
private:
AliHoughFilter(const AliHoughFilter&);
// //
// AliMDC //
// //
-// Set of classes defining the ALICE RAW event format. The AliRawEvent //
+// Set of classes defining the ALICE RAW event format. The AliRawEventV2//
// class defines a RAW event. It consists of an AliEventHeader object //
// an AliEquipmentHeader object, an AliRawData object and an array of //
-// sub-events, themselves also being AliRawEvents. The number of //
+// sub-events, themselves also being AliRawEventV2s. The number of //
// sub-events depends on the number of DATE LDC's. //
-// The AliRawEvent objects are written to a ROOT file using different //
+// The AliRawEventV2 objects are written to a ROOT file using different //
// technologies, i.e. to local disk via AliRawDB or via rfiod using //
// AliRawRFIODB or via rootd using AliRawRootdDB or to CASTOR via //
// rootd using AliRawCastorDB (and for performance testing there is //
#include <TStopwatch.h>
#include <TPluginManager.h>
#include <TBufferFile.h>
+#include <TProcessID.h>
#include <sys/uio.h>
#ifdef USE_EB
#include <AliLog.h>
#include <AliESDEvent.h>
-#include "AliRawEvent.h"
+#include "AliRawEventV2.h"
#include "AliRawEventHeaderBase.h"
-#include "AliRawEquipment.h"
+#include "AliRawEquipmentV2.h"
#include "AliRawEquipmentHeader.h"
+#include "AliRawDataArrayV2.h"
#include "AliRawData.h"
-#include "AliStats.h"
#include "AliRawDB.h"
#include "AliRawRFIODB.h"
#include "AliRawCastorDB.h"
Double_t maxSizeTagDB, const char* fileNameTagDB,
const char *guidFileFolder,
Int_t basketsize) :
- fEvent(new AliRawEvent),
+ fEvent(new AliRawEventV2),
fESD(NULL),
- fStats(NULL),
fRawDB(NULL),
fTagDB(NULL),
fEventTag(new AliRawEventTag),
// in order to allow big raw data files
TTree::SetMaxTreeSize(20000000000LL);
+ AliRawEquipmentHeader::Class()->IgnoreTObjectStreamer();
+ AliRawEquipmentV2::Class()->IgnoreTObjectStreamer();
+ AliRawEventV2::Class()->IgnoreTObjectStreamer();
+ AliRawDataArrayV2::Class()->IgnoreTObjectStreamer();
+
TBufferFile::SetGlobalReadParam(5);
// This line is needed in case of a stand-alone application w/o
fFilters.Delete();
if(fTagDB) delete fTagDB;
delete fRawDB;
- delete fStats;
delete fESD;
delete fEvent;
delete fEventTag;
Info("Open", "Filling raw DB %s\n", fRawDB->GetDBName());
- // Create AliStats object
- fStats = new AliStats(fRawDB->GetDBName(), fCompress,
- fFilterMode != kFilterOff);
return 0;
}
//______________________________________________________________________________
Int_t AliMDC::ProcessEvent(void* event, Bool_t isIovecArray)
{
-// Convert the DATE event to an AliRawEvent object and store it in the raw DB,
+// Convert the DATE event to an AliRawEventV2 object and store it in the raw DB,
// optionally also run the filter.
// event is either a pointer to the streamlined event
// or, if isIovecArray is kTRUE, a pointer to an array of iovecs with one
// The return value is the number of written bytes or an error code
const Long64_t kFileSizeErrorLevel = 19000000000LL;
+ Int_t objectNumber = TProcessID::GetObjectCount();
+
Long64_t currentFileSize = GetTotalSize();
- AliDebug(1,Form("current file size is %lld bytes",currentFileSize));
+ // AliDebug(1,Form("current file size is %lld bytes",currentFileSize));
if(currentFileSize > kFileSizeErrorLevel) {
Error("ProcessEvent", "file size (%lu) exceeds the limit "
, currentFileSize);
// Read event header
if ((status = header->ReadHeader(data)) != (Int_t)header->GetHeadSize()) {
+ Error("ProcessEvent","Wrong event header format (%d != %d)",
+ status,(Int_t)header->GetHeadSize());
return kErrHeader;
}
- if (AliDebugLevel() > 2) ToAliDebug(3, header->Dump(););
+ // if (AliDebugLevel() > 2) ToAliDebug(3, header->Dump(););
// Check event type and skip "Start of Run", "End of Run",
// "Start of Run Files" and "End of Run Files"
Int_t size = header->GetEventSize() - header->GetHeadSize();
-
- AliDebug(1, Form("Processing %s (%d bytes)", header->GetTypeName(), size));
+ UInt_t eventType = header->Get("Type");
+
+ // AliDebug(1, Form("Processing %s (%d bytes)", header->GetTypeName(), size));
// Amount of data left to read for this event
Int_t toRead = size;
while (toRead > 0) {
if (isIovecArray) data = (char*) ((iovec*) event)[nsub].iov_base;
- AliDebug(1, Form("reading LDC %d", nsub));
+ // AliDebug(1, Form("reading LDC %d", nsub));
- AliRawEvent *subEvent = fEvent->NextSubEvent();
+ AliRawEventV2 *subEvent = fEvent->NextSubEvent();
// Read sub-event header
AliRawEventHeaderBase *subHeader = subEvent->GetHeader(data);
return kErrSubHeader;
}
- if (AliDebugLevel() > 2) ToAliDebug(3, subHeader->Dump(););
+ // if (AliDebugLevel() > 2) ToAliDebug(3, subHeader->Dump(););
toRead -= subHeader->GetHeadSize();
}
// Read Equipment Headers (in case of physics or calibration event)
- 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::kStartOfData ||
- header->Get("Type") == AliRawEventHeaderBase::kEndOfData) {
+ if (eventType == AliRawEventHeaderBase::kPhysicsEvent ||
+ eventType == AliRawEventHeaderBase::kCalibrationEvent ||
+ eventType == AliRawEventHeaderBase::kSystemSoftwareTriggerEvent ||
+ eventType == AliRawEventHeaderBase::kDetectorSoftwareTriggerEvent ||
+ eventType == AliRawEventHeaderBase::kStartOfData ||
+ eventType == AliRawEventHeaderBase::kEndOfData) {
while (rawSize > 0) {
- AliRawEquipment &equipment = *subEvent->NextEquipment();
+ AliRawEquipmentV2 &equipment = *subEvent->NextEquipment();
AliRawEquipmentHeader &equipmentHeader =
*equipment.GetEquipmentHeader();
Int_t equipHeaderSize = equipmentHeader.HeaderSize();
return kErrEquipmentHeader;
}
- if (AliDebugLevel() > 2) ToAliDebug(3, equipmentHeader.Dump(););
+ // if (AliDebugLevel() > 2) ToAliDebug(3, equipmentHeader.Dump(););
toRead -= equipHeaderSize;
rawSize -= equipHeaderSize;
// Read equipment raw data
- AliRawData &subRaw = *equipment.GetRawData();
+ AliRawDataArrayV2 *arr = fRawDB->GetRawDataArray(equipmentHeader.GetEquipmentSize(),
+ equipmentHeader.GetId());
+ AliRawData &subRaw = *equipment.NextRawData(arr);
Int_t eqSize = equipmentHeader.GetEquipmentSize() - equipHeaderSize;
if ((status = ReadRawData(subRaw, eqSize, data)) != eqSize) {
} else { // Read only raw data but no equipment header
if (rawSize) {
- AliRawEquipment &equipment = *subEvent->NextEquipment();
- AliRawData &subRaw = *equipment.GetRawData();
+ AliRawEquipmentV2 &equipment = *subEvent->NextEquipment();
+ AliRawEquipmentHeader &equipmentHeader =
+ *equipment.GetEquipmentHeader();
+ equipmentHeader.Reset();
+ AliRawDataArrayV2 *arr = fRawDB->GetRawDataArray(equipmentHeader.GetEquipmentSize(),
+ equipmentHeader.GetId());
+ AliRawData &subRaw = *equipment.NextRawData(arr);
if ((status = ReadRawData(subRaw, rawSize, data)) != rawSize) {
return kErrEquipment;
}
// High Level Event Filter
if (fFilterMode != kFilterOff) {
- 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::kStartOfData ||
- header->Get("Type") == AliRawEventHeaderBase::kEndOfData) {
+ if (eventType == AliRawEventHeaderBase::kPhysicsEvent ||
+ eventType == AliRawEventHeaderBase::kCalibrationEvent ||
+ eventType == AliRawEventHeaderBase::kSystemSoftwareTriggerEvent ||
+ eventType == AliRawEventHeaderBase::kDetectorSoftwareTriggerEvent ||
+ eventType == AliRawEventHeaderBase::kStartOfData ||
+ eventType == AliRawEventHeaderBase::kEndOfData) {
Bool_t result = kFALSE;
for (Int_t iFilter = 0; iFilter < fFilters.GetEntriesFast(); iFilter++) {
AliFilter* filter = (AliFilter*) fFilters[iFilter];
}
}
- // Set stat info for first event of this file
- if (fRawDB->GetEvents() == 0)
- fStats->SetFirstId(header->Get("RunNb"), header->GetP("Id")[0]);
-
// Store raw event in tree
Int_t nBytes = fRawDB->Fill();
+ TProcessID::SetObjectCount(objectNumber);
+
// Fill the event tag object
- fEventTag->SetHeader(fEvent->GetHeader());
+ fEventTag->SetHeader(header);
fEventTag->SetGUID(fRawDB->GetDB()->GetUUID().AsString());
fEventTag->SetEventNumber(fRawDB->GetEvents()-1);
// Make top event object ready for next event data
fEvent->Reset();
+ fRawDB->Reset();
+
// Clean up HLT ESD for the next event
if (fESD) fESD->Reset();
if (!fRawDB) return -1;
- fRawDB->WriteStats(fStats);
Long64_t filesize = fRawDB->Close();
delete fRawDB;
fRawDB = NULL;
- delete fStats;
- fStats = NULL;
return filesize;
}
// Used for statistics
TStopwatch timer;
timer.Start();
- Double_t told = 0, tnew = 0;
Float_t chunkSize = maxFileSize/100, nextChunk = chunkSize;
// Create new raw DB.
Int_t numEvents = 0;
AliRawEventHeaderBase header;
+ AliRawEventHeaderBase *hdr = NULL;
while (kTRUE) {
Error("Run", "AliMDC was compiled without event builder support");
delete fRawDB;
fRawDB = NULL;
- delete fStats;
- fStats = NULL;
return 1;
#endif
}
}
char *data = (char *)header.HeaderBaseBegin();
- AliRawEventHeaderBase *hdr = AliRawEventHeaderBase::Create(data);
+ if (!hdr) {
+ hdr = AliRawEventHeaderBase::Create(data);
+ }
+ else {
+ memcpy(hdr->HeaderBaseBegin(), header.HeaderBaseBegin(), header.HeaderBaseSize());
+ }
Int_t nrecv;
if ((nrecv = Read(fd, hdr->HeaderBegin(), hdr->HeaderSize())) !=
hdr->HeaderSize()) {
delete hdr;
return 1;
}
- delete hdr;
}
Int_t result = ProcessEvent(event, !inputFile);
if (result >= 0) {
numEvents++;
- if (!(numEvents%10))
- printf("Processed event %d (%d)\n", numEvents, fRawDB->GetEvents());
}
if (result > 0) {
// Filling time statistics
if (fRawDB->GetBytesWritten() > nextChunk) {
- tnew = timer.RealTime();
- fStats->Fill(tnew-told);
- told = tnew;
- timer.Continue();
nextChunk += chunkSize;
}
printf("Written raw DB at a rate of %.1f MB/s\n",
fRawDB->GetBytesWritten() / timer.RealTime() / 1000000.);
- // Write stats object to raw db, run db, MySQL and AliEn
- fRawDB->WriteStats(fStats);
- delete fStats;
- fStats = NULL;
-
if (!fRawDB->NextFile()) {
Error("Run", "error opening next raw data file");
Close();
if (inputFile) delete[] event;
+ delete hdr;
return 1;
}
printf("Filling raw DB %s\n", fRawDB->GetDBName());
- fStats = new AliStats(fRawDB->GetDBName(), fCompress,
- fFilterMode != kFilterOff);
-
timer.Start();
- told = 0, tnew = 0;
nextChunk = chunkSize;
}
}
}
+ delete hdr;
+
printf("Written raw DB at a rate of %.1f MB/s\n",
fRawDB->GetBytesWritten() / timer.RealTime() / 1000000.);
#endif
// Forward class declarations
-class AliRawEvent;
class AliRawEventHeaderBase;
class AliRawEquipmentHeader;
class AliRawData;
class AliRawDB;
class AliTagDB;
class AliRawEventTag;
-class AliStats;
class AliESDEvent;
-#include "AliRawEvent.h"
+#include "AliRawEventV2.h"
#include "AliESDEvent.h"
-#include "AliStats.h"
#include "AliRawDB.h"
#include "AliTagDB.h"
#include "AliRawData.h"
-#include "AliRawDataArray.h"
#include "AliRawEventTag.h"
class AliMDC : public TObject {
AliMDCInterruptHandler& operator=(const AliMDCInterruptHandler& handler); // Not implemented
};
- AliRawEvent *fEvent; // produced AliRawEvent
+ AliRawEventV2 *fEvent; // produced AliRawEvent
AliESDEvent *fESD; // pointer to HLT ESD object
- AliStats *fStats; // statistics
AliRawDB *fRawDB; // raw data DB
AliTagDB *fTagDB; // tag DB
AliRawEventTag *fEventTag; // raw-data event tag object
//______________________________________________________________________________
-AliRawCastorDB::AliRawCastorDB(AliRawEvent *event,
+AliRawCastorDB::AliRawCastorDB(AliRawEventV2 *event,
AliESDEvent *esd,
Int_t compress,
const char* fileName,Int_t basketsize)
// Write the tree.
Bool_t error = kFALSE;
- if (fTree->Write() == 0)
- error = kTRUE;
+ if (fTree)
+ if (fTree->Write() == 0)
+ error = kTRUE;
if (fESDTree)
if (fESDTree->Write() == 0)
error = kTRUE;
// Close DB, this also deletes the fTree
fRawDB->Close();
+ fTree = NULL;
+
Long64_t filesize = fRawDB->GetEND();
if (fDeleteFiles) {
class AliRawCastorDB : public AliRawDB {
public:
- AliRawCastorDB(AliRawEvent *event,
+ AliRawCastorDB(AliRawEventV2 *event,
AliESDEvent *esd,
Int_t compress,
const char* fileName = NULL,
#include <TBranch.h>
#include "AliESDEvent.h"
-#include "AliRawEvent.h"
-#include "AliRawDataArray.h"
+#include "AliRawEventV2.h"
+#include "AliRawDataArrayV2.h"
#include "AliRawEventHeaderBase.h"
-#include "AliRawEquipment.h"
#include "AliRawEquipmentHeader.h"
-#include "AliStats.h"
#include "AliRawDB.h"
const char *AliRawDB::fgkAliRootTag = "$Rev$";
-// Split TPC into 9 branches in order to avoid problems with big memory
+// Split TPC into 18 branches in order to avoid problems with big memory
// consumption in case of TPC events w/o zero-suppression
Int_t AliRawDB::fgkDetBranches[AliDAQ::kNDetectors+1] = {1,1,1,18,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,10,1};
//______________________________________________________________________________
-AliRawDB::AliRawDB(AliRawEvent *event,
+AliRawDB::AliRawDB(AliRawEventV2 *event,
AliESDEvent *esd,
Int_t compress,
const char* fileName,
// Create a new raw DB
for (Int_t iDet = 0; iDet < AliDAQ::kNDetectors; iDet++) {
- fDetRawData[iDet] = new AliRawDataArray*[fgkDetBranches[iDet]];
+ fDetRawData[iDet] = new AliRawDataArrayV2*[fgkDetBranches[iDet]];
Int_t nDDLsPerBranch = AliDAQ::NumberOfDdls(iDet)/fgkDetBranches[iDet];
for (Int_t iBranch = 0; iBranch < fgkDetBranches[iDet]; iBranch++)
- fDetRawData[iDet][iBranch] = new AliRawDataArray(nDDLsPerBranch);
+ fDetRawData[iDet][iBranch] = new AliRawDataArrayV2(nDDLsPerBranch);
}
- fDetRawData[AliDAQ::kNDetectors] = new AliRawDataArray*[fgkDetBranches[AliDAQ::kNDetectors]];
+ fDetRawData[AliDAQ::kNDetectors] = new AliRawDataArrayV2*[fgkDetBranches[AliDAQ::kNDetectors]];
for (Int_t iBranch = 0; iBranch < fgkDetBranches[AliDAQ::kNDetectors]; iBranch++)
- fDetRawData[AliDAQ::kNDetectors][iBranch] = new AliRawDataArray(100);
+ fDetRawData[AliDAQ::kNDetectors][iBranch] = new AliRawDataArrayV2(100);
if (fileName) {
if (!Create(fileName))
return kFALSE;
}
- // Create raw data TTree
- MakeTree();
-
return kTRUE;
}
fTree->BranchRef();
- // splitting 29.6 MB/s, no splitting 35.3 MB/s on P4 2GHz 15k SCSI
- //Int_t split = 1;
- Int_t split = 0;
- TBranch *b = fTree->Branch("rawevent", "AliRawEvent", &fEvent, fBasketSize, split);
+ Int_t split = 99;
+ TBranch *b = fTree->Branch("rawevent", "AliRawEventV2", &fEvent, fBasketSize, split);
BranchResetBit(b);
// Make brach for each sub-detector
for (Int_t iDet = 0; iDet < AliDAQ::kNDetectors; iDet++) {
for (Int_t iBranch = 0; iBranch < fgkDetBranches[iDet]; iBranch++) {
- b = fTree->Branch(Form("%s%d",AliDAQ::DetectorName(iDet),iBranch),"AliRawDataArray",
+ b = fTree->Branch(Form("%s%d",AliDAQ::DetectorName(iDet),iBranch),"AliRawDataArrayV2",
&fDetRawData[iDet][iBranch],fBasketSize,split);
BranchResetBit(b);
}
}
// Make special branch for unrecognized raw-data payloads
for (Int_t iBranch = 0; iBranch < fgkDetBranches[AliDAQ::kNDetectors]; iBranch++) {
- b = fTree->Branch(Form("Common%d",iBranch),"AliRawDataArray",
+ b = fTree->Branch(Form("Common%d",iBranch),"AliRawDataArrayV2",
&fDetRawData[AliDAQ::kNDetectors][iBranch],fBasketSize,split);
BranchResetBit(b);
}
// Write the tree.
Bool_t error = kFALSE;
- if (fTree->Write() == 0)
- error = kTRUE;
+ if (fTree)
+ if (fTree->Write() == 0)
+ error = kTRUE;
if (fESDTree)
if (fESDTree->Write() == 0)
error = kTRUE;
// Close DB, this also deletes the fTree
fRawDB->Close();
+ fTree = NULL;
+
Long64_t filesize = fRawDB->GetEND();
if (fDeleteFiles) {
//______________________________________________________________________________
Int_t AliRawDB::Fill()
{
- // Fill the trees and return the number of written bytes
-
- for (Int_t iDet = 0; iDet < (AliDAQ::kNDetectors + 1); iDet++)
- for (Int_t iBranch = 0; iBranch < fgkDetBranches[iDet]; iBranch++)
- fDetRawData[iDet][iBranch]->ClearData();
+ // Fill the trees and return the number of written bytes
- // Move the raw-data payloads to the corresponding branches
- for(Int_t iSubEvent = 0; iSubEvent < fEvent->GetNSubEvents(); iSubEvent++) {
- AliRawEvent *subEvent = fEvent->GetSubEvent(iSubEvent);
- for(Int_t iEquipment = 0; iEquipment < subEvent->GetNEquipments(); iEquipment++) {
- AliRawEquipment *equipment = subEvent->GetEquipment(iEquipment);
- Int_t iDet = AliDAQ::kNDetectors;
- Int_t iBranch = 0; // can we split somehow the unrecognized data??? For the moment - no
- if(equipment->GetEquipmentHeader()->GetEquipmentSize()) {
- UInt_t eqId = equipment->GetEquipmentHeader()->GetId();
- Int_t ddlIndex = -1;
- iDet = AliDAQ::DetectorIDFromDdlID(eqId,ddlIndex);
- if (iDet < 0 || iDet >= AliDAQ::kNDetectors)
- iDet = AliDAQ::kNDetectors;
- else
- iBranch = (ddlIndex * fgkDetBranches[iDet])/AliDAQ::NumberOfDdls(iDet);
- }
- equipment->SetRawDataRef(fDetRawData[iDet][iBranch]);
- }
- }
+ // Create raw data TTree if it not yet done
+ if (!fTree) MakeTree();
Double_t bytes = fRawDB->GetBytesWritten();
Bool_t error = kFALSE;
// Return the total size of the trees
Long64_t total = 0;
- {
+ if (fTree) {
Int_t skey = 0;
TDirectory *dir = fTree->GetDirectory();
if (dir) {
return nbytes;
}
-//______________________________________________________________________________
-void AliRawDB::WriteStats(AliStats* stats)
-{
- // Write stats to raw DB, local run DB and global MySQL DB.
-
- AliRawEventHeaderBase &header = *GetEvent()->GetHeader();
-
- // Write stats into RawDB
- TDirectory *ds = gDirectory;
- GetDB()->cd();
- stats->SetEvents(GetEvents());
- stats->SetLastId(header.GetP("Id")[0]);
- stats->SetFileSize(GetBytesWritten());
- stats->SetCompressionFactor(GetCompressionFactor());
- stats->SetEndTime();
- stats->Write("stats");
- ds->cd();
-}
-
//______________________________________________________________________________
Bool_t AliRawDB::NextFile(const char* fileName)
{
return kTRUE;
}
+
+
+//______________________________________________________________________________
+void AliRawDB::Reset()
+{
+ // Clear the raw-data arrays
+ // Should be done before processing the raw-data event
+
+ for (Int_t iDet = 0; iDet < (AliDAQ::kNDetectors + 1); iDet++)
+ for (Int_t iBranch = 0; iBranch < fgkDetBranches[iDet]; iBranch++)
+ fDetRawData[iDet][iBranch]->ClearData();
+}
+
+//______________________________________________________________________________
+AliRawDataArrayV2 *AliRawDB::GetRawDataArray(UInt_t eqSize, UInt_t eqId) const
+{
+ // Return the corresponding raw-datra array (branch)
+ // depending on the equipment ID
+
+ Int_t iDet = AliDAQ::kNDetectors;
+ Int_t iBranch = 0; // can we split somehow the unrecognized data??? For the moment - no
+ if(eqSize) {
+ Int_t ddlIndex = -1;
+ iDet = AliDAQ::DetectorIDFromDdlID(eqId,ddlIndex);
+ if (iDet < 0 || iDet >= AliDAQ::kNDetectors)
+ iDet = AliDAQ::kNDetectors;
+ else
+ iBranch = (ddlIndex * fgkDetBranches[iDet])/AliDAQ::NumberOfDdls(iDet);
+ }
+
+ return fDetRawData[iDet][iBranch];
+}
+
#include "AliDAQ.h"
// Forward class declarations
-class AliRawEvent;
-class AliRawDataArray;
-class AliStats;
+class AliRawEventV2;
+class AliRawDataArrayV2;
class TFile;
class AliESDEvent;
class AliRawDB : public TObject {
public:
- AliRawDB(AliRawEvent *event,
+ AliRawDB(AliRawEventV2 *event,
AliESDEvent *esd,
Int_t compress,
const char* fileName = NULL,
Long64_t GetTotalSize();
Long64_t AutoSave();
- void WriteStats(AliStats* stats);
-
void SetMaxSize(Double_t maxSize) { fMaxSize = maxSize; }
void SetFS(const char* fs1, const char* fs2 = NULL);
void SetDeleteFiles(Bool_t deleteFiles = kTRUE) { fDeleteFiles = deleteFiles; }
Double_t GetBytesWritten() const { return fRawDB->GetBytesWritten(); }
TFile *GetDB() const { return fRawDB; }
const char *GetDBName() const { return fRawDB->GetName(); }
- Int_t GetEvents() const { return (Int_t) fTree->GetEntries(); }
- AliRawEvent *GetEvent() const { return fEvent; }
+ Int_t GetEvents() const { return (fTree) ? (Int_t) fTree->GetEntries() : 0; }
+ AliRawEventV2 *GetEvent() const { return fEvent; }
Float_t GetCompressionFactor() const;
Int_t GetCompressionMode() const { return fRawDB->GetCompressionLevel(); }
Int_t GetBasketSize() const { return fBasketSize; }
void Stop() { fStop = kTRUE; }
static const char *GetAliRootTag();
Bool_t WriteGuidFile(TString &guidFileFolder);
+ void Reset();
+ AliRawDataArrayV2 *GetRawDataArray(UInt_t eqSize, UInt_t eqId) const;
protected:
TFile *fRawDB; // DB to store raw data
TTree *fTree; // tree used to store raw data
- AliRawEvent *fEvent; // AliRawEvent via which data is stored
- AliRawDataArray **fDetRawData[AliDAQ::kNDetectors+1]; // Detectors raw-data payload
+ AliRawEventV2 *fEvent; // AliRawEvent via which data is stored
+ AliRawDataArrayV2 **fDetRawData[AliDAQ::kNDetectors+1]; // Detectors raw-data payload
TTree *fESDTree; // tree for storing HLT ESD information
AliESDEvent *fESD; // pointer to HLT ESD object
Int_t fCompress; // compression mode (1 default)
AliRawDB(const AliRawDB& rawDB);
AliRawDB& operator = (const AliRawDB& rawDB);
- ClassDef(AliRawDB,4) // Raw DB
+ ClassDef(AliRawDB,5) // Raw DB
};
#endif
ClassImp(AliRawData)
AliRawData::AliRawData():
+TObject(),
fSize(0),
-fBufSize(0),
fRawData(NULL),
fOwner(kTRUE)
{
AliRawData();
virtual ~AliRawData() { if (fOwner) delete [] fRawData; }
- inline void SetSize(Int_t size);
inline void SetBuffer(void *buf, Int_t size);
Int_t GetSize() const { return fSize; }
void *GetBuffer() { return fRawData; }
private:
Int_t fSize; // number of raw data bytes
- Int_t fBufSize; //!actual size of fRawData
char *fRawData; //[fSize] raw event data
Bool_t fOwner; //!if true object owns fRawData buffer
- AliRawData(const AliRawData &); // not implemented, usage causes
- AliRawData &operator=(const AliRawData &); // link time error
+ AliRawData(const AliRawData &);
+ AliRawData &operator=(const AliRawData &);
- ClassDef(AliRawData,1) // Alice raw event buffer
+ ClassDef(AliRawData,2) // Alice raw event buffer
};
-void AliRawData::SetSize(Int_t size)
-{
- if (size > fBufSize) {
- if (fOwner) delete [] fRawData;
- fRawData = new char [size];
- fBufSize = size;
- fOwner = kTRUE;
- }
- fSize = size;
-}
-
void AliRawData::SetBuffer(void *buf, Int_t size)
{
if (fOwner) delete [] fRawData;
fRawData = (char *) buf;
- fBufSize = size;
fSize = size;
fOwner = kFALSE;
}
--- /dev/null
+// Author: Cvetan Cheshkov 27/03/2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliRawDataArrayV2 //
+// A container object which is used in order to write the sub-detector //
+// raw-data payloads into a separate branches //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include "AliRawDataArrayV2.h"
+#include "AliRawData.h"
+
+
+ClassImp(AliRawDataArrayV2)
+
+AliRawDataArrayV2::AliRawDataArrayV2():
+fRawDataArray("AliRawData",100),
+fNAlloc(0)
+{
+ // Default constructor
+}
+
+AliRawDataArrayV2::AliRawDataArrayV2(Int_t n):
+fRawDataArray("AliRawData",n),
+fNAlloc(0)
+{
+ // Default constructor
+}
+
+AliRawDataArrayV2::~AliRawDataArrayV2()
+{
+ fRawDataArray.Delete();
+}
+
+void AliRawDataArrayV2::ClearData()
+{
+ fRawDataArray.Clear();
+}
+
+AliRawData *AliRawDataArrayV2::Add()
+{
+ Int_t nEntries = fRawDataArray.GetEntriesFast();
+ if (nEntries < fNAlloc) {
+ return (AliRawData *)fRawDataArray[nEntries];
+ }
+ else {
+ fNAlloc = nEntries + 1;
+ return new (fRawDataArray[nEntries]) AliRawData();
+ }
+}
--- /dev/null
+#ifndef ALIRAWDATAARRAYV2_H
+#define ALIRAWDATAARRAYV2_H
+
+// Author: Cvetan Cheshkov 27/03/2007
+
+/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliRawDataArrayV2 //
+// A container object which is used in order to write the sub-detector //
+// raw-data payloads into a separate branches //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TObject
+#include <TObject.h>
+#endif
+#include <TClonesArray.h>
+
+class AliRawData;
+
+class AliRawDataArrayV2 : public TObject {
+
+public:
+ AliRawDataArrayV2();
+ AliRawDataArrayV2(Int_t n);
+ virtual ~AliRawDataArrayV2();
+
+ void ClearData();
+ AliRawData *Add();
+
+private:
+ TClonesArray fRawDataArray; // Array containing raw-data payloads
+ Int_t fNAlloc; //!
+
+ AliRawDataArrayV2(const AliRawDataArrayV2 &); // not implemented, usage causes
+ AliRawDataArrayV2 &operator=(const AliRawDataArrayV2 &); // link time error
+
+ ClassDef(AliRawDataArrayV2,1) // Alice raw event buffer
+};
+
+#endif
return fRawData;
}
-//______________________________________________________________________________
-void AliRawEquipment::Reset()
-{
- // Reset the equipment in case it needs to be re-used (avoiding costly
- // new/delete cycle). We reset the size marker for the AliRawData
- // object.
-
- if (fEqpHdr) fEqpHdr->Reset();
- GetRawData()->SetSize(0);
- fRawDataRef = NULL;
-}
-
//______________________________________________________________________________
AliRawEquipment::~AliRawEquipment()
{
}
//______________________________________________________________________________
-void AliRawEquipment::SetRawDataRef(AliRawDataArray *array)
+void AliRawEquipment::Streamer(TBuffer &R__b)
{
- // Set the TRef to the raw-data container
- // before writing it to the branch
- if (fRawData) {
- fRawDataRef = fRawData;
- array->Add(fRawData);
- fRawData = NULL;
- return;
- }
- else {
- Error("SetRawDataRef", "Raw-data payload does not exist! Can not set a reference to it!");
- fRawDataRef = NULL;
- return;
- }
+ // Stream an object of class AliRawEquipment.
+
+ UInt_t R__s, R__c;
+ if (R__b.IsReading()) {
+ Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
+ TObject::Streamer(R__b);
+ R__b >> fEqpHdr;
+ R__b >> fRawData;
+ fRawDataRef.Streamer(R__b);
+ R__b.CheckByteCount(R__s, R__c, AliRawEquipment::IsA());
+ } else {
+ R__c = R__b.WriteVersion(AliRawEquipment::IsA(), kTRUE);
+ TObject::Streamer(R__b);
+ R__b << fEqpHdr;
+ R__b << fRawData;
+ fRawDataRef.Streamer(R__b);
+ R__b.SetByteCount(R__c, kTRUE);
+ }
}
class AliRawEquipmentHeader;
class AliRawData;
+#include "AliRawVEquipment.h"
-class AliRawEquipment : public TObject {
+class AliRawEquipment : public AliRawVEquipment {
public:
AliRawEquipment();
virtual ~AliRawEquipment();
- AliRawEquipmentHeader *GetEquipmentHeader();
- AliRawData *GetRawData();
- void Reset();
- void SetRawDataRef(AliRawDataArray *array);
+ virtual AliRawEquipmentHeader *GetEquipmentHeader();
+ virtual AliRawData *GetRawData();
private:
AliRawEquipmentHeader *fEqpHdr; // equipment header
AliRawEquipment(const AliRawEquipment& rawEvent);
AliRawEquipment& operator = (const AliRawEquipment& rawEvent);
- ClassDef(AliRawEquipment,2) // ALICE raw equipment object
+ ClassDef(AliRawEquipment,3) // ALICE raw equipment object
};
#endif
UInt_t fTypeAttribute[kAttributeWords]; // system (0,1) and user (2) attributes
UInt_t fBasicElementSizeType; // basic element size type
- ClassDef(AliRawEquipmentHeader,1) //Alice equipment header
+ ClassDef(AliRawEquipmentHeader,2) //Alice equipment header
};
#endif
--- /dev/null
+// @(#) $Id: AliRawEquipment.cxx 23318 2008-01-14 12:43:28Z hristov $
+// Author: Fons Rademakers 26/11/99
+
+/**************************************************************************
+ * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliRawEquipmentV2 //
+// //
+// Set of classes defining the ALICE RAW event format. The AliRawEventV2//
+// class defines a RAW event. It consists of an AliEventHeader object //
+// an AliEquipmentHeader object, an AliRawData object and an array of //
+// sub-events, themselves also being AliRawEventV2s. The number of //
+// sub-events depends on the number of DATE LDC's. //
+// The AliRawEventV2 objects are written to a ROOT file using different //
+// technologies, i.e. to local disk via AliRawDB or via rfiod using //
+// AliRawRFIODB or via rootd using AliRawRootdDB or to CASTOR via //
+// rootd using AliRawCastorDB (and for performance testing there is //
+// also AliRawNullDB). //
+// 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. //
+// The AliMDC class is usid by the "alimdc" stand-alone program //
+// that reads data directly from DATE. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include "AliRawEquipmentV2.h"
+#include "AliRawDataArrayV2.h"
+#include "AliRawData.h"
+
+ClassImp(AliRawEquipmentV2)
+
+//______________________________________________________________________________
+AliRawEquipmentV2::AliRawEquipmentV2():
+AliRawVEquipment(),
+fEqpHdr(),
+fRawData(NULL),
+fRawDataRef(NULL)
+{
+ // Create ALICE equipment object.
+
+}
+
+//______________________________________________________________________________
+AliRawEquipmentHeader *AliRawEquipmentV2::GetEquipmentHeader()
+{
+ // Get equipment header part of AliRawEquipmentV2.
+
+ return &fEqpHdr;
+}
+
+//______________________________________________________________________________
+AliRawData *AliRawEquipmentV2::GetRawData()
+{
+ // Get raw data part of AliRawEquipmentV2.
+
+ if (!fRawData) {
+ if (fRawDataRef.IsValid()) {
+ fRawData = (AliRawData*)fRawDataRef.GetObject();
+ }
+ }
+ return fRawData;
+}
+
+//______________________________________________________________________________
+void AliRawEquipmentV2::Reset()
+{
+ // Reset the equipment in case it needs to be re-used (avoiding costly
+ // new/delete cycle). We reset the size marker for the AliRawData
+ // object.
+
+ fEqpHdr.Reset();
+ fRawDataRef = NULL;
+}
+
+//______________________________________________________________________________
+AliRawEquipmentV2::~AliRawEquipmentV2()
+{
+ // Clean up event object. Delete also, possible, private raw data.
+
+ if (!fRawDataRef.IsValid()) delete fRawData;
+}
+
+//______________________________________________________________________________
+AliRawData *AliRawEquipmentV2::NextRawData(AliRawDataArrayV2 *array)
+{
+ // Get a pointer to the raw-data object
+ // stored within an array in a separate
+ // branch of the tree.
+ // Set the reference to the raw-data object
+
+ AliRawData *raw = NULL;
+ if (array) {
+ raw = array->Add();
+ fRawDataRef = raw;
+ }
+ else {
+ Error("NextRawData", "Raw-data array does not exist! Can not set a reference to a raw-data object!");
+ fRawDataRef = NULL;
+ }
+
+ return raw;
+}
--- /dev/null
+#ifndef ALIRAWEQUIPMENTV2_H
+#define ALIRAWEQUIPMENTV2_H
+// Author: Cvetan Cheshkov 11/05/2009
+
+/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliRawEquipmentV2 //
+// //
+// Set of classes defining the ALICE RAW event format. The AliRawEventV2//
+// class defines a RAW event. It consists of an AliEventHeader object //
+// an AliEquipmentHeader object, an AliRawData object and an array of //
+// sub-events, themselves also being AliRawEventV2s. The number of //
+// sub-events depends on the number of DATE LDC's. //
+// The AliRawEventV2 objects are written to a ROOT file using different //
+// technologies, i.e. to local disk via AliRawDB or via rfiod using //
+// 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. //
+// The AliMDC class is usid by the "alimdc" stand-alone program //
+// that reads data directly from DATE. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TObject
+#include <TObject.h>
+#endif
+#include <TRef.h>
+
+// Forward class declarations
+class AliRawDataArrayV2;
+
+#include "AliRawVEquipment.h"
+#include "AliRawEquipmentHeader.h"
+
+class AliRawEquipmentV2 : public AliRawVEquipment {
+
+public:
+ AliRawEquipmentV2();
+ virtual ~AliRawEquipmentV2();
+
+ virtual AliRawEquipmentHeader *GetEquipmentHeader();
+ virtual AliRawData *GetRawData();
+ void Reset();
+ AliRawData *NextRawData(AliRawDataArrayV2 *array);
+
+private:
+ AliRawEquipmentHeader fEqpHdr; // equipment header
+ AliRawData *fRawData; //! raw data container
+ TRef fRawDataRef; // reference to raw data container
+
+ AliRawEquipmentV2(const AliRawEquipmentV2& eq);
+ AliRawEquipmentV2& operator = (const AliRawEquipmentV2& eq);
+
+ ClassDef(AliRawEquipmentV2,1) // ALICE raw equipment object
+};
+
+#endif
}
-//______________________________________________________________________________
-AliRawEventHeaderBase *AliRawEvent::GetHeader(char*& data)
-{
- // 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;
-}
-
//______________________________________________________________________________
AliRawEventHeaderBase *AliRawEvent::GetHeader()
{
if (!fEvtHdr) {
- AliFatal("Header version not yet initialized!");
- return 0x0;
- }
+ AliFatal("Event header does not exist!");
+ return 0x0;
+ }
return fEvtHdr;
}
-//______________________________________________________________________________
-AliRawEquipment *AliRawEvent::NextEquipment()
-{
- // Returns next equipment object.
-
- if (!fEquipments)
- fEquipments = new TObjArray(100); // arbitrary, probably enough to prevent resizing
-
- if (fEquipments->GetSize() <= fNEquipments) {
- fEquipments->Expand(fNEquipments+10);
- Warning("NextEquipment", "expanded fEquipments by 10 to %d",
- fEquipments->GetSize());
- }
-
- AliRawEquipment *eq;
- if (!(eq = (AliRawEquipment *)fEquipments->At(fNEquipments))) {
- eq = new AliRawEquipment;
- fEquipments->AddAt(eq, fNEquipments);
- }
-
- fNEquipments++;
-
- return eq;
-}
-
//______________________________________________________________________________
AliRawEquipment *AliRawEvent::GetEquipment(Int_t index) const
{
}
//______________________________________________________________________________
-AliRawEvent *AliRawEvent::NextSubEvent()
-{
- // Returns next sub-event object.
-
- if (!fSubEvents)
- fSubEvents = new TObjArray(100); // arbitrary, probably enough to prevent resizing
-
- if (fSubEvents->GetSize() <= fNSubEvents) {
- fSubEvents->Expand(fNSubEvents+10);
- Warning("NextSubEvent", "expanded fSubEvents by 10 to %d",
- fSubEvents->GetSize());
- }
-
- AliRawEvent *ev;
- if (!(ev = (AliRawEvent *)fSubEvents->At(fNSubEvents))) {
- ev = new AliRawEvent;
- fSubEvents->AddAt(ev, fNSubEvents);
- }
-
- fNSubEvents++;
-
- return ev;
-}
-
-//______________________________________________________________________________
-AliRawEvent *AliRawEvent::GetSubEvent(Int_t index) const
+AliRawEvent *AliRawEvent::GetSubEvent(Int_t index)
{
// Get specified sub event. Returns 0 if sub event does not exist.
return (AliRawEvent *) fSubEvents->At(index);
}
-//______________________________________________________________________________
-void AliRawEvent::Reset()
-{
- // Reset the event in case it needs to be re-used (avoiding costly
- // 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->Reset();
- }
- fNSubEvents = 0;
-}
-
//______________________________________________________________________________
AliRawEvent::~AliRawEvent()
{
fSubEvents->Delete();
delete fSubEvents;
}
+
+//______________________________________________________________________________
+void AliRawEvent::Streamer(TBuffer &R__b)
+{
+ // Stream an object of class AliRawEvent.
+
+ UInt_t R__s, R__c;
+ if (R__b.IsReading()) {
+ Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
+ TObject::Streamer(R__b);
+ R__b >> fNEquipments;
+ R__b >> fNSubEvents;
+ R__b >> fEvtHdr;
+ R__b >> fEquipments;
+ R__b >> fSubEvents;
+ R__b.CheckByteCount(R__s, R__c, AliRawEvent::IsA());
+ } else {
+ R__c = R__b.WriteVersion(AliRawEvent::IsA(), kTRUE);
+ TObject::Streamer(R__b);
+ R__b << fNEquipments;
+ R__b << fNSubEvents;
+ R__b << fEvtHdr;
+ R__b << fEquipments;
+ R__b << fSubEvents;
+ R__b.SetByteCount(R__c, kTRUE);
+ }
+}
class AliRawEventHeaderBase;
class AliRawEquipment;
+#include "AliRawVEvent.h"
-class AliRawEvent : public TObject {
+class AliRawEvent : public AliRawVEvent {
public:
AliRawEvent();
virtual ~AliRawEvent();
- AliRawEventHeaderBase *GetHeader(char*& data);
- AliRawEventHeaderBase *GetHeader();
- Int_t GetNEquipments() const { return fNEquipments; }
- AliRawEquipment *NextEquipment();
- AliRawEquipment *GetEquipment(Int_t index) const;
- Int_t GetNSubEvents() const { return fNSubEvents; }
- AliRawEvent *NextSubEvent();
- AliRawEvent *GetSubEvent(Int_t index) const;
- void Reset();
+ virtual AliRawEventHeaderBase *GetHeader();
+ virtual Int_t GetNEquipments() const { return fNEquipments; }
+ virtual AliRawEquipment *GetEquipment(Int_t index) const;
+ virtual Int_t GetNSubEvents() const { return fNSubEvents; }
+ virtual AliRawEvent *GetSubEvent(Int_t index);
private:
Int_t fNEquipments; // number of valid equipments
AliRawEvent(const AliRawEvent& rawEvent);
AliRawEvent& operator = (const AliRawEvent& rawEvent);
- ClassDef(AliRawEvent,2) // ALICE raw event object
+ ClassDef(AliRawEvent,3) // ALICE raw event object
};
#endif
fExtendedAllocSize(0),
fExtendedData(NULL),
fIsSwapped(kFALSE),
-fHeaderSize(0)
+fHeaderSize(0),
+fHeaderBegin(NULL),
+fFirstEqIndex(-1),
+fLastEqIndex(-1)
{
// Default constructor
}
//______________________________________________________________________________
-void *AliRawEventHeaderBase::HeaderBegin()
+void *AliRawEventHeaderBase::HeaderBegin() const
{
// Returns the pointer to the first data member
// beyond the base class data members
+ if (fHeaderBegin) return fHeaderBegin;
+
TList *datalist = IsA()->GetListOfDataMembers();
TIter next(datalist);
TDataMember *member = (TDataMember *)next();
if(!strcmp(member->GetTypeName(),"TClass"))
member = (TDataMember *)next();
- return (void *)((char *)this+member->GetOffset());
+ void *ptr = (void *)((char *)this+member->GetOffset());
+ const_cast<AliRawEventHeaderBase*>(this)->fHeaderBegin = ptr;
+
+ return ptr;
}
//______________________________________________________________________________
cout << opt << " Type attribute: " << GetP("TypeAttribute")[0] << "-" << GetP("TypeAttribute")[1] << "-" << GetP("TypeAttribute")[2] << endl;
cout << opt << " GDC: " << Get("GdcId") << " LDC: " << Get("LdcId") << endl;
}
+
+//_____________________________________________________________________________
+void AliRawEventHeaderBase::AddEqIndex(Int_t index)
+{
+ // Adds an equipment by changing properly
+ // the first and last equipment indexes
+ if (fFirstEqIndex < 0) fFirstEqIndex = index;
+ if (index > fLastEqIndex) fLastEqIndex = index;
+}
+
+//_____________________________________________________________________________
+void AliRawEventHeaderBase::Reset()
+{
+ fFirstEqIndex = fLastEqIndex = -1;
+}
+
+//______________________________________________________________________________
+void AliRawEventHeaderBase::Streamer(TBuffer &R__b)
+{
+ // Stream an object of class AliRawEventHeaderBase.
+
+ if (R__b.IsReading()) {
+ UInt_t R__s, R__c;
+ Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
+ if (R__v > 3) {
+ R__b.ReadClassBuffer(AliRawEventHeaderBase::Class(),this,R__v,R__s,R__c);
+ return;
+ }
+ TObject::Streamer(R__b);
+ R__b >> fSize;
+ R__b >> fMagic;
+ R__b >> fHeadSize;
+ R__b >> fVersion;
+ R__b >> fExtendedDataSize;
+ delete [] fExtendedData;
+ fExtendedData = new char[fExtendedDataSize];
+ R__b.ReadFastArray(fExtendedData,fExtendedDataSize);
+ R__b >> fIsSwapped;
+ R__b.CheckByteCount(R__s, R__c, AliRawEventHeaderBase::IsA());
+ } else {
+ R__b.WriteClassBuffer(AliRawEventHeaderBase::Class(),this);
+ }
+}
AliRawEventHeaderBase();
virtual ~AliRawEventHeaderBase() { if (fExtendedData) delete [] fExtendedData; }
- void *HeaderBaseBegin() { return (void *) &fSize; }
+ void *HeaderBaseBegin() const { return (void *) &fSize; }
Int_t HeaderBaseSize() const { return (Long_t) &fVersion - (Long_t) &fSize + sizeof(fVersion); }
- void *HeaderBegin();
+ void *HeaderBegin() const;
Int_t HeaderSize() const;
Bool_t DataIsSwapped() const { return fIsSwapped; }
Bool_t IsSwapped() const { return (fMagic == fgkEventMagicNumberSwapped) ? kTRUE : kFALSE; }
void Print( const Option_t* opt ="" ) const;
+ Int_t GetFirstEqIndex() const { return fFirstEqIndex; }
+ Int_t GetLastEqIndex() const { return fLastEqIndex; }
+ void AddEqIndex(Int_t index);
+ void Reset();
+
// The following enumeration can be used once the kEventTypeMask has been
// applied to the raw event type
enum EAliRawEventType {
Bool_t fIsSwapped; // is data swapped
Int_t fHeaderSize; //! cache for the header size estimate
+ void *fHeaderBegin; //! cache for the header begin pointer
+
+ Int_t fFirstEqIndex; // index of the first equipment
+ Int_t fLastEqIndex; // index of the last equipment
static const UInt_t fgkEventMagicNumber = 0xDA1E5AFE; // magic word
static const UInt_t fgkEventMagicNumberSwapped = 0xFE5A1EDA; // swapped magic word
- ClassDef(AliRawEventHeaderBase,3) // Alice raw event header base class
+ ClassDef(AliRawEventHeaderBase,4) // Alice raw event header base class
};
#define EVENT_HEADER_VERSION(AA,BB) AliRawEventHeaderV##AA##_##BB
--- /dev/null
+// Author: Cvetan Cheshkov 11/05/2009
+
+/**************************************************************************
+ * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliRawEventV2 //
+// //
+// Set of classes defining the ALICE RAW event format. The AliRawEventV2 //
+// class defines a RAW event. It consists of an AliEventHeader object //
+// an AliEquipmentHeader object, an AliRawData object and an array of //
+// sub-events, themselves also being AliRawEventV2s. The number of //
+// sub-events depends on the number of DATE LDC's. //
+// The AliRawEventV2 objects are written to a ROOT file using different //
+// technologies, i.e. to local disk via AliRawDB or via rfiod using //
+// AliRawRFIODB or via rootd using AliRawRootdDB or to CASTOR via //
+// rootd using AliRawCastorDB (and for performance testing there is //
+// also AliRawNullDB). //
+// 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. //
+// The AliMDC class is usid by the "alimdc" stand-alone program //
+// that reads data directly from DATE. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include <TObjArray.h>
+#include <TClass.h>
+
+#include "AliLog.h"
+
+#include "AliRawEventHeaderBase.h"
+#include "AliRawEquipmentV2.h"
+
+#include "AliRawEventV2.h"
+
+
+ClassImp(AliRawEventV2)
+
+
+//______________________________________________________________________________
+AliRawEventV2::AliRawEventV2():
+AliRawVEvent(),
+fEquipments("AliRawEquipmentV2",1000),
+fEvtHdrs(NULL),
+fIndex(0),
+fNAllocHdrs(0),
+fNAllocEqs(0)
+{
+ // Create ALICE event object. If ownData is kFALSE we will use a static
+ // raw data object, otherwise a private copy will be made.
+
+}
+
+//______________________________________________________________________________
+AliRawEventHeaderBase *AliRawEventV2::GetHeader(char*& data)
+{
+ // Get event header part of AliRawEventV2.
+ // First the DATE version is identified and then the
+ // corresponding event header version object is created
+
+ AliRawEventHeaderBase *hdr = NULL;
+
+ if (!fEvtHdrs) {
+ hdr = AliRawEventHeaderBase::Create(data);
+ hdr->IsA()->IgnoreTObjectStreamer();
+ fEvtHdrs = new TClonesArray(hdr->IsA()->GetName(),100);
+ delete hdr;
+ }
+
+ if (fIndex < fNAllocHdrs) {
+ TClonesArray &arr = *fEvtHdrs;
+ return (AliRawEventHeaderBase *)arr[fIndex];
+ }
+ else {
+ fNAllocHdrs = fIndex + 1;
+ return (AliRawEventHeaderBase *)fEvtHdrs->New(fIndex);
+ }
+}
+
+//______________________________________________________________________________
+AliRawEventHeaderBase *AliRawEventV2::GetHeader()
+{
+ AliRawEventHeaderBase *hdr = NULL;
+ if (!fEvtHdrs || !(hdr = (AliRawEventHeaderBase *)fEvtHdrs->UncheckedAt(fIndex))) {
+ AliFatal("Event header does not exist!");
+ return NULL;
+ }
+
+ return hdr;
+}
+
+//______________________________________________________________________________
+AliRawEquipmentV2 *AliRawEventV2::NextEquipment()
+{
+ // Returns next equipment object.
+
+ AliRawEventHeaderBase *hdr = (AliRawEventHeaderBase *)fEvtHdrs->UncheckedAt(fIndex);
+ Int_t nEquipments = fEquipments.GetEntriesFast();
+ hdr->AddEqIndex(nEquipments);
+
+ if (nEquipments < fNAllocEqs) {
+ return (AliRawEquipmentV2 *)fEquipments[nEquipments];
+ }
+ else {
+ fNAllocEqs = nEquipments + 1;
+ return new (fEquipments[nEquipments]) AliRawEquipmentV2();
+ }
+}
+
+//______________________________________________________________________________
+AliRawVEquipment *AliRawEventV2::GetEquipment(Int_t index) const
+{
+ // Get specified equipment. Returns 0 if equipment does not exist.
+
+ // if (!fEquipments)
+ // return NULL;
+
+ AliRawEventHeaderBase *hdr = NULL;
+ if (!fEvtHdrs || !(hdr = (AliRawEventHeaderBase *)fEvtHdrs->UncheckedAt(fIndex))) {
+ AliFatal("Header is not yet initialized!");
+ return NULL;
+ }
+
+ if ((index + hdr->GetFirstEqIndex()) > hdr->GetLastEqIndex()) {
+ AliFatal("Equipment index out of scope!");
+ return NULL;
+ }
+
+ return (AliRawVEquipment *) fEquipments.UncheckedAt(index+hdr->GetFirstEqIndex());
+}
+
+
+//______________________________________________________________________________
+Int_t AliRawEventV2::GetNEquipments() const
+{
+ // if (!fEquipments)
+ // return 0;
+
+ AliRawEventHeaderBase *hdr = NULL;
+ if (!fEvtHdrs || !(hdr = (AliRawEventHeaderBase *)fEvtHdrs->UncheckedAt(fIndex))) {
+ AliFatal("Header is not yet initialized!");
+ return 0;
+ }
+
+ return (hdr->GetFirstEqIndex() < 0) ? 0 : (hdr->GetLastEqIndex() - hdr->GetFirstEqIndex() + 1);
+}
+
+//______________________________________________________________________________
+AliRawEventV2 *AliRawEventV2::NextSubEvent()
+{
+ // Returns next sub-event object.
+
+ fIndex++;
+
+ return this;
+}
+
+//______________________________________________________________________________
+AliRawVEvent *AliRawEventV2::GetSubEvent(Int_t index)
+{
+ // Get specified sub event. Returns 0 if sub event does not exist.
+
+ if (!fEvtHdrs) {
+ AliFatal("Headers are not yet initialized!");
+ return NULL;
+ }
+
+ fIndex = index + 1;
+
+ return this;
+}
+
+//______________________________________________________________________________
+void AliRawEventV2::Reset()
+{
+ // Reset the event in case it needs to be re-used (avoiding costly
+ // new/delete cycle). We reset the size marker for the AliRawData
+ // objects and the sub event counter.
+
+ fEquipments.Clear();
+
+ if (fEvtHdrs) {
+ for (int i = 0; i < fEvtHdrs->GetEntriesFast(); i++) {
+ AliRawEventHeaderBase *hdr = (AliRawEventHeaderBase *)fEvtHdrs->UncheckedAt(i);
+ hdr->Reset();
+ }
+ fEvtHdrs->Clear();
+ }
+ fIndex = 0;
+}
+
+//______________________________________________________________________________
+AliRawEventV2::~AliRawEventV2()
+{
+ // Clean up event object. Delete also, possible, private raw data.
+
+ // if (fEquipments)
+ fEquipments.Delete();
+ // delete fEquipments;
+ if (fEvtHdrs)
+ fEvtHdrs->Delete();
+ delete fEvtHdrs;
+}
--- /dev/null
+#ifndef ALIRAWEVENTV2_H
+#define ALIRAWEVENTV2_H
+// Author: Cvetan Cheshkov 11/05/2009
+
+/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliRawEventV2 //
+// //
+// Set of classes defining the ALICE RAW event format. The AliRawEventV2 //
+// class defines a RAW event. It consists of an AliEventHeader object //
+// an AliEquipmentHeader object, an AliRawData object and an array of //
+// sub-events, themselves also being AliRawEventV2s. The number of //
+// sub-events depends on the number of DATE LDC's. //
+// The AliRawEventV2 objects are written to a ROOT file using different //
+// technologies, i.e. to local disk via AliRawDB or via rfiod using //
+// 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. //
+// The AliMDC class is usid by the "alimdc" stand-alone program //
+// that reads data directly from DATE. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TObject
+#include <TObject.h>
+#endif
+
+#ifndef ROOT_TClonesArray
+#include <TClonesArray.h>
+#endif
+
+
+// Forward class declarations
+class AliRawEventHeaderBase;
+class AliRawVEquipment;
+class AliRawEquipmentV2;
+
+#include "AliRawVEvent.h"
+
+class AliRawEventV2 : public AliRawVEvent {
+
+public:
+ AliRawEventV2();
+ virtual ~AliRawEventV2();
+
+ AliRawEventHeaderBase *GetHeader(char*& data);
+ virtual AliRawEventHeaderBase *GetHeader();
+ virtual Int_t GetNEquipments() const;
+ AliRawEquipmentV2 *NextEquipment();
+ virtual AliRawVEquipment *GetEquipment(Int_t index) const;
+ virtual Int_t GetNSubEvents() const { return (fEvtHdrs) ? (fEvtHdrs->GetEntriesFast()-1) : 0; }
+ AliRawEventV2 *NextSubEvent();
+ virtual AliRawVEvent *GetSubEvent(Int_t index);
+ void Reset();
+
+private:
+ TClonesArray fEquipments; // AliRawEquipmentV2's
+ TClonesArray *fEvtHdrs; //-> event and subevent headers
+
+ Int_t fIndex; //!
+ Int_t fNAllocHdrs; //!
+ Int_t fNAllocEqs; //!
+
+ AliRawEventV2(const AliRawEventV2& rawEvent);
+ AliRawEventV2& operator = (const AliRawEventV2& rawEvent);
+
+ ClassDef(AliRawEventV2,1) // ALICE raw event object
+};
+
+#endif
//______________________________________________________________________________
-AliRawNullDB::AliRawNullDB(AliRawEvent *event,
+AliRawNullDB::AliRawNullDB(AliRawEventV2 *event,
AliESDEvent *esd,
Int_t compress,
const char* fileName,Int_t basketsize)
// Write the tree.
Bool_t error = kFALSE;
- if (fTree->Write() == 0)
- error = kTRUE;
+ if (fTree)
+ if (fTree->Write() == 0)
+ error = kTRUE;
if (fESDTree)
if (fESDTree->Write() == 0)
error = kTRUE;
// Close DB, this also deletes the fTree
fRawDB->Close();
+ fTree = NULL;
+
Long64_t filesize = fRawDB->GetEND();
delete fRawDB;
class AliRawNullDB : public AliRawDB {
public:
- AliRawNullDB(AliRawEvent *event,
+ AliRawNullDB(AliRawEventV2 *event,
AliESDEvent *esd,
Int_t compress,
const char* fileName,
//______________________________________________________________________________
-AliRawRFIODB::AliRawRFIODB(AliRawEvent *event,
+AliRawRFIODB::AliRawRFIODB(AliRawEventV2 *event,
AliESDEvent *esd,
Int_t compress,
const char* fileName,Int_t basketsize)
// Write the tree.
Bool_t error = kFALSE;
- if (fTree->Write() == 0)
- error = kTRUE;
+ if (fTree)
+ if (fTree->Write() == 0)
+ error = kTRUE;
if (fESDTree)
if (fESDTree->Write() == 0)
error = kTRUE;
// Close DB, this also deletes the fTree
fRawDB->Close();
+ fTree = NULL;
+
Long64_t filesize = fRawDB->GetEND();
if (fDeleteFiles) {
class AliRawRFIODB : public AliRawDB {
public:
- AliRawRFIODB(AliRawEvent *event,
+ AliRawRFIODB(AliRawEventV2 *event,
AliESDEvent *esd,
Int_t compress,
const char* fileName = NULL,
class TChain;
class AliRawEventHeaderBase;
-class AliRawEvent;
+class AliRawVEvent;
class AliRawReader: public TObject {
public :
{fRequireHeader = required;};
virtual const AliRawEventHeaderBase* GetEventHeader() const {return NULL;};
- virtual const AliRawEvent* GetEvent() const {return NULL;}
+ virtual const AliRawVEvent* GetEvent() const {return NULL;}
virtual UInt_t GetType() const = 0;
virtual UInt_t GetRunNumber() const = 0;
#include <TKey.h>
#include "AliRawReaderChain.h"
-#include "AliRawEvent.h"
+#include "AliRawVEvent.h"
ClassImp(AliRawReaderChain)
do {
delete fEvent;
- fEvent = new AliRawEvent;
+ fEvent = NULL;
+ fEventHeader = NULL;
Long64_t treeEntry = fChain->LoadTree(fEventIndex+1);
if (!fBranch)
return kFALSE;
if (fBranch->GetEntry(treeEntry) <= 0)
return kFALSE;
+ fEventHeader = fEvent->GetHeader();
fEventIndex++;
} while (!IsEventSelected());
fEventNumber++;
fEventIndex = -1;
delete fEvent;
- fEvent = new AliRawEvent;
+ fEvent = NULL;
+ fEventHeader = NULL;
fEventNumber = -1;
return Reset();
}
if (!fChain || !fChain->GetListOfFiles()->GetEntriesFast()) return kFALSE;
delete fEvent;
- fEvent = new AliRawEvent;
+ fEvent = NULL;
+ fEventHeader = NULL;
Long64_t treeEntry = fChain->LoadTree(event);
if (!fBranch)
return kFALSE;
if (fBranch->GetEntry(treeEntry) <= 0)
return kFALSE;
+ fEventHeader = fEvent->GetHeader();
fEventIndex = event;
fEventNumber++;
return Reset();
///
/// The root file is expected to contain a tree of name "RAW" with
/// a branch of name "rawevent" which contains objects of type
-/// AliRawEvent.
+/// AliRawVEvent.
///
/// The file name and the event number are arguments of the constructor
/// of AliRawReaderRoot.
#include <TFile.h>
#include <TTree.h>
#include "AliRawReaderRoot.h"
-#include "AliRawEvent.h"
+#include "AliRawVEvent.h"
#include "AliRawEventHeaderBase.h"
-#include "AliRawEquipment.h"
+#include "AliRawVEquipment.h"
#include "AliRawEquipmentHeader.h"
#include "AliRawData.h"
fBranch(NULL),
fEventIndex(-1),
fEvent(NULL),
+ fEventHeader(NULL),
fSubEventIndex(0),
fSubEvent(NULL),
fEquipmentIndex(0),
fBranch(NULL),
fEventIndex(eventNumber),
fEvent(NULL),
+ fEventHeader(NULL),
fSubEventIndex(0),
fSubEvent(NULL),
fEquipmentIndex(0),
return;
}
- fEvent = new AliRawEvent;
fBranch->SetAddress(&fEvent);
if (fEventIndex >= 0) {
if (fBranch->GetEntry(fEventIndex) <= 0) {
fIsValid = kFALSE;
return;
}
+ fEventHeader = fEvent->GetHeader();
}
}
-AliRawReaderRoot::AliRawReaderRoot(AliRawEvent* event) :
+AliRawReaderRoot::AliRawReaderRoot(AliRawVEvent* event) :
fFile(NULL),
fBranch(NULL),
fEventIndex(-1),
fEvent(event),
+ fEventHeader(event->GetHeader()),
fSubEventIndex(0),
fSubEvent(NULL),
fEquipmentIndex(0),
fBranch(NULL),
fEventIndex(rawReader.fEventIndex),
fEvent(NULL),
+ fEventHeader(NULL),
fSubEventIndex(rawReader.fSubEventIndex),
fSubEvent(NULL),
fEquipmentIndex(rawReader.fEquipmentIndex),
return;
}
- fEvent = new AliRawEvent;
fBranch->SetAddress(&fEvent);
if (fEventIndex >= 0) {
if (fBranch->GetEntry(fEventIndex) <= 0) {
fIsValid = kFALSE;
return;
}
+ fEventHeader = fEvent->GetHeader();
}
} else {
fEvent = rawReader.fEvent;
+ fEventHeader = rawReader.fEventHeader;
}
if (fSubEventIndex > 0) {
{
// Get the even header
// Return NULL in case of failure
- if (!fEvent) return NULL;
- return fEvent->GetHeader();
+ return fEventHeader;
}
UInt_t AliRawReaderRoot::GetType() const
{
// get the type from the event header
- if (!fEvent) return 0;
- return fEvent->GetHeader()->Get("Type");
+ if (!fEventHeader) return 0;
+ return fEventHeader->Get("Type");
}
UInt_t AliRawReaderRoot::GetRunNumber() const
{
// get the run number from the event header
- if (!fEvent) return 0;
- return fEvent->GetHeader()->Get("RunNb");
+ if (!fEventHeader) return 0;
+ return fEventHeader->Get("RunNb");
}
const UInt_t* AliRawReaderRoot::GetEventId() const
{
// get the event id from the event header
- if (!fEvent) return NULL;
- return fEvent->GetHeader()->GetP("Id");
+ if (!fEventHeader) return NULL;
+ return fEventHeader->GetP("Id");
}
const UInt_t* AliRawReaderRoot::GetTriggerPattern() const
{
// get the trigger pattern from the event header
- if (!fEvent) return NULL;
- return fEvent->GetHeader()->GetP("TriggerPattern");
+ if (!fEventHeader) return NULL;
+ return fEventHeader->GetP("TriggerPattern");
}
const UInt_t* AliRawReaderRoot::GetDetectorPattern() const
{
// get the detector pattern from the event header
- if (!fEvent) return NULL;
- return fEvent->GetHeader()->GetP("DetectorPattern");
+ if (!fEventHeader) return NULL;
+ return fEventHeader->GetP("DetectorPattern");
}
const UInt_t* AliRawReaderRoot::GetAttributes() const
{
// get the type attributes from the event header
- if (!fEvent) return NULL;
- return fEvent->GetHeader()->GetP("TypeAttribute");
+ if (!fEventHeader) return NULL;
+ return fEventHeader->GetP("TypeAttribute");
}
const UInt_t* AliRawReaderRoot::GetSubEventAttributes() const
{
// get the GDC Id from the event header
- if (!fEvent) return 0;
- return fEvent->GetHeader()->Get("GdcId");
+ if (!fEventHeader) return 0;
+ return fEventHeader->Get("GdcId");
}
UInt_t AliRawReaderRoot::GetTimestamp() const
{
- if (!fEvent) return 0;
- return fEvent->GetHeader()->Get("Timestamp");
+ if (!fEventHeader) return 0;
+ return fEventHeader->Get("Timestamp");
}
Int_t AliRawReaderRoot::GetEquipmentSize() const
do {
delete fEvent;
- fEvent = new AliRawEvent;
+ fEvent = NULL;
+ fEventHeader = NULL;
fBranch->SetAddress(&fEvent);
if (fBranch->GetEntry(fEventIndex+1) <= 0)
return kFALSE;
+ fEventHeader = fEvent->GetHeader();
fEventIndex++;
} while (!IsEventSelected());
fEventNumber++;
fEventIndex = -1;
delete fEvent;
- fEvent = new AliRawEvent;
+ fEvent = NULL;
+ fEventHeader = NULL;
fBranch->SetAddress(&fEvent);
fEventNumber = -1;
return Reset();
if (!fBranch) return kFALSE;
delete fEvent;
- fEvent = new AliRawEvent;
+ fEvent = NULL;
+ fEventHeader = NULL;
fBranch->SetAddress(&fEvent);
if (fBranch->GetEntry(event) <= 0)
return kFALSE;
+ fEventHeader = fEvent->GetHeader();
fEventIndex = event;
fEventNumber++;
return Reset();
if (!fEvent) return 0;
- AliRawEvent* subEvent = NULL;
+ AliRawVEvent* subEvent = NULL;
Int_t subEventIndex = 0;
- AliRawEquipment* equipment = NULL;
+ AliRawVEquipment* equipment = NULL;
Int_t equipmentIndex = 0;
UChar_t* position = 0;
UChar_t* end = 0;
#include "AliRawReader.h"
-class AliRawEvent;
-class AliRawEquipment;
+class AliRawVEvent;
+class AliRawVEquipment;
class AliRawData;
class TFile;
class TBranch;
public :
AliRawReaderRoot();
AliRawReaderRoot(const char* fileName, Int_t eventNumber = -1);
- AliRawReaderRoot(AliRawEvent* event);
+ AliRawReaderRoot(AliRawVEvent* event);
AliRawReaderRoot(const AliRawReaderRoot& rawReader);
AliRawReaderRoot& operator = (const AliRawReaderRoot& rawReader);
virtual ~AliRawReaderRoot();
virtual Int_t CheckData() const;
- virtual const AliRawEvent* GetEvent() const {return fEvent;}
+ virtual const AliRawVEvent* GetEvent() const {return fEvent;}
protected :
TFile* fFile; // raw data root file
TBranch* fBranch; // branch of raw events
Int_t fEventIndex; // index of the event in the tree
- AliRawEvent* fEvent; // (super) event
+ AliRawVEvent* fEvent; // (super) event
+ AliRawEventHeaderBase* fEventHeader; // (super) event header
Int_t fSubEventIndex; // index of current sub event
- AliRawEvent* fSubEvent; // current sub event
+ AliRawVEvent* fSubEvent; // current sub event
Int_t fEquipmentIndex; // index of current equipment
- AliRawEquipment* fEquipment; // current equipment
+ AliRawVEquipment*fEquipment; // current equipment
AliRawData* fRawData; // current raw data
UChar_t* fPosition; // current position in the raw data
UChar_t* fEnd; // end position of the current subevent
//______________________________________________________________________________
-AliRawRootdDB::AliRawRootdDB(AliRawEvent *event,
+AliRawRootdDB::AliRawRootdDB(AliRawEventV2 *event,
AliESDEvent *esd,
Int_t compress,
const char* fileName,Int_t basketsize)
// Write the tree.
Bool_t error = kFALSE;
- if (fTree->Write() == 0)
- error = kTRUE;
+ if (fTree)
+ if (fTree->Write() == 0)
+ error = kTRUE;
if (fESDTree)
if (fESDTree->Write() == 0)
error = kTRUE;
// Close DB, this also deletes the fTree
fRawDB->Close();
+ fTree = NULL;
+
Long64_t filesize = fRawDB->GetEND();
#if 0
class AliRawRootdDB : public AliRawDB {
public:
- AliRawRootdDB(AliRawEvent *event,
+ AliRawRootdDB(AliRawEventV2 *event,
AliESDEvent *esd,
Int_t compress,
const char* fileName = NULL,
--- /dev/null
+// Author: Cvetan Cheshkov 11/05/2009
+
+/**************************************************************************
+ * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliRawVEquipment //
+// //
+// Set of classes defining the ALICE RAW event format. The AliRawVEvent //
+// class defines a RAW event. It consists of an AliEventHeader object //
+// an AliEquipmentHeader object, an AliRawData object and an array of //
+// sub-events, themselves also being AliRawVEvents. The number of //
+// sub-events depends on the number of DATE LDC's. //
+// The AliRawVEvent objects are written to a ROOT file using different //
+// technologies, i.e. to local disk via AliRawDB or via rfiod using //
+// AliRawRFIODB or via rootd using AliRawRootdDB or to CASTOR via //
+// rootd using AliRawCastorDB (and for performance testing there is //
+// also AliRawNullDB). //
+// 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. //
+// The AliMDC class is usid by the "alimdc" stand-alone program //
+// that reads data directly from DATE. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include "AliRawVEquipment.h"
+
+ClassImp(AliRawVEquipment)
--- /dev/null
+#ifndef ALIRAWVEQUIPMENT_H
+#define ALIRAWVEQUIPMENT_H
+// Author: Cvetan Cheshkov 11/05/2009
+
+/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliRawVEquipment //
+// //
+// Set of classes defining the ALICE RAW event format. The AliRawVEvent //
+// class defines a RAW event. It consists of an AliEventHeader object //
+// an AliEquipmentHeader object, an AliRawData object and an array of //
+// sub-events, themselves also being AliRawVEvents. The number of //
+// sub-events depends on the number of DATE LDC's. //
+// The AliRawVEvent objects are written to a ROOT file using different //
+// technologies, i.e. to local disk via AliRawDB or via rfiod using //
+// 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. //
+// The AliMDC class is usid by the "alimdc" stand-alone program //
+// that reads data directly from DATE. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TObject
+#include <TObject.h>
+#endif
+
+// Forward class declarations
+class AliRawEquipmentHeader;
+class AliRawData;
+
+class AliRawVEquipment : public TObject {
+
+public:
+ AliRawVEquipment() { }
+ virtual ~AliRawVEquipment() { }
+
+ virtual AliRawEquipmentHeader *GetEquipmentHeader() = 0;
+ virtual AliRawData *GetRawData() = 0;
+
+private:
+
+ AliRawVEquipment(const AliRawVEquipment& eq);
+ AliRawVEquipment& operator = (const AliRawVEquipment& eq);
+
+ ClassDef(AliRawVEquipment,1) // ALICE raw equipment object
+};
+
+#endif
--- /dev/null
+// Author: Cvetan Cheshkov 11/05/2009
+
+/**************************************************************************
+ * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliRawVEvent //
+// //
+// Set of classes defining the ALICE RAW event format. The AliRawVEvent //
+// class defines a RAW event. It consists of an AliEventHeader object //
+// an AliEquipmentHeader object, an AliRawData object and an array of //
+// sub-events, themselves also being AliRawVEvents. The number of //
+// sub-events depends on the number of DATE LDC's. //
+// The AliRawVEvent objects are written to a ROOT file using different //
+// technologies, i.e. to local disk via AliRawDB or via rfiod using //
+// AliRawRFIODB or via rootd using AliRawRootdDB or to CASTOR via //
+// rootd using AliRawCastorDB (and for performance testing there is //
+// also AliRawNullDB). //
+// 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. //
+// The AliMDC class is usid by the "alimdc" stand-alone program //
+// that reads data directly from DATE. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#include "AliRawVEvent.h"
+
+
+ClassImp(AliRawVEvent)
--- /dev/null
+#ifndef ALIRAWVEVENT_H
+#define ALIRAWVEVENT_H
+// Author: Cvetan Cheshkov 11/05/2009
+
+/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//////////////////////////////////////////////////////////////////////////
+// //
+// AliRawVEvent //
+// //
+// Set of classes defining the ALICE RAW event format. The AliRawVEvent //
+// class defines a RAW event. It consists of an AliEventHeader object //
+// an AliEquipmentHeader object, an AliRawData object and an array of //
+// sub-events, themselves also being AliRawVEvents. The number of //
+// sub-events depends on the number of DATE LDC's. //
+// The AliRawVEvent objects are written to a ROOT file using different //
+// technologies, i.e. to local disk via AliRawDB or via rfiod using //
+// 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. //
+// The AliMDC class is usid by the "alimdc" stand-alone program //
+// that reads data directly from DATE. //
+// //
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TObject
+#include <TObject.h>
+#endif
+
+#ifndef ROOT_TClonesArray
+#include <TClonesArray.h>
+#endif
+
+
+// Forward class declarations
+class AliRawEventHeaderBase;
+class AliRawVEquipment;
+
+
+class AliRawVEvent : public TObject {
+
+public:
+ AliRawVEvent() { }
+ virtual ~AliRawVEvent() { }
+
+ virtual AliRawEventHeaderBase *GetHeader() = 0;
+ virtual Int_t GetNEquipments() const = 0;
+ virtual AliRawVEquipment *GetEquipment(Int_t index) const = 0;
+ virtual Int_t GetNSubEvents() const = 0;
+ virtual AliRawVEvent *GetSubEvent(Int_t index) = 0;
+
+private:
+
+ AliRawVEvent(const AliRawVEvent& rawEvent);
+ AliRawVEvent& operator = (const AliRawVEvent& rawEvent);
+
+ ClassDef(AliRawVEvent,1) // ALICE raw event object
+};
+
+#endif
#pragma link off all classes;
#pragma link off all functions;
-#pragma link C++ class AliRawEvent;
-#pragma link C++ class AliRawEventHeaderBase;
+#pragma link C++ class AliRawVEvent+;
+#pragma link C++ class AliRawEvent-;
+#pragma link C++ class AliRawEventV2+;
+#pragma link C++ class AliRawEventHeaderBase-;
#pragma link C++ defined_in RAW/AliRawEventHeaderVersions.h;
#pragma link C++ class AliRawEquipmentHeader;
-#pragma link C++ class AliRawEquipment;
+#pragma link C++ class AliRawVEquipment+;
+#pragma link C++ class AliRawEquipment-;
+#pragma link C++ class AliRawEquipmentV2+;
#pragma link C++ class AliRawData;
+#pragma link C++ class AliRawDataArrayV2+;
#pragma link C++ class AliRawDataArray;
#pragma link C++ class AliStats;
-#pragma link C++ class AliRawEventTag;
+#pragma link C++ class AliRawEventTag+;
#pragma link C++ class AliAltroMapping+;
#pragma link C++ class AliCaloAltroMapping+;
#pragma link C++ class AliDAQ+;
#include <TTree.h>
#include <TGrid.h>
-#include "AliRawEvent.h"
+#include "AliRawVEvent.h"
#include "AliRawEventHeaderBase.h"
-#include "AliRawEquipment.h"
+#include "AliRawVEquipment.h"
#include "AliRawEquipmentHeader.h"
#include "AliRawDataHeader.h"
#include "AliRawData.h"
}
//______________________________________________________________________________
-static bool DumpEvent(const char *progname, AliRawEvent *rawEvent)
+static bool DumpEvent(const char *progname, AliRawVEvent *rawEvent)
{
// Dumps and checks one
// raw-data event
AliRawDataHeader *cdhRef = NULL;
for(Int_t iSubEvent=0; iSubEvent < rawEvent->GetNSubEvents(); iSubEvent++) {
- AliRawEvent *rawSubEvent = rawEvent->GetSubEvent(iSubEvent);
+ AliRawVEvent *rawSubEvent = rawEvent->GetSubEvent(iSubEvent);
AliRawEventHeaderBase *rawSubEventHeader = rawSubEvent->GetHeader();
cout << " *********** Sub-event header ***********" << endl;
rawSubEventHeader->Print(" ");
for(Int_t iEquipment=0; iEquipment < rawSubEvent->GetNEquipments(); iEquipment++) {
- AliRawEquipment *rawEquip = rawSubEvent->GetEquipment(iEquipment);
+ AliRawVEquipment *rawEquip = rawSubEvent->GetEquipment(iEquipment);
AliRawEquipmentHeader *rawEquipHeader = rawEquip->GetEquipmentHeader();
cout << " *********** Equipment event header ***********" << endl;
rawEquipHeader->Print(" ");
return 1;
}
- AliRawEvent *rawEvent=NULL;
+ AliRawVEvent *rawEvent=NULL;
rawTree->SetBranchAddress("rawevent", &rawEvent);
cout << "*******************************************" << endl;
for(Int_t iEvent=0; iEvent < nEvents; iEvent++) {
- rawEvent=new AliRawEvent;
+ rawEvent=NULL;
rawTree->GetEntry(iEvent);
cout << " *********** Event " << iEvent << " *******" << endl;
DumpEvent(argv[0],rawEvent);
#-*- Mode: Makefile -*-
SRCS:= AliRawEventHeaderBase.cxx AliRawEquipmentHeader.cxx \
- AliRawData.cxx AliRawEquipment.cxx AliRawEvent.cxx \
- AliRawDataArray.cxx \
+ AliRawEquipment.cxx AliRawEvent.cxx \
+ AliRawData.cxx AliRawVEquipment.cxx AliRawEquipmentV2.cxx AliRawVEvent.cxx AliRawEventV2.cxx \
+ AliRawDataArrayV2.cxx AliRawDataArray.cxx \
AliStats.cxx AliRawEventTag.cxx \
AliAltroMapping.cxx AliCaloAltroMapping.cxx \
AliDAQ.cxx
#include "AliQAv1.h"
#include "AliQADataMakerRec.h"
#include "AliQAManager.h"
-#include "AliRawEvent.h"
+#include "AliRawVEvent.h"
#include "AliRawEventHeaderBase.h"
#include "AliRawHLTManager.h"
#include "AliRawReaderDate.h"
AliCodeTimerAuto("");
TTree *currTree = fChain->GetTree();
- AliRawEvent *event = new AliRawEvent;
+ AliRawVEvent *event = NULL;
currTree->SetBranchAddress("rawevent",&event);
currTree->GetEntry(entry);
fRawReader = new AliRawReaderRoot(event);