Skip to content
Snippets Groups Projects
Commit 45270a5a authored by Administrator's avatar Administrator
Browse files

Remove ROOT dependencies

Use std::string instead of TString to format log output.
parent ce6be392
No related branches found
No related tags found
1 merge request!649Remove ROOT dependencies
Pipeline #15062 passed
......@@ -11,11 +11,9 @@
#include "CbmPsdDigi.h"
#include <TBuffer.h> // for TBuffer
#include <TClass.h> // for CbmPsdDigi::IsA()
#include <TString.h> // for Form, TString
#include <string> // for basic_string
#include <iomanip> // for hex, setw, setfill, fixed, setprecission
#include <sstream> // for operator<<, basic_ostream, char_trait
#include <string> // for basic_string
// --- Copy constructor
CbmPsdDigi::CbmPsdDigi(const CbmPsdDigi& other) : fuAddress(other.fuAddress), fdTime(other.fdTime), fdEdep(other.fdEdep)
......@@ -37,8 +35,13 @@ void CbmPsdDigi::SetAddress(uint32_t moduleId, uint32_t sectionId)
// --- Info to string
std::string CbmPsdDigi::ToString() const
{
TString string = Form("CbmPsdDigi: address = 0x%08X Charge = %f Time = %f", fuAddress, fdEdep, fdTime);
return string.Data();
// Example output
// CbmPsdDigi: address = 0x00001018 Charge = 0.011590 Time = 1006.438294
std::stringstream ss;
ss << "CbmPsdDigi: address = 0x" << std::uppercase << std::hex << std::setw(8) << std::setfill('0') << fuAddress
<< " Charge = " << std::fixed << std::setprecision(6) << fdEdep << " Time = " << fdTime;
return ss.str();
}
#ifndef NO_ROOT
......
......@@ -10,9 +10,9 @@
**/
#include "CbmTofDigi.h"
#include <TString.h> // for Form, TString
#include <string> // for basic_string
#include <iomanip> // for hex, setw, setfill, fixed, setprecission
#include <sstream> // for operator<<, basic_ostream, char_trait
#include <string> // for basic_string
CbmTofDigi::CbmTofDigi() : fdTime(0.), fdTot(-1.), fuAddress(0)
// fMatch(nullptr)
......@@ -39,11 +39,15 @@ CbmTofDigi::~CbmTofDigi()
// if ( fMatch ) delete fMatch;
}
std::string CbmTofDigi::ToString() const
{
TString string = Form("CbmTofDigi: address = 0x%08X time = %f tot = %f", fuAddress, fdTime, fdTot);
return string.Data();
// Example Output i
// CbmTofDigi: address = 0x05020026 time = 1017.181900 tot = 1.221741
std::stringstream ss;
ss << "CbmTofDigi: address = 0x" << std::uppercase << std::hex << std::setw(8) << std::setfill('0') << fuAddress
<< " time = " << std::fixed << std::setprecision(6) << fdTime << " tot = " << fdTot;
return ss.str();
}
void CbmTofDigi::SetAddress(uint32_t Sm, uint32_t Rpc, uint32_t Channel, uint32_t Side, uint32_t SmType)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment