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