]>
Commit | Line | Data |
---|---|---|
972432c1 | 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 | ||
c4ee792d | 16 | /* $Id $ */ |
972432c1 | 17 | |
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
c4ee792d | 19 | /// \class AliMUONRawStreamTrigger |
972432c1 | 20 | /// This class provides access to MUON digits in raw data. |
21 | /// | |
22 | /// It loops over all MUON digits in the raw data given by the AliRawReader. | |
23 | /// The Next method goes to the next digit. If there are no digits left | |
24 | /// it returns kFALSE(under develpment). | |
25 | /// It can loop also over DDL and store the decoded rawdata in TClonesArrays | |
313a427d | 26 | /// in payload class. |
972432c1 | 27 | /// |
28 | /// First version implement for Trigger | |
c4ee792d | 29 | /// \author Christian Finck |
3d1463c8 | 30 | //----------------------------------------------------------------------------- |
972432c1 | 31 | |
32 | #include "AliMUONRawStreamTrigger.h" | |
33 | ||
34 | #include "AliRawReader.h" | |
35 | #include "AliRawDataHeader.h" | |
9e378ff4 | 36 | #include "AliDAQ.h" |
972432c1 | 37 | #include "AliLog.h" |
38 | ||
00e86732 | 39 | /// \cond CLASSIMP |
972432c1 | 40 | ClassImp(AliMUONRawStreamTrigger) |
00e86732 | 41 | /// \endcond |
972432c1 | 42 | |
43 | AliMUONRawStreamTrigger::AliMUONRawStreamTrigger() | |
44 | : TObject(), | |
45 | fRawReader(0x0), | |
9f5dcca3 | 46 | fPayload(new AliMUONPayloadTrigger()), |
972432c1 | 47 | fDDL(0), |
48 | fSubEntries(0), | |
49 | fNextDDL(kTRUE), | |
3c7f5307 | 50 | fMaxDDL(2), |
51 | fEnableErrorLogger(kFALSE) | |
972432c1 | 52 | { |
00e86732 | 53 | /// |
54 | /// create an object to read MUON raw digits | |
55 | /// Default ctor for monitoring purposes | |
56 | /// | |
972432c1 | 57 | |
972432c1 | 58 | |
59 | } | |
60 | ||
61 | //_________________________________________________________________ | |
62 | AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(AliRawReader* rawReader) | |
63 | : TObject(), | |
9f5dcca3 | 64 | fRawReader(rawReader), |
65 | fPayload(new AliMUONPayloadTrigger()), | |
972432c1 | 66 | fDDL(0), |
67 | fSubEntries(0), | |
68 | fNextDDL(kTRUE), | |
3c7f5307 | 69 | fMaxDDL(2), |
70 | fEnableErrorLogger(kFALSE) | |
972432c1 | 71 | { |
00e86732 | 72 | /// |
73 | /// ctor with AliRawReader as argument | |
74 | /// for reconstruction purpose | |
75 | /// | |
972432c1 | 76 | |
972432c1 | 77 | } |
78 | ||
79 | //___________________________________ | |
80 | AliMUONRawStreamTrigger::~AliMUONRawStreamTrigger() | |
81 | { | |
00e86732 | 82 | /// |
83 | /// clean up | |
84 | /// | |
313a427d | 85 | delete fPayload; |
972432c1 | 86 | } |
87 | ||
88 | //_____________________________________________________________ | |
89 | Bool_t AliMUONRawStreamTrigger::Next() | |
90 | { | |
00e86732 | 91 | /// read the next raw digit (buspatch structure) |
92 | /// returns kFALSE if there is no digit left | |
972432c1 | 93 | |
94 | // if (fNextDDL){ | |
95 | // if(!NextDDL()) return kFALSE; | |
96 | // } | |
97 | // Int_t nEntries = fDDLTrigger->GetBusPatchEntries(); | |
98 | ||
99 | // if (fSubEntries < nEntries) { | |
100 | // fLocalStruct = (AliMUONLocalStruct*)fDDLTrigger->GetBusPatchEntry(fSubEntries); | |
101 | // fSubEntries++; | |
102 | // fNextDDL = kFALSE; | |
103 | // return kTRUE; | |
104 | // } else { | |
105 | // fDDLTrigger->GetBusPatchArray()->Delete(); | |
106 | // fSubEntries = 0; | |
107 | // fNextDDL = kTRUE; | |
108 | // return Next(); | |
109 | // } | |
110 | ||
111 | return kFALSE; | |
112 | } | |
113 | ||
114 | //______________________________________________________ | |
115 | Bool_t AliMUONRawStreamTrigger::NextDDL() | |
116 | { | |
00e86732 | 117 | /// reading tracker DDL |
118 | /// store buspatch info into Array | |
119 | /// store only non-empty structures (buspatch info with datalength !=0) | |
972432c1 | 120 | |
972432c1 | 121 | // reset TClones |
313a427d | 122 | fPayload->ResetDDL(); |
123 | ||
972432c1 | 124 | |
125 | // loop over the two ddl's | |
126 | if (fDDL >= fMaxDDL) { | |
127 | fDDL = 0; | |
128 | return kFALSE; | |
129 | } | |
9e378ff4 | 130 | |
972432c1 | 131 | fRawReader->Reset(); |
362c9d61 | 132 | fRawReader->Select("MUONTRG", fDDL, fDDL); //Select the DDL file to be read |
972432c1 | 133 | |
d6ac560d | 134 | if (!fRawReader->ReadHeader()) return kFALSE; |
972432c1 | 135 | |
136 | Int_t totalDataWord = fRawReader->GetDataSize(); // in bytes | |
137 | UInt_t *buffer = new UInt_t[totalDataWord/4]; | |
138 | ||
d6ac560d | 139 | // check not necessary yet, but for future developments |
140 | if (!fRawReader->ReadNext((UChar_t*)buffer, totalDataWord)) return kFALSE; | |
972432c1 | 141 | |
313a427d | 142 | fPayload->Decode(buffer); |
3c7f5307 | 143 | if (fEnableErrorLogger) AddErrorMessage(); |
972432c1 | 144 | |
313a427d | 145 | fDDL++; |
972432c1 | 146 | |
972432c1 | 147 | delete [] buffer; |
148 | ||
ea59383d | 149 | |
972432c1 | 150 | return kTRUE; |
151 | } | |
152 | ||
972432c1 | 153 | |
154 | //______________________________________________________ | |
155 | void AliMUONRawStreamTrigger::SetMaxDDL(Int_t ddl) | |
156 | { | |
00e86732 | 157 | /// set DDL number |
972432c1 | 158 | if (ddl > 2) ddl = 2; |
159 | fMaxDDL = ddl; | |
160 | } | |
161 | ||
162 | //______________________________________________________ | |
163 | void AliMUONRawStreamTrigger::SetMaxReg(Int_t reg) | |
164 | { | |
00e86732 | 165 | /// set regional card number |
313a427d | 166 | fPayload->SetMaxReg(reg); |
972432c1 | 167 | } |
168 | ||
169 | //______________________________________________________ | |
170 | void AliMUONRawStreamTrigger::SetMaxLoc(Int_t loc) | |
171 | { | |
00e86732 | 172 | /// set local card number |
313a427d | 173 | fPayload->SetMaxLoc(loc); |
972432c1 | 174 | } |
ea59383d | 175 | |
176 | //______________________________________________________ | |
177 | void AliMUONRawStreamTrigger::AddErrorMessage() | |
178 | { | |
179 | /// add message into logger of AliRawReader per event | |
180 | ||
181 | for (Int_t i = 0; i < fPayload->GetDarcEoWErrors(); ++i) | |
182 | fRawReader->AddMajorErrorLog(kDarcEoWErr, "Wrong end of Darc word structure"); | |
183 | ||
184 | for (Int_t i = 0; i < fPayload->GetGlobalEoWErrors(); ++i) | |
185 | fRawReader->AddMajorErrorLog(kGlobalEoWErr, "Wrong end of Global word structure"); | |
186 | ||
187 | for (Int_t i = 0; i < fPayload->GetRegEoWErrors(); ++i) | |
188 | fRawReader->AddMajorErrorLog(kRegEoWErr, "Wrong end of Regional word structure"); | |
189 | ||
190 | for (Int_t i = 0; i < fPayload->GetLocalEoWErrors(); ++i) | |
191 | fRawReader->AddMajorErrorLog(kLocalEoWErr, "Wrong end of Local word structure"); | |
192 | ||
193 | } |