// //
///////////////////////////////////////////////////////////////////////////////
-//#include <Riostream.h>
-
#include <TMath.h>
#include "TClass.h"
#include "AliDAQ.h"
-#include "AliRawDataHeader.h"
+#include "AliRawDataHeaderSim.h"
#include "AliRawReader.h"
#include "AliLog.h"
#include "AliFstream.h"
#include "AliTRDdigitsManager.h"
#include "AliTRDgeometry.h"
#include "AliTRDdataArrayI.h"
+#include "AliTRDdataArrayS.h"
+#include "AliTRDrawStreamBase.h"
#include "AliTRDRawStream.h"
#include "AliTRDRawStreamV2.h"
#include "AliTRDcalibDB.h"
AliFstream* of = new AliFstream(name);
// Write a dummy data header
- AliRawDataHeader header; // the event header
+ AliRawDataHeaderSim header; // the event header
UInt_t hpos = of->Tellp();
of->WriteBuffer((char *) (& header), sizeof(header));
Int_t iDet = fGeo->GetDetector(plan,cham,sect);
// Get the digits array
- AliTRDdataArrayI *digits = digitsManager->GetDigits(iDet);
- digits->Expand();
+ AliTRDdataArrayS *digits = (AliTRDdataArrayS *) digitsManager->GetDigits(iDet);
+ if (digits->HasData()) {
+
+ digits->Expand();
- Int_t hcwords = 0;
- Int_t rv = fFee->GetRAWversion();
+ Int_t hcwords = 0;
+ Int_t rv = fFee->GetRAWversion();
- // Process A side of the chamber
- if ( rv >= 1 && rv <= 2 ) hcwords = ProduceHcDataV1andV2(digits,0,iDet,hcBuffer,kMaxHcWords);
- if ( rv == 3 ) hcwords = ProduceHcDataV3 (digits,0,iDet,hcBuffer,kMaxHcWords);
+ // Process A side of the chamber
+ if ( rv >= 1 && rv <= 2 ) {
+ hcwords = ProduceHcDataV1andV2(digits,0,iDet,hcBuffer,kMaxHcWords);
+ }
+ if ( rv == 3 ) {
+ hcwords = ProduceHcDataV3 (digits,0,iDet,hcBuffer,kMaxHcWords);
+ }
- of->WriteBuffer((char *) hcBuffer, hcwords*4);
- npayloadbyte += hcwords*4;
+ of->WriteBuffer((char *) hcBuffer, hcwords*4);
+ npayloadbyte += hcwords*4;
- // Process B side of the chamber
- if ( rv >= 1 && rv <= 2 ) hcwords = ProduceHcDataV1andV2(digits,1,iDet,hcBuffer,kMaxHcWords);
- if ( rv >= 3 ) hcwords = ProduceHcDataV3 (digits,1,iDet,hcBuffer,kMaxHcWords);
+ // Process B side of the chamber
+ if ( rv >= 1 && rv <= 2 ) {
+ hcwords = ProduceHcDataV1andV2(digits,1,iDet,hcBuffer,kMaxHcWords);
+ }
+ if ( rv >= 3 ) {
+ hcwords = ProduceHcDataV3 (digits,1,iDet,hcBuffer,kMaxHcWords);
+ }
+
+ of->WriteBuffer((char *) hcBuffer, hcwords*4);
+ npayloadbyte += hcwords*4;
+
+ }
- of->WriteBuffer((char *) hcBuffer, hcwords*4);
- npayloadbyte += hcwords*4;
}
}
}
//_____________________________________________________________________________
-Int_t AliTRDrawData::ProduceHcDataV1andV2(AliTRDdataArrayI *digits, Int_t side
+Int_t AliTRDrawData::ProduceHcDataV1andV2(AliTRDdataArrayS *digits, Int_t side
, Int_t det, UInt_t *buf, Int_t maxSize)
{
//
}
//_____________________________________________________________________________
-Int_t AliTRDrawData::ProduceHcDataV3(AliTRDdataArrayI *digits, Int_t side
+Int_t AliTRDrawData::ProduceHcDataV3(AliTRDdataArrayS *digits, Int_t side
, Int_t det, UInt_t *buf, Int_t maxSize)
{
//
// Vx of the raw data reading
//
- AliTRDdataArrayI *digits = 0;
+ AliTRDdataArrayS *digits = 0;
+ AliTRDdataArrayI *track0 = 0;
+ AliTRDdataArrayI *track1 = 0;
+ AliTRDdataArrayI *track2 = 0;
+
+ //AliTRDSignalIndex *indexes = 0;
+ // Create the digits manager
+ AliTRDdigitsManager* digitsManager = new AliTRDdigitsManager();
+ digitsManager->CreateArrays();
+
+ //AliTRDRawStream input(rawReader);
+ // AliTRDRawStreamV2 input(rawReader);
+ // input.SetRawVersion( fFee->GetRAWversion() );
+ // input.Init();
+
+ AliTRDrawStreamBase *pinput = AliTRDrawStreamBase::GetRawStream(rawReader);
+ AliTRDrawStreamBase &input = *pinput;
+
+ AliInfo(Form("Stream version: %s", input.IsA()->GetName()));
+
+ // Loop through the digits
+ Int_t det = 0;
+
+ while (det >= 0)
+ {
+ det = input.NextChamber(digitsManager);
+ if (det >= 0)
+ {
+ // get...
+ digits = (AliTRDdataArrayS *) digitsManager->GetDigits(det);
+ track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
+ track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
+ track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
+ // and compress
+ if (digits) digits->Compress(1,0);
+ if (track0) track0->Compress(1,0);
+ if (track1) track1->Compress(1,0);
+ if (track2) track2->Compress(1,0);
+ }
+ }
+
+ delete pinput;
+ pinput = NULL;
+
+ return digitsManager;
+}
+
+//_____________________________________________________________________________
+AliTRDdigitsManager *AliTRDrawData::Raw2DigitsOLD(AliRawReader *rawReader)
+{
+ //
+ // Vx of the raw data reading
+ //
+
+ AliTRDdataArrayS *digits = 0;
AliTRDdataArrayI *track0 = 0;
AliTRDdataArrayI *track1 = 0;
AliTRDdataArrayI *track2 = 0;
if (track2) track2->Compress(1,0);
// Add a container for the digits of this detector
- digits = digitsManager->GetDigits(det);
- track0 = digitsManager->GetDictionary(det,0);
- track1 = digitsManager->GetDictionary(det,1);
- track2 = digitsManager->GetDictionary(det,2);
+ digits = (AliTRDdataArrayS *) digitsManager->GetDigits(det);
+ track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
+ track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
+ track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
// Allocate memory space for the digits buffer
if (digits->GetNtime() == 0)