32 #ifndef STRANDOMSELECTOR_H
33 #define STRANDOMSELECTOR_H
36 #include <TCollection.h>
37 #include <TIterator.h>
65 Int_t mTotalElemReturned;
69 Int_t mTotalElemSkipped;
73 Double_t mProbability;
80 bool mAbsoluteThreshold;
84 const TCollection * mContainer;
87 TIterator * mIterator;
98 const TCollection * newContainer,
104 mRand.SetSeed( newSeed );
105 mProbability = newProb;
106 mAbsoluteThreshold = newAt;
108 mContainer = newContainer;
135 Double_t newProb = 1.0,
140 initialize( NULL, newProb, newAT, seed );
164 TCollection * newContainer,
165 Double_t newProb = 1.0,
170 initialize( newContainer, newProb, newAT, seed );
177 : mRand(toCopy.mRand),
178 mTotalElemReturned(toCopy.mTotalElemReturned),
179 mTotalElemSkipped(toCopy.mTotalElemSkipped),
180 mProbability(toCopy.mProbability),
181 mAbsoluteThreshold(toCopy.mAbsoluteThreshold),
182 mContainer(toCopy.mContainer),
187 mIterator = mContainer->MakeIterator();
190 (*mIterator) = (*toCopy.mIterator);
201 mTotalElemReturned = 0;
202 mTotalElemSkipped = 0;
209 mIterator = mContainer->MakeIterator();
221 void Skip( Int_t numberToSkip = 1 )
227 for (
int ii = 0; ii < numberToSkip; ++ii )
229 checkme = mIterator->Next();
250 TObject * retVal = mIterator->Next();
253 ++mTotalElemReturned;
262 TObject * GetNextRandom();
276 void SetSeed( UInt_t seed = 0 )
278 mRand.SetSeed( seed );
280 const UInt_t GetSeed()
282 return mRand.GetSeed();
294 void SetProbability( Double_t newProb )
296 mProbability = newProb;
298 const Double_t GetProbability()
319 void SetAbsoluteThreshold(
bool newAT )
321 mAbsoluteThreshold = newAT;
323 const bool GetAbsoluteThreshold()
325 return mAbsoluteThreshold;
329 const Int_t GetTotalNumber()
333 return mContainer->GetEntries();
343 const Int_t GetNumberReturned()
345 return mTotalElemReturned;
350 const Int_t GetNumberSkipped()
352 return mTotalElemSkipped;
360 void SetContainer( TCollection * newCont )
362 mContainer = newCont;
365 const TCollection * GetContainer()
389 #endif // STARRANDOMSELECTOR_H