]>
Commit | Line | Data |
---|---|---|
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 | /// \cond CLASSIMP | |
39 | ClassImp(AliMUONRawStreamTrigger) | |
40 | /// \endcond | |
41 | ||
42 | AliMUONRawStreamTrigger::AliMUONRawStreamTrigger() | |
43 | : TObject(), | |
44 | fRawReader(0x0), | |
45 | fPayload(new AliMUONPayloadTrigger()), | |
46 | fDDL(0), | |
47 | fSubEntries(0), | |
48 | fNextDDL(kTRUE), | |
49 | fMaxDDL(2) | |
50 | { | |
51 | /// | |
52 | /// create an object to read MUON raw digits | |
53 | /// Default ctor for monitoring purposes | |
54 | /// | |
55 | ||
56 | ||
57 | } | |
58 | ||
59 | //_________________________________________________________________ | |
60 | AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(AliRawReader* rawReader) | |
61 | : TObject(), | |
62 | fRawReader(rawReader), | |
63 | fPayload(new AliMUONPayloadTrigger()), | |
64 | fDDL(0), | |
65 | fSubEntries(0), | |
66 | fNextDDL(kTRUE), | |
67 | fMaxDDL(2) | |
68 | ||
69 | { | |
70 | /// | |
71 | /// ctor with AliRawReader as argument | |
72 | /// for reconstruction purpose | |
73 | /// | |
74 | ||
75 | } | |
76 | ||
77 | //___________________________________ | |
78 | AliMUONRawStreamTrigger::~AliMUONRawStreamTrigger() | |
79 | { | |
80 | /// | |
81 | /// clean up | |
82 | /// | |
83 | delete fPayload; | |
84 | } | |
85 | ||
86 | //_____________________________________________________________ | |
87 | Bool_t AliMUONRawStreamTrigger::Next() | |
88 | { | |
89 | /// read the next raw digit (buspatch structure) | |
90 | /// returns kFALSE if there is no digit left | |
91 | ||
92 | // if (fNextDDL){ | |
93 | // if(!NextDDL()) return kFALSE; | |
94 | // } | |
95 | // Int_t nEntries = fDDLTrigger->GetBusPatchEntries(); | |
96 | ||
97 | // if (fSubEntries < nEntries) { | |
98 | // fLocalStruct = (AliMUONLocalStruct*)fDDLTrigger->GetBusPatchEntry(fSubEntries); | |
99 | // fSubEntries++; | |
100 | // fNextDDL = kFALSE; | |
101 | // return kTRUE; | |
102 | // } else { | |
103 | // fDDLTrigger->GetBusPatchArray()->Delete(); | |
104 | // fSubEntries = 0; | |
105 | // fNextDDL = kTRUE; | |
106 | // return Next(); | |
107 | // } | |
108 | ||
109 | return kFALSE; | |
110 | } | |
111 | ||
112 | //______________________________________________________ | |
113 | Bool_t AliMUONRawStreamTrigger::NextDDL() | |
114 | { | |
115 | /// reading tracker DDL | |
116 | /// store buspatch info into Array | |
117 | /// store only non-empty structures (buspatch info with datalength !=0) | |
118 | ||
119 | // reset TClones | |
120 | fPayload->ResetDDL(); | |
121 | ||
122 | ||
123 | // loop over the two ddl's | |
124 | if (fDDL >= fMaxDDL) { | |
125 | fDDL = 0; | |
126 | return kFALSE; | |
127 | } | |
128 | ||
129 | fRawReader->Reset(); | |
130 | fRawReader->Select("MUONTRG", fDDL, fDDL); //Select the DDL file to be read | |
131 | ||
132 | fRawReader->ReadHeader(); | |
133 | ||
134 | Int_t totalDataWord = fRawReader->GetDataSize(); // in bytes | |
135 | UInt_t *buffer = new UInt_t[totalDataWord/4]; | |
136 | ||
137 | fRawReader->ReadNext((UChar_t*)buffer, totalDataWord); | |
138 | ||
139 | fPayload->Decode(buffer); | |
140 | ||
141 | fDDL++; | |
142 | ||
143 | delete [] buffer; | |
144 | ||
145 | return kTRUE; | |
146 | } | |
147 | ||
148 | ||
149 | //______________________________________________________ | |
150 | void AliMUONRawStreamTrigger::SetMaxDDL(Int_t ddl) | |
151 | { | |
152 | /// set DDL number | |
153 | if (ddl > 2) ddl = 2; | |
154 | fMaxDDL = ddl; | |
155 | } | |
156 | ||
157 | //______________________________________________________ | |
158 | void AliMUONRawStreamTrigger::SetMaxReg(Int_t reg) | |
159 | { | |
160 | /// set regional card number | |
161 | fPayload->SetMaxReg(reg); | |
162 | } | |
163 | ||
164 | //______________________________________________________ | |
165 | void AliMUONRawStreamTrigger::SetMaxLoc(Int_t loc) | |
166 | { | |
167 | /// set local card number | |
168 | fPayload->SetMaxLoc(loc); | |
169 | } |