Skip to content

Experimental data analysis

Dmytro Kresan edited this page Aug 11, 2014 · 14 revisions

General information

Data sources

Unpacking and analysis of experimental data is to be performed using an instance of the FairRunOnline class. Multiple types of data source (remote-event-server, local LMD file, etc.) are supported by inheritance from the base abstract class FairSource. Such derived objects (FairRemoteSource, FairLmdSource) have to override following member functions:

virtual Bool_t Init();     // initialisation of the source
virtual Int_t ReadEvent(); // data parsing
virtual void Close();      // close file, socket, etc.

Unpackers

A detector-specific unpacker (derived from the abstract class FairUnpack), parses and converts data subset from a source into ROOT objects. Unpacker has to override member functions:

public:
 virtual Bool_t Init();                            // initialisation
 virtual Bool_t DoUnpack(Int_t *data, Int_t size); // data - pointer to a sub-event, size - data size in double words
 virtual void Reset();                             // clear data structures
protected:
 virtual void Register();                          // register data structures

MBS parameters of the detector (type, sub-type, crate, etc.) have to be set in the standard constructor of the FairUnpack. Using values of these parameters, the framework takes care of matching between sub-events and unpackers.

Output

Data will be stored in ROOT tree with branches defined in Register() of an unpacker class. Using the task mechanism of FairRoot, one can perform further data analysis on the fly or in a separate macro.

Steering macro

1. Create data source

FairLmdSource* source = new FairLmdSource();
source->AddFile("filename.lmd");

2. Create unpacker(s) and add them to source

// NeuLAND MBS parameters -------------------------------
Short_t type = 94;
Short_t subType = 9400;
Short_t procId = 10;
Short_t subCrate = 1;
Short_t control = 3;
source->AddUnpacker(new R3BLandUnpack("", type, subType, procId, subCrate, control));

3. Steering object and run-time database

FairRunOnline* run = new FairRunOnline(source);
run->SetOutputFile("output.root");
run->Init();
FairRuntimeDb* rtdb = run->GetRuntimeDb();
Bool_t kParameterMerged = kTRUE;
FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged);
parOut->open("params.root");
rtdb->setFirstInput(parOut);
rtdb->saveOutput();
rtdb->print();
run->Run(1000, 0);