* provided "as is" without express or implied warranty. *
**************************************************************************/
-/* $Id:$*/
+/* $Id$*/
///////////////////////////////////////////////////////////////////
// //
// 29 | //
// 28 |-> 4 bits to identify the Carlos (0-11) inside the DDL //
// 27 - //
-// 26 detecot side (0= left, =right) //
+// 26 detecor side (0= left, =right) //
// 25 - //
// 24 | //
// 23 | //
// 1 | //
// 0 - //
// //
-// Plus 2 types of control words: //
-// - DDL identifier with the 4 more significant bits = 1000 //
-// - End of module data (needed by the Cluster Finder) = 1111 //
+// Plus 2 typs of control words: //
+// - End of module data (needed by the Cluster Finder) //
+// first 4 most significant bits = 1111 //
+// - Jitter word //
+// first 4 most significant bits = 1000 //
// //
// Origin: F.Prino, Torino, prino@to.infn.it //
// //
///////////////////////////////////////////////////////////////////
+#include"AliLog.h"
#include "AliITSCompressRawDataSDD.h"
#include "AliRawReader.h"
#include "AliRawReaderDate.h"
ClassImp(AliITSCompressRawDataSDD)
-AliITSCompressRawDataSDD::AliITSCompressRawDataSDD(TString filename):
+AliITSCompressRawDataSDD::AliITSCompressRawDataSDD():
TObject(),
-fEventRange(kFALSE),
-fFirstEvent(0),
-fLastEvent(0)
+fRawReader(0),
+fPointerToData(0),
+fSizeInMemory(0)
{
- fNameFile=filename;
+ // default constructor
}
//______________________________________________________________________
-void AliITSCompressRawDataSDD::Compress(){
- Int_t iev=0;
- if(fEventRange) iev=fFirstEvent;
- AliRawReader *rd;
- if(fNameFile.Contains(".root")){
- rd=new AliRawReaderRoot(fNameFile.Data(),iev);
- }else{
- rd=new AliRawReaderDate(fNameFile.Data(),iev);
- }
-
- FILE *outtxt=fopen("data.txt","w");
- Int_t oldddl=-1;
+AliITSCompressRawDataSDD::~AliITSCompressRawDataSDD(){
+ // raw reader is passed from outdside, don't delete it
+}
+//______________________________________________________________________
+UInt_t AliITSCompressRawDataSDD::CompressEvent(UChar_t* inputPtr){
+ // Method to be used in HLT
+ UInt_t siz=0;
+ memcpy(fPointerToData,inputPtr,32); // event header, 8 words
+ fPointerToData+=32;
+ siz+=32;
UInt_t word=0;
- do{
- rd->Reset();
-
- AliITSRawStreamSDD s(rd);
- while(s.Next()){
- if(rd->GetDDLID()!=oldddl){
- word=8<<28;
- word+=rd->GetDDLID();
- fprintf(outtxt,"%08X\n",word);
- oldddl=rd->GetDDLID();
+ AliITSRawStreamSDD s(fRawReader);
+ s.SetDecompressAmbra(kFALSE);
+ Int_t mask1=0xFF000000;
+ Int_t mask2=0x00FF0000;
+ Int_t mask3=0x0000FF00;
+ Int_t mask4=0x000000FF;
+ while(s.Next()){
+ if(s.IsCompletedModule()==kTRUE){
+ word=UInt_t(15)<<28;
+ word+=s.GetCarlosId();
+ if(siz+4<fSizeInMemory){
+ *(fPointerToData)=(word&mask4);
+ ++fPointerToData;
+ *(fPointerToData)=(word&mask3)>>8;
+ ++fPointerToData;
+ *(fPointerToData)=(word&mask2)>>16;
+ ++fPointerToData;
+ *(fPointerToData)=(word&mask1)>>24;
+ ++fPointerToData;
+ siz+=4;
}
- if(s.IsCompletedModule()==kFALSE){
- word=s.GetCarlosId()<<27;
- word+=s.GetChannel()<<26;
- word+=s.GetCoord1()<<18;
- word+=s.GetCoord2()<<10;
- word+=s.GetSignal();
- fprintf(outtxt,"%08X\n",word);
+ }else if(s.IsCompletedDDL()==kTRUE){
+ word=UInt_t(8)<<28;
+ word+=s.GetJitter();
+ if(siz+4<fSizeInMemory){
+ *(fPointerToData)=(word&mask4);
+ ++fPointerToData;
+ *(fPointerToData)=(word&mask3)>>8;
+ ++fPointerToData;
+ *(fPointerToData)=(word&mask2)>>16;
+ ++fPointerToData;
+ *(fPointerToData)=(word&mask1)>>24;
+ ++fPointerToData;
+ siz+=4;
}
- if(s.IsCompletedModule()==kTRUE){
- word=15<<28;
- word+=s.GetCarlosId();
- fprintf(outtxt,"%08X\n",word);
+ }else{
+ word=s.GetCarlosId()<<27;
+ word+=s.GetChannel()<<26;
+ word+=s.GetCoord1()<<18;
+ word+=s.GetCoord2()<<10;
+ word+=s.GetEightBitSignal();
+ if(siz+4<fSizeInMemory){
+ *(fPointerToData)=(word&mask4);
+ ++fPointerToData;
+ *(fPointerToData)=(word&mask3)>>8;
+ ++fPointerToData;
+ *(fPointerToData)=(word&mask2)>>16;
+ ++fPointerToData;
+ *(fPointerToData)=(word&mask1)>>24;
+ ++fPointerToData;
+ siz+=4;
}
}
- iev++;
- if(fEventRange && iev>fLastEvent) break;
- }while(rd->NextEvent());
- fclose(outtxt);
+ }
+ return siz;
}