]>
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); | |
a51e676d | 40 | |
41 | for(Int_t i = 0 ; i < fgkNTDC; i++ ) fTDC[i] = 0 ; | |
42 | for(Int_t i = 0 ; i < fgkNQDC; i++ ) fQDC[i] = 0 ; | |
43 | for(Int_t i = 0 ; i < fgkNScalerCCUSB; i++ ) fScalerCCUSB[i] = 0; | |
44 | for(Int_t i = 0 ; i < fgkNScalerLecroy; i++ ) fScalerLecroy[i] = 0; | |
d6d75a3f | 45 | } |
46 | ||
47 | Bool_t AliEMCALCCUSBRawStream::Next() | |
48 | { | |
49 | // read the next raw digit | |
50 | // returns kFALSE if there is no digit left | |
51 | ||
c37b8947 | 52 | if ( fEOBuffer == 0xFFFF ) { fEOBuffer = 0; return kFALSE; } |
d6d75a3f | 53 | |
54 | if (!fRawReader->ReadNextInt((UInt_t&) fHeader)) { | |
55 | Error("Next", "No header"); | |
56 | return kFALSE; | |
57 | } | |
58 | ||
59 | if (!fRawReader->ReadNextInt((UInt_t&) fOptHeader)) { | |
60 | Error("Next", "No optional header"); | |
61 | return kFALSE; | |
62 | } | |
63 | ||
64 | if (!fRawReader->ReadNextInt((UInt_t&) fEventLength)) { | |
65 | Error("Next", "No event length"); | |
66 | return kFALSE; | |
67 | } | |
68 | ||
69 | for (Int_t i = 0; i < fgkNScalerCCUSB; i++) | |
70 | { | |
71 | if (!fRawReader->ReadNext((UChar_t*)&fData,8)) | |
72 | { | |
73 | Error("Next", "Internal CC-USB scaler issing"); | |
74 | return kFALSE; | |
75 | } | |
76 | ||
77 | fScalerCCUSB[i] = fData; | |
78 | } | |
79 | ||
80 | for (Int_t i = 0; i < fgkNScalerLecroy; i++) | |
81 | { | |
82 | if (!fRawReader->ReadNext((UChar_t*)&fData,8)) | |
83 | { | |
84 | Error("Next", "Lecroy scaler missing"); | |
85 | return kFALSE; | |
86 | } | |
87 | ||
88 | fScalerLecroy[i] = fData; | |
89 | } | |
90 | ||
91 | for (Int_t i = 0; i < fgkNTDC; i++) | |
92 | { | |
93 | if (!fRawReader->ReadNextInt(fData)) | |
94 | { | |
95 | Error("Next", "Incomplete TDC equipment"); | |
96 | return kFALSE; | |
97 | } | |
98 | ||
99 | fTDC[i] = fData; | |
100 | } | |
101 | ||
102 | for (Int_t i = 0; i < fgkNQDC; i++) | |
103 | { | |
104 | if (!fRawReader->ReadNextInt(fData)) | |
105 | { | |
106 | Error("Next", "Incomplete QDC equipment"); | |
107 | return kFALSE; | |
108 | } | |
109 | ||
110 | fQDC[i] = fData; | |
111 | } | |
112 | ||
113 | if ( !fRawReader->ReadNextInt((UInt_t&) fEOBuffer) ) | |
114 | { | |
115 | Error("Next", "No end of buffer"); | |
116 | return kFALSE; | |
117 | } | |
118 | ||
119 | return kTRUE; | |
120 | } | |
121 |