Changeset 14952


Ignore:
Timestamp:
02/24/13 11:07:17 (12 years ago)
Author:
Jens Buss
Message:
whitespace and comments
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/rootmacros/PulseTemplates/Sample.C

    r14951 r14952  
    198198Sample::BootstrapTH1(TH1* inputHisto, TH1*  outHisto)
    199199{
     200    //reset outHisto in case it is reused
    200201    outHisto->Reset();
    201202
    202     //compute the median for 1-d histogram h1
     203    //compute number of bins for 1-d histogram h1
    203204    int nbins = inputHisto->GetXaxis()->GetNbins();
    204205
     
    206207    //we need to get the binning
    207208
    208     //entries of TH1
     209    //vector to contain entries of TH1
    209210    vector<double>    entries;
    210211
    211212    //quantity of entries in bin
    212     int quantity    = 0;
    213     double value       = 0;
     213    int     quantity    = 0;        //number of entries in a bin
     214    double  value       = 0;        //value of a bin
     215
     216    //Loop over bins to fill entries vektor
    214217    for (int i=0;i<nbins;i++)
    215218    {
    216219        value       = inputHisto->GetBinLowEdge(i);
    217220        quantity    = inputHisto->GetBinContent(i);
     221        //Loop over bin quantities
    218222        for (int j = 0; j < quantity; j++)
    219223        {
     224            // fill entries vektor with value of a bin
     225            // as many times as the bin has entries
    220226            entries.push_back(value);
    221227        }
     
    230236    vector<int> entryID (sampleSize,0);
    231237
    232     //calculate a list with random EntryIDs and fill it into entryID
     238    //calculate a list with random int numbers between 0 ad sampleSize
     239    // and fill it into entryID vector
    233240    BootstrapSample(&entryID, 0, sampleSize, sampleSize );
    234241
     
    237244    for ( unsigned int i = 0 ; i < entryID.size(); i++ )
    238245    {
     246        //fill values pulled from entries vektor into outHisto
    239247        outHisto->Fill(
    240248                    entries.at( entryID.at(i) )
     
    243251    }
    244252
     253    //return the nummber of filled entries
    245254    return counter + 1;
    246255}
Note: See TracChangeset for help on using the changeset viewer.