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