]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpManuIterator.cxx
Fixing part of the Coding violation
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpManuIterator.cxx
CommitLineData
1ef5468a 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#include "AliMpManuIterator.h"
19
20#include "AliMpBusPatch.h"
21#include "AliMpDDLStore.h"
22#include "TExMap.h"
23
24/// \class AliMpManuIterator
25///
26/// Class to loop over all manus of MUON Tracker
27///
28/// \author Laurent Aphecetche, Subatech
29
30/// \cond CLASSIMP
31ClassImp(AliMpManuIterator)
32/// \endcond
33
34//_____________________________________________________________________________
35AliMpManuIterator::AliMpManuIterator()
36: TObject(),
37fIterator(new TExMapIter(AliMpDDLStore::Instance()->GetBusPatchesIterator())),
38fCurrentBusPatch(0x0),
39fCurrentManuIndex(-1)
40{
41 /// ctor
42 Reset();
43}
44
45//_____________________________________________________________________________
46AliMpManuIterator::~AliMpManuIterator()
47{
48 /// dtor
49 delete fIterator;
50}
51
52//_____________________________________________________________________________
53Bool_t
54AliMpManuIterator::Next(Int_t& detElemId, Int_t& manuId)
55{
56 /// Set the next (de,manu) pair and return kTRUE, or kFALSE if ended.
57
58 ++fCurrentManuIndex;
59
60 if ( fCurrentManuIndex < fCurrentBusPatch->GetNofManus() )
61 {
62 detElemId = fCurrentBusPatch->GetDEId();
63 manuId = fCurrentBusPatch->GetManuId(fCurrentManuIndex);
64 return kTRUE;
65 }
66 else
67 {
68 fCurrentBusPatch = NextBusPatch();
69 if (!fCurrentBusPatch )
70 {
71 return kFALSE;
72 }
73 fCurrentManuIndex = -1;
74 return Next(detElemId,manuId);
75 }
76}
77
78//_____________________________________________________________________________
79AliMpBusPatch*
80AliMpManuIterator::NextBusPatch() const
81{
82 /// Return next bus patch
83
84 Long_t key, value;
85
86 Bool_t ok = fIterator->Next(key,value);
87
88 if (ok)
89 {
90 return reinterpret_cast<AliMpBusPatch*>(value);
91 }
92 return 0x0;
93}
94
95//_____________________________________________________________________________
96void
97AliMpManuIterator::Reset()
98{
99 /// Rewind the iterator
100 fIterator->Reset();
101
102 fCurrentBusPatch = NextBusPatch();
103
104 fCurrentManuIndex = -1;
105}