]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDigitStoreV1Iterator.cxx
Define default values of cluster resolution per chamber in the
[u/mrichter/AliRoot.git] / MUON / AliMUONDigitStoreV1Iterator.cxx
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 ClassImp(AliMUONDigitStoreV1Iterator)
36 /// \endcond
37
38 //_____________________________________________________________________________
39 AliMUONDigitStoreV1Iterator::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)),
45 fArray(a),
46 fFirstDetElemId(firstDetElemId),
47 fLastDetElemId(lastDetElemId),
48 fCathode(cathode)
49 {
50   /// ctor
51 }
52
53 //_____________________________________________________________________________
54 AliMUONDigitStoreV1Iterator::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 //_____________________________________________________________________________
65 AliMUONDigitStoreV1Iterator& 
66 AliMUONDigitStoreV1Iterator::operator=(const TIterator& rhs)
67 {
68   /// overriden assignment operator (imposed by Root's definition of TIterator ?)
69   
70   if ( this != &rhs )
71   {
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     }
83   }
84   return *this;
85 }
86
87 //_____________________________________________________________________________
88 AliMUONDigitStoreV1Iterator& 
89 AliMUONDigitStoreV1Iterator::operator=(const AliMUONDigitStoreV1Iterator& rhs)
90 {
91   /// assignement operator
92   if ( this != &rhs ) 
93   {
94     TIterator::operator=(rhs);
95     fArray = rhs.fArray;
96     fFirstDetElemId = rhs.fFirstDetElemId;
97     fLastDetElemId = rhs.fLastDetElemId;
98     fCathode = rhs.fCathode;
99   }
100   return *this;
101 }
102
103 //_____________________________________________________________________________
104 AliMUONDigitStoreV1Iterator::~AliMUONDigitStoreV1Iterator()
105 {
106   /// dtor
107 }
108
109 //_____________________________________________________________________________
110 const TCollection* 
111 AliMUONDigitStoreV1Iterator::GetCollection() const
112 {
113   /// Return the TObjArray we're iterating upon
114   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   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 }