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