Example macro file that reads a reduced-CoBo file to build the average and the RMS for each channel (only one is displayed).
This example uses the functions from the GETRoot library. It can be executed in a ROOT session with:
void PlotRCoBo_ChannelMeanRMS ( const string & data_file, u_short aget_id, u_short chan_id )
{
GSetVerboseLevel(3);
getProcessedInfoCount = 5;
u_int n = 512;
double dt = 0.01;
GETSample & sample_out = rcobo[0][0][aget_id][chan_id].OutSample();
cout << endl
<< "Computing averages" << endl;
u_int nr = GETRCoBoMean ( rcobo, data_file, 0, false );
cout << endl
<< "Number of events read: " << nr << endl
<< endl;
if (nr > 0)
{
cout << "Computing RMS" << endl
<< endl;
GETRCoBoStdDeviation ( rcobo, 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/RCoBo_ChannelMeanRMS.eps" );
}
}