]>
Commit | Line | Data |
---|---|---|
fe44e30b | 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 | ||
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
fe44e30b | 19 | /// \class AliMUONDigitStoreV1Iterator |
20 | /// | |
21 | /// Implementation of TIteraor for AliMUONVDigitStoreV1 | |
22 | /// Reuses the AliMUONTOTCAStoreIterator iterator | |
23 | /// | |
24 | /// \author Laurent Aphecetche, Subatech | |
3d1463c8 | 25 | //----------------------------------------------------------------------------- |
fe44e30b | 26 | |
27 | #include "AliMUONDigitStoreV1Iterator.h" | |
28 | ||
29 | #include "AliMpDEManager.h" | |
30 | #include "AliMUONVDigit.h" | |
31 | ||
32 | /// \cond CLASSIMP | |
33 | ClassImp(AliMUONDigitStoreV1Iterator) | |
34 | /// \endcond | |
35 | ||
36 | //_____________________________________________________________________________ | |
37 | AliMUONDigitStoreV1Iterator::AliMUONDigitStoreV1Iterator(TObjArray* a, | |
38 | Int_t firstDetElemId, | |
39 | Int_t lastDetElemId, | |
40 | Int_t cathode) | |
41 | : AliMUONTOTCAStoreIterator(a,AliMpDEManager::GetChamberId(firstDetElemId), | |
42 | AliMpDEManager::GetChamberId(lastDetElemId)), | |
43 | fArray(a), | |
44 | fFirstDetElemId(firstDetElemId), | |
45 | fLastDetElemId(lastDetElemId), | |
46 | fCathode(cathode) | |
47 | { | |
48 | /// ctor | |
49 | } | |
50 | ||
51 | //_____________________________________________________________________________ | |
52 | AliMUONDigitStoreV1Iterator::AliMUONDigitStoreV1Iterator(const AliMUONDigitStoreV1Iterator& rhs) | |
53 | : AliMUONTOTCAStoreIterator(rhs), | |
54 | fArray(rhs.fArray), | |
55 | fFirstDetElemId(rhs.fFirstDetElemId), | |
56 | fLastDetElemId(rhs.fLastDetElemId), | |
57 | fCathode(rhs.fCathode) | |
58 | { | |
59 | /// copy ctor | |
60 | } | |
61 | ||
62 | //_____________________________________________________________________________ | |
63 | TIterator& | |
64 | AliMUONDigitStoreV1Iterator::operator=(const TIterator& rhs) | |
65 | { | |
66 | /// overriden assignment operator (imposed by Root's definition of TIterator ?) | |
67 | if ( this != &rhs && rhs.IsA() == AliMUONDigitStoreV1Iterator::Class()) | |
68 | { | |
69 | const AliMUONDigitStoreV1Iterator& rhs1 = | |
70 | static_cast<const AliMUONDigitStoreV1Iterator&>(rhs); | |
71 | ||
72 | fArray = rhs1.fArray; | |
73 | fFirstDetElemId = rhs1.fFirstDetElemId; | |
74 | fLastDetElemId = rhs1.fLastDetElemId; | |
75 | fCathode = rhs1.fCathode; | |
76 | } | |
77 | return *this; | |
78 | } | |
79 | ||
80 | //_____________________________________________________________________________ | |
81 | AliMUONDigitStoreV1Iterator& | |
82 | AliMUONDigitStoreV1Iterator::operator=(const AliMUONDigitStoreV1Iterator& rhs) | |
83 | { | |
84 | /// assignement operator | |
85 | if ( this != &rhs ) | |
86 | { | |
87 | fArray = rhs.fArray; | |
88 | fFirstDetElemId = rhs.fFirstDetElemId; | |
89 | fLastDetElemId = rhs.fLastDetElemId; | |
90 | fCathode = rhs.fCathode; | |
91 | } | |
92 | return *this; | |
93 | } | |
94 | ||
95 | //_____________________________________________________________________________ | |
96 | AliMUONDigitStoreV1Iterator::~AliMUONDigitStoreV1Iterator() | |
97 | { | |
98 | /// dtor | |
99 | } | |
100 | ||
101 | //_____________________________________________________________________________ | |
102 | const TCollection* | |
103 | AliMUONDigitStoreV1Iterator::GetCollection() const | |
104 | { | |
105 | /// Return the TObjArray we're iterating upon | |
106 | return fArray; | |
107 | } | |
108 | ||
109 | //_____________________________________________________________________________ | |
110 | TObject* | |
111 | AliMUONDigitStoreV1Iterator::Next() | |
112 | { | |
113 | /// Return the next digit (with its DE in [fFirstDetElemId,fLastDetElemId], | |
114 | /// and its cathode == fCathode (or any cathode if fCathode==2) | |
115 | /// in the store. | |
116 | ||
117 | TObject* object = 0x0; | |
118 | ||
119 | while ( (object = static_cast<AliMUONVDigit*>(AliMUONTOTCAStoreIterator::Next()) ) ) | |
120 | { | |
121 | AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(object); | |
122 | ||
123 | if ( digit->DetElemId() >= fFirstDetElemId && | |
124 | digit->DetElemId() <= fLastDetElemId ) | |
125 | { | |
126 | if ( fCathode == 2 || digit->Cathode() == fCathode ) | |
127 | { | |
128 | return digit; | |
129 | } | |
130 | } | |
131 | } | |
132 | ||
133 | return 0x0; | |
134 | } |