]>
Commit | Line | Data |
---|---|---|
70b4a8d6 | 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 "AliMUONDataIterator.h" | |
19 | ||
20 | #include "AliMUONConstants.h" | |
21 | #include "AliMUONData.h" | |
22 | #include "AliMUONDataDigitIterator.h" | |
23 | #include "TString.h" | |
24 | ||
25 | // | |
26 | // A wrapper to various iterators used to loop over | |
27 | // objects handled by AliMUONData, like sdigits, digits, rawclusters, | |
28 | // and so on. | |
29 | // | |
30 | // Currently only implemented for digits, as a proof-of-principle. | |
31 | // | |
32 | ||
5398f946 | 33 | /// \cond CLASSIMP |
34 | ClassImp(AliMUONDataIterator) | |
35 | /// \endcond | |
36 | ||
70b4a8d6 | 37 | namespace |
38 | { | |
39 | void GetChamberNumbers(AliMUONDataIterator::EIterationStyle type, | |
40 | Int_t& firstChamber, Int_t& lastChamber) | |
41 | { | |
42 | switch ( type ) | |
43 | { | |
44 | case AliMUONDataIterator::kAllChambers: | |
45 | firstChamber=0; | |
46 | lastChamber=AliMUONConstants::NCh()-1; | |
47 | break; | |
48 | case AliMUONDataIterator::kTrackingChambers: | |
49 | firstChamber=0; | |
50 | lastChamber=AliMUONConstants::NCh()-1; | |
51 | break; | |
52 | case AliMUONDataIterator::kTriggerChambers: | |
53 | firstChamber=AliMUONConstants::NTrackingCh(); | |
54 | lastChamber=AliMUONConstants::NCh()-1; | |
55 | break; | |
56 | default: | |
57 | firstChamber=lastChamber=-1; | |
58 | break; | |
59 | } | |
60 | } | |
61 | } | |
62 | ||
70b4a8d6 | 63 | //_____________________________________________________________________________ |
64 | AliMUONDataIterator::AliMUONDataIterator() | |
65 | : | |
66 | TObject(), | |
67 | fIterator(0x0) | |
68 | { | |
69 | } | |
70 | ||
71 | //_____________________________________________________________________________ | |
72 | AliMUONDataIterator::AliMUONDataIterator(AliMUONData* data, | |
73 | const char* onWhatToIterate, | |
74 | EIterationStyle howToIterate) | |
75 | : | |
76 | TObject(), | |
77 | fIterator(0x0) | |
78 | { | |
79 | TString opt(onWhatToIterate); | |
80 | opt.ToLower(); | |
81 | if ( opt.Contains("digit") || opt.Contains("d") ) | |
82 | { | |
83 | Int_t firstChamber; | |
84 | Int_t lastChamber; | |
85 | GetChamberNumbers(howToIterate,firstChamber,lastChamber); | |
86 | if ( firstChamber >= 0 && lastChamber >= 0 ) | |
87 | { | |
88 | data->GetLoader()->LoadDigits("READ"); | |
89 | data->SetTreeAddress("D,GLT"); | |
90 | fIterator = new AliMUONDataDigitIterator(data,firstChamber,lastChamber); | |
91 | } | |
92 | } | |
93 | } | |
94 | ||
95 | //_____________________________________________________________________________ | |
96 | AliMUONDataIterator::~AliMUONDataIterator() | |
97 | { | |
98 | delete fIterator; | |
99 | } | |
100 | ||
101 | //_____________________________________________________________________________ | |
102 | TObject* | |
103 | AliMUONDataIterator::Next() | |
104 | { | |
a0dc51a6 | 105 | if (fIterator) return fIterator->Next(); |
70b4a8d6 | 106 | return 0x0; |
107 | } | |
108 | ||
109 | //_____________________________________________________________________________ | |
110 | Bool_t | |
111 | AliMUONDataIterator::Remove() | |
112 | { | |
a0dc51a6 | 113 | if (fIterator) return fIterator->Remove(); |
70b4a8d6 | 114 | return kFALSE; |
115 | } | |
116 | ||
117 | //_____________________________________________________________________________ | |
118 | void | |
119 | AliMUONDataIterator::Reset() | |
120 | { | |
a0dc51a6 | 121 | if (fIterator) fIterator->Reset(); |
70b4a8d6 | 122 | } |