Example of a ROOT macro that computes the average samples and the RMS for all channels, from aTPC demonstrator run file.
The processing is done by the functions from the GETRoot library.
void PlotDemonstrator_RMS2 ( const string & data_file,
u_short cobo_id,
u_short asad_id,
u_short aget_id,
u_short chan_id )
{
GSetVerboseLevel(3);
getProcessedInfoCount = 5;
u_short ncobo = 2;
u_int n = 512;
double dt = 0.01;
GETSample & sample_out = gDem[cobo_id][asad_id][aget_id][chan_id].OutSample();
cout << endl
<< "Computing averages" << endl;
u_int nr = GETSystemMean ( gDem, data_file, 0, false );
cout << endl
<< "Number of events read: " << nr << endl
<< endl;
if (nr > 0)
{
cout << "Computing RMS" << endl
<< endl;
GETSystemStdDeviation ( gDem, data_file, 0, false );
GETSample sample_inf = sample_mean - sample_out;
GETSample sample_sup = sample_mean + sample_out;
TGraph * gr_mean = sample_mean.CreateFunctionGraph ( );
gr_mean->SetTitle ( "Average + RMS channel output" );
gr_mean->SetLineColor ( kRed+1 );
gr_mean->SetLineWidth ( 2 );
gr_mean->SetLineStyle ( 1 );
gr_mean->GetXaxis()->SetRangeUser ( 0., (n-1)*dt );
TGraph * gr_inf = sample_inf.CreateFunctionGraph ( );
gr_inf->SetLineColor ( kGreen+1 );
gr_inf->SetLineWidth ( 1 );
gr_inf->SetLineStyle ( 1 );
TGraph * gr_sup = sample_sup.CreateFunctionGraph ( );
gr_sup->SetLineColor ( kGreen+1 );
gr_sup->SetLineWidth ( 1 );
gr_sup->SetLineStyle ( 1 );
TCanvas * canvas = new TCanvas ( "PlotRMS", "PLOTRMS", 800, 400 );
gr_mean->Draw ( "AL" );
gr_inf->Draw ( "L" );
gr_sup->Draw ( "L" );
gSystem->mkdir ( "plots", kTRUE );
canvas->SaveAs ( "plots/Demonstrator_RMS2.eps" );
}
}