Changeset 13785 for fact/tools


Ignore:
Timestamp:
05/18/12 21:36:54 (12 years ago)
Author:
Jens Buss
Message:
renamed temporary functions, set them to pointers
File:
1 edited

Legend:

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

    r13652 r13785  
    44#include "templateextractors.h"
    55#include <stdlib.h>
     6
    67using namespace std;
    78
     
    262263                                 << " Overlay"
    263264                                 << endl;
    264     TH2F*   hInputHistoArray        = NULL;
    265     TH1F*   hOutputMaxHistoArray    = NULL;
    266     TH1F*   hOutputMeanHistoArray   = NULL;
    267     TH1F*   hOutputMedianHistoArray = NULL;
     265    TH2F*   hInputHisto             = NULL;
     266    TH1F*   hOutputMaxHisto         = NULL;
     267    TH1F*   hOutputMeanHisto        = NULL;
     268    TH1F*   hOutputMedianHisto      = NULL;
    268269    TH1*    hTempHisto              = NULL;
    269270    float   max_prop                = 0;
     
    274275    {
    275276        cout << "...setting pointers to histogramm arrays ";
     277        cout << " for " << overlayType << "Overlay" << endl;
    276278    }
    277279    if (overlayType.Contains("Edge"))
    278280    {
    279         hInputHistoArray        = CurrentPixel->hEdgeOverlay[pulse_order];
     281        hInputHisto        = (CurrentPixel->hEdgeOverlay[pulse_order]);
    280282
    281283        //Maximum Propability of Slices
    282         hOutputMaxHistoArray    = CurrentPixel->hPixelEdgeMax[pulse_order];
     284        hOutputMaxHisto    = (CurrentPixel->hPixelEdgeMax[pulse_order]);
    283285
    284286        //Mean of Slices
    285         hOutputMeanHistoArray   = CurrentPixel->hPixelEdgeMean[pulse_order];
     287        hOutputMeanHisto   = (CurrentPixel->hPixelEdgeMean[pulse_order]);
    286288
    287289        //Median of Slices
    288         hOutputMedianHistoArray = CurrentPixel->hPixelEdgeMedian[pulse_order];
     290        hOutputMedianHisto = (CurrentPixel->hPixelEdgeMedian[pulse_order]);
    289291    }
    290292    else if (overlayType.Contains("Maximum"))
    291293    {
    292         hInputHistoArray        = CurrentPixel->hMaxOverlay[pulse_order];
     294        hInputHisto        = (CurrentPixel->hMaxOverlay[pulse_order]);
    293295
    294296        //Maximum Propability of Slices
    295         hOutputMaxHistoArray    = CurrentPixel->hPixelMax[pulse_order];
     297        hOutputMaxHisto    = (CurrentPixel->hPixelMax[pulse_order]);
    296298
    297299        //Mean of Slices
    298         hOutputMeanHistoArray   = CurrentPixel->hPixelMean[pulse_order];
     300        hOutputMeanHisto   = (CurrentPixel->hPixelMean[pulse_order]);
    299301
    300302        //Median of Slices
    301         hOutputMedianHistoArray = CurrentPixel->hPixelMedian[pulse_order];
     303        hOutputMedianHisto = (CurrentPixel->hPixelMedian[pulse_order]);
    302304    }
    303305    else
    304306    {
    305         cout << endl << "Unknown Overlay Method-->aborting" << endl;
     307        cout << endl << overlayType << "Unknown Overlay Method-->aborting" << endl;
    306308        return;
    307309    }
     
    311313    }
    312314
    313     if (verbosityLevel > 2) cout << "\t...calculation of "
    314                                  << "pulse order " << pulse_order << endl;
    315 
    316     cout << "################ " << endl;
    317     //  vector max_value_of to number of timeslices in Overlay Spectra
    318     cout << "### " << hInputHistoArray;
    319     cout << "################ " << endl;
    320 
    321 //    int nbins = hInputHistoArray->GetXaxis()->GetNbins();
    322 //    cout << "###" << nbins << endl;
    323 
     315    if (verbosityLevel > 2)
     316    {
     317        cout << "\t...calculation of "
     318             << "pulse order " << pulse_order << endl;
     319    }
    324320
    325321//    if (verbosityLevel > 2) cout << "\t...# slices processed " << nbins << endl;
     
    328324    {
    329325
    330         hTempHisto  = hInputHistoArray->ProjectionY("",TimeSlice,TimeSlice);
     326        hTempHisto  = hInputHisto->ProjectionY("",TimeSlice,TimeSlice);
    331327
    332328        if (verbosityLevel > 3)
     
    346342
    347343        if (verbosityLevel > 4) cout << "\t\t\t\t MaxProb of Slice " << TimeSlice << ": " << max_prop << endl;
    348         hOutputMaxHistoArray->SetBinContent(TimeSlice, max_prop );
     344        hOutputMaxHisto->SetBinContent(TimeSlice, max_prop );
    349345
    350346        if (verbosityLevel > 4) cout << "\t\t\t\t Mean of Slice " << TimeSlice << ": " << mean << endl;
    351         hOutputMeanHistoArray->SetBinContent(TimeSlice, mean );
     347        hOutputMeanHisto->SetBinContent(TimeSlice, mean );
    352348
    353349        if (verbosityLevel > 4) cout << "\t\t\t\t Median of Slice " << TimeSlice << ": " << median << endl;
    354         hOutputMedianHistoArray->SetBinContent(TimeSlice, median );
    355 //            delete h1;
     350        hOutputMedianHisto->SetBinContent(TimeSlice, median );
     351        delete hTempHisto;
    356352
    357353    }//Loop over Timeslices
     
    369365        )
    370366{
     367//    TSystem this_system();
     368//    this_system.cd(path);
     369//    cout << this_system.pwd();
     370//    this_system.mkdir("CSV");
    371371    path = CurrentPixel->CsvFileName( path, overlayMethod, order);
    372372
    373     TH1F**  Max_histo_array    = NULL;
    374     TH1F**  Median_histo_array    = NULL;
    375     TH1F**  Mean_histo_array    = NULL;
     373    TH1F*  Max_histo    = NULL;
     374    TH1F*  Median_histo    = NULL;
     375    TH1F*  Mean_histo    = NULL;
    376376
    377377    if (overlayMethod.Contains("Maximum"))
    378378    {
    379             Max_histo_array = CurrentPixel->hPixelMax;
    380             Median_histo_array = CurrentPixel->hPixelMedian;
    381             Mean_histo_array = CurrentPixel->hPixelMean;
     379        Max_histo = CurrentPixel->hPixelMax[order];
     380            Median_histo = CurrentPixel->hPixelMedian[order];
     381            Mean_histo = CurrentPixel->hPixelMean[order];
    382382    }
    383383    else if (overlayMethod.Contains("Edge"))
    384384    {
    385         Max_histo_array = CurrentPixel->hPixelMax;
    386         Median_histo_array = CurrentPixel->hPixelMedian;
    387         Mean_histo_array = CurrentPixel->hPixelMean;
     385        Max_histo = CurrentPixel->hPixelMax[order];
     386        Median_histo = CurrentPixel->hPixelMedian[order];
     387        Mean_histo = CurrentPixel->hPixelMean[order];
    388388    }
    389389    else
     
    394394
    395395
    396     Int_t nbins = Max_histo_array[order]->GetXaxis()->GetNbins();
     396    Int_t nbins = Max_histo->GetXaxis()->GetNbins();
    397397
    398398    if (verbosityLevel > 0)
     
    421421    {
    422422        out << TimeSlice << "," ;
    423         out << Max_histo_array[order]->GetBinContent(TimeSlice) << ",";
    424         out << Mean_histo_array[order]->GetBinContent(TimeSlice) << ",";
    425         out << Median_histo_array[order]->GetBinContent(TimeSlice) << endl;
     423        out << Max_histo->GetBinContent(TimeSlice) << ",";
     424        out << Mean_histo->GetBinContent(TimeSlice) << ",";
     425        out << Median_histo->GetBinContent(TimeSlice) << endl;
    426426    }
    427427    out.close();
Note: See TracChangeset for help on using the changeset viewer.