]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONRawStreamTrigger.cxx
Removed declaration of not used/implemented function FixLeft()
[u/mrichter/AliRoot.git] / MUON / AliMUONRawStreamTrigger.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 TClonesArrays
25 /// in payload class.
26 /// 
27 /// First version implement for Trigger
28 ///
29 ///////////////////////////////////////////////////////////////////////////////
30
31 #include "AliMUONRawStreamTrigger.h"
32
33 #include "AliRawReader.h"
34 #include "AliRawDataHeader.h"
35 #include "AliDAQ.h"
36 #include "AliLog.h"
37
38
39 ClassImp(AliMUONRawStreamTrigger)
40
41 AliMUONRawStreamTrigger::AliMUONRawStreamTrigger()
42   : TObject(),
43     fRawReader(0x0),
44     fDDL(0),
45     fSubEntries(0),
46     fNextDDL(kTRUE),
47     fMaxDDL(2)
48 {
49   //
50   // create an object to read MUON raw digits
51   // Default ctor for monitoring purposes
52   //
53
54   fPayload = new AliMUONPayloadTrigger();
55
56 }
57
58 //_________________________________________________________________
59 AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(AliRawReader* rawReader)
60   : TObject(),
61     fDDL(0),
62     fSubEntries(0),
63     fNextDDL(kTRUE),
64     fMaxDDL(2)
65
66 {
67   //
68   // ctor with AliRawReader as argument
69   // for reconstruction purpose
70   //
71
72   fRawReader = rawReader;
73   fPayload   = new AliMUONPayloadTrigger();
74
75 }
76
77 //_________________________________________________________________
78 AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(const AliMUONRawStreamTrigger& stream) :
79   TObject(stream)
80 {
81   //
82   // copy ctor
83   //
84   AliFatal("copy constructor not implemented");
85 }
86
87 //______________________________________________________________________
88 AliMUONRawStreamTrigger& AliMUONRawStreamTrigger::operator = (const AliMUONRawStreamTrigger& 
89                                               /* stream */)
90
91   // 
92   // assignment operator
93   //
94   AliFatal("assignment operator not implemented");
95   return *this;
96 }
97
98 //___________________________________
99 AliMUONRawStreamTrigger::~AliMUONRawStreamTrigger()
100 {
101   //
102   // clean up
103   //
104   delete fPayload;
105 }
106
107 //_____________________________________________________________
108 Bool_t AliMUONRawStreamTrigger::Next()
109 {
110 // read the next raw digit (buspatch structure)
111 // returns kFALSE if there is no digit left
112
113 //   if (fNextDDL){
114 //     if(!NextDDL()) return kFALSE;
115 //   }
116 //   Int_t nEntries = fDDLTrigger->GetBusPatchEntries();
117
118 //   if (fSubEntries < nEntries) {
119 //     fLocalStruct =  (AliMUONLocalStruct*)fDDLTrigger->GetBusPatchEntry(fSubEntries);
120 //     fSubEntries++;
121 //     fNextDDL = kFALSE;
122 //     return kTRUE;
123 //   } else {
124 //     fDDLTrigger->GetBusPatchArray()->Delete();
125 //     fSubEntries = 0;
126 //     fNextDDL = kTRUE;
127 //     return Next(); 
128 //   }
129
130   return kFALSE;
131 }
132
133 //______________________________________________________
134 Bool_t AliMUONRawStreamTrigger::NextDDL()
135 {
136   // reading tracker DDL
137   // store buspatch info into Array
138   // store only non-empty structures (buspatch info with datalength !=0)
139
140   // reset TClones
141   fPayload->ResetDDL();
142
143
144   // loop over the two ddl's
145   if (fDDL >= fMaxDDL) {
146     fDDL = 0;
147     return kFALSE;
148   }
149
150   fRawReader->Reset();
151   fRawReader->Select("MUONTRG", fDDL, fDDL);  //Select the DDL file to be read  
152
153   fRawReader->ReadHeader();
154
155   Int_t totalDataWord = fRawReader->GetDataSize(); // in bytes
156   UInt_t *buffer = new UInt_t[totalDataWord/4];
157
158   fRawReader->ReadNext((UChar_t*)buffer, totalDataWord); 
159   
160   fPayload->Decode(buffer);
161
162   fDDL++;
163
164   delete [] buffer;
165
166   return kTRUE;
167 }
168
169
170 //______________________________________________________
171 void AliMUONRawStreamTrigger::SetMaxDDL(Int_t ddl) 
172 {
173   // set DDL number
174   if (ddl > 2) ddl = 2;
175   fMaxDDL = ddl;
176 }
177
178 //______________________________________________________
179 void AliMUONRawStreamTrigger::SetMaxReg(Int_t reg) 
180 {
181   // set regional card number
182   fPayload->SetMaxReg(reg);
183 }
184
185 //______________________________________________________
186 void AliMUONRawStreamTrigger::SetMaxLoc(Int_t loc) 
187 {
188   // set local card number
189   fPayload->SetMaxLoc(loc);
190 }