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