]>
Commit | Line | Data |
---|---|---|
0508ca31 | 1 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
2 | * See cxx source for full Copyright notice */ | |
3 | ||
4 | //----------------------------------- | |
5 | // | |
5f006bd7 | 6 | // decoding of TRD raw data stream |
0508ca31 | 7 | // and translation into digits |
8 | // | |
9 | //---------------------------------- | |
10 | ||
d60fe037 | 11 | #ifndef ALITRDRAWSTREAM_H |
12 | #define ALITRDRAWSTREAM_H | |
13 | ||
f4b3235e | 14 | #include "TTree.h" |
9cb9c409 | 15 | #include "AliLog.h" |
6419bebb | 16 | #include "TClonesArray.h" |
9cb9c409 | 17 | |
6419bebb | 18 | class TObject; |
d60fe037 | 19 | class TObjArray; |
20 | class TString; | |
cc26f39c | 21 | class TBranch; |
d60fe037 | 22 | |
23 | class AliRawReader; | |
24 | class AliTRDdigitsManager; | |
25 | class AliTRDdigitsParam; | |
26 | class AliTRDarrayADC; | |
27 | class AliTRDSignalIndex; | |
cc26f39c | 28 | class AliTRDtrackletContainer; |
03e2f460 | 29 | class AliESDTrdTrack; |
d60fe037 | 30 | |
8df1f8f5 | 31 | class AliTRDrawStream : public TObject |
d60fe037 | 32 | { |
33 | public: | |
34 | AliTRDrawStream(AliRawReader *rawReader = 0x0); | |
35 | ~AliTRDrawStream(); | |
36 | ||
9cb9c409 | 37 | enum { kDDLOffset = 0x400, // Offset for DDL numbers |
38 | kDDLMax = 0x411 }; // Max DDL number for TRD SM | |
84f471a7 | 39 | |
d60fe037 | 40 | Bool_t SetReader(AliRawReader *rawReader) { fRawReader = rawReader; return kTRUE; } |
41 | void SetDigitsManager(AliTRDdigitsManager *digMgr) { fDigitsManager = digMgr; } | |
5fdfc9e4 | 42 | void SetTrackletArray(TClonesArray *ar) { fTracklets = ar; } |
43 | void SetTrackArray(TClonesArray *ar) { fTracks = ar; } | |
44 | void SetMarkerArray(TClonesArray *ar) { fMarkers = ar; } | |
45 | ||
46 | TClonesArray* GetTrackletArray() const { return fTracklets; } | |
47 | TClonesArray* GetTrackArray() const { return fTracks; } | |
48 | TClonesArray* GetMarkerArray() const { return fMarkers; } | |
d60fe037 | 49 | |
f4b3235e | 50 | AliTRDdigitsManager* GetDigitsManager() const { return fDigitsManager; } |
51 | TTree *GetTrackletTree() const { return fTrackletTree; } | |
52 | ||
d60fe037 | 53 | Bool_t ReadEvent(TTree *trackletTree = 0x0); |
54 | ||
55 | Bool_t NextDDL(); | |
5f006bd7 | 56 | Int_t NextChamber(AliTRDdigitsManager *digMgr); |
9cb9c409 | 57 | Int_t NextChamber(AliTRDdigitsManager *digMgr, |
2519cca4 | 58 | UInt_t ** /* trackletContainer */, UShort_t ** /* errorContainer */) { AliError("Deprecated, use NextChamber(AliTRDdigitsManger*) instead!"); return NextChamber(digMgr); } |
d60fe037 | 59 | |
67271412 | 60 | Bool_t ConnectTracklets(TTree *trklTree); |
61 | ||
5fdfc9e4 | 62 | void StoreErrorsInTree() { fStoreError = &AliTRDrawStream::StoreErrorTree; } |
63 | void StoreErrorsInArray() { fStoreError = &AliTRDrawStream::StoreErrorArray; } | |
f4b3235e | 64 | void EnableErrorStorage() { fStoreError = &AliTRDrawStream::StoreErrorTree; } |
65 | void DisableErrorStorage() { fStoreError = &AliTRDrawStream::ForgetError; } | |
66 | ||
d60fe037 | 67 | // error handling |
5f006bd7 | 68 | enum ErrorCode_t { |
69 | kUnknown = 0, | |
70 | kLinkMonitor, | |
52a2b6c0 | 71 | kEvCntMismatch, |
d60fe037 | 72 | kNonTrdEq, |
73 | kStackHeaderInvalid, | |
74 | kInvalidDetector, | |
789a8b20 | 75 | kInvalidPadRow, |
d60fe037 | 76 | kNoDigits, |
77 | kHCmismatch, | |
78 | kHCcheckFailed, | |
79 | kPosUnexp, | |
80 | kTPmodeInvalid, | |
81 | kTPmismatch, | |
82 | kNtimebinsChanged, | |
83 | kAdcMaskInconsistent, | |
84 | kAdcCheckInvalid, | |
85 | kAdcDataAbort, | |
86 | kAdcChannelsMiss, | |
87 | kMissMcmHeaders, | |
2519cca4 | 88 | kMissTpData, |
52a2b6c0 | 89 | kCRCmismatch, |
d60fe037 | 90 | kLastErrorCode |
5f006bd7 | 91 | }; |
d60fe037 | 92 | |
cc26f39c | 93 | enum ErrorBehav_t { |
92223bf6 | 94 | kTolerate = 0, |
5fedeee9 | 95 | kDiscardMCM = 1, |
96 | kDiscardHC = 2, | |
97 | kDiscardDDL = 4, | |
98 | kAbort = 8 | |
cc26f39c | 99 | }; |
100 | ||
5fdfc9e4 | 101 | enum MarkerCode_t { |
8df9496c | 102 | kHCactive = 1, |
103 | kSecactive = 2 | |
5fdfc9e4 | 104 | }; |
105 | ||
0508ca31 | 106 | TTree* GetErrorTree() const { return fErrors; } |
d60fe037 | 107 | static const char* GetErrorMessage(ErrorCode_t errCode); |
9cb9c409 | 108 | static void SetErrorDebugLevel(ErrorCode_t error, Int_t level) { fgErrorDebugLevel[error] = level; } |
109 | static void SetErrorBehaviour(ErrorCode_t error, ErrorBehav_t behav) { fgErrorBehav[error] = behav; } | |
d60fe037 | 110 | |
8df9496c | 111 | class AliTRDrawStreamError : public TObject { |
112 | public: | |
5f006bd7 | 113 | AliTRDrawStreamError(Int_t error = 0, Int_t sector = -1, Int_t stack = -1, Int_t link = -1, Int_t rob = -1, Int_t mcm = -1); |
8df9496c | 114 | virtual ~AliTRDrawStreamError() {} |
115 | Int_t fError; // error code | |
116 | Int_t fSector; // sector | |
117 | Int_t fStack; // stack | |
118 | Int_t fLink; // link | |
119 | Int_t fRob; // ROB no | |
120 | Int_t fMcm; // MCM no | |
121 | ClassDef(AliTRDrawStreamError, 1); | |
122 | }; | |
123 | ||
cc26f39c | 124 | // event statistics |
125 | class AliTRDrawStats : public TObject { | |
126 | public: | |
127 | AliTRDrawStats() : TObject(), fBytesRead(0) {} | |
128 | void ClearStats(); | |
129 | ||
130 | class AliTRDrawStatsSector : public TObject { | |
131 | public: | |
132 | AliTRDrawStatsSector() : TObject(), fBytes(0), fBytesRead(0), fNTracklets(0), fNMCMs(0), fNChannels(0) {} | |
133 | void ClearStats(); | |
134 | ||
135 | class AliTRDrawStatsHC : public TObject { | |
136 | public: | |
137 | AliTRDrawStatsHC() : TObject(), fBytes(0), fBytesRead(0), fNTracklets(0), fNMCMs(0), fNChannels(0) {} | |
138 | void ClearStats(); | |
139 | ||
140 | Int_t fBytes; // number of bytes (not necessarily read) | |
141 | Int_t fBytesRead; // number of bytes read | |
142 | Int_t fNTracklets; // number of tracklets | |
143 | Int_t fNMCMs; // number of MCMs (from MCM headers) | |
144 | Int_t fNChannels; // number of channels | |
145 | ClassDef(AliTRDrawStatsHC, 1); | |
146 | }; | |
147 | ||
148 | Int_t fBytes; // number of bytes (not necessarily read) | |
149 | Int_t fBytesRead; // number of bytes read | |
150 | Int_t fNTracklets; // number of tracklets | |
151 | Int_t fNMCMs; // number of MCMs (from MCM headers) | |
152 | Int_t fNChannels; // number of channels | |
153 | AliTRDrawStatsHC fStatsHC[60]; //[60] HC-wise statistics | |
154 | ClassDef(AliTRDrawStatsSector, 1); | |
155 | }; | |
156 | ||
cc26f39c | 157 | AliTRDrawStatsSector fStatsSector[18]; //[18] sector-wise statistics |
158 | Int_t fBytesRead; // number of bytes read | |
159 | ClassDef(AliTRDrawStats, 1); | |
160 | }; | |
161 | ||
cc26f39c | 162 | AliTRDrawStats* GetStats() { return &fStats; } |
92305359 | 163 | Int_t GetEventSize(Int_t sector) const { return fStats.fStatsSector[sector].fBytes; } |
5fedeee9 | 164 | Int_t GetEventSize(Int_t sector, Int_t stack) const { |
165 | Int_t size = 0; | |
166 | for (Int_t iHC = 0; iHC < 12; iHC++) { | |
167 | size += fStats.fStatsSector[sector].fStatsHC[12*stack + iHC].fBytes; | |
168 | } | |
169 | return size; | |
170 | } | |
92305359 | 171 | Int_t GetNTracklets(Int_t sector) const { return fStats.fStatsSector[sector].fNTracklets; } |
172 | Int_t GetNMCMs(Int_t sector) const { return fStats.fStatsSector[sector].fNMCMs; } | |
173 | Int_t GetNChannels(Int_t sector) const { return fStats.fStatsSector[sector].fNChannels; } | |
cc26f39c | 174 | |
03e2f460 | 175 | ULong64_t GetTrkFlags(Int_t sector, Int_t stack) const { return (fCurrTrgFlags[sector] & (1 << (27 + stack))) ? fCurrTrkFlags[sector*fgkNstacks + stack] : 0; } |
2519cca4 | 176 | UInt_t GetTriggerFlags(Int_t sector) const { return fCurrTrgFlags[sector]; } |
177 | ||
cc26f39c | 178 | // raw data dumping |
179 | void SetDumpMCM(Int_t det, Int_t rob, Int_t mcm, Bool_t dump = kTRUE); | |
180 | ||
92305359 | 181 | Bool_t IsDumping() const { return (fNDumpMCMs > 0); } |
182 | Bool_t DumpingMCM(Int_t det, Int_t rob, Int_t mcm) const; | |
cc26f39c | 183 | |
6419bebb | 184 | TString DumpRaw(TString title, const UInt_t *start, Int_t length, UInt_t endmarker = 0xffffffff); |
9cb9c409 | 185 | TString DumpMcmHeader(TString title, UInt_t word); |
186 | TString DumpAdcMask(TString title, UInt_t word); | |
187 | ||
52a2b6c0 | 188 | static void SortTracklets(TClonesArray *trklArray, TList &sortedTracklets, Int_t *indices); |
03e2f460 | 189 | static void AssignTracklets(AliESDTrdTrack *trdTrack, Int_t *trackletIndex, Int_t refIndex[6]); |
52a2b6c0 | 190 | |
9cb9c409 | 191 | // temporary: allow to change expected readout order |
192 | static void SetMCMReadoutPos(Int_t mcm, Int_t pos) { if (mcm > -1 && mcm < 16) fgMcmOrder[mcm] = pos; } | |
193 | static void SetROBReadoutPos(Int_t robpair, Int_t pos) { if (robpair > -1 && robpair < 4) fgMcmOrder[robpair] = pos; } | |
cc26f39c | 194 | |
d60fe037 | 195 | protected: |
9cb9c409 | 196 | Int_t ReadGTUHeaders(UInt_t *buffer); |
d60fe037 | 197 | Int_t ReadSmHeader(); |
9cb9c409 | 198 | Int_t ReadTrackingHeader(Int_t stack); |
199 | Int_t ReadTriggerHeaders(); | |
200 | Int_t ReadStackHeader(Int_t stack); | |
201 | Int_t DecodeGTUtracks(); | |
202 | Int_t ReadGTUTrailer(); | |
d60fe037 | 203 | |
204 | Int_t ReadLinkData(); | |
205 | Int_t ReadTracklets(); | |
206 | Int_t ReadHcHeader(); | |
207 | Int_t ReadTPData(Int_t mode = 1); | |
208 | Int_t ReadZSData(); | |
209 | Int_t ReadNonZSData(); | |
210 | ||
52a2b6c0 | 211 | Int_t SeekNextStack(); |
92223bf6 | 212 | Int_t SeekNextLink(); |
213 | ||
d60fe037 | 214 | // MCM header decoding |
0508ca31 | 215 | Int_t ROB(UInt_t mcmhdr) const { return 0x7 & mcmhdr >> 28; } |
216 | Int_t MCM(UInt_t mcmhdr) const { return 0xf & mcmhdr >> 24; } | |
217 | Int_t Row(UInt_t mcmhdr) const { return (ROB(mcmhdr) / 2) * 4 + MCM(mcmhdr) / 4; } | |
218 | Int_t AdcColOffset(UInt_t mcmhdr) const { return (MCM(mcmhdr) % 4 + 1) * 21 + (ROB(mcmhdr) % 2) * 84 - 1; } | |
219 | Int_t PadColOffset(UInt_t mcmhdr) const { return (MCM(mcmhdr) % 4 + 1) * 18 + (ROB(mcmhdr) % 2) * 72 + 1; } | |
220 | Int_t EvNo(UInt_t mcmhdr) const { return 0xfffff & mcmhdr >> 4; } | |
221 | Int_t Check(UInt_t mcmhdr) const { return 0xf & mcmhdr; } | |
222 | Int_t CouldBeMCMhdr(UInt_t mcmhdr) const { return ((0xf & mcmhdr) == 0xc); } | |
223 | ||
9cb9c409 | 224 | Int_t GetMCMReadoutPos(Int_t mcm) const { return (mcm > -1 && mcm < 16) ? fgMcmOrder[mcm] : -1; } |
225 | Int_t GetROBReadoutPos(Int_t rob) const { return (rob > -1 && rob < 4) ? fgRobOrder[rob] : -1; } | |
d60fe037 | 226 | |
227 | // ADC mask decoding | |
0508ca31 | 228 | Int_t GetActiveChannels(UInt_t adcmask) const { return 0x1fffff & adcmask >> 4; } |
82029d44 | 229 | inline Int_t GetNActiveChannelsFromMask(UInt_t adcmask) const; // { Int_t nch = 0; for (Int_t i = 0; i < 21; i++) if ((GetActiveChannels(adcmask) & 1 << i)) nch++; return nch; } |
0508ca31 | 230 | Int_t GetNActiveChannels(UInt_t adcmask) const { return (0x1f & ~(adcmask >> 25)); } |
231 | Int_t CouldBeADCmask(UInt_t adcmask) const { return ((0xf & adcmask) == 0xc && (0x3 & adcmask >> 30) == 0x1); } | |
5f006bd7 | 232 | |
d60fe037 | 233 | // error message generation |
1dd71b58 | 234 | void EquipmentError(ErrorCode_t err = kUnknown, const char *const msg = " ", ...); |
235 | void StackError (ErrorCode_t err = kUnknown, const char *const msg = " ", ...); | |
236 | void LinkError (ErrorCode_t err = kUnknown, const char *const msg = " ", ...); | |
237 | void ROBError (ErrorCode_t err = kUnknown, const char *const msg = " ", ...); | |
238 | void MCMError (ErrorCode_t err = kUnknown, const char *const msg = " ", ...); | |
f4b3235e | 239 | void StoreErrorTree() { fErrors->Fill(); } |
5fdfc9e4 | 240 | void StoreErrorArray() { new ((*fMarkers)[fMarkers->GetEntriesFast()]) AliTRDrawStreamError(fLastError); } |
f4b3235e | 241 | void ForgetError() { return; } |
242 | void (AliTRDrawStream::*fStoreError)(); //! function pointer to method used for storing the error | |
d60fe037 | 243 | |
92305359 | 244 | static const char* fgkErrorMessages[kLastErrorCode]; // error messages corresponding to the error codes |
245 | static Int_t fgErrorDebugLevel[kLastErrorCode]; // error debug level | |
92223bf6 | 246 | static ErrorBehav_t fgErrorBehav[kLastErrorCode]; // bevhaviour in case of error of given type |
d60fe037 | 247 | |
248 | // I/O | |
5f006bd7 | 249 | AliRawReader *fRawReader; // pointer to the raw reader to take the data from |
0508ca31 | 250 | AliTRDdigitsManager *fDigitsManager; // pointer to the digitsManager to fill the data |
251 | AliTRDdigitsParam *fDigitsParam; // pointer to the parameters belonging to the digits | |
d60fe037 | 252 | |
0508ca31 | 253 | TTree *fErrors; // tree containing the occured error codes |
8df9496c | 254 | AliTRDrawStreamError fLastError; // last error which occured |
92223bf6 | 255 | UInt_t fErrorFlags; // error flags used to steer subsequent reading |
256 | char fErrorBuffer[100]; // buffer for error message | |
d60fe037 | 257 | |
2519cca4 | 258 | AliTRDrawStats fStats; // event statistics, clearing must be done by the user |
259 | ||
0508ca31 | 260 | UInt_t *fPayloadStart; // pointer to start of data payload |
261 | UInt_t *fPayloadCurr; // pointer to current reading position in the payload | |
cc26f39c | 262 | Int_t fPayloadSize; // size of the payload (in UInt_t words) |
d60fe037 | 263 | |
0508ca31 | 264 | static const Int_t fgkNlinks; // number of links to read |
9cb9c409 | 265 | static const Int_t fgkNsectors; // number of sectors |
0508ca31 | 266 | static const Int_t fgkNstacks; // number of stacks to read |
9cb9c409 | 267 | static const Int_t fgkNtriggers; // number of triggers in data stream |
5f006bd7 | 268 | static const UInt_t fgkDataEndmarker; // data endmarker |
0508ca31 | 269 | static const UInt_t fgkTrackletEndmarker; // tracklet endmarker |
52a2b6c0 | 270 | static const UInt_t fgkStackEndmarker[]; // stack endmarker (used from version 0xd on) |
9cb9c409 | 271 | static Int_t fgMcmOrder []; // expected readout order of the MCMs |
272 | static Int_t fgRobOrder []; // expected readout order of the ROBs | |
d60fe037 | 273 | |
274 | // persistent information | |
0508ca31 | 275 | Int_t fNtimebins; // number of timebins |
5f006bd7 | 276 | Int_t fLastEvId; // Event ID of last event |
d60fe037 | 277 | |
278 | // information valid at current reader position | |
0508ca31 | 279 | // all the variables fCurr... refer to the value at the current |
280 | // reading position | |
5f006bd7 | 281 | Int_t fCurrSlot; // current slot |
0508ca31 | 282 | Int_t fCurrLink; // current link |
283 | Int_t fCurrRobPos; // current ROB number | |
284 | Int_t fCurrMcmPos; // current MCM number | |
d60fe037 | 285 | |
286 | // DDL header | |
0508ca31 | 287 | UInt_t fCurrEquipmentId; // current Equipment ID |
d60fe037 | 288 | |
9cb9c409 | 289 | // SM header |
290 | UInt_t fCurrSmHeaderSize; // current size of the SM header | |
291 | UInt_t fCurrSmHeaderVersion; // current version of the SM header | |
292 | UInt_t fCurrTrailerReadout; // current presence of trailer (after the payload) | |
293 | UInt_t fCurrTrgHeaderAvail; // current trigger information availability | |
294 | UInt_t fCurrTrgHeaderReadout; // current readout mode for the trigger headers | |
295 | UInt_t fCurrTrkHeaderAvail; // current tracking information availability | |
52a2b6c0 | 296 | UInt_t fCurrStackEndmarkerAvail; // current stack endmarker availability |
9cb9c409 | 297 | UInt_t fCurrEvType; // current event type |
298 | UInt_t fCurrTriggerEnable; // current trigger enable | |
299 | UInt_t fCurrTriggerFired; // current trigger fired | |
0508ca31 | 300 | UInt_t fCurrTrackEnable; // current value of track enable |
301 | UInt_t fCurrTrackletEnable; // current value of tracklet enable | |
302 | UInt_t fCurrStackMask; // current mask of active stacks | |
d60fe037 | 303 | |
9cb9c409 | 304 | // Tracking header |
305 | UInt_t *fCurrTrkHeaderIndexWord; // current tracking header index word | |
306 | UInt_t *fCurrTrkHeaderSize; // current tracking header index word | |
2519cca4 | 307 | ULong64_t *fCurrTrkFlags; // current tracking done flags |
9cb9c409 | 308 | |
309 | // Trigger header | |
310 | UInt_t *fCurrTrgHeaderIndexWord; // current tracking header index word | |
311 | UInt_t *fCurrTrgHeaderSize; // current tracking header index word | |
2519cca4 | 312 | UInt_t *fCurrTrgFlags; // current trigger flags of all sectors |
9cb9c409 | 313 | |
314 | // Stack header | |
0508ca31 | 315 | UInt_t *fCurrStackIndexWord; // current stack index words |
316 | UInt_t *fCurrStackHeaderSize; // current stack index sizes | |
317 | UInt_t *fCurrStackHeaderVersion; // current stack header versions | |
318 | UInt_t *fCurrLinkMask; // current link masks | |
319 | UInt_t *fCurrCleanCheckout; // current clean checkout flags | |
320 | UInt_t *fCurrBoardId; // current board IDs | |
9cb9c409 | 321 | UInt_t fCurrHwRev; // current hardware revision |
322 | UInt_t *fCurrHwRevTMU; // current hardware revision | |
0508ca31 | 323 | UInt_t *fCurrLinkMonitorFlags; // current link monitor flags |
324 | UInt_t *fCurrLinkDataTypeFlags; // current link data flags | |
325 | UInt_t *fCurrLinkDebugFlags; // current link debug flags | |
d60fe037 | 326 | |
52a2b6c0 | 327 | // CRC checks from trailer |
328 | Char_t fCurrMatchFlagsSRAM; | |
329 | Char_t fCurrMatchFlagsPostBP; | |
330 | UInt_t fCurrChecksumStack[5]; | |
331 | UInt_t fCurrChecksumSIU; | |
332 | ||
d60fe037 | 333 | // HC information |
0508ca31 | 334 | Int_t fCurrSpecial; // current value of the special flag |
335 | Int_t fCurrMajor; // current major version | |
336 | Int_t fCurrMinor; // current minor version | |
337 | Int_t fCurrAddHcWords; // current number of additional HC-header words | |
338 | Int_t fCurrSm; // current sector | |
339 | Int_t fCurrStack; // current stack | |
340 | Int_t fCurrLayer; // current layer | |
341 | Int_t fCurrSide; // current side | |
342 | Int_t fCurrHC; // current HC | |
343 | Int_t fCurrCheck; // current check bits | |
344 | Int_t fCurrNtimebins; // current number of timebins | |
345 | Int_t fCurrBC; // current BC | |
346 | Int_t fCurrPtrgCnt; // current pretrigger count | |
347 | Int_t fCurrPtrgPhase; // current pretrigger phase | |
d60fe037 | 348 | |
cc26f39c | 349 | // settings for dumping |
350 | Int_t fDumpMCM[100]; // MCMs to dump | |
351 | Int_t fNDumpMCMs; // number of MCMs to dump | |
352 | ||
d60fe037 | 353 | // tracklet information |
0508ca31 | 354 | TClonesArray *fTrackletArray; // pointer to array for tracklet storage |
d60fe037 | 355 | |
356 | // output data | |
0508ca31 | 357 | AliTRDarrayADC *fAdcArray; // pointer to ADC array |
358 | AliTRDSignalIndex *fSignalIndex; // pointer to the signal index | |
359 | TTree *fTrackletTree; // pointer to the tree for tracklet storage | |
5fdfc9e4 | 360 | TClonesArray *fTracklets; // pointer to array of tracklets |
361 | TClonesArray *fTracks; // pointer to array of GTU tracks | |
362 | TClonesArray *fMarkers; // pointer to array of markers (data present, errors, ...) | |
d60fe037 | 363 | |
364 | AliTRDrawStream(const AliTRDrawStream&); // not implemented | |
0508ca31 | 365 | AliTRDrawStream& operator=(const AliTRDrawStream&); // not implemented |
d60fe037 | 366 | |
367 | ClassDef(AliTRDrawStream, 0); | |
368 | }; | |
369 | ||
82029d44 | 370 | Int_t AliTRDrawStream::GetNActiveChannelsFromMask(UInt_t adcmask) const |
371 | { | |
372 | // return number of active bits in the ADC mask | |
373 | ||
374 | adcmask = GetActiveChannels(adcmask); | |
375 | adcmask = adcmask - ((adcmask >> 1) & 0x55555555); | |
376 | adcmask = (adcmask & 0x33333333) + ((adcmask >> 2) & 0x33333333); | |
377 | return (((adcmask + (adcmask >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; | |
378 | } | |
379 | ||
d60fe037 | 380 | #endif |