1 /**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////
20 // Class to decode compressed SDD Raw Data format //
21 // The 32 bits for a data word are defined as follows: //
22 // 31 control bit (0=data word, 1= control word) //
25 // 28 |-> 4 bits to identify the Carlos (0-11) inside the DDL //
27 // 26 detecot side (0= left, =right) //
32 // 21 |-> 8 bits to identify the anode number (0-255) //
40 // 13 |-> 8 bits to identify the time bin (0-255) //
49 // 4 |-> 10 bit for the ADC counts //
55 // Plus 2 types of control words: //
56 // - Jitter word = 1000 //
57 // - End of module data (needed by the Cluster Finder) = 1111 //
59 // Origin: F.Prino, Torino, prino@to.infn.it //
61 ///////////////////////////////////////////////////////////////////
65 #include "AliITSRawStreamSDDCompressed.h"
66 #include "AliRawReader.h"
69 ClassImp(AliITSRawStreamSDDCompressed)
73 //______________________________________________________________________
74 AliITSRawStreamSDDCompressed::AliITSRawStreamSDDCompressed(AliRawReader* rawReader) :
75 AliITSRawStream(rawReader),
83 // create an object to read ITS SDD raw digits
84 for(Int_t im=0;im<kSDDModules;im++){
85 fLowThresholdArray[im][0]=0;
86 fLowThresholdArray[im][1]=0;
89 fRawReader->Select("ITSSDD");
94 //______________________________________________________________________
95 AliITSRawStreamSDDCompressed::AliITSRawStreamSDDCompressed(const AliITSRawStreamSDDCompressed& rs) :
96 AliITSRawStream(rs.fRawReader),
97 fDDLModuleMap(rs.fDDLModuleMap),
105 AliError("Copy constructor should not be used.");
107 //__________________________________________________________________________
108 AliITSRawStreamSDDCompressed& AliITSRawStreamSDDCompressed::operator=(const AliITSRawStreamSDDCompressed& rs) {
109 // assignment operator
111 AliError("Assignment opertator should not be used.");
115 //______________________________________________________________________
116 AliITSRawStreamSDDCompressed::~AliITSRawStreamSDDCompressed(){
117 if(fDDLModuleMap) delete fDDLModuleMap;
121 //______________________________________________________________________
122 Int_t AliITSRawStreamSDDCompressed::DecompAmbra(Int_t value) const
124 // AMBRA decompression (from 8 to 10 bit)
126 if ((value & 0x80) == 0) {
128 } else if ((value & 0x40) == 0) {
129 return 0x081 + ((value & 0x3f) << 1);
130 } else if ((value & 0x20) == 0) {
131 return 0x104 + ((value & 0x1f) << 3);
133 return 0x208 + ((value & 0x1f) << 4);
137 //______________________________________________________________________
138 Bool_t AliITSRawStreamSDDCompressed::Next()
140 // read the next raw digit
141 // returns kFALSE if there is no digit left
142 // returns kTRUE and fCompletedModule=kFALSE and fCompletedDDL=kFALSE when a digit is found
143 // returns kTRUE and fCompletedModule=kTRUE and fCompletedDDL=kFALSE when a module is completed (=3x3FFFFFFF footer words)
144 // returns kTRUE and fCompletedModule=kFALSE and fCompletedDDL=kTRUE when a DDL is completed (=jitter word)
147 UInt_t maskjit=8; // Jitter word has the 4 most significant bits = 1000
148 UInt_t maskeom=15; // end of module has the 4 most significant bits = 1111
149 UInt_t maskmod=15; // last 4 bits for module number in end of module word
150 // UInt_t maskDDL=0xFF; // last 8 bits for DDL number in start of DDL word
152 UInt_t maskCarlos=15<<27; // 4 bits (27-30) for CarlosId in data word
153 UInt_t maskSide=1<<26; // 1 bit (26) for side in data word
154 UInt_t maskAnode=255<<18; // 8 bits (18-25) for Nanode in data word
155 UInt_t maskTb=255<<10; // 8 bits (10-27) for Ntimebin in data word
156 UInt_t maskADC=1023; // 10 bits (0-9) for ADC in data word
159 if (!fRawReader->ReadNextInt(fData)) return kFALSE; // read next word
160 UInt_t mostsigbits=fData>>28;
161 if(mostsigbits==maskeom){
162 fCarlosId=fData&maskmod;
163 fDDL=fRawReader->GetDDLID();
164 fModuleID = GetModuleNumber(fDDL,fCarlosId);
165 fCompletedDDL=kFALSE;
166 fCompletedModule=kTRUE;
168 } else if(mostsigbits==maskjit){
169 fJitter = fData&0x000000ff;
170 fCompletedModule=kFALSE;
174 fCarlosId=(fData&maskCarlos)>>27;
175 fDDL=fRawReader->GetDDLID();
176 fModuleID = GetModuleNumber(fDDL,fCarlosId);
177 fChannel=(fData&maskSide)>>26;
178 fCoord1=(fData&maskAnode)>>18;
179 fCoord2=(fData&maskTb)>>10;
180 Int_t sig8bit=fData&maskADC;
181 sig8bit+=fLowThresholdArray[fModuleID-kSPDModules][fChannel];
182 fSignal=DecompAmbra(sig8bit);
183 fCompletedModule=kFALSE;
184 fCompletedDDL=kFALSE;