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