]>
Commit | Line | Data |
---|---|---|
70b4a8d6 | 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 | // $Id$ | |
17 | ||
18 | #include "AliMUONDataDigitIterator.h" | |
19 | ||
20 | #include "AliMUONData.h" | |
70b4a8d6 | 21 | #include "TClonesArray.h" |
22 | ||
85fec35d | 23 | /// |
24 | /// \class AliMUONDataDigitIterator | |
70b4a8d6 | 25 | /// |
26 | /// An iterator to access digits (stored into AliMUONData). | |
27 | /// | |
28 | /// Iteration can occur on tracking chambers only, trigger chambers only, | |
29 | /// or both. | |
30 | /// | |
85fec35d | 31 | /// \author L. Aphecetche |
32 | /// | |
70b4a8d6 | 33 | |
5398f946 | 34 | /// \cond CLASSIMP |
35 | ClassImp(AliMUONDataDigitIterator) | |
36 | /// \endcond | |
37 | ||
70b4a8d6 | 38 | //_____________________________________________________________________________ |
39 | AliMUONDataDigitIterator::AliMUONDataDigitIterator(const AliMUONData* data, | |
40 | Int_t firstChamber, | |
41 | Int_t lastChamber) | |
42 | : | |
43 | AliMUONVDataIterator(), | |
44 | fData(data), | |
45 | fFirstChamber(firstChamber), | |
46 | fLastChamber(lastChamber) | |
47 | { | |
5398f946 | 48 | /// Standard constructor |
70b4a8d6 | 49 | Reset(); |
50 | } | |
51 | ||
52 | //_____________________________________________________________________________ | |
53 | AliMUONDataDigitIterator::AliMUONDataDigitIterator(const AliMUONDataDigitIterator& rhs) | |
54 | : | |
55 | AliMUONVDataIterator() | |
56 | { | |
5398f946 | 57 | /// Copy constructor |
58 | ||
70b4a8d6 | 59 | rhs.CopyTo(*this); |
60 | } | |
61 | ||
5398f946 | 62 | //_____________________________________________________________________________ |
63 | AliMUONDataDigitIterator::~AliMUONDataDigitIterator() | |
64 | { | |
65 | /// Destructor | |
66 | } | |
67 | ||
70b4a8d6 | 68 | //_____________________________________________________________________________ |
69 | AliMUONDataDigitIterator& | |
70 | AliMUONDataDigitIterator::operator=(const AliMUONDataDigitIterator& rhs) | |
71 | { | |
5398f946 | 72 | /// Assignment operator |
73 | ||
70b4a8d6 | 74 | rhs.CopyTo(*this); |
75 | return *this; | |
76 | } | |
77 | ||
78 | //_____________________________________________________________________________ | |
79 | void | |
80 | AliMUONDataDigitIterator::CopyTo(AliMUONDataDigitIterator& destination) const | |
81 | { | |
5398f946 | 82 | /// Copy *this to destination |
70b4a8d6 | 83 | destination.fData=fData; |
84 | destination.fFirstChamber=fFirstChamber; | |
85 | destination.fLastChamber=fLastChamber; | |
86 | destination.fCurrentDigit=fCurrentDigit; | |
87 | destination.fCurrentChamber=fCurrentChamber; | |
88 | destination.fDigits=fDigits; | |
89 | } | |
90 | ||
91 | //_____________________________________________________________________________ | |
92 | TObject* | |
93 | AliMUONDataDigitIterator::Next() | |
94 | { | |
5398f946 | 95 | /// Return current element and self-position to the next one. |
70b4a8d6 | 96 | |
97 | TObject* rv(0x0); | |
98 | ||
99 | if ( fDigits ) | |
100 | { | |
101 | // get the pointer to be returned | |
102 | rv = fDigits->At(fCurrentDigit); | |
103 | // prepare for the next position, if it exists | |
104 | if ( fCurrentDigit < fDigits->GetLast() ) | |
105 | { | |
106 | ++fCurrentDigit; | |
107 | } | |
108 | else | |
109 | { | |
110 | fCurrentDigit = 0; | |
111 | ++fCurrentChamber; | |
112 | if ( fCurrentChamber <= fLastChamber ) | |
113 | { | |
114 | fDigits = fData->Digits(fCurrentChamber); | |
115 | } | |
116 | else | |
117 | { | |
118 | fDigits = 0x0; | |
119 | } | |
120 | } | |
121 | } | |
122 | ||
123 | return rv; | |
124 | } | |
125 | ||
126 | //_____________________________________________________________________________ | |
127 | Bool_t | |
128 | AliMUONDataDigitIterator::Remove() | |
129 | { | |
5398f946 | 130 | /// Remove current element. |
70b4a8d6 | 131 | |
132 | if ( fDigits ) | |
133 | { | |
134 | fDigits->RemoveAt(fCurrentDigit); | |
135 | fDigits->Compress(); | |
136 | return kTRUE; | |
137 | } | |
138 | ||
139 | return kFALSE; | |
140 | } | |
141 | ||
142 | //_____________________________________________________________________________ | |
143 | void | |
144 | AliMUONDataDigitIterator::Reset() | |
145 | { | |
5398f946 | 146 | /// Reset the iterator |
70b4a8d6 | 147 | fData->GetDigits(); |
148 | fCurrentDigit = 0; | |
149 | fCurrentChamber = fFirstChamber; | |
150 | fDigits = fData->Digits(fCurrentChamber); | |
151 | } |