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