1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliMUONDataIterator.h"
20 #include "AliMUONConstants.h"
21 #include "AliMUONData.h"
22 #include "AliMUONDataDigitIterator.h"
26 // A wrapper to various iterators used to loop over
27 // objects handled by AliMUONData, like sdigits, digits, rawclusters,
30 // Currently only implemented for digits, as a proof-of-principle.
34 ClassImp(AliMUONDataIterator)
39 void GetChamberNumbers(AliMUONDataIterator::EIterationStyle type,
40 Int_t& firstChamber, Int_t& lastChamber)
44 case AliMUONDataIterator::kAllChambers:
46 lastChamber=AliMUONConstants::NCh()-1;
48 case AliMUONDataIterator::kTrackingChambers:
50 lastChamber=AliMUONConstants::NCh()-1;
52 case AliMUONDataIterator::kTriggerChambers:
53 firstChamber=AliMUONConstants::NTrackingCh();
54 lastChamber=AliMUONConstants::NCh()-1;
57 firstChamber=lastChamber=-1;
63 //_____________________________________________________________________________
64 AliMUONDataIterator::AliMUONDataIterator()
71 //_____________________________________________________________________________
72 AliMUONDataIterator::AliMUONDataIterator(AliMUONData* data,
73 const char* onWhatToIterate,
74 EIterationStyle howToIterate)
79 TString opt(onWhatToIterate);
81 if ( opt.Contains("digit") || opt.Contains("d") )
85 GetChamberNumbers(howToIterate,firstChamber,lastChamber);
86 if ( firstChamber >= 0 && lastChamber >= 0 )
88 data->GetLoader()->LoadDigits("READ");
89 data->SetTreeAddress("D,GLT");
90 fIterator = new AliMUONDataDigitIterator(data,firstChamber,lastChamber);
95 //_____________________________________________________________________________
96 AliMUONDataIterator::~AliMUONDataIterator()
101 //_____________________________________________________________________________
103 AliMUONDataIterator::Next()
105 if (fIterator) return fIterator->Next();
109 //_____________________________________________________________________________
111 AliMUONDataIterator::Remove()
113 if (fIterator) return fIterator->Remove();
117 //_____________________________________________________________________________
119 AliMUONDataIterator::Reset()
121 if (fIterator) fIterator->Reset();