source: fact/tools/rootmacros/PulseTemplates/Sample.h@ 14805

Last change on this file since 14805 was 14744, checked in by Jens Buss, 12 years ago
changed random number generator to uniform numbers, add func BootstrapVector, add func BootstrapTH1
  • Property svn:executable set to *
File size: 2.5 KB
Line 
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#include <TH1.h>
40//
41
42//Evt data types
43//
44
45// LOCAL INCLUDES
46//
47
48// FORWARD REFERENCES
49//
50using namespace std;
51
52class Sample
53{
54public:
55 // LIFECYCLE
56
57 /** Default constructor.
58 */
59 Sample();
60 Sample(int size);
61 Sample(vector<int> *RndNumList);
62 Sample(vector<int> *RndNumList, int size);
63
64 ~Sample(void);
65 // OPERATORS
66
67 // /** Assignment operator.
68 // *
69 // * @param from THe value to assign to this object.
70 // *
71 // * @return A reference to this object.
72 // */
73 // MonteCarlo& operator=(const XX& from);
74
75 // OPERATIONS
76 void InitMembers();
77
78 int GenerateRandomInt();
79 int GenerateRandomInt(int min, int max);
80 void GenerateSample();
81 void GenerateSample(vector<int>* sampleVector, int min, int max, int size);
82 void BootstrapSample();
83 int BootstrapVector(vector<double> *inVector, vector<double> *outVector);
84 int BootstrapTH1(TH1* inputHisto, TH1 *outHisto);
85 void BootstrapSample(vector<int>* sampleVector, int min, int max, int size);
86
87
88 // ACCESS
89 void SetMinNumber(int min);
90 void SetMaxNumber(int max);
91 void SetSampleSize(int size);
92 void SetSeed(int seed);
93 int GetMinNumber();
94 int GetMaxNumber();
95 int GetSampleSize();
96 int GetSeed();
97 void GetRndListValues(vector<int> *RndNumList);
98 vector<int>* GetRndListPtr();
99
100 // INQUIRY
101private:
102 vector<int>* mpRndNumList;
103 int mMinNumber;
104 int mMaxNumber;
105 int mSampleSize;
106 int mSeed;
107 TRandom3 mRandom;
108
109};
110
111// INLINE METHODS
112//
113
114// EXTERNAL REFERENCES
115//
116
117#endif // SAMPLE_H
118
Note: See TracBrowser for help on using the repository browser.