]>
Commit | Line | Data |
---|---|---|
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" | |
630711ed | 23 | #include "AliLog.h" |
1ef5468a | 24 | |
25 | /// \class AliMpManuIterator | |
26 | /// | |
27 | /// Class to loop over all manus of MUON Tracker | |
28 | /// | |
29 | /// \author Laurent Aphecetche, Subatech | |
30 | ||
31 | /// \cond CLASSIMP | |
32 | ClassImp(AliMpManuIterator) | |
33 | /// \endcond | |
34 | ||
35 | //_____________________________________________________________________________ | |
36 | AliMpManuIterator::AliMpManuIterator() | |
37 | : TObject(), | |
630711ed | 38 | fIterator(AliMpDDLStore::Instance()->CreateBusPatchIterator()), |
1ef5468a | 39 | fCurrentBusPatch(0x0), |
40 | fCurrentManuIndex(-1) | |
41 | { | |
42 | /// ctor | |
43 | Reset(); | |
44 | } | |
45 | ||
46 | //_____________________________________________________________________________ | |
47 | AliMpManuIterator::~AliMpManuIterator() | |
48 | { | |
49 | /// dtor | |
50 | delete fIterator; | |
51 | } | |
52 | ||
53 | //_____________________________________________________________________________ | |
54 | Bool_t | |
55 | AliMpManuIterator::Next(Int_t& detElemId, Int_t& manuId) | |
56 | { | |
57 | /// Set the next (de,manu) pair and return kTRUE, or kFALSE if ended. | |
58 | ||
59 | ++fCurrentManuIndex; | |
60 | ||
61 | if ( fCurrentManuIndex < fCurrentBusPatch->GetNofManus() ) | |
62 | { | |
63 | detElemId = fCurrentBusPatch->GetDEId(); | |
64 | manuId = fCurrentBusPatch->GetManuId(fCurrentManuIndex); | |
65 | return kTRUE; | |
66 | } | |
67 | else | |
68 | { | |
630711ed | 69 | fCurrentBusPatch = static_cast<AliMpBusPatch*>(fIterator->Next()); |
1ef5468a | 70 | if (!fCurrentBusPatch ) |
71 | { | |
72 | return kFALSE; | |
73 | } | |
74 | fCurrentManuIndex = -1; | |
75 | return Next(detElemId,manuId); | |
76 | } | |
77 | } | |
78 | ||
1ef5468a | 79 | //_____________________________________________________________________________ |
80 | void | |
81 | AliMpManuIterator::Reset() | |
82 | { | |
83 | /// Rewind the iterator | |
84 | fIterator->Reset(); | |
85 | ||
630711ed | 86 | fCurrentBusPatch = static_cast<AliMpBusPatch*>(fIterator->Next()); |
1ef5468a | 87 | |
88 | fCurrentManuIndex = -1; | |
89 | } |