]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONRawStreamTracker.cxx
New class AliMUONTrackExtrap containing static method for tack extrapolation (Philipp...
[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 /// \cond CLASSIMP
41 ClassImp(AliMUONRawStreamTracker)
42 /// \endcond
43
44 AliMUONRawStreamTracker::AliMUONRawStreamTracker()
45   : TObject(),
46     fRawReader(0x0),
47     fDDL(0),
48     fBusPatchId(0),
49     fDspId(0),
50     fBlkId(0),
51     fNextDDL(kTRUE),
52     fMaxDDL(20),
53     fPayload(new AliMUONPayloadTracker())
54 {
55   ///
56   /// create an object to read MUON raw digits
57   /// Default ctor for monitoring purposes
58   ///
59
60
61 }
62
63 //_________________________________________________________________
64 AliMUONRawStreamTracker::AliMUONRawStreamTracker(AliRawReader* rawReader)
65   : TObject(),
66     fRawReader(rawReader),
67     fDDL(0),
68     fBusPatchId(0),
69     fDspId(0),
70     fBlkId(0),
71     fNextDDL(kTRUE),
72     fMaxDDL(20),
73     fPayload(new AliMUONPayloadTracker())
74
75 {
76   ///
77   /// ctor with AliRawReader as argument
78   /// for reconstruction purpose
79   ///
80
81
82 }
83
84 //___________________________________
85 AliMUONRawStreamTracker::~AliMUONRawStreamTracker()
86 {
87   ///
88   /// clean up
89   ///
90   delete fPayload;
91
92 }
93
94 //_____________________________________________________________
95 Bool_t AliMUONRawStreamTracker::Next()
96 {
97   ///
98   /// read the next raw digit (buspatch structure)
99   /// returns kFALSE if there is no digit left
100   /// (under development)
101
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 //      }
159
160      return kFALSE;
161 }
162
163 //______________________________________________________
164 Bool_t AliMUONRawStreamTracker::NextDDL()
165 {
166   /// reading tracker DDL
167
168   fPayload->ResetDDL();
169
170
171   if (fDDL >= 20) {
172     fDDL = 0;
173     return kFALSE;
174   }
175   AliDebug(3, Form("DDL Number %d\n", fDDL ));
176
177   fRawReader->Reset();
178   fRawReader->Select("MUONTRK", fDDL, fDDL);  //Select the DDL file to be read  
179
180   fRawReader->ReadHeader();
181
182   Int_t totalDataWord  = fRawReader->GetDataSize(); // in bytes
183
184   UInt_t *buffer = new UInt_t[totalDataWord/4];
185
186   fRawReader->ReadNext((UChar_t*)buffer, totalDataWord); 
187
188   fPayload->Decode(buffer, totalDataWord/4);
189
190   delete[] buffer;
191
192   fDDL++;
193
194   return kTRUE;
195 }
196
197 //______________________________________________________
198 void AliMUONRawStreamTracker::SetMaxDDL(Int_t ddl) 
199 {
200   /// set DDL number
201   if (ddl > 20) ddl = 20;
202   fMaxDDL = ddl;
203
204 }
205
206 //______________________________________________________
207 void AliMUONRawStreamTracker::SetMaxBlock(Int_t blk) 
208 {
209   /// set regional card number
210   fPayload->SetMaxBlock(blk);
211 }