Go4Loop Program - PNapi90/DESPEC-Analysis-Framework GitHub Wiki

The Go4 loop program is responsible for getting the different data streams via the pointer int* pdata, identifing the different Detector-Systems via PrcID and start the data processing and eventbuilding (at the moment, this programm is called First_Test.cxx/h).

If you want to generate ROOT histograms or do rudimentary analysis, please do it inside this program.

Defining histograms

To define histogram, use the overloaded constructor (not default) of the Go4 Loop Program TSCNUnpackProc(const char*). There you can initialize your histograms via Hist_X = MakeTH1('D',name,name,nbins,min,max) (for 1D histograms). You also have to add those histograms to the header file (.h file).

If you want to initialize a list (or an array of histograms) you can do it in the following kind of way (let's assume you want to create an array of histograms with 4 rows and 4 columns)

  • Define your histogram pointer (called x for now) in the header via TH1*** x
  • In the cxx file constructor:
x = new TH1**[4];
for(int i = 0;i < 4;++i){
    x[i] = new TH1*[4];
    for(int j = 0;j < 4;++j) x[i][j] = MakeTH1(...);
}
  • Via x[i][j]->Fill(...), you can fill the respective histogram.
  • For the correct name of the histogram, you can use Form("some_name_%d_%d",i,j), where the placeholders %d are filled by i and j respectively.
  • If you have a long list of possible combinations (e.g. channel i vs channel j), you can also initialize "on demand".
x = new TH1**[150];
for(int i = 0;i < 150;++i){
    x[i] = new TH1*[300];
    for(int j = 0;j < 300;++j) x[i][j] = NULL;
    //without x[i][j] = NULL, this would create 45000 histograms
}

//somewhere in the analysis part
if(!x[i][j]) x[i][j] = MakeTH1(...);
x[i][j]->Fill(...);
  • This only creates the histograms that will contain data.