new SDD preprocessor + removal of eff C++ warning (base) - E. Crescio
[u/mrichter/AliRoot.git] / ITS / AliITSRawStreamSDD.cxx
CommitLineData
2906f4c2 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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/// This class provides access to ITS SDD digits in raw data.
21///
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliITSRawStreamSDD.h"
25#include "AliRawReader.h"
26
27ClassImp(AliITSRawStreamSDD)
28
2906f4c2 29const Int_t AliITSRawStreamSDD::fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL] = {
30 {240,241,242,246,247,248,252,253,254,258,259,260,264,265,266,270,271,272,276,277,278,-1},
31 {243,244,245,249,250,251,255,256,257,261,262,263,267,268,269,273,274,275,279,280,281,-1},
32 {282,283,284,288,289,290,294,295,296,300,301,302,306,307,308,312,313,314,318,319,320,-1},
33 {285,286,287,291,292,293,297,298,299,303,304,305,309,310,311,315,316,317,321,322,323,-1},
34 {324,325,326,327,332,333,334,335,340,341,342,343,348,349,350,351,356,357,358,359,364,365},
35 {328,329,330,331,336,337,338,339,344,345,346,347,352,353,354,355,360,361,362,363,368,369},
36 {366,367,372,373,374,375,380,381,382,383,388,389,390,391,396,397,398,399,404,405,406,407},
37 {370,371,376,377,378,379,384,385,386,387,392,393,394,395,400,401,402,403,408,409,410,411},
38 {412,413,414,415,420,421,422,423,428,429,430,431,436,437,438,439,444,445,446,447,452,453},
39 {416,417,418,419,424,425,426,427,432,433,434,435,440,441,442,443,448,449,450,451,456,457},
40 {454,455,460,461,462,463,468,469,470,471,476,477,478,479,484,485,486,487,492,493,494,495},
1ba0280f 41 {458,459,464,465,466,467,472,473,474,475,480,481,482,483,488,489,490,491,496,497,498,499}};
42
43const UInt_t AliITSRawStreamSDD::fgkCodeLength[8] = {8, 18, 2, 3, 4, 5, 6, 7};
2906f4c2 44
45AliITSRawStreamSDD::AliITSRawStreamSDD(AliRawReader* rawReader) :
e56160b8 46 AliITSRawStream(rawReader),
47fData(0),
48fSkip(0),
49fEventId(0),
50fCarlosId(0),
51fChannel(0),
52fJitter(0){
2906f4c2 53// create an object to read ITS SDD raw digits
1ba0280f 54
1ba0280f 55 for(Int_t i=0;i<2;i++){
56 fChannelData[i]=0;
57 fLastBit[i]=0;
58 fChannelCode[i]=0;
59 fReadCode[i]=kFALSE;
60 fReadBits[i]=0;
61 fTimeBin[i]=0;
62 fAnode[i]=0;
63 fLowThreshold[i]=0;
64 }
362c9d61 65 fRawReader->Select("ITSSDD");
1ba0280f 66
67}
68
69UInt_t AliITSRawStreamSDD::ReadBits()
70{
71// read bits from the given channel
72
73 UInt_t result = (fChannelData[fChannel] & ((1<<fReadBits[fChannel]) - 1));
74 fChannelData[fChannel] >>= fReadBits[fChannel];
75 fLastBit[fChannel] -= fReadBits[fChannel];
76 return result;
2906f4c2 77}
78
1ba0280f 79Int_t AliITSRawStreamSDD::DecompAmbra(Int_t value) const
80{
81// AMBRA decompression
82
83 if ((value & 0x80) == 0) {
84 return value & 0x7f;
85 } else if ((value & 0x40) == 0) {
86 return 0x081 + ((value & 0x3f) << 1);
87 } else if ((value & 0x20) == 0) {
88 return 0x104 + ((value & 0x1f) << 3);
89 } else {
90 return 0x208 + ((value & 0x1f) << 4);
91 }
92}
2906f4c2 93
94Bool_t AliITSRawStreamSDD::Next()
95{
96// read the next raw digit
97// returns kFALSE if there is no digit left
98
99 fPrevModuleID = fModuleID;
100 if (!fRawReader->ReadNextInt(fData)) return kFALSE;
101
102 UInt_t relModuleID = (fData >> 25) & 0x0000007F;
103 fModuleID = fgkDDLModuleMap[fRawReader->GetDDLID()][relModuleID];
104 fCoord1 = (fData >> 16) & 0x000001FF;
105 fCoord2 = (fData >> 8) & 0x000000FF;
106 fSignal = fData & 0x000000FF;
107
108 return kTRUE;
109}
1ba0280f 110