Changeset 12170


Ignore:
Timestamp:
10/11/11 19:26:14 (13 years ago)
Author:
neise
Message:
small fix: Thomas and Werner
Location:
fact/tools/rootmacros
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/rootmacros/FPedestalAllPx.c

    r12166 r12170  
    11#include <cstdio>
    2 int FPedestalAllPx(fits &datafile, vector<int16_t> &data, vector<int16_t> &data_offset, vector<float> &drs_basemean, vector<float> &drs_gainmean, vector<float> &drs_triggeroffsetmean, UInt_t data_px, UInt_t data_roi, float pedestal_mean[], float pedestal_rms[])
     2int FPedestalAllPx(
     3    fits &datafile,
     4    vector<int16_t> &data,
     5    vector<int16_t> &data_offset,
     6    vector<float> &drs_basemean,
     7    vector<float> &drs_gainmean,
     8    vector<float> &drs_triggeroffsetmean,
     9    UInt_t data_px,
     10    UInt_t data_roi,
     11    float pedestal_mean[],
     12    float pedestal_rms[] )
    313{
    414//      TCanvas *canv_base = new TCanvas( "canv_base", "Determine the baseline", 100, 520, 700, 500 );
     
    919        TH1F* baseline[data_px];
    1020        for(int i=0; i<data_px; i++) {
    11                 std::sprintf(title_base,"Baseline of Px %i (data: %s, DRS: %s)",i);
     21
     22                std::sprintf(title_base,"Baseline of Px %i",i);
    1223                std::sprintf(name_base,"base%i",i);
     24
    1325                baseline[i] = new TH1F(name_base,title_base,2000,-99.5,100.5);
    1426                baseline[i]->GetXaxis()->SetTitle("Sample value (mV)");
     
    1628        }
    1729       
    18 //      TH1F *baseline = new TH1F("baseline", title_base, 1000,-10,40);
    19 //      baseline[i]->GetXaxis()->SetTitle("Sample value (mV)");
    20 //      baseline[i]->GetYaxis()->SetTitle("Entries");
    21        
    2230//-------------------------------------------
    2331//Find the baseline
    2432//-------------------------------------------
    25         for (size_t i=0; i<datafile.GetNumRows(); i++)
     33        for (size_t i=0; ( i<datafile.GetNumRows() ); i++)
    2634        {
    2735                datafile.GetRow(i);
    28                 cout << "Loop variable: " << i << endl;
     36                if( i%50 == 0 ) cout << "Loop variable: " << i << endl;
    2937               
    3038                //Iterate over the pixels
     
    5260                pedestal_rms[j] = baseline[j]->GetRMS();
    5361        }
    54         std::cout << "Value of maximal probability: " << pedestal_mean[1348] << " +- " << pedestal_rms[1348] << std::endl;
     62//      std::cout << "Value of maximal probability Px 1348: " << pedestal_mean[1348] << " +- " << pedestal_rms[1348] << std::endl;
    5563       
    5664//      canv_base->cd();
  • fact/tools/rootmacros/testFPedestalAllPx.C

    r12166 r12170  
    1111#include "FPedestalAllPx.c"
    1212
    13 int testFPedestalAllPx(const char *name, const char *drsname)
     13int testFPedestalAllPx(
     14    const char *name = "../raw/20110916_025.fits",
     15    const char *drsname = "../raw/20110916_024.drs.fits")
    1416{
    1517//******************************************************************************
     
    1921//Example call in ROOT:
    2022//root [74] .x calscope.C++("20110804_024.fits","20110804_023.drs.fits",10,1348)
    21 //T. Krähenbühl, August 2011, tpk@phys.ethz.ch
     23//T. Kr�henb�hl, August 2011, tpk@phys.ethz.ch
    2224//******************************************************************************
    2325
     
    5254        vector<float> drs_gainmean;
    5355        vector<float> drs_triggeroffsetmean;
     56   
    5457        FOpenCalibFile(drsname, drs_basemean, drs_gainmean, drs_triggeroffsetmean, drs_n);
    5558       
     59   
    5660//-------------------------------------------
    5761//Check the sizes of the data columns
     
    6266                return 1;
    6367        }
     68    else{
     69        cout << "Data and DRS file compatible" << endl;
     70        // continue
     71    }
    6472       
    6573       
     
    7583        float pedestal_mean[data_px];
    7684        float pedestal_rms[data_px];
     85
    7786        FPedestalAllPx(datafile, data, data_offset, drs_basemean, drs_gainmean, drs_triggeroffsetmean, data_px, data_roi, pedestal_mean, pedestal_rms);
     87
    7888//      vector<float> calevent(data_px*data_roi); //Vector for the calibrated event
    7989//      FGetCalEvent(data, data_offset, drs_basemean, drs_gainmean, drs_triggeroffsetmean, calevent, data_px, data_roi);
     
    8292//Draw the data
    8393//-------------------------------------------
     94   
    8495        TCanvas *canv_mean= new TCanvas( "canv_mean", "mean in mV", 30, 300, 900, 500 );
    8596        TH1F* histo_mean = new TH1F("histo_mean","Value of maximal probability",2000,-99.5,100.5);
Note: See TracChangeset for help on using the changeset viewer.