Create class for Unpacker
Note: Since we now have UCESB doing the unpacking and mapping, there shouldn't be any UNPACK structure in R3BRoot anymore.
Class for a detector unpacker has to derive from FairUnpack parent abstract class. Naming convention is: "R3B", followed by detector name, followed by "Unpack". Derived class has to override following public methods:
Bool_t DoUnpack(Int_t* data, Int_t size);
and a protected method:
In addition, standard constructor has to have MBS sub-event parameters (integers: type, subType, procId, subCrate, control), which have to be passed to the base class standard constructor.
Create Data structure
Data class has to be derived from TObject base class, and contains relevant private members of simple types (Int_t, Long_t, Double_t) with public accessors to them and standard constructor. Naming convention for the class: "R3B", followed by detector name, followed by data type ("RawHit", "CalHit", "Digi"). Classes describing data objects belong to folder r3broot/r3bdata/"DETECTOR_NAME"Data/.
Public function Init() is called by the FairRoot steering class before processing the data, and should implement necessary initialisation.
Output of the unpacker is stored to the ROOT file using FairRootManager singleton class. Function Register() has to contain:
FairRootManager::Instance()->Register("LandRawHit", "Land", fRawData, kTRUE);
and a call to the Register() method needs to be placed in Init() implementation.
Using the values of MBS sub-event parameters parsed to the standard constructor, framework assigns a sub-event to the proper unpacker. Function DoUnpack() is called once per sub-event and provides access to input data in terms of array of double words (32 bit each) and size of the array (in double words).
The data is decoded using bit patterns matching the lay-out of the sub-event, and extracted values are stored in the output data structures:
Reset of output data
Public function Reset() is called by the framework prior to processing an event, and has to clear the array of output data from previous event:
fNHits = 0;
Using output of Unpacker
The data produced by a detector unpacker can be accessed from a user-defined task, which is described in this tutorial.