]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSRawStreamSPD.cxx
Updated flags
[u/mrichter/AliRoot.git] / ITS / AliITSRawStreamSPD.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 SPD digits in raw data.
21///
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliITSRawStreamSPD.h"
25#include "AliRawReader.h"
26
27ClassImp(AliITSRawStreamSPD)
28
29
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
54AliITSRawStreamSPD::AliITSRawStreamSPD(AliRawReader* rawReader) :
55 AliITSRawStream(rawReader),
56 fData(0),
57 fDDLNumber(-1),
58 fEventNumber(-1),
59 fModuleNumber(-1),
60 fOffset(0),
61 fHitCount(0)
62{
63// create an object to read ITS SPD raw digits
64
65 fRawReader->Select(1);
66}
67
68
69Bool_t AliITSRawStreamSPD::Next()
70{
71// read the next raw digit
72// returns kFALSE if there is no digit left
73
74 fPrevModuleID = fModuleID;
75 while (fRawReader->ReadNextShort(fData)) {
76
77 if ((fData & 0xC000) == 0x4000) { // header
78 fHitCount = 0;
79 UShort_t eventNumber = (fData >> 4) & 0x007F;
80 if (fEventNumber < 0) {
81 fEventNumber = eventNumber;
82 } else if (eventNumber != fEventNumber) {
83 Warning("Next", "mismatching event numbers: %d != %d",
84 eventNumber, fEventNumber);
85 }
86 UShort_t chipAddr = fData & 0x000F;
87 if (fRawReader->GetDDLID() != fDDLNumber) {
88 fModuleNumber = -1;
89 fDDLNumber = fRawReader->GetDDLID();
90 }
91 if ((chipAddr == 5) || (chipAddr == 0)) {
92 fModuleNumber++;
93 while (fRawReader->TestBlockAttribute(fModuleNumber/2)) fModuleNumber++;
94 }
95 if (fDDLNumber < kDDLsNumber) {
96 fModuleID = fgkDDLModuleMap[fDDLNumber][fModuleNumber];
97 } else {
98 fModuleID = fModuleNumber;
99 }
100 fOffset = 32 * (chipAddr % 5);
101 } else if ((fData & 0xC000) == 0x0000) { // trailer
102 UShort_t hitCount = fData & 0x1FFF;
103 if (hitCount != fHitCount) Error("Next", "wrong number of hits: %d != %d", fHitCount, hitCount);
104 } else if ((fData & 0xC000) == 0x8000) { // pixel hit
105 fHitCount++;
106 fCoord1 = (fData & 0x001F) + fOffset;
107 fCoord2 = (fData >> 5) & 0x00FF;
108 return kTRUE;
109 } else { // fill word
110 if ((fData & 0xC000) != 0xC000) Error("Next", "wrong fill word!");
111 }
112
113 }
114
115 return kFALSE;
116}