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 : #include "AliMpManuIterator.h"
19 :
20 : #include "AliMpBusPatch.h"
21 : #include "AliMpDDLStore.h"
22 : #include "TExMap.h"
23 : #include "AliLog.h"
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 18 : ClassImp(AliMpManuIterator)
33 : /// \endcond
34 :
35 : //_____________________________________________________________________________
36 : AliMpManuIterator::AliMpManuIterator()
37 4 : : TObject(),
38 12 : fIterator(AliMpDDLStore::Instance()->CreateBusPatchIterator()),
39 4 : fCurrentBusPatch(0x0),
40 4 : fCurrentManuIndex(-1)
41 20 : {
42 : /// ctor
43 4 : Reset();
44 8 : }
45 :
46 : //_____________________________________________________________________________
47 : AliMpManuIterator::~AliMpManuIterator()
48 16 : {
49 : /// dtor
50 8 : delete fIterator;
51 8 : }
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 141728 : ++fCurrentManuIndex;
60 :
61 70864 : if ( fCurrentManuIndex < fCurrentBusPatch->GetNofManus() )
62 : {
63 67312 : detElemId = fCurrentBusPatch->GetDEId();
64 67312 : manuId = fCurrentBusPatch->GetManuId(fCurrentManuIndex);
65 67312 : return kTRUE;
66 : }
67 : else
68 : {
69 3552 : fCurrentBusPatch = static_cast<AliMpBusPatch*>(fIterator->Next());
70 3552 : if (!fCurrentBusPatch )
71 : {
72 4 : return kFALSE;
73 : }
74 3548 : fCurrentManuIndex = -1;
75 3548 : return Next(detElemId,manuId);
76 : }
77 70864 : }
78 :
79 : //_____________________________________________________________________________
80 : void
81 : AliMpManuIterator::Reset()
82 : {
83 : /// Rewind the iterator
84 8 : fIterator->Reset();
85 :
86 4 : fCurrentBusPatch = static_cast<AliMpBusPatch*>(fIterator->Next());
87 :
88 4 : fCurrentManuIndex = -1;
89 4 : }
|