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 EMCALSTU DDL raw data.
20 ///////////////////////////////////////////////////////////////////////////////
22 #include "AliEMCALSTURawStream.h"
23 #include "AliRawReader.h"
26 ClassImp(AliEMCALSTURawStream)
28 //_____________________________________________________________________________
29 AliEMCALSTURawStream::AliEMCALSTURawStream(AliRawReader* rawReader) :
30 fRawReader(rawReader),
34 memset(fJetPatchWords, 0, sizeof(fJetPatchWords));
40 // select the raw data corresponding to
41 // the EMCALSTU detector id
42 fRawReader->Select("EMCAL", kEMCALSTUDDL);
45 //_____________________________________________________________________________
46 AliEMCALSTURawStream::AliEMCALSTURawStream(const AliEMCALSTURawStream& stream) :
52 AliFatal("Copy constructor not implemented");
55 //_____________________________________________________________________________
56 AliEMCALSTURawStream& AliEMCALSTURawStream::operator = (const AliEMCALSTURawStream& source
59 // assignment operator; use copy ctor
60 if (&source == this) return *this;
62 new (this) AliEMCALSTURawStream(source);
66 //_____________________________________________________________________________
67 AliEMCALSTURawStream::~AliEMCALSTURawStream()
72 //_____________________________________________________________________________
73 void AliEMCALSTURawStream::Reset()
75 // reset raw stream params
76 if (fRawReader) fRawReader->Reset();
79 //_____________________________________________________________________________
80 Bool_t AliEMCALSTURawStream::Next()
82 // read the whole EMCALSTU raw data stream
83 // return kFALSE in case of error
87 // EMCALSTU raw data should contain CDH so we don't need any mods a la
88 // fRawReader->RequireHeader(kTRUE);
90 // let's pick up the data block, if we can
91 if (!fRawReader->ReadNextData(data)) {
95 // check that the amount of data we picked up is what we expected
96 // 20080721 (DS): the rest of this method needs to be verified as the exact data format
98 int nwordsExtra = fRawReader->GetDataSize() - (kNumJetPatchWords + kNumGammaJetPatchWords);
99 if ( nwordsExtra < 0 ) {
100 AliError(Form("Wrong EMCALSTU raw data size: %d", fRawReader->GetDataSize()));
104 // unpack the data into our local arrays
108 for (iword = 0; iword<kNumJetPatchWords; iword++) {
109 fJetPatchWords[iword] = (data[iword] & 0xffffffff);
112 ioffset += kNumJetPatchWords;
113 for (iword = 0; iword<kNumGammaJetPatchWords; iword++) {
114 fGammaJetPatchWords[iword] = (data[iword+ioffset] & 0xffffffff);
117 // also 2x2sum's, if there appears to be enough/more data..
119 if ( nwordsExtra > kNum2x2Words ) {
120 ioffset += kNumGammaJetPatchWords;
121 for (iword = 0; iword<kNum2x2Words; iword++) {
122 f2x2Words[iword] = (data[iword+ioffset] & 0xffffffff);
124 fNum2x2Words = kNum2x2Words;