Example of a ROOT macro that computes the average fluctuations over time buckets, for all channels.
The processing is done by the functions from the GETRoot library for the channels mean and RMS samples, and then by the macro for averaging the RMS over time buckets.
void PlotDemonstrator_Noise ( const string & data_file )
{
GSetVerboseLevel(3);
getProcessedInfoCount = 5;
gStyle->SetPadLeftMargin ( 0.06 );
gStyle->SetPadRightMargin ( 0.02 );
gStyle->SetTitleOffset ( 1.0, "X" );
gStyle->SetTitleOffset ( 0.5, "Y" );
gStyle->SetTitleSize ( 0.05, "XYZ" );
gStyle->SetLabelSize ( 0.05, "XY" );
gStyle->SetLabelSize ( 0.04, "Z" );
gStyle->SetLabelOffset ( 0.005, "Z" );
u_short ncobo = 2;
u_int n = 512;
double dt = 0.01;
cout << endl
<< "Computing RMS samples" << endl;
u_int nr = GETSystemMean ( gDem, data_file, 0, false );
cout << "Number of events read: " << nr << endl
<< endl;
if (nr > 0)
{
GETSystemStdDeviation ( gDem, data_file, 0, false );
TGraphErrors * gr_noise = new TGraphErrors ( nch );
TGraph * gr_pts = new TGraphErrors ( nch );
for ( u_int k = 0; k < nch; ++k )
{
double rms = out->GetMean ( );
double sig = out->GetRMS ( );
gr_pts->SetPoint ( k, k, rms );
gr_noise->SetPoint ( k, k, rms );
gr_noise->SetPointError ( k, 0., sig );
}
gr_noise->SetTitle ( "Average channels noise" );
gr_noise->SetLineColor ( kRed+1 );
gr_noise->SetLineWidth ( 1 );
gr_noise->SetLineStyle ( 1 );
gr_noise->SetMarkerColor ( kRed+1 );
gr_noise->SetMarkerStyle ( 20 );
gr_noise->SetMarkerSize ( 0.3 );
gr_pts->SetMarkerColor ( 1 );
gr_pts->SetMarkerStyle ( 20 );
gr_pts->SetMarkerSize ( 0.5 );
gr_noise->GetXaxis()->SetRangeUser ( -1., nch );
gr_noise->GetXaxis()->SetTitle ( "channel index" );
gr_noise->GetYaxis()->SetTitle ( "noise (coder units)" );
gr_noise->GetXaxis()->CenterTitle ( );
gr_noise->GetYaxis()->CenterTitle ( );
TCanvas * canvas = new TCanvas ( "PlotNoiseSummary", "PlotNoiseSummary", 1500, 400 );
gr_noise->Draw ( "AP" );
gr_pts->Draw ( "P" );
canvas->Update();
gSystem->mkdir ( "plots", kTRUE );
canvas->SaveAs ( "plots/Demonstrator_Noise.eps" );
}
}