Changed default OCDB from 2009 to 2010
[u/mrichter/AliRoot.git] / MUON / AliMUONDigitStoreV1Iterator.cxx
CommitLineData
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
79dbdbc3 29#include "AliLog.h"
fe44e30b 30#include "AliMpDEManager.h"
31#include "AliMUONVDigit.h"
630711ed 32#include "TObjArray.h"
fe44e30b 33
34/// \cond CLASSIMP
35ClassImp(AliMUONDigitStoreV1Iterator)
36/// \endcond
37
38//_____________________________________________________________________________
39AliMUONDigitStoreV1Iterator::AliMUONDigitStoreV1Iterator(TObjArray* a,
40 Int_t firstDetElemId,
41 Int_t lastDetElemId,
42 Int_t cathode)
43: AliMUONTOTCAStoreIterator(a,AliMpDEManager::GetChamberId(firstDetElemId),
44 AliMpDEManager::GetChamberId(lastDetElemId)),
45fArray(a),
46fFirstDetElemId(firstDetElemId),
47fLastDetElemId(lastDetElemId),
48fCathode(cathode)
49{
50 /// ctor
51}
52
53//_____________________________________________________________________________
54AliMUONDigitStoreV1Iterator::AliMUONDigitStoreV1Iterator(const AliMUONDigitStoreV1Iterator& rhs)
55: AliMUONTOTCAStoreIterator(rhs),
56 fArray(rhs.fArray),
57 fFirstDetElemId(rhs.fFirstDetElemId),
58 fLastDetElemId(rhs.fLastDetElemId),
59 fCathode(rhs.fCathode)
60{
61 /// copy ctor
62}
63
64//_____________________________________________________________________________
6805f5be 65AliMUONDigitStoreV1Iterator&
fe44e30b 66AliMUONDigitStoreV1Iterator::operator=(const TIterator& rhs)
67{
68 /// overriden assignment operator (imposed by Root's definition of TIterator ?)
79dbdbc3 69
70 if ( this != &rhs )
fe44e30b 71 {
79dbdbc3 72 if ( rhs.IsA() != AliMUONDigitStoreV1Iterator::Class() )
73 {
74 AliErrorGeneral("AliMUONDigitStoreV1Iterator::operator=","Wrong type");
75 }
76 else
77 {
78 const AliMUONDigitStoreV1Iterator& rhs1 =
79 static_cast<const AliMUONDigitStoreV1Iterator&>(rhs);
80
81 AliMUONDigitStoreV1Iterator::operator=(rhs1);
82 }
fe44e30b 83 }
84 return *this;
85}
86
87//_____________________________________________________________________________
88AliMUONDigitStoreV1Iterator&
89AliMUONDigitStoreV1Iterator::operator=(const AliMUONDigitStoreV1Iterator& rhs)
90{
91 /// assignement operator
92 if ( this != &rhs )
93 {
79dbdbc3 94 TIterator::operator=(rhs);
fe44e30b 95 fArray = rhs.fArray;
96 fFirstDetElemId = rhs.fFirstDetElemId;
97 fLastDetElemId = rhs.fLastDetElemId;
98 fCathode = rhs.fCathode;
99 }
100 return *this;
101}
102
103//_____________________________________________________________________________
104AliMUONDigitStoreV1Iterator::~AliMUONDigitStoreV1Iterator()
105{
106 /// dtor
107}
108
109//_____________________________________________________________________________
110const TCollection*
111AliMUONDigitStoreV1Iterator::GetCollection() const
112{
113 /// Return the TObjArray we're iterating upon
114 return fArray;
115}
116
117//_____________________________________________________________________________
118TObject*
119AliMUONDigitStoreV1Iterator::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 while ( (object = static_cast<AliMUONVDigit*>(AliMUONTOTCAStoreIterator::Next()) ) )
128 {
129 AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(object);
130
131 if ( digit->DetElemId() >= fFirstDetElemId &&
132 digit->DetElemId() <= fLastDetElemId )
133 {
134 if ( fCathode == 2 || digit->Cathode() == fCathode )
135 {
136 return digit;
137 }
138 }
139 }
140
141 return 0x0;
142}