Index: fact/tools/rootmacros/PulseTemplates/Sample.C
===================================================================
--- fact/tools/rootmacros/PulseTemplates/Sample.C	(revision 14706)
+++ fact/tools/rootmacros/PulseTemplates/Sample.C	(revision 14706)
@@ -0,0 +1,205 @@
+#include "Sample.h"
+
+Sample::Sample()
+{
+    InitMembers();
+    mpRndNumList = new vector<int>;
+}
+
+Sample::Sample(int size)
+{
+    InitMembers();
+    mpRndNumList = new vector<int>;
+    mpRndNumList->resize(size);
+}
+
+Sample::Sample(vector<int> *RndNumList)
+{
+    InitMembers();
+    mpRndNumList    =   RndNumList;
+}
+
+Sample::Sample(vector<int> *RndNumList, int size)
+{
+    InitMembers();
+    mpRndNumList    =   RndNumList;
+    mpRndNumList->resize(size);
+}
+
+Sample::~Sample(void)
+{
+    if (mpRndNumList != NULL)
+    {
+        delete mpRndNumList;
+    }
+}
+
+void Sample::InitMembers()
+{
+    mpRndNumList    = NULL;
+    mMinNumber      = 0;
+    mMaxNumber      = 0;
+    mSampleSize     = 0;
+    mSeed           = 4357;
+}
+
+//============================================================================
+//ACCESS
+//============================================================================
+void    Sample::SetMinNumber(int min){  mMinNumber  = min; return;}
+void    Sample::SetMaxNumber(int max){  mMaxNumber  = max; return;}
+void    Sample::SetSampleSize(int size){mSampleSize = size; return;}
+void    Sample::SetSeed(int seed)
+{
+    mSeed = seed;
+    mRandom.SetSeed(mSeed);
+    return;
+}
+int     Sample::GetMinNumber(){return   mMinNumber;}
+int     Sample::GetMaxNumber(){return   mMaxNumber;}
+int     Sample::GetSampleSize(){return  mSampleSize;}
+int     Sample::GetSeed(){return  mSeed;}
+
+void    Sample::GetRndListValues(vector<int> *RndNumList)
+{
+    vector<int>::iterator it;
+
+    for ( it=mpRndNumList->begin() ; it < mpRndNumList->end(); it++ )
+    {
+        RndNumList->push_back(*it);
+    }
+
+    return;
+}
+
+vector<int>*    Sample::GetRndListPtr()
+{
+    return mpRndNumList;
+}
+
+//============================================================================
+//OPERATIONS
+//============================================================================
+int
+Sample::GenerateRandomInt(
+        int     min,
+        int     max)
+{
+    int rndNum = min + mRandom.Integer(max - min);
+    cout << rndNum << endl;
+    return rndNum;
+}
+
+int
+Sample::GenerateRandomInt()
+{
+    return GenerateRandomInt( mMinNumber, mMaxNumber );
+//    return 0;
+}
+
+void
+Sample::GenerateSample()
+{
+    GenerateSample( mpRndNumList, mMinNumber, mMaxNumber, mSampleSize);
+    return;
+}
+
+void
+Sample::GenerateSample(
+        vector<int>*    sampleVector,
+        int     min,
+        int     max,
+        int     size)
+{
+    if ( size > max - min)
+    {
+        cout << "sample size is larger than range of sample, will set size to range" << endl;
+        size = max - min + 1;
+    }
+    //resize destination vector for pulled numbers
+    sampleVector->resize(size);
+
+    //calculate qunatity of numbers in range
+    int qunatityOfNumbers = max - min + 1;
+
+    //crate a vector list of ordered numbers in defined range
+    vector<int> listOfNumbers;
+    listOfNumbers.resize(qunatityOfNumbers);
+
+    //fill a list of ordered numbers in defined range
+    for (int i = min; i <= max; i++)
+    {
+            listOfNumbers.at(i)=i;
+    }
+
+    //container to fill in numbers with ordering
+    set<int> sampleSet;
+
+    //container for insert result
+    bool result;
+    for (int i = 0; i < size; i++)
+    {
+        int randomNumber = GenerateRandomInt( 0, qunatityOfNumbers-i);
+        result = sampleSet.insert(listOfNumbers.at(randomNumber)).second;
+        if (result)
+        {
+//        cout << "rndNR " << randomNumber << endl;
+            listOfNumbers.erase(listOfNumbers.begin()+randomNumber);
+        }
+        else if (!result)
+        {
+            cout << " pulled number exists, pulling again" << endl;
+            i--;
+        }
+    }
+
+    set<int>::iterator it;
+
+    int counter = 0;
+    for ( it=sampleSet.begin() ; it != sampleSet.end(); it++ )
+    {
+        sampleVector->at(counter)=*it;
+        counter++;
+    }
+
+     return;
+}
+
+void
+Sample::BootstrapSample()
+{
+    BootstrapSample( mpRndNumList, mMinNumber, mMaxNumber, mSampleSize );
+
+    return;
+}
+
+void
+Sample::BootstrapSample(
+        vector<int> *sampleVector,
+        int   numMinEvent,
+        int   numMaxEvent,
+        int   size)
+{
+    sampleVector->resize(size);
+
+    multiset<int> sampleSet;
+
+    for (int i = 0; i < size; i++)
+    {
+        int randomNumber = GenerateRandomInt( numMinEvent, numMaxEvent);
+        sampleSet.insert(randomNumber);
+    }
+
+    multiset<int>::iterator it;
+
+//    set<int>::iterator it;
+
+    int counter = 0;
+    for ( it=sampleSet.begin() ; it != sampleSet.end(); it++ )
+    {
+        sampleVector->at(counter)=*it;
+        counter++;
+    }
+
+    return;
+}
Index: fact/tools/rootmacros/PulseTemplates/Sample.h
===================================================================
--- fact/tools/rootmacros/PulseTemplates/Sample.h	(revision 14706)
+++ fact/tools/rootmacros/PulseTemplates/Sample.h	(revision 14706)
@@ -0,0 +1,115 @@
+/*
+  Ideas for random sampling:
+
+  Bootstrapping: pull with pu back
+  generate a random list of Eventnumbers, induvidual number can occure certain
+  times in list, put numbers in List sorted.
+  read eventnumbers to process from list
+  USE: STL multiset
+
+  sampling: pull random evtn numbers without putting back
+  generate a random list with subset of eventlist. pull random number and put
+  it in list sorted. if number occurs again skip it. and try next number
+  USE: STL set
+  */
+
+#ifndef SAMPLE_H
+#define SAMPLE_H
+
+/**  A one line description of the class.
+ *
+ * #include "XX.h" <BR>
+ * -llib
+ *
+ * A longer description.
+ *
+ * @see something
+ */
+
+
+// SYSTEM INCLUDES
+#include <iostream>
+#include <vector>
+#include <set>
+#include <utility>
+//
+
+// PROJECT INCLUDES
+#include <TRandom3.h>
+//
+
+//Evt data types
+//
+
+// LOCAL INCLUDES
+//
+
+// FORWARD REFERENCES
+//
+using namespace std;
+
+class Sample
+{
+public:
+    // LIFECYCLE
+
+        /** Default constructor.
+        */
+    Sample();
+    Sample(int size);
+    Sample(vector<int> *RndNumList);
+    Sample(vector<int> *RndNumList, int size);
+
+    ~Sample(void);
+    // OPERATORS
+
+    //    /** Assignment operator.
+    //    *
+    //    * @param from THe value to assign to this object.
+    //    *
+    //    * @return A reference to this object.
+    //    */
+    //    MonteCarlo&                     operator=(const XX& from);
+
+    // OPERATIONS
+    void InitMembers();
+
+    int     GenerateRandomInt();
+    int     GenerateRandomInt(int min, int max);
+    void    GenerateSample();
+    void    GenerateSample(vector<int>* sampleVector, int min, int max, int size);
+    void    BootstrapSample();
+    void    BootstrapSample(vector<int>* sampleVector, int min, int max, int size);
+
+
+    // ACCESS
+    void    SetMinNumber(int min);
+    void    SetMaxNumber(int max);
+    void    SetSampleSize(int size);
+    void    SetSeed(int seed);
+    int     GetMinNumber();
+    int     GetMaxNumber();
+    int     GetSampleSize();
+    int     GetSeed();
+    void    GetRndListValues(vector<int> *RndNumList);
+    vector<int>*    GetRndListPtr();
+
+    // INQUIRY
+private:
+    vector<int>*    mpRndNumList;
+    int             mMinNumber;
+    int             mMaxNumber;
+    int             mSampleSize;
+    int             mSeed;
+    TRandom3        mRandom;
+
+};
+
+// INLINE METHODS
+//
+
+// EXTERNAL REFERENCES
+//
+
+#endif // SAMPLE_H
+
