Project
Loading...
Searching...
No Matches
test_ctf_io_ctp.cxx File Reference
#include <cassert>
#include <boost/test/unit_test.hpp>
#include <boost/test/data/test_case.hpp>
#include <boost/test/data/dataset.hpp>
#include "CommonUtils/NameConf.h"
#include "CTPReconstruction/CTFCoder.h"
#include "DataFormatsCTP/CTF.h"
#include "DataFormatsCTP/Digits.h"
#include "Framework/Logger.h"
#include <TFile.h>
#include <TStopwatch.h>
#include <TSystem.h>
#include <cstring>
#include <random>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   Test CTPCTFIO
 
#define BOOST_TEST_MAIN
 
#define BOOST_TEST_DYN_LINK
 

Functions

sw Start ()
 
std::mt19937_64 eng (rd())
 
 for (int itrg=0;itrg< 1000;itrg++)
 
coder setANSVersion (ansVersion)
 
coder encode (vec, digits, lumi)
 
sw Stop ()
 
 LOG (info)<< "Compressed in "<< sw.CpuTime()<< " s"
 
TFile flOut ("test_ctf_ctp.root", "recreate")
 
TTree ctfTree (std::string(o2::base::NameConf::CTFTREENAME).c_str(), "O2 CTF tree")
 
ctfImage print ()
 
ctfImage appendToTree (ctfTree, "CTP")
 
ctfTree Write ()
 
vec clear ()
 
TFile flIn ("test_ctf_ctp.root")
 
std::unique_ptr< TTree > tree ((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))
 
 BOOST_CHECK (tree)
 
coder decode (ctfImage, digitsD, lumiD)
 
 BOOST_TEST (digits==digitsD, boost::test_tools::per_element())
 
 BOOST_CHECK (lumiD.orbit==lumi.orbit &&lumiD.nHBFCounted==lumi.nHBFCounted &&lumiD.orbit==lumi.orbit)
 

Variables

std::vector< o2::ctf::ANSHeaderANSVersions {o2::ctf::ANSVersionCompat, o2::ctf::ANSVersion1}
 
TStopwatch sw
 
o2::InteractionRecord ir0 (3, 5)
 
o2::InteractionRecord ir (ir0)
 
std::random_device rd
 
std::uniform_int_distribution< unsigned long longdistr
 
LumiInfo lumi {digits.front().intRecord.orbit, 30, 12345}
 
std::vector< o2::ctf::BufferTypevec
 
auto * ctfImage = o2::ctp::CTF::get(vec.data())
 
std::vector< CTPDigitdigitsD
 
LumiInfo lumiD
 

Macro Definition Documentation

◆ BOOST_TEST_DYN_LINK

#define BOOST_TEST_DYN_LINK

Definition at line 14 of file test_ctf_io_ctp.cxx.

◆ BOOST_TEST_MAIN

#define BOOST_TEST_MAIN

Definition at line 13 of file test_ctf_io_ctp.cxx.

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   Test CTPCTFIO

Definition at line 12 of file test_ctf_io_ctp.cxx.

Function Documentation

◆ appendToTree()

ctfImage appendToTree ( ctfTree  ,
"CTP"   
)

◆ BOOST_CHECK() [1/2]

BOOST_CHECK ( lumiD.  orbit = =lumi.orbit &&lumiD.nHBFCounted==lumi.nHBFCounted &&lumiD.orbit==lumi.orbit)

◆ BOOST_CHECK() [2/2]

BOOST_CHECK ( tree  )

◆ BOOST_TEST()

BOOST_TEST ( digits  = =digitsD,
boost::test_tools::per_element()   
)

◆ clear()

vec clear ( )

◆ ctfTree()

TTree ctfTree ( std::string(o2::base::NameConf::CTFTREENAME).c_str()  ,
"O2 CTF tree"   
)

◆ decode()

coder decode ( ctfImage  ,
digitsD  ,
lumiD   
)

◆ encode()

coder encode ( vec  ,
digits  ,
lumi   
)

◆ eng()

std::mt19937_64 eng ( rd()  )

◆ flIn()

TFile flIn ( "test_ctf_ctp.root"  )

◆ flOut()

TFile flOut ( "test_ctf_ctp.root"  ,
"recreate"   
)

◆ for()

for ( )

Definition at line 48 of file test_ctf_io_ctp.cxx.

◆ LOG()

LOG ( info  )

◆ print()

ctfImage print ( )

◆ setANSVersion()

coder setANSVersion ( ansVersion  )

◆ Start()

sw Start ( )

◆ Stop()

sw Stop ( )

◆ tree()

std::unique_ptr< TTree > tree ( (TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str())  )

◆ Write()

ctfTree Write ( )

Variable Documentation

◆ ANSVersions

Definition at line 36 of file test_ctf_io_ctp.cxx.

◆ ctfImage

const auto ctfImage = o2::ctp::CTF::get(vec.data())

Definition at line 70 of file test_ctf_io_ctp.cxx.

◆ digitsD

std::vector<CTPDigit> digitsD

Definition at line 92 of file test_ctf_io_ctp.cxx.

◆ distr

std::uniform_int_distribution<unsigned long long> distr

Definition at line 47 of file test_ctf_io_ctp.cxx.

◆ ir

◆ ir0

o2::InteractionRecord ir0(3, 5) ( ,
 
)

◆ lumi

LumiInfo lumi {digits.front().intRecord.orbit, 30, 12345}

Definition at line 55 of file test_ctf_io_ctp.cxx.

◆ lumiD

LumiInfo lumiD

Definition at line 93 of file test_ctf_io_ctp.cxx.

◆ rd

std::random_device rd

Definition at line 45 of file test_ctf_io_ctp.cxx.

◆ sw

TStopwatch sw
Initial value:
{
std::vector<CTPDigit> digits
std::vector< Digit > digits

Definition at line 41 of file test_ctf_io_ctp.cxx.

◆ vec

std::vector<o2::ctf::BufferType> vec

Definition at line 58 of file test_ctf_io_ctp.cxx.