1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////////
18 // This is a class for reading ITS SPD raw data files and providing
19 // information about digits
21 ///////////////////////////////////////////////////////////////////////////////
23 #include "AliITSRawStreamSPD.h"
24 #include "AliRawReader.h"
26 ClassImp(AliITSRawStreamSPD)
29 AliITSRawStreamSPD::AliITSRawStreamSPD(AliRawReader* rawReader) :
30 AliITSRawStream(rawReader)
32 // create an object to read ITS SPD raw digits
34 fRawReader->Select(1);
38 Bool_t AliITSRawStreamSPD::Next()
40 // read the next raw digit
41 // returns kFALSE if there is no digit left
43 fPrevModuleID = fModuleID;
44 while (fRawReader->ReadNextShort(fData)) {
46 if ((fData & 0xE000) == 0x6000) { // header
48 UShort_t halfStave = (fData >> 4) & 0x007F;
49 UShort_t chipAddr = fData & 0x000F;
50 fModuleID = 2 * halfStave;
51 if (chipAddr >= 5) fModuleID++;
52 fOffset = 32 * (chipAddr % 5);
53 } else if ((fData & 0xE000) == 0x0000) { // trailer
54 UShort_t hitCount = fData & 0x1FFF;
55 if (hitCount != fHitCount) Error("Next", "wrong number of hits!");
56 } else if ((fData & 0xC000) == 0x8000) { // pixel hit
58 fCoord1 = (fData & 0x001F) + fOffset;
59 fCoord2 = (fData >> 5) & 0x00FF;
62 if (fData != 0xFEDC) Error("Next", "wrong fill word!");