]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONRawStreamTracker.cxx
Adding functions for iterating over motif positions
[u/mrichter/AliRoot.git] / MUON / AliMUONRawStreamTracker.cxx
CommitLineData
c0751163 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///
19/// This class provides access to MUON digits in raw data.
20///
21/// It loops over all MUON digits in the raw data given by the AliRawReader.
22/// The Next method goes to the next digit. If there are no digits left
23/// it returns kFALSE (under develpment)
313a427d 24/// It can loop also over DDL and store the decoded rawdata in TClonesArray
25/// in Payload class.
c0751163 26///
27/// First version implement for Tracker
28///
29///////////////////////////////////////////////////////////////////////////////
30
31#include "AliMUONRawStreamTracker.h"
32
33#include "AliRawReader.h"
34#include "AliRawDataHeader.h"
9e378ff4 35#include "AliDAQ.h"
c0751163 36#include "AliLog.h"
37
00e86732 38/// \cond CLASSIMP
c0751163 39ClassImp(AliMUONRawStreamTracker)
00e86732 40/// \endcond
c0751163 41
42AliMUONRawStreamTracker::AliMUONRawStreamTracker()
43 : TObject(),
44 fRawReader(0x0),
45 fDDL(0),
46 fBusPatchId(0),
47 fDspId(0),
48 fBlkId(0),
49 fNextDDL(kTRUE),
9f5dcca3 50 fMaxDDL(20),
51 fPayload(new AliMUONPayloadTracker())
c0751163 52{
00e86732 53 ///
54 /// create an object to read MUON raw digits
55 /// Default ctor for monitoring purposes
56 ///
c0751163 57
313a427d 58
c0751163 59}
60
61//_________________________________________________________________
62AliMUONRawStreamTracker::AliMUONRawStreamTracker(AliRawReader* rawReader)
63 : TObject(),
9f5dcca3 64 fRawReader(rawReader),
c0751163 65 fDDL(0),
66 fBusPatchId(0),
67 fDspId(0),
68 fBlkId(0),
69 fNextDDL(kTRUE),
9f5dcca3 70 fMaxDDL(20),
71 fPayload(new AliMUONPayloadTracker())
72
c0751163 73{
00e86732 74 ///
75 /// ctor with AliRawReader as argument
76 /// for reconstruction purpose
77 ///
c0751163 78
c0751163 79
c0751163 80}
81
c0751163 82//___________________________________
83AliMUONRawStreamTracker::~AliMUONRawStreamTracker()
84{
00e86732 85 ///
86 /// clean up
87 ///
313a427d 88 delete fPayload;
89
c0751163 90}
91
92//_____________________________________________________________
93Bool_t AliMUONRawStreamTracker::Next()
94{
00e86732 95 ///
96 /// read the next raw digit (buspatch structure)
97 /// returns kFALSE if there is no digit left
98 /// (under development)
c0751163 99
313a427d 100// AliMUONDDLTracker* ddlTracker = 0x0;
101// AliMUONBlockHeader* blkHeader = 0x0;
102// AliMUONDspHeader* dspHeader = 0x0;
103// Int_t nBusPatch;
104// Int_t nDsp;
105// Int_t nBlock;
106
107// next:
108// if (fNextDDL){
109// printf("iDDL %d\n", fDDL+1);
110// fBlkId = 0;
111// fDspId = 0;
112// fBusPatchId = 0;
113// if(!NextDDL())
114// return kFALSE;
115// }
116// fNextDDL = kFALSE;
117
118// ddlTracker = GetDDLTracker();
119
120// nBlock = ddlTracker->GetBlkHeaderEntries();
121// if (fBlkId < nBlock) {
122
123// blkHeader = ddlTracker->GetBlkHeaderEntry(fBlkId);
124// nDsp = blkHeader->GetDspHeaderEntries();
125
126// if( fDspId < nDsp) {
127// dspHeader = blkHeader->GetDspHeaderEntry(fDspId);
128// nBusPatch = dspHeader->GetBusPatchEntries();
129
130// if (fBusPatchId < nBusPatch) {
131// fBusStructPtr = dspHeader->GetBusPatchEntry(fBusPatchId++);
132// return kTRUE;
133
134// } else {// iBusPatch
135// fDspId++;
136// fBusPatchId = 0;
137// goto next;
138// // Next();
139// }
140
141// } else {// iDsp
142// fBlkId++;
143// fDspId = 0;
144// fBusPatchId = 0;
145// goto next;
146// // Next();
147// }
148
149// } else {// iBlock
150// fBlkId = 0;
151// fDspId = 0;
152// fBusPatchId = 0;
153// fNextDDL = kTRUE;
154// //return kTRUE;
155// goto next;
156// }
c0751163 157
158 return kFALSE;
159}
160
161//______________________________________________________
162Bool_t AliMUONRawStreamTracker::NextDDL()
163{
00e86732 164 /// reading tracker DDL
c0751163 165
313a427d 166 fPayload->ResetDDL();
c0751163 167
168
c0751163 169 if (fDDL >= 20) {
170 fDDL = 0;
171 return kFALSE;
172 }
173 AliDebug(3, Form("DDL Number %d\n", fDDL ));
174
c0751163 175 fRawReader->Reset();
362c9d61 176 fRawReader->Select("MUONTRK", fDDL, fDDL); //Select the DDL file to be read
c0751163 177
178 fRawReader->ReadHeader();
179
313a427d 180 Int_t totalDataWord = fRawReader->GetDataSize(); // in bytes
c0751163 181
313a427d 182 UInt_t *buffer = new UInt_t[totalDataWord/4];
c0751163 183
313a427d 184 fRawReader->ReadNext((UChar_t*)buffer, totalDataWord);
c0751163 185
84ceeb06 186 fPayload->Decode(buffer, totalDataWord/4);
c0751163 187
313a427d 188 delete[] buffer;
c0751163 189
190 fDDL++;
191
192 return kTRUE;
193}
c0751163 194
195//______________________________________________________
196void AliMUONRawStreamTracker::SetMaxDDL(Int_t ddl)
197{
00e86732 198 /// set DDL number
c0751163 199 if (ddl > 20) ddl = 20;
200 fMaxDDL = ddl;
313a427d 201
c0751163 202}
203
204//______________________________________________________
205void AliMUONRawStreamTracker::SetMaxBlock(Int_t blk)
206{
00e86732 207 /// set regional card number
313a427d 208 fPayload->SetMaxBlock(blk);
c0751163 209}