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 class provides access to CC-USB data in test bench raw data.
19 /// Author: guernane@lpsc.in2p3.fr
21 ///////////////////////////////////////////////////////////////////////////////
23 #include "AliEMCALCCUSBRawStream.h"
24 #include "AliRawReader.h"
26 ClassImp(AliEMCALCCUSBRawStream)
28 AliEMCALCCUSBRawStream::AliEMCALCCUSBRawStream(AliRawReader* rawReader) :
29 fRawReader(rawReader),
36 fRawReader = rawReader;
39 fRawReader->SelectEquipment(1, 1, 1);
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;
47 Bool_t AliEMCALCCUSBRawStream::Next()
49 // read the next raw digit
50 // returns kFALSE if there is no digit left
52 if ( fEOBuffer == 0xFFFF ) { fEOBuffer = 0; return kFALSE; }
54 if (!fRawReader->ReadNextInt((UInt_t&) fHeader)) {
55 Error("Next", "No header");
59 if (!fRawReader->ReadNextInt((UInt_t&) fOptHeader)) {
60 Error("Next", "No optional header");
64 if (!fRawReader->ReadNextInt((UInt_t&) fEventLength)) {
65 Error("Next", "No event length");
69 for (Int_t i = 0; i < fgkNScalerCCUSB; i++)
71 if (!fRawReader->ReadNext((UChar_t*)&fData,8))
73 Error("Next", "Internal CC-USB scaler issing");
77 fScalerCCUSB[i] = fData;
80 for (Int_t i = 0; i < fgkNScalerLecroy; i++)
82 if (!fRawReader->ReadNext((UChar_t*)&fData,8))
84 Error("Next", "Lecroy scaler missing");
88 fScalerLecroy[i] = fData;
91 for (Int_t i = 0; i < fgkNTDC; i++)
93 if (!fRawReader->ReadNextInt(fData))
95 Error("Next", "Incomplete TDC equipment");
102 for (Int_t i = 0; i < fgkNQDC; i++)
104 if (!fRawReader->ReadNextInt(fData))
106 Error("Next", "Incomplete QDC equipment");
113 if ( !fRawReader->ReadNextInt((UInt_t&) fEOBuffer) )
115 Error("Next", "No end of buffer");