Index: fact/tools/rootmacros/PulseTemplates/Sample.C
===================================================================
--- fact/tools/rootmacros/PulseTemplates/Sample.C	(revision 14742)
+++ fact/tools/rootmacros/PulseTemplates/Sample.C	(revision 14743)
@@ -86,6 +86,7 @@
         int     max)
 {
-    int rndNum = min + mRandom.Integer(max - min);
-    cout << rndNum << endl;
+//    int rndNum = min + mRandom.Integer(max - min);
+    int rndNum = (int) mRandom.Uniform(min, max);
+//    cout << rndNum << endl;
     return rndNum;
 }
@@ -166,4 +167,77 @@
 }
 
+
+int
+Sample::BootstrapVector(vector<double> *inVector, vector<double> *outVector)
+{
+    //get size of sample to be bootstrapped
+    int sampleSize = inVector->size();
+
+    //Vector with positions in original sample
+    vector<int> entryID (sampleSize,0);
+
+    //calculate wich entries from inVector will be put into outVector
+    BootstrapSample(&entryID, 0, sampleSize, sampleSize );
+
+    vector<int>::iterator it;
+
+    //Loop over entryID vector to fill content from inVector to outVector
+    int counter = 0;
+    for ( it=entryID.begin() ; it != entryID.end(); it++ )
+    {
+        outVector->at(counter) = inVector->at(*it);
+        counter++;
+    }
+
+    return counter + 1;
+}
+
+int
+Sample::BootstrapTH1(TH1* inputHisto, TH1*  outHisto)
+{
+    //compute the median for 1-d histogram h1
+    int nbins = inputHisto->GetXaxis()->GetNbins();
+
+    //we need to get the binning
+
+    //entries of TH1
+    vector<float>    entries;
+
+    //quantity of entries in bin
+    int quantity    = 0;
+    float value       = 0;
+    for (int i=0;i<nbins;i++)
+    {
+        value       = inputHisto->GetBinLowEdge(i);
+        quantity    = inputHisto->GetBinContent(i);
+//        cout << value << "(" << quantity << ") ";
+        for (int j = 0; j < quantity; j++)
+        {
+            entries.push_back(value);
+        }
+    }
+
+    //get size of sample to be bootstrapped
+    int sampleSize = entries.size();
+
+    //Vector with positions in original sample
+    vector<int> entryID (sampleSize,0);
+
+    //calculate a list with random EntryIDs and fill it into entryID
+    BootstrapSample(&entryID, 0, sampleSize, sampleSize );
+
+    //Loop over entryID vector to bootstrap the histogram
+    int counter = 0;
+    for ( unsigned int i = 0 ; i < entryID.size(); i++ )
+    {
+        outHisto->Fill(
+                    entries.at( entryID.at(i) )
+                    );
+        counter++;
+    }
+
+    return counter + 1;
+}
+
 void
 Sample::BootstrapSample()
@@ -181,8 +255,16 @@
         int   size)
 {
+    if (size == 0){
+        cout << "size = 0; nothing to do" << endl;
+        return;
+    }
+
+    //resize the sample vector to size of boostrapped sample
     sampleVector->resize(size);
 
+    //list of rndnumbers pulled with putting back
     multiset<int> sampleSet;
 
+    //loop over samplesize to generate random numbers to fill into sampleset
     for (int i = 0; i < size; i++)
     {
@@ -196,4 +278,6 @@
 
     int counter = 0;
+    // loop over list of rndnumbers and fill their entries into sampleVector
+    // entries are vector positions
     for ( it=sampleSet.begin() ; it != sampleSet.end(); it++ )
     {
@@ -204,2 +288,3 @@
     return;
 }
+//NOTE: crashes for some reason if size is smaller than max-min
