GET library
ReadRCoBo.C

Example file to read 1 event and plot the content of a full AGET chip.

It can be executed in a ROOT session with:

* [ROOT] .L ReadRCoBo.C
* [ROOT] RCoBoPlotAGet ( "../../data/RCoBo/CoBo_baseline.graw", 1, 17 );
*
//======================================================================
// ROOT macros for RCoBo system
//
// - read a test file (from reduced CoBo)
// - display all channels signal (with function from GET/ROOT library)
//
//======================================================================
/*
These macros require to load the GET libraries
gROOT->Macro ( (getenv("GET_BASE")+string("/root/GETRootLibs.C")).c_str() );
To execute the macro
.L ReadRCoBo.C
RCoBoPlotAGet ( "../../data/RCoBo/CoBo_pulser.graw", 1, 0 );
*/
//----------------------------------------------------------------------
// This function plots signals for one AGet chip of the selected event
// in the data file
void RCoBoPlotAGet ( const string & data_file, int evt, int aget_id )
{
GSetVerboseLevel(6);
// create the GET system (reduced CoBo)
// - 512 samples / channel
// - 0.01 us sampling time
u_int n = 512;
double dt = 0.01;
GETRCoBo get(n,dt);
// read until selected event
bool event_ok = true;
get.OpenRunFile ( data_file );
for (int i = 0; i < evt; ++i)
{
int res = get.ReadEvent ( false ); // no processing
if (res != 0)
{ event_ok = false; i = evt; }
}
get.CloseRunFile ( );
// requested event has been read
if (event_ok)
{
GETAGet * aget = &get[0][0][aget_id];
// use the GETRoot library
GETPlotAGet ( *aget );
}
else // error on event number
GLogWarning ( "PlotAGet: it seems that event #" + GGetString(evt)
+ " does not exist" );
}