]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSRawStreamSPD.cxx
Shortcut methods in AliRunLoader. AliHits2SDigits.C and AliSDigits2Digits.C adapted...
[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
28AliITSRawStreamSPD::AliITSRawStreamSPD() :
29 fRawReader("SPDslice", kTRUE)
30{
31// create an object to read ITS SPD raw digits
32
33}
34
35
36Bool_t AliITSRawStreamSPD::Next()
37{
38// read the next raw digit
39// returns kFALSE if there is no digit left
40
41 fPrevModuleID = fModuleID;
42 while (fRawReader.ReadNextShort(fData)) {
43
44 if ((fData & 0xE000) == 0x6000) { // header
45 fHitCount = 0;
46 UShort_t halfStave = (fData >> 4) & 0x007F;
47 UShort_t chipAddr = fData & 0x000F;
48 fModuleID = 2 * halfStave;
49 if (chipAddr >= 5) fModuleID++;
50 fOffset = 32 * (chipAddr % 5);
51 } else if ((fData & 0xE000) == 0x0000) { // trailer
52 UShort_t hitCount = fData & 0x1FFF;
53 if (hitCount != fHitCount) Error("Next", "wrong number of hits!");
54 } else if ((fData & 0xC000) == 0x8000) { // pixel hit
55 fHitCount++;
56 fCoord1 = (fData & 0x001F) + fOffset;
57 fCoord2 = (fData >> 5) & 0x00FF;
58 return kTRUE;
59 } else { // fill word
60 if (fData != 0xFEDC) Error("Next", "wrong fill word!");
61 }
62
63 }
64
65 return kFALSE;
66}