]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliITSRawStreamSPD.cxx
bugfix
[u/mrichter/AliRoot.git] / RAW / AliITSRawStreamSPD.cxx
CommitLineData
c391f9d9 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
bea6b2a4 16/* $Id$ */
17
c391f9d9 18///////////////////////////////////////////////////////////////////////////////
bea6b2a4 19///
20/// This class provides access to ITS SPD digits in raw data.
21///
c391f9d9 22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliITSRawStreamSPD.h"
42d20574 25#include "AliRawReader.h"
c391f9d9 26
27ClassImp(AliITSRawStreamSPD)
28
29
a864f8e9 30const Int_t AliITSRawStreamSPD::fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL] = {
31 { 0, 1, 4, 5, 80, 81, 84, 85, 88, 89, 92, 93},
32 { 2, 3, 6, 7, 82, 83, 86, 87, 90, 91, 94, 95},
33 { 8, 9,12,13, 96, 97,100,101,104,105,108,109},
34 {10,11,14,15, 98, 99,102,103,106,107,110,111},
35 {16,17,20,21,112,113,116,117,120,121,124,125},
36 {18,19,22,23,114,115,118,119,122,123,126,127},
37 {24,25,28,29,128,129,132,133,136,137,140,141},
38 {26,27,30,31,130,131,134,135,138,139,142,143},
39 {32,33,36,37,144,145,148,149,152,153,156,157},
40 {34,35,38,39,146,147,150,151,154,155,158,159},
41 {40,41,44,45,160,161,164,165,168,169,172,173},
42 {42,43,46,47,162,163,166,167,170,171,174,175},
43 {48,49,52,53,176,177,180,181,184,185,188,189},
44 {50,51,54,55,178,179,182,183,186,187,190,191},
45 {56,57,60,61,192,193,196,197,200,201,204,205},
46 {58,59,62,63,194,195,198,199,202,203,206,207},
47 {64,65,68,69,208,209,212,213,216,217,220,221},
48 {66,67,70,71,210,211,214,215,218,219,222,223},
49 {72,73,76,77,224,225,228,229,232,233,236,237},
50 {74,75,78,79,226,227,230,231,234,235,238,239}
51};
52
53
7941072e 54AliITSRawStreamSPD::AliITSRawStreamSPD(AliRawReader* rawReader) :
55 AliITSRawStream(rawReader)
c391f9d9 56{
57// create an object to read ITS SPD raw digits
58
7941072e 59 fRawReader->Select(1);
c391f9d9 60}
61
62
63Bool_t AliITSRawStreamSPD::Next()
64{
65// read the next raw digit
66// returns kFALSE if there is no digit left
67
68 fPrevModuleID = fModuleID;
7941072e 69 while (fRawReader->ReadNextShort(fData)) {
c391f9d9 70
71 if ((fData & 0xE000) == 0x6000) { // header
72 fHitCount = 0;
73 UShort_t halfStave = (fData >> 4) & 0x007F;
74 UShort_t chipAddr = fData & 0x000F;
75 fModuleID = 2 * halfStave;
76 if (chipAddr >= 5) fModuleID++;
77 fOffset = 32 * (chipAddr % 5);
78 } else if ((fData & 0xE000) == 0x0000) { // trailer
79 UShort_t hitCount = fData & 0x1FFF;
80 if (hitCount != fHitCount) Error("Next", "wrong number of hits!");
81 } else if ((fData & 0xC000) == 0x8000) { // pixel hit
82 fHitCount++;
83 fCoord1 = (fData & 0x001F) + fOffset;
84 fCoord2 = (fData >> 5) & 0x00FF;
85 return kTRUE;
86 } else { // fill word
87 if (fData != 0xFEDC) Error("Next", "wrong fill word!");
88 }
89
90 }
91
92 return kFALSE;
93}