]>
Commit | Line | Data |
---|---|---|
d6d75a3f | 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 class provides access to CC-USB data in test bench raw data. | |
19 | /// Author: guernane@lpsc.in2p3.fr | |
20 | /// | |
21 | /////////////////////////////////////////////////////////////////////////////// | |
22 | ||
23 | #include "AliEMCALCCUSBRawStream.h" | |
24 | #include "AliRawReader.h" | |
25 | ||
26 | ClassImp(AliEMCALCCUSBRawStream) | |
27 | ||
28 | AliEMCALCCUSBRawStream::AliEMCALCCUSBRawStream(AliRawReader* rawReader) : | |
29 | fRawReader(rawReader), | |
30 | fData(0), | |
31 | fHeader(0), | |
32 | fOptHeader(0), | |
33 | fEventLength(0), | |
34 | fEOBuffer(0) | |
35 | { | |
36 | fRawReader = rawReader; | |
37 | ||
38 | fRawReader->Reset(); | |
39 | fRawReader->SelectEquipment(1, 1, 1); | |
40 | } | |
41 | ||
42 | Bool_t AliEMCALCCUSBRawStream::Next() | |
43 | { | |
44 | // read the next raw digit | |
45 | // returns kFALSE if there is no digit left | |
46 | ||
c37b8947 | 47 | if ( fEOBuffer == 0xFFFF ) { fEOBuffer = 0; return kFALSE; } |
d6d75a3f | 48 | |
49 | if (!fRawReader->ReadNextInt((UInt_t&) fHeader)) { | |
50 | Error("Next", "No header"); | |
51 | return kFALSE; | |
52 | } | |
53 | ||
54 | if (!fRawReader->ReadNextInt((UInt_t&) fOptHeader)) { | |
55 | Error("Next", "No optional header"); | |
56 | return kFALSE; | |
57 | } | |
58 | ||
59 | if (!fRawReader->ReadNextInt((UInt_t&) fEventLength)) { | |
60 | Error("Next", "No event length"); | |
61 | return kFALSE; | |
62 | } | |
63 | ||
64 | for (Int_t i = 0; i < fgkNScalerCCUSB; i++) | |
65 | { | |
66 | if (!fRawReader->ReadNext((UChar_t*)&fData,8)) | |
67 | { | |
68 | Error("Next", "Internal CC-USB scaler issing"); | |
69 | return kFALSE; | |
70 | } | |
71 | ||
72 | fScalerCCUSB[i] = fData; | |
73 | } | |
74 | ||
75 | for (Int_t i = 0; i < fgkNScalerLecroy; i++) | |
76 | { | |
77 | if (!fRawReader->ReadNext((UChar_t*)&fData,8)) | |
78 | { | |
79 | Error("Next", "Lecroy scaler missing"); | |
80 | return kFALSE; | |
81 | } | |
82 | ||
83 | fScalerLecroy[i] = fData; | |
84 | } | |
85 | ||
86 | for (Int_t i = 0; i < fgkNTDC; i++) | |
87 | { | |
88 | if (!fRawReader->ReadNextInt(fData)) | |
89 | { | |
90 | Error("Next", "Incomplete TDC equipment"); | |
91 | return kFALSE; | |
92 | } | |
93 | ||
94 | fTDC[i] = fData; | |
95 | } | |
96 | ||
97 | for (Int_t i = 0; i < fgkNQDC; i++) | |
98 | { | |
99 | if (!fRawReader->ReadNextInt(fData)) | |
100 | { | |
101 | Error("Next", "Incomplete QDC equipment"); | |
102 | return kFALSE; | |
103 | } | |
104 | ||
105 | fQDC[i] = fData; | |
106 | } | |
107 | ||
108 | if ( !fRawReader->ReadNextInt((UInt_t&) fEOBuffer) ) | |
109 | { | |
110 | Error("Next", "No end of buffer"); | |
111 | return kFALSE; | |
112 | } | |
113 | ||
114 | return kTRUE; | |
115 | } | |
116 |