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"
25 /// \class AliMUONDataIterator
26 /// A wrapper to various iterators used to loop over
27 /// objects handled by AliMUONData, like sdigits, digits, rawclusters,
29 /// Currently only implemented for digits, as a proof-of-principle.
31 /// \author Laurent Aphecetche
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()
69 /// Default constructor
72 //_____________________________________________________________________________
73 AliMUONDataIterator::AliMUONDataIterator(AliMUONData* data,
74 const char* onWhatToIterate,
75 EIterationStyle howToIterate)
80 /// Standard constructor
82 TString opt(onWhatToIterate);
84 if ( opt.Contains("digit") || opt.Contains("d") )
88 GetChamberNumbers(howToIterate,firstChamber,lastChamber);
89 if ( firstChamber >= 0 && lastChamber >= 0 )
91 data->GetLoader()->LoadDigits("READ");
92 data->SetTreeAddress("D,GLT");
93 fIterator = new AliMUONDataDigitIterator(data,firstChamber,lastChamber);
98 //_____________________________________________________________________________
99 AliMUONDataIterator::~AliMUONDataIterator()
106 //_____________________________________________________________________________
108 AliMUONDataIterator::Next()
110 /// Set iterator to the next element
112 if (fIterator) return fIterator->Next();
116 //_____________________________________________________________________________
118 AliMUONDataIterator::Remove()
120 /// Remove current element
122 if (fIterator) return fIterator->Remove();
126 //_____________________________________________________________________________
128 AliMUONDataIterator::Reset()
132 if (fIterator) fIterator->Reset();