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