]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSRawStreamSPD.cxx
macro moved to oldmacros directory. It has to be updated
[u/mrichter/AliRoot.git] / ITS / 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
16///////////////////////////////////////////////////////////////////////////////
17//
18// This is a class for reading ITS SPD raw data files and providing
19// information about digits
20//
21///////////////////////////////////////////////////////////////////////////////
22
23#include "AliITSRawStreamSPD.h"
24
25ClassImp(AliITSRawStreamSPD)
26
27
7941072e 28AliITSRawStreamSPD::AliITSRawStreamSPD(AliRawReader* rawReader) :
29 AliITSRawStream(rawReader)
c391f9d9 30{
31// create an object to read ITS SPD raw digits
32
7941072e 33 fRawReader->Select(1);
c391f9d9 34}
35
36
37Bool_t AliITSRawStreamSPD::Next()
38{
39// read the next raw digit
40// returns kFALSE if there is no digit left
41
42 fPrevModuleID = fModuleID;
7941072e 43 while (fRawReader->ReadNextShort(fData)) {
c391f9d9 44
45 if ((fData & 0xE000) == 0x6000) { // header
46 fHitCount = 0;
47 UShort_t halfStave = (fData >> 4) & 0x007F;
48 UShort_t chipAddr = fData & 0x000F;
49 fModuleID = 2 * halfStave;
50 if (chipAddr >= 5) fModuleID++;
51 fOffset = 32 * (chipAddr % 5);
52 } else if ((fData & 0xE000) == 0x0000) { // trailer
53 UShort_t hitCount = fData & 0x1FFF;
54 if (hitCount != fHitCount) Error("Next", "wrong number of hits!");
55 } else if ((fData & 0xC000) == 0x8000) { // pixel hit
56 fHitCount++;
57 fCoord1 = (fData & 0x001F) + fOffset;
58 fCoord2 = (fData >> 5) & 0x00FF;
59 return kTRUE;
60 } else { // fill word
61 if (fData != 0xFEDC) Error("Next", "wrong fill word!");
62 }
63
64 }
65
66 return kFALSE;
67}