Adding UCESB reader - R3BRootGroup/R3BRoot GitHub Wiki

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.

Create class

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$MappedData class deriving from TObject and placed into corresponding subdirectory of r3bdata folder.

Example implementation

Initialization

{
// Initialize input UCESB structure
Int_t ok;
EXT_STR_h101_raw_nnp_ITEMS_INFO(ok, *a_struct_info, EXT_STR_h101, 1);
if (!ok)
{
// Throw error
perror("ext_data_struct_info_item");
fLogger->Error(MESSAGE_ORIGIN, "Failed to setup structure information.");
return kFALSE;
}
// Register output array in tree
FairRootManager::Instance()->Register("NeulandMappedItem", "Land", fArray, kTRUE);
return kTRUE;
}

Data conversion

{
// 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[0]._[24]._[0].E; // 1st plane, bar no. 25, first side
if (tdc1)
{
new ((*fArray)[fArray->GetEntriesFast()])
R3BNeulandMappedItem(0, 0, 0, 0, 0, 4096 - tdc1, 0, 25, 1, kFALSE);
}
fNEvent += 1;
return kTRUE;
}

Resetting

// Reset the output array
fArray->Clear();

Usage

An instance of the reader has to be added to the R3BUcesbSource object in a steering macro.