A UCESB Reader for a detector is a class, which converts unpacker's structures into R3BRoot data objects and stores them in the output file.
Te class has to inherit from abstract base class R3BReader and has to be located in the r3bsource subdirectory.
As an example for creating reader for a detector, you can use r3bsource/R3BNeulandTacquilaReader class. The following pure virtual functions have to be implemented:
- Bool_t Init(ext_data_struct_info*); // for initialisation of input/output.
- Bool_t Read(); // for data conversion.
- void Reset(); // for resetting the output array.
Create data structure
Output data is to be stored in R3B$Det_Name$MappedItem class deriving from TObject and placed into corresponding subdirectory of r3bdata folder. For more details, you can have a look at the corresponding tutorial from R3BRoot Workshop.
// Initialize input UCESB structure
EXT_STR_h101_raw_nnp_ITEMS_INFO(ok, *a_struct_info, EXT_STR_h101, 1);
// Throw error
fLogger->Error(MESSAGE_ORIGIN, "Failed to setup structure information.");
// Register output array in tree
FairRootManager::Instance()->Register("NeulandMappedItem", "Land", fArray, kTRUE);
// Convert plain raw data to multi-dimensional array
EXT_STR_h101_onion* data = (EXT_STR_h101_onion*)fData;
// Signal channel
UInt_t tdc1 = data->NNP._._.E; // 1st plane, bar no. 25, first side
R3BNeulandMappedItem(0, 0, 0, 0, 0, 4096 - tdc1, 0, 25, 1, kFALSE);
fNEvent += 1;
An instance of the reader has to be added to the R3BUcesbSource object in a steering macro.