Line data Source code
1 : /**************************************************************************
2 : * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
3 : * *
4 : * Author: The ALICE Off-line Project. *
5 : * Contributors are mentioned in the code where appropriate. *
6 : * *
7 : * Permission to use, copy, modify and distribute this software and its *
8 : * documentation strictly for non-commercial purposes is hereby granted *
9 : * without fee, provided that the above copyright notice appears in all *
10 : * copies and that both the copyright notice and this permission notice *
11 : * appear in the supporting documentation. The authors make no claims *
12 : * about the suitability of this software for any purpose. It is *
13 : * provided "as is" without express or implied warranty. *
14 : **************************************************************************/
15 :
16 : /* $Id$*/
17 :
18 : ///////////////////////////////////////////////////////////////////
19 : // //
20 : // Class to decode the SDD Raw Data from the CarlosRX format to //
21 : // a compressed format consisting in a word of 32 bit per cell //
22 : // The 32 bits for a data word are defined as follows: //
23 : // 31 control bit (0=data word, 1= control word) //
24 : // 30 - //
25 : // 29 | //
26 : // 28 |-> 4 bits to identify the Carlos (0-11) inside the DDL //
27 : // 27 - //
28 : // 26 detecor side (0= left, =right) //
29 : // 25 - //
30 : // 24 | //
31 : // 23 | //
32 : // 22 | //
33 : // 21 |-> 8 bits to identify the anode number (0-255) //
34 : // 20 | //
35 : // 19 | //
36 : // 18 - //
37 : // 17 - //
38 : // 16 | //
39 : // 15 | //
40 : // 14 | //
41 : // 13 |-> 8 bits to identify the time bin (0-255) //
42 : // 12 | //
43 : // 11 | //
44 : // 10 - //
45 : // 9 - //
46 : // 8 | //
47 : // 7 | //
48 : // 6 | //
49 : // 5 | //
50 : // 4 |-> 10 bit for the ADC counts //
51 : // 3 | //
52 : // 2 | //
53 : // 1 | //
54 : // 0 - //
55 : // //
56 : // Plus 2 typs of control words: //
57 : // - End of module data (needed by the Cluster Finder) //
58 : // first 4 most significant bits = 1111 //
59 : // - Jitter word //
60 : // first 4 most significant bits = 1000 //
61 : // //
62 : // Origin: F.Prino, Torino, prino@to.infn.it //
63 : // //
64 : ///////////////////////////////////////////////////////////////////
65 :
66 : #include"AliLog.h"
67 : #include "AliITSCompressRawDataSDD.h"
68 : #include "AliRawReader.h"
69 : #include "AliRawReaderDate.h"
70 : #include "AliRawReaderRoot.h"
71 : #include "AliITSRawStreamSDD.h"
72 :
73 :
74 118 : ClassImp(AliITSCompressRawDataSDD)
75 :
76 : AliITSCompressRawDataSDD::AliITSCompressRawDataSDD():
77 0 : TObject(),
78 0 : fRawReader(0),
79 0 : fPointerToData(0),
80 0 : fSizeInMemory(0)
81 0 : {
82 : // default constructor
83 0 : }
84 : //______________________________________________________________________
85 0 : AliITSCompressRawDataSDD::~AliITSCompressRawDataSDD(){
86 : // raw reader is passed from outdside, don't delete it
87 0 : }
88 : //______________________________________________________________________
89 : UInt_t AliITSCompressRawDataSDD::CompressEvent(UChar_t* inputPtr){
90 : // Method to be used in HLT
91 : UInt_t siz=0;
92 0 : memcpy(fPointerToData,inputPtr,32); // event header, 8 words
93 0 : fPointerToData+=32;
94 : siz+=32;
95 : UInt_t word=0;
96 0 : AliITSRawStreamSDD s(fRawReader);
97 0 : s.SetDecompressAmbra(kFALSE);
98 : Int_t mask1=0xFF000000;
99 : Int_t mask2=0x00FF0000;
100 : Int_t mask3=0x0000FF00;
101 : Int_t mask4=0x000000FF;
102 0 : while(s.Next()){
103 0 : if(s.IsCompletedModule()==kTRUE){
104 : word=UInt_t(15)<<28;
105 0 : word+=s.GetCarlosId();
106 0 : if(siz+4<fSizeInMemory){
107 0 : *(fPointerToData)=(word&mask4);
108 0 : ++fPointerToData;
109 0 : *(fPointerToData)=(word&mask3)>>8;
110 0 : ++fPointerToData;
111 0 : *(fPointerToData)=(word&mask2)>>16;
112 0 : ++fPointerToData;
113 0 : *(fPointerToData)=(word&mask1)>>24;
114 0 : ++fPointerToData;
115 : siz+=4;
116 0 : }
117 0 : }else if(s.IsCompletedDDL()==kTRUE){
118 : word=UInt_t(8)<<28;
119 0 : word+=s.GetJitter();
120 0 : if(siz+4<fSizeInMemory){
121 0 : *(fPointerToData)=(word&mask4);
122 0 : ++fPointerToData;
123 0 : *(fPointerToData)=(word&mask3)>>8;
124 0 : ++fPointerToData;
125 0 : *(fPointerToData)=(word&mask2)>>16;
126 0 : ++fPointerToData;
127 0 : *(fPointerToData)=(word&mask1)>>24;
128 0 : ++fPointerToData;
129 : siz+=4;
130 0 : }
131 : }else{
132 0 : word=s.GetCarlosId()<<27;
133 0 : word+=s.GetChannel()<<26;
134 0 : word+=s.GetCoord1()<<18;
135 0 : word+=s.GetCoord2()<<10;
136 0 : word+=s.GetEightBitSignal();
137 0 : if(siz+4<fSizeInMemory){
138 0 : *(fPointerToData)=(word&mask4);
139 0 : ++fPointerToData;
140 0 : *(fPointerToData)=(word&mask3)>>8;
141 0 : ++fPointerToData;
142 0 : *(fPointerToData)=(word&mask2)>>16;
143 0 : ++fPointerToData;
144 0 : *(fPointerToData)=(word&mask1)>>24;
145 0 : ++fPointerToData;
146 : siz+=4;
147 0 : }
148 : }
149 : }
150 : return siz;
151 0 : }
|