]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCTPRawStream.cxx
Reverting the changes, additional modifications are needed to make it working
[u/mrichter/AliRoot.git] / STEER / AliCTPRawStream.cxx
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 CTP DDL raw data.
19 ///
20 /// The raw data format is taken form the trigger TDR.
21 /// The meaning of the trigger class and cluster masks
22 /// are given in the trigger description file (in /data)
23 /// and in the AliCentralTrigger class.
24 ///
25 ///////////////////////////////////////////////////////////////////////////////
26
27 #include "AliCTPRawStream.h"
28 #include "AliRawReader.h"
29 #include "AliLog.h"
30 #include "AliDAQ.h"
31
32 ClassImp(AliCTPRawStream)
33
34 //_____________________________________________________________________________
35 AliCTPRawStream::AliCTPRawStream(AliRawReader* rawReader) :
36   fClassMask(0),
37   fClusterMask(0),
38   fRawReader(rawReader)
39 {
40   // create an object to read CTP raw data
41   //
42   // select the raw data corresponding to
43   // the CTP detector id
44   fRawReader->Reset();
45   AliDebug(1,Form("Selecting raw data for detector %d",AliDAQ::DetectorID("TRG")));
46   fRawReader->Select("TRG");
47 }
48
49 //_____________________________________________________________________________
50 AliCTPRawStream::AliCTPRawStream(const AliCTPRawStream& stream) :
51   TObject(stream),
52   fClassMask(0),
53   fClusterMask(0),
54   fRawReader(NULL)
55 {
56   // Copy constructor
57   AliFatal("Copy constructor not implemented");
58 }
59
60 //_____________________________________________________________________________
61 AliCTPRawStream& AliCTPRawStream::operator = (const AliCTPRawStream& 
62                                               /* stream */)
63 {
64   AliFatal("Assignment operator not implemented");
65   return *this;
66 }
67
68 //_____________________________________________________________________________
69 AliCTPRawStream::~AliCTPRawStream()
70 {
71   // destructor
72 }
73
74 //_____________________________________________________________________________
75 void AliCTPRawStream::Reset()
76 {
77   // reset raw stream params
78
79   fClassMask = fClusterMask = 0;
80
81   if (fRawReader) fRawReader->Reset();
82 }
83
84 //_____________________________________________________________________________
85 Bool_t AliCTPRawStream::Next()
86 {
87   // read the whole CTP raw data stream
88   // return kFALSE in case of error
89
90   UChar_t *data = NULL;
91
92   if (!fRawReader->ReadNextData(data)) return kFALSE;
93
94   if (fRawReader->GetDataSize() != 32) {
95     AliError(Form("Wrong CTP raw data size: %d",fRawReader->GetDataSize()));
96     return kFALSE;
97   }
98
99   fClusterMask = data[12] >> 2;
100
101   fClassMask =  ((ULong64_t)data[12] & 0x3) << 48;
102
103   fClassMask |= (ULong64_t)data[16] << 36;
104   fClassMask |= ((ULong64_t)data[17] & 0xF) << 44;
105
106   fClassMask |= (ULong64_t)data[20] << 24;
107   fClassMask |= ((ULong64_t)data[21] & 0xF) << 32;
108
109   fClassMask |= (ULong64_t)data[24] << 12;
110   fClassMask |= ((ULong64_t)data[25] & 0xF) << 20;
111
112   fClassMask |= (ULong64_t)data[28];
113   fClassMask |= ((ULong64_t)data[29] & 0xF) << 8;
114
115   return kTRUE;
116 }
117