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 deriving from the base abstract class FairSource. Such derived objects (FairRemoteSource, FairLmdSource) have to override following member functions:
virtual Int_t ReadEvent(); // data parsing
virtual void Close(); // close file, socket, etc.
The instance of a source is the parameter in the standard constructor of FairRunOnline.
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:
virtual Bool_t Init(); // initialisation
virtual Bool_t DoUnpack(Int_t *data, Int_t size); // data - pointer to an MBS sub-event, size - data size in double words
virtual void Reset(); // clear data structures
virtual void Register(); // register data structures (using FairRootManager)
MBS parameters of a detector (type, sub-type, crate, etc.) have to be set in the call to standard constructor of the FairUnpack. Using values of these parameters, the framework takes care of matching between sub-events in the data stream and user-specified unpackers.
Unpackers, created in the macro, are to be added to the source using FairSource::AddUnpacker(FairUnpack*) member function.
Data will be stored in ROOT tree with branches defined in Register() of an unpacker class:
FairRootManager* fMan = FairRootManager::Instance();
fMan->Register("LandRawHit", "Land", fRawData, kTRUE);
Using the task mechanism of FairRoot, one can perform further data analysis on the fly or in a separate macro. In the Init() member function of an analysis task one should use:
fLandRawHit = (TClonesArray*)fMan->GetObject("LandRawHit");
1. Create data source
Reading from a local lmd-file:
Connecting to the remote-event-server:
"node_name" - name of the machine with running remote-event-server (mrevserv64)
2. Create unpacker(s) and add them to source
Short_t type = 94;
Short_t subType = 9400;
Short_t procId = 10;
Short_t subCrate = 1;
Short_t control = 3;
R3BLandUnpack *unpacker = new R3BLandUnpack("", type, subType,
procId, subCrate, control);
3. Steering object and run-time database
FairRuntimeDb* rtdb = run->GetRuntimeDb();
Bool_t kParameterMerged = kTRUE;
FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged);
Int_t nEvents = 1000;
In case a negative value is set in number of events, the event loop will continue until end of file is reached, or until CTRL+C interrupt is detected (e.g. when using remote-event-server as a data source).