Ignore:
Timestamp:
10/26/11 10:53:20 (13 years ago)
Author:
kraehenb
Message:
Added more comments. Questions please to tpk@phys.ethz.ch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/rootmacros/gainanalysis.C

    r12166 r12275  
    2121{
    2222//******************************************************************************
    23 //Read a datafile and plot the DRS-calibrated data
    24 //ATTENTION: only works for ROI=1024
     23//Read a file with G-APD singles, analyse them and plot the spectra
     24//This source code is best read with a wide editor (>100 characters per line) or a horizontal scroll bar.
     25//ATTENTION: this script only works for ROI=1024
    2526// (array indices of the calibration wrong otherwise)
    2627//******************************************************************************
     
    9293        Double_t par_init[5+2*n_peaks] = {70,90,100,15,10,15,10,30,30};
    9394        Double_t parread_tmp[5+2*n_peaks];
    94         Double_t parread[data_px][5+2*n_peaks];
    9595//      TF1 *f_peaks = new TF1("total","[2]*TMath::Exp(-(x-[0])*(x-[0])/(2*[3]*[3])) + [4]*TMath::Exp(-(x-[0]-[1])*(x-[0]-[1])/(2*[5]*[5])) + [6]*TMath::Exp(-(x-[0]-2*[1])*(x-[0]-2*[1])/(2*[7]*[7])) + [8]*TMath::Exp(-(x-[0]-3*[1])*(x-[0]-3*[1])/(2*[9]*[9])) + [10]*TMath::Exp(-(x-[12])*(x-[12])/(2*[11]*[11]))",fit_start,fit_end);
    9696//      Double_t par_init[3+2*n_peaks] = {70,90,500000,15,50000,15,5000,15,500,15,800000,20,0};
     
    120120       
    121121//-------------------------------------------
    122 //Oscilloscope
     122//Oscilloscope (search for peaks and fill integral into the histograms)
    123123//-------------------------------------------
    124124//      float threshold = pedestal_mean+pedestal_rms;
     
    174174//      canv_spect->Update();
    175175//***********************
     176       
     177//-------------------------------------------
     178//Fit the histograms and store the parameters into parread
     179//parread_dist: peak difference (gain) per pixel, parread_x: x-Values for the TGraph
     180//-------------------------------------------
     181        Double_t parread[data_px][5+2*n_peaks];
    176182        Double_t parread_dist[data_px];
    177183        Double_t parread_x[data_px];
     
    196202        }
    197203       
     204//-------------------------------------------
     205//Plot the gain of all pixel
     206//-------------------------------------------
    198207        canv_gain->cd();
    199208        TGraph* plot_gain = new TGraph(data_px,parread_x,parread_dist);
     
    207216       
    208217//-------------------------------------------
    209 //Draw the data where the gain is out of limits
     218//Draw the spectrum of pixel where the gain is out of limits
     219//Drawn are the fitted function (f_peaks) and its components (f_peak[i], f_pedestal)
    210220//-------------------------------------------
    211221        char temp = 'x';
     
    238248                }
    239249        }
    240 //-------------------------------------------
    241 //Draw the data
     250       
     251//-------------------------------------------
     252//Give the possibility to draw the spectrum of any pixel
    242253//-------------------------------------------
    243254        canv_spect->cd();
Note: See TracChangeset for help on using the changeset viewer.