| 1 | /* | 
|---|
| 2 | Ideas for random sampling: | 
|---|
| 3 |  | 
|---|
| 4 | Bootstrapping: pull with pu back | 
|---|
| 5 | generate a random list of Eventnumbers, induvidual number can occure certain | 
|---|
| 6 | times in list, put numbers in List sorted. | 
|---|
| 7 | read eventnumbers to process from list | 
|---|
| 8 | USE: STL multiset | 
|---|
| 9 |  | 
|---|
| 10 | sampling: pull random evtn numbers without putting back | 
|---|
| 11 | generate a random list with subset of eventlist. pull random number and put | 
|---|
| 12 | it in list sorted. if number occurs again skip it. and try next number | 
|---|
| 13 | USE: STL set | 
|---|
| 14 | */ | 
|---|
| 15 |  | 
|---|
| 16 | #ifndef SAMPLE_H | 
|---|
| 17 | #define SAMPLE_H | 
|---|
| 18 |  | 
|---|
| 19 | /**  A one line description of the class. | 
|---|
| 20 | * | 
|---|
| 21 | * #include "XX.h" <BR> | 
|---|
| 22 | * -llib | 
|---|
| 23 | * | 
|---|
| 24 | * A longer description. | 
|---|
| 25 | * | 
|---|
| 26 | * @see something | 
|---|
| 27 | */ | 
|---|
| 28 |  | 
|---|
| 29 |  | 
|---|
| 30 | // SYSTEM INCLUDES | 
|---|
| 31 | #include <iostream> | 
|---|
| 32 | #include <vector> | 
|---|
| 33 | #include <set> | 
|---|
| 34 | #include <utility> | 
|---|
| 35 | // | 
|---|
| 36 |  | 
|---|
| 37 | // PROJECT INCLUDES | 
|---|
| 38 | #include <TRandom3.h> | 
|---|
| 39 | // | 
|---|
| 40 |  | 
|---|
| 41 | //Evt data types | 
|---|
| 42 | // | 
|---|
| 43 |  | 
|---|
| 44 | // LOCAL INCLUDES | 
|---|
| 45 | // | 
|---|
| 46 |  | 
|---|
| 47 | // FORWARD REFERENCES | 
|---|
| 48 | // | 
|---|
| 49 | using namespace std; | 
|---|
| 50 |  | 
|---|
| 51 | class Sample | 
|---|
| 52 | { | 
|---|
| 53 | public: | 
|---|
| 54 | // LIFECYCLE | 
|---|
| 55 |  | 
|---|
| 56 | /** Default constructor. | 
|---|
| 57 | */ | 
|---|
| 58 | Sample(); | 
|---|
| 59 | Sample(int size); | 
|---|
| 60 | Sample(vector<int> *RndNumList); | 
|---|
| 61 | Sample(vector<int> *RndNumList, int size); | 
|---|
| 62 |  | 
|---|
| 63 | ~Sample(void); | 
|---|
| 64 | // OPERATORS | 
|---|
| 65 |  | 
|---|
| 66 | //    /** Assignment operator. | 
|---|
| 67 | //    * | 
|---|
| 68 | //    * @param from THe value to assign to this object. | 
|---|
| 69 | //    * | 
|---|
| 70 | //    * @return A reference to this object. | 
|---|
| 71 | //    */ | 
|---|
| 72 | //    MonteCarlo&                     operator=(const XX& from); | 
|---|
| 73 |  | 
|---|
| 74 | // OPERATIONS | 
|---|
| 75 | void InitMembers(); | 
|---|
| 76 |  | 
|---|
| 77 | int     GenerateRandomInt(); | 
|---|
| 78 | int     GenerateRandomInt(int min, int max); | 
|---|
| 79 | void    GenerateSample(); | 
|---|
| 80 | void    GenerateSample(vector<int>* sampleVector, int min, int max, int size); | 
|---|
| 81 | void    BootstrapSample(); | 
|---|
| 82 | void    BootstrapSample(vector<int>* sampleVector, int min, int max, int size); | 
|---|
| 83 |  | 
|---|
| 84 |  | 
|---|
| 85 | // ACCESS | 
|---|
| 86 | void    SetMinNumber(int min); | 
|---|
| 87 | void    SetMaxNumber(int max); | 
|---|
| 88 | void    SetSampleSize(int size); | 
|---|
| 89 | void    SetSeed(int seed); | 
|---|
| 90 | int     GetMinNumber(); | 
|---|
| 91 | int     GetMaxNumber(); | 
|---|
| 92 | int     GetSampleSize(); | 
|---|
| 93 | int     GetSeed(); | 
|---|
| 94 | void    GetRndListValues(vector<int> *RndNumList); | 
|---|
| 95 | vector<int>*    GetRndListPtr(); | 
|---|
| 96 |  | 
|---|
| 97 | // INQUIRY | 
|---|
| 98 | private: | 
|---|
| 99 | vector<int>*    mpRndNumList; | 
|---|
| 100 | int             mMinNumber; | 
|---|
| 101 | int             mMaxNumber; | 
|---|
| 102 | int             mSampleSize; | 
|---|
| 103 | int             mSeed; | 
|---|
| 104 | TRandom3        mRandom; | 
|---|
| 105 |  | 
|---|
| 106 | }; | 
|---|
| 107 |  | 
|---|
| 108 | // INLINE METHODS | 
|---|
| 109 | // | 
|---|
| 110 |  | 
|---|
| 111 | // EXTERNAL REFERENCES | 
|---|
| 112 | // | 
|---|
| 113 |  | 
|---|
| 114 | #endif // SAMPLE_H | 
|---|
| 115 |  | 
|---|