fDataBuffer and fPackedDataBuffer arrays of pointers modified to array
authorrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Dec 2008 11:15:45 +0000 (11:15 +0000)
committerrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Dec 2008 11:15:45 +0000 (11:15 +0000)
TOF/AliTOFRawStream.cxx
TOF/AliTOFRawStream.h

index 1060b1f..0a1c412 100644 (file)
@@ -174,6 +174,8 @@ AliTOFRawStream::AliTOFRawStream(AliRawReader* rawReader):
   fInsideLTM(kFALSE),
   fInsideTRMchain0(kFALSE),
   fInsideTRMchain1(kFALSE),
+  fDataBuffer(),
+  fPackedDataBuffer(),
   fLocalEventCounterDRM(-1),
   fLocalEventCounterLTM(-1),
   fLocalEventCounterTRM(0x0),
@@ -187,8 +189,8 @@ AliTOFRawStream::AliTOFRawStream(AliRawReader* rawReader):
   //
 
   for (Int_t i=0;i<AliDAQ::NumberOfDdls("TOF");i++){
-    fDataBuffer[i]=new AliTOFHitDataBuffer();
-    fPackedDataBuffer[i]=new AliTOFHitDataBuffer();
+    ResetDataBuffer(i);
+    ResetPackedDataBuffer(i);
   }
 
   fTOFrawData = new TClonesArray("AliTOFrawData",1000);
@@ -247,6 +249,8 @@ AliTOFRawStream::AliTOFRawStream():
   fInsideLTM(kFALSE),
   fInsideTRMchain0(kFALSE),
   fInsideTRMchain1(kFALSE),
+  fDataBuffer(),
+  fPackedDataBuffer(),
   fLocalEventCounterDRM(-1),
   fLocalEventCounterLTM(-1),
   fLocalEventCounterTRM(0x0),
@@ -259,8 +263,8 @@ AliTOFRawStream::AliTOFRawStream():
   // default ctr
   //
   for (Int_t i=0;i<AliDAQ::NumberOfDdls("TOF");i++){
-    fDataBuffer[i]=new AliTOFHitDataBuffer();
-    fPackedDataBuffer[i]=new AliTOFHitDataBuffer();
+    ResetDataBuffer(i);
+    ResetPackedDataBuffer(i);
   }
 
   fTOFrawData = new TClonesArray("AliTOFrawData",1000);
@@ -315,6 +319,8 @@ AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) :
   fInsideLTM(stream.fInsideLTM),
   fInsideTRMchain0(stream.fInsideTRMchain0),
   fInsideTRMchain1(stream.fInsideTRMchain1),
+  fDataBuffer(),
+  fPackedDataBuffer(),
   fLocalEventCounterDRM(stream.fLocalEventCounterDRM),
   fLocalEventCounterLTM(stream.fLocalEventCounterLTM),
   fLocalEventCounterTRM(0x0),
@@ -328,8 +334,8 @@ AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) :
   //
 
   for (Int_t i=0;i<AliDAQ::NumberOfDdls("TOF");i++){
-    fDataBuffer[i]= new AliTOFHitDataBuffer(*stream.fDataBuffer[i]);
-    fPackedDataBuffer[i]= new AliTOFHitDataBuffer(*stream.fPackedDataBuffer[i]);
+    fDataBuffer[i] = stream.fDataBuffer[i];
+    fPackedDataBuffer[i] = stream.fPackedDataBuffer[i];
   }
 
   fTOFrawData = new TClonesArray(*stream.fTOFrawData);
@@ -422,11 +428,6 @@ AliTOFRawStream::~AliTOFRawStream()
 
   fPackedDigits = 0;
 
-  for (Int_t i=0;i<72;i++){ 
-    delete fDataBuffer[i];
-    delete fPackedDataBuffer[i];
-  }
-
   delete fDecoder;
 
   fTOFrawData->Clear();
@@ -1398,8 +1399,8 @@ Bool_t AliTOFRawStream::Decode(Int_t verbose = 0) {
     
     //set up the decoder
     fDecoder->SetVerbose(verbose);
-    fDecoder->SetDataBuffer(fDataBuffer[currentDDL]);
-    fDecoder->SetPackedDataBuffer(fPackedDataBuffer[currentDDL]);
+    fDecoder->SetDataBuffer(&fDataBuffer[currentDDL]);
+    fDecoder->SetPackedDataBuffer(&fPackedDataBuffer[currentDDL]);
     
     //start decoding
     if (fDecoder->Decode((UInt_t *)data, kDataWords, currentCDH) == kTRUE) {
@@ -1455,7 +1456,7 @@ AliTOFRawStream::LoadRawDataBuffers(Int_t indexDDL, Int_t verbose)
   }
   
   if (verbose > 0)
-    AliInfo(Form("Done. %d packed %s been found.", fPackedDataBuffer[indexDDL]->GetEntries(), fPackedDataBuffer[indexDDL]->GetEntries() > 1 ? "hits have" : "hit has"));
+    AliInfo(Form("Done. %d packed %s been found.", fPackedDataBuffer[indexDDL].GetEntries(), fPackedDataBuffer[indexDDL].GetEntries() > 1 ? "hits have" : "hit has"));
   
   AliTOFHitData *hitData; //hit data pointer
   
@@ -1469,8 +1470,8 @@ AliTOFRawStream::LoadRawDataBuffers(Int_t indexDDL, Int_t verbose)
     }
 
   //loop over DDL packed hits
-  for (Int_t iHit = 0; iHit < fPackedDataBuffer[indexDDL]->GetEntries(); iHit++){
-    hitData = fPackedDataBuffer[indexDDL]->GetHit(iHit); //get hit data
+  for (Int_t iHit = 0; iHit < fPackedDataBuffer[indexDDL].GetEntries(); iHit++){
+    hitData = fPackedDataBuffer[indexDDL].GetHit(iHit); //get hit data
     Int_t   hitACQ = hitData->GetACQ();
     Int_t   hitPS = hitData->GetPS();
     Int_t   hitSlotID = hitData->GetSlotID();
@@ -1501,8 +1502,8 @@ AliTOFRawStream::LoadRawDataBuffers(Int_t indexDDL, Int_t verbose)
   if (verbose > 0)
     AliInfo("Resetting buffers ...");
 
-  fDataBuffer[indexDDL]->Reset();
-  fPackedDataBuffer[indexDDL]->Reset();
+  fDataBuffer[indexDDL].Reset();
+  fPackedDataBuffer[indexDDL].Reset();
 
   if (verbose > 0)
     AliInfo("Done.");
index c453bcd..ca221a2 100644 (file)
@@ -457,11 +457,11 @@ class AliTOFRawStream: public TObject {
   void SetV2718Patch(Bool_t V2718Patch = kTRUE) {fDecoder->SetV2718Patch(V2718Patch);};
 
 
-  AliTOFHitDataBuffer *GetDataBuffer(Int_t DDL) {return fDataBuffer[DDL];};
-  AliTOFHitDataBuffer *GetPackedDataBuffer(Int_t DDL) {return fPackedDataBuffer[DDL];};
+  AliTOFHitDataBuffer *GetDataBuffer(Int_t DDL) {return &fDataBuffer[DDL];};
+  AliTOFHitDataBuffer *GetPackedDataBuffer(Int_t DDL) {return &fPackedDataBuffer[DDL];};
 
-  void ResetDataBuffer(Int_t DDL) {fDataBuffer[DDL]->Reset();};
-  void ResetPackedDataBuffer(Int_t DDL) {fPackedDataBuffer[DDL]->Reset();};
+  void ResetDataBuffer(Int_t DDL) {fDataBuffer[DDL].Reset();};
+  void ResetPackedDataBuffer(Int_t DDL) {fPackedDataBuffer[DDL].Reset();};
 
   void ResetBuffers();
 
@@ -525,8 +525,8 @@ class AliTOFRawStream: public TObject {
   Bool_t fInsideTRMchain0;   // inside/outside chain 0
   Bool_t fInsideTRMchain1;   // inside/outside chain 1
 
-  AliTOFHitDataBuffer *fDataBuffer[72]; // pointer to AliTOFHitDataBuffer
-  AliTOFHitDataBuffer *fPackedDataBuffer[72]; // pointer to AliTOFHitDataBuffer
+  AliTOFHitDataBuffer fDataBuffer[72]; // AliTOFHitDataBuffer
+  AliTOFHitDataBuffer fPackedDataBuffer[72]; // AliTOFHitDataBuffer
 
   Int_t   fLocalEventCounterDRM; // event counter recorded in the DRM global trailer
   Int_t   fLocalEventCounterLTM; // event counter recorded in the LTM global trailer