BmnRoot 26.10.0-233-gb9bbe585
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnConverter Class Reference

#include <BmnConverter.h>

Collaboration diagram for BmnConverter:

Public Member Functions

 BmnConverter (uint32_t threadCount=0, uint32_t period=8, TString outDir=".", bool tempFileOnDisk=false)
virtual ~BmnConverter ()
BmnStatus ParseJsonTLV (UInt_t *buf, UInt_t &len)
void OutputSpills ()
BmnStatus FeedFile (TString name, Bool_t getRunId=kTRUE, Bool_t getSubName=kTRUE)
BmnStatus FeedEvent (UInt_t *buf, UInt_t len, Int_t type)
void SeparateEventsBySpills ()
void SeparateEventsBySpillsTM ()
void ReproduceBranches (TTree *inTree, TTree *outTree)
void SetRunId (uint32_t v)
void SetPeriod (uint32_t v)
void SetSubName (TString v)
void SetSpillMap (map< SysPoint, BmnSpillInfo > spillMap)
map< SysPoint, BmnSpillInfo > GetSpillMap ()
bool GetTempFileOnDisk ()
void Close ()
void SetDecoderConfigFileName (string FileName)
void OutputTrees ()

Static Public Member Functions

static BmnStatus ParseComplexTLV (UInt_t *buf, UInt_t &len, UInt_t &runId)

Public Attributes

vector< pair< int, pair< int, int > > > vecTree
vector< pair< int, pair< int, int > > > vecTreeSpills
map< int32_t, map< int32_t, TreePos > > treeMap
map< int32_t, multimap< SysPoint, TreePos > > treeMapSpills
multimap< SysPoint, TreePE > treeTimeMap
map< int32_t, MapTP2TreePE > treeTimeMapDiv
BmnThreadManager< BmnConverterThread > * fThreads
uint32_t fThreadCnt

Private Member Functions

Int_t GetSpillNumber (vector< SysPoint > *spillEnds, vector< SysPoint > *spillStarts, SysPoint time)
Int_t GetSpillNumber (vector< SysPoint > *spillEnds, vector< SysPoint > *spillStarts, TTimeStamp time)
BmnStatus ConvertRawToRootIterateFileRead ()
void QuickProcessEvent (UInt_t *d, UInt_t &len)
void QuickConvertStatEvent (UInt_t *buf, UInt_t &len)
void QuickProcessEvent (BmnConverterThread *&tmp, UInt_t &len)
 QuickProcessEvent reduced version in order to skip additional memcpy and read raw data directly into the thread's buffer.
void QuickConvertStatEvent (BmnConverterThread *&tmp, UInt_t &len)
BmnStatus LoadConfig ()
BmnStatus CreateTempFile ()
BmnStatus InitUTCShift ()
Int_t GetUTCShift (TTimeStamp t)

Private Attributes

const TTimeStamp TimeZero = TTimeStamp(time_t(0), 0)
pt::ptree conf
bool temp_file_on_disk
uint32_t fPeriodId
uint32_t fRunId
BmnEventType fCurEvType
FILE * fRawFileIn
TString fSubName
uint32_t fEventId
string fDecoderConfigFileName
TString fRawRunHdrName
TString fMetadataName
TString fRawTreeName
TString fRawTreeSpillName
TString fRootFileName
TString fRootDirPath
BmnSpillHeader * spillHeader
unique_ptr< DigiRunHeader > runHeader
unique_ptr< BmnMetadataRaw > metadata
unique_ptr< ROOT::TBufferMerger > fMerger
vector< TObject * > fNamVec
vector< TClonesArray * > fArrVec
uint32_t data [10000000]
uint32_t fDat
Bool_t fExportJsonBlocks
map< TTimeStamp, Int_t > leaps
TTimeStamp utc_valid
Int_t tai_utc_dif
Int_t cc = 0
map< SysPoint, BmnSpillInfo > fSpillMap
BmnConverterThread * fCurWaitingThread

Detailed Description

Definition at line 61 of file BmnConverter.h.

Constructor & Destructor Documentation

◆ BmnConverter()

BmnConverter::BmnConverter ( uint32_t threadCount = 0,
uint32_t period = 8,
TString outDir = ".",
bool tempFileOnDisk = false )

◆ ~BmnConverter()

virtual BmnConverter::~BmnConverter ( )
inlinevirtual

Definition at line 75 of file BmnConverter.h.

Member Function Documentation

◆ Close()

void BmnConverter::Close ( )
inline

Definition at line 103 of file BmnConverter.h.

References fThreads.

Referenced by OutputSpills(), and SeparateEventsBySpillsTM().

Here is the caller graph for this function:

◆ ConvertRawToRootIterateFileRead()

BmnStatus BmnConverter::ConvertRawToRootIterateFileRead ( )
private

Definition at line 480 of file BmnConverter.cxx.

References ANSI_COLOR_BLUE, ANSI_COLOR_RESET, data, fCurEvType, fDat, fEventId, fPeriodId, fRawFileIn, fRunId, kBMNCONTINUE, kBMNEMPTY, kBMNEOS, kBMNERROR, kBMNPAYLOAD, kBMNSTAT, kBMNSUCCESS, kNBYTESINWORD, kWORDSIZE, BmnConverterTools::ParseComplexTLV(), ParseJsonTLV(), QuickConvertStatEvent(), QuickProcessEvent(), SYNC_EOS, SYNC_EVENT, SYNC_EVENT_OLD, SYNC_FILE_BEGIN, SYNC_FILE_END, SYNC_JSON, SYNC_RUN_START, SYNC_RUN_STOP, and SYNC_STAT.

Referenced by FeedFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateTempFile()

BmnStatus BmnConverter::CreateTempFile ( )
private

Definition at line 106 of file BmnConverter.cxx.

References fMerger, TString::Format(), fRootDirPath, fRootFileName, fRunId, kBMNERROR, and kBMNSUCCESS.

Referenced by BmnConverter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FeedEvent()

BmnStatus BmnConverter::FeedEvent ( UInt_t * buf,
UInt_t len,
Int_t type )

Definition at line 422 of file BmnConverter.cxx.

References fCurEvType, fEventId, kBMNERROR, kBMNPAYLOAD, kBMNSTAT, kBMNSUCCESS, QuickConvertStatEvent(), and QuickProcessEvent().

Here is the call graph for this function:

◆ FeedFile()

BmnStatus BmnConverter::FeedFile ( TString name,
Bool_t getRunId = kTRUE,
Bool_t getSubName = kTRUE )

Definition at line 437 of file BmnConverter.cxx.

References ANSI_COLOR_BLUE, ANSI_COLOR_RESET, ConvertRawToRootIterateFileRead(), TString::Data(), fCurWaitingThread, fPeriodId, fRawFileIn, fRunId, fSubName, fThreadCnt, fThreads, BmnFileProp::GetRunId(), BmnConverterTools::GetSubNameAfterRunId(), i, kBMNERROR, kBMNSUCCESS, BmnConverterTools::ParseRawFileName(), TStopwatch::RealTime(), TStopwatch::Start(), TStopwatch::Stop(), vecTree, and vecTreeSpills.

Referenced by BmnDataToRootParallel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSpillMap()

map< SysPoint, BmnSpillInfo > BmnConverter::GetSpillMap ( )
inline

Definition at line 99 of file BmnConverter.h.

References fSpillMap.

◆ GetSpillNumber() [1/2]

Int_t BmnConverter::GetSpillNumber ( vector< SysPoint > * spillEnds,
vector< SysPoint > * spillStarts,
SysPoint time )
private

Definition at line 122 of file BmnConverter.cxx.

Referenced by GetSpillNumber(), SeparateEventsBySpills(), and SeparateEventsBySpillsTM().

Here is the caller graph for this function:

◆ GetSpillNumber() [2/2]

Int_t BmnConverter::GetSpillNumber ( vector< SysPoint > * spillEnds,
vector< SysPoint > * spillStarts,
TTimeStamp time )
private

Definition at line 135 of file BmnConverter.cxx.

References GetSpillNumber(), and BmnFunctionSet::TimeStamp2TP().

Here is the call graph for this function:

◆ GetTempFileOnDisk()

bool BmnConverter::GetTempFileOnDisk ( )
inline

Definition at line 101 of file BmnConverter.h.

References temp_file_on_disk.

Referenced by BmnDataToRootParallel().

Here is the caller graph for this function:

◆ GetUTCShift()

Int_t BmnConverter::GetUTCShift ( TTimeStamp t)
private

Definition at line 797 of file BmnConverter.cxx.

References TTimeStamp::AsString(), leaps, and utc_valid.

Referenced by ParseJsonTLV().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitUTCShift()

BmnStatus BmnConverter::InitUTCShift ( )
private

Definition at line 763 of file BmnConverter.cxx.

References kBMNSUCCESS, leaps, and utc_valid.

Referenced by BmnConverter().

Here is the caller graph for this function:

◆ LoadConfig()

BmnStatus BmnConverter::LoadConfig ( )
private

Definition at line 92 of file BmnConverter.cxx.

References conf, fDecoderConfigFileName, fExportJsonBlocks, fThreadCnt, fThreads, i, kBMNSUCCESS, and BmnConverterThread::SetExportExternalSpillStat().

Referenced by BmnConverter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OutputSpills()

void BmnConverter::OutputSpills ( )

Definition at line 175 of file BmnConverter.cxx.

References ANSI_COLOR_BLUE, ANSI_COLOR_RESET, Close(), TFile::Close(), ROOT::DisableImplicitMT(), ROOT::EnableImplicitMT(), BmnAbstractThread::Execute(), fMetadataName, fRawRunHdrName, fRawTreeName, fRawTreeSpillName, fRootFileName, fRunId, fThreadCnt, fThreads, TDirectoryFile::Get(), i, TFile::IsOpen(), metadata, OutputTrees(), TStopwatch::RealTime(), runHeader, BmnConverterThread::SetData(), BmnConverterThread::SetMerger(), TStopwatch::Start(), TStopwatch::Stop(), vecTree, vecTreeSpills, and TDirectory::WriteObject().

Referenced by BmnDataToRootParallel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OutputTrees()

void BmnConverter::OutputTrees ( )

Definition at line 141 of file BmnConverter.cxx.

References BmnConverterThread::FinalizeFile(), fMerger, fMetadataName, fRawRunHdrName, fThreadCnt, fThreads, i, metadata, and runHeader.

Referenced by OutputSpills().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseComplexTLV()

BmnStatus BmnConverter::ParseComplexTLV ( UInt_t * buf,
UInt_t & len,
UInt_t & runId )
static

◆ ParseJsonTLV()

BmnStatus BmnConverter::ParseJsonTLV ( UInt_t * buf,
UInt_t & len )

Definition at line 675 of file BmnConverter.cxx.

References d, fExportJsonBlocks, fRunId, fSpillMap, GetUTCShift(), kBMNERROR, kBMNSUCCESS, kNBYTESINWORD, metadata, BmnConverterTools::ParseJsonConfig(), BmnConverterTools::ParseJsonStatus(), runHeader, SpillStatus::start_ts, BmnSpillInfo::stop_ts, SpillStatus::stop_ts, tai_utc_dif, BmnFunctionSet::TimePoint2String(), and SpillStatus::times_valid.

Referenced by ConvertRawToRootIterateFileRead().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ QuickConvertStatEvent() [1/2]

void BmnConverter::QuickConvertStatEvent ( BmnConverterThread *& tmp,
UInt_t & len )
private

Definition at line 657 of file BmnConverter.cxx.

References BmnAbstractThread::Execute(), fCurEvType, fEventId, fRunId, and BmnConverterThread::SetData().

Here is the call graph for this function:

◆ QuickConvertStatEvent() [2/2]

void BmnConverter::QuickConvertStatEvent ( UInt_t * buf,
UInt_t & len )
private

Definition at line 643 of file BmnConverter.cxx.

References d, BmnAbstractThread::Execute(), fCurEvType, fEventId, fRunId, fThreads, and BmnConverterThread::SetData().

Referenced by ConvertRawToRootIterateFileRead(), and FeedEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ QuickProcessEvent() [1/2]

void BmnConverter::QuickProcessEvent ( BmnConverterThread *& tmp,
UInt_t & len )
private
Parameters
tmpthread pointer
lendata length

Definition at line 666 of file BmnConverter.cxx.

References BmnAbstractThread::Execute(), fCurEvType, fEventId, fRunId, and BmnConverterThread::SetData().

Here is the call graph for this function:

◆ QuickProcessEvent() [2/2]

void BmnConverter::QuickProcessEvent ( UInt_t * d,
UInt_t & len )
private

Definition at line 650 of file BmnConverter.cxx.

References d, BmnAbstractThread::Execute(), fCurEvType, fEventId, fRunId, fThreads, and BmnConverterThread::SetData().

Referenced by ConvertRawToRootIterateFileRead(), and FeedEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReproduceBranches()

void BmnConverter::ReproduceBranches ( TTree * inTree,
TTree * outTree )

Definition at line 371 of file BmnConverter.cxx.

References TObjArray::At(), TTree::Branch(), TClonesArray::Class(), TObject::ClassName(), fArrVec, fNamVec, TBranch::GetAddress(), TClass::GetClass(), TClonesArray::GetClass(), TObjArray::GetEntries(), TTree::GetEntry(), TTree::GetListOfBranches(), TNamed::GetName(), and i.

Here is the call graph for this function:

◆ SeparateEventsBySpills()

void BmnConverter::SeparateEventsBySpills ( )

Definition at line 230 of file BmnConverter.cxx.

References ANSI_COLOR_BLUE, ANSI_COLOR_RESET, TObjArray::First(), fSpillMap, fThreadCnt, fThreads, TObjArray::GetEntriesFast(), TBranch::GetEntry(), GetSpillNumber(), i, BmnConverterThread::msc, TStopwatch::RealTime(), runHeader, TStopwatch::Start(), TStopwatch::Stop(), BmnConverterThread::t0raw, BmnFunctionSet::TimePoint2String(), vecTree, and vecTreeSpills.

Referenced by BmnDataToRootParallel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SeparateEventsBySpillsTM()

void BmnConverter::SeparateEventsBySpillsTM ( )

Definition at line 300 of file BmnConverter.cxx.

References ANSI_COLOR_BLUE, ANSI_COLOR_RESET, TTree::CloneTree(), Close(), TFile::Close(), BmnConverterThread::eventHeaderDAQ, TTree::Fill(), fMetadataName, fRawRunHdrName, BmnConverterThread::fRawTree, fRunId, fSpillMap, fThreadCnt, fThreads, TTree::GetBranch(), TTree::GetEntriesFast(), TBranch::GetEntry(), BmnEventHeader::GetEventTimeTP(), GetSpillNumber(), i, TFile::IsOpen(), metadata, TStopwatch::RealTime(), runHeader, TTree::SetAutoFlush(), TTree::SetAutoSave(), TTree::SetBasketSize(), TStopwatch::Start(), TStopwatch::Stop(), BmnFunctionSet::TimePoint2String(), treeTimeMap, treeTimeMapDiv, and TDirectory::WriteObject().

Referenced by BmnDataToRootParallel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetDecoderConfigFileName()

void BmnConverter::SetDecoderConfigFileName ( string FileName)
inline

Definition at line 110 of file BmnConverter.h.

References fDecoderConfigFileName.

◆ SetPeriod()

void BmnConverter::SetPeriod ( uint32_t v)
inline

Definition at line 93 of file BmnConverter.h.

References fPeriodId, and v.

Referenced by BmnDataToRootParallel().

Here is the caller graph for this function:

◆ SetRunId()

void BmnConverter::SetRunId ( uint32_t v)
inline

Definition at line 91 of file BmnConverter.h.

References fRunId, and v.

◆ SetSpillMap()

void BmnConverter::SetSpillMap ( map< SysPoint, BmnSpillInfo > spillMap)
inline

Definition at line 97 of file BmnConverter.h.

References fSpillMap.

◆ SetSubName()

void BmnConverter::SetSubName ( TString v)
inline

Definition at line 95 of file BmnConverter.h.

References fSubName, and v.

Member Data Documentation

◆ cc

Int_t BmnConverter::cc = 0
private

Definition at line 161 of file BmnConverter.h.

◆ conf

pt::ptree BmnConverter::conf
private

Definition at line 117 of file BmnConverter.h.

Referenced by LoadConfig().

◆ data

uint32_t BmnConverter::data[10000000]
private

Definition at line 149 of file BmnConverter.h.

Referenced by ConvertRawToRootIterateFileRead().

◆ fArrVec

vector<TClonesArray*> BmnConverter::fArrVec
private

Definition at line 147 of file BmnConverter.h.

Referenced by ReproduceBranches().

◆ fCurEvType

◆ fCurWaitingThread

BmnConverterThread* BmnConverter::fCurWaitingThread
private

Definition at line 163 of file BmnConverter.h.

Referenced by BmnConverter(), and FeedFile().

◆ fDat

uint32_t BmnConverter::fDat
private

Definition at line 152 of file BmnConverter.h.

Referenced by ConvertRawToRootIterateFileRead().

◆ fDecoderConfigFileName

string BmnConverter::fDecoderConfigFileName
private

Definition at line 129 of file BmnConverter.h.

Referenced by LoadConfig(), and SetDecoderConfigFileName().

◆ fEventId

uint32_t BmnConverter::fEventId
private

◆ fExportJsonBlocks

Bool_t BmnConverter::fExportJsonBlocks
private

Definition at line 156 of file BmnConverter.h.

Referenced by BmnConverter(), LoadConfig(), and ParseJsonTLV().

◆ fMerger

unique_ptr<ROOT::TBufferMerger> BmnConverter::fMerger
private

Definition at line 144 of file BmnConverter.h.

Referenced by BmnConverter(), CreateTempFile(), and OutputTrees().

◆ fMetadataName

TString BmnConverter::fMetadataName
private

Definition at line 131 of file BmnConverter.h.

Referenced by BmnConverter(), OutputSpills(), OutputTrees(), and SeparateEventsBySpillsTM().

◆ fNamVec

vector<TObject*> BmnConverter::fNamVec
private

Definition at line 146 of file BmnConverter.h.

Referenced by ReproduceBranches().

◆ fPeriodId

uint32_t BmnConverter::fPeriodId
private

Definition at line 119 of file BmnConverter.h.

Referenced by BmnConverter(), ConvertRawToRootIterateFileRead(), FeedFile(), and SetPeriod().

◆ fRawFileIn

FILE* BmnConverter::fRawFileIn
private

Definition at line 124 of file BmnConverter.h.

Referenced by ConvertRawToRootIterateFileRead(), and FeedFile().

◆ fRawRunHdrName

TString BmnConverter::fRawRunHdrName
private

Definition at line 130 of file BmnConverter.h.

Referenced by BmnConverter(), OutputSpills(), OutputTrees(), and SeparateEventsBySpillsTM().

◆ fRawTreeName

TString BmnConverter::fRawTreeName
private

Definition at line 132 of file BmnConverter.h.

Referenced by BmnConverter(), and OutputSpills().

◆ fRawTreeSpillName

TString BmnConverter::fRawTreeSpillName
private

Definition at line 133 of file BmnConverter.h.

Referenced by BmnConverter(), and OutputSpills().

◆ fRootDirPath

TString BmnConverter::fRootDirPath
private

Definition at line 135 of file BmnConverter.h.

Referenced by BmnConverter(), and CreateTempFile().

◆ fRootFileName

TString BmnConverter::fRootFileName
private

Definition at line 134 of file BmnConverter.h.

Referenced by BmnConverter(), CreateTempFile(), and OutputSpills().

◆ fRunId

◆ fSpillMap

map<SysPoint, BmnSpillInfo> BmnConverter::fSpillMap
private

◆ fSubName

TString BmnConverter::fSubName
private

Definition at line 125 of file BmnConverter.h.

Referenced by FeedFile(), and SetSubName().

◆ fThreadCnt

uint32_t BmnConverter::fThreadCnt

◆ fThreads

◆ leaps

map<TTimeStamp, Int_t> BmnConverter::leaps
private

Definition at line 158 of file BmnConverter.h.

Referenced by GetUTCShift(), and InitUTCShift().

◆ metadata

unique_ptr<BmnMetadataRaw> BmnConverter::metadata
private

◆ runHeader

unique_ptr<DigiRunHeader> BmnConverter::runHeader
private

◆ spillHeader

BmnSpillHeader* BmnConverter::spillHeader
private

Definition at line 140 of file BmnConverter.h.

Referenced by BmnConverter().

◆ tai_utc_dif

Int_t BmnConverter::tai_utc_dif
private

Definition at line 160 of file BmnConverter.h.

Referenced by BmnConverter(), and ParseJsonTLV().

◆ temp_file_on_disk

bool BmnConverter::temp_file_on_disk
private

Definition at line 118 of file BmnConverter.h.

Referenced by BmnConverter(), and GetTempFileOnDisk().

◆ TimeZero

const TTimeStamp BmnConverter::TimeZero = TTimeStamp(time_t(0), 0)
private

Definition at line 115 of file BmnConverter.h.

◆ treeMap

map<int32_t, map<int32_t, TreePos> > BmnConverter::treeMap

Definition at line 68 of file BmnConverter.h.

◆ treeMapSpills

map<int32_t, multimap<SysPoint, TreePos> > BmnConverter::treeMapSpills

Definition at line 69 of file BmnConverter.h.

◆ treeTimeMap

multimap<SysPoint, TreePE> BmnConverter::treeTimeMap

Definition at line 70 of file BmnConverter.h.

Referenced by SeparateEventsBySpillsTM().

◆ treeTimeMapDiv

map<int32_t, MapTP2TreePE> BmnConverter::treeTimeMapDiv

Definition at line 71 of file BmnConverter.h.

Referenced by SeparateEventsBySpillsTM().

◆ utc_valid

TTimeStamp BmnConverter::utc_valid
private

Definition at line 159 of file BmnConverter.h.

Referenced by GetUTCShift(), and InitUTCShift().

◆ vecTree

vector<pair<int, pair<int, int> > > BmnConverter::vecTree

Definition at line 64 of file BmnConverter.h.

Referenced by FeedFile(), OutputSpills(), and SeparateEventsBySpills().

◆ vecTreeSpills

vector<pair<int, pair<int, int> > > BmnConverter::vecTreeSpills

Definition at line 65 of file BmnConverter.h.

Referenced by FeedFile(), OutputSpills(), and SeparateEventsBySpills().


The documentation for this class was generated from the following files: