MUSIC
unknown
Analysis for the MUSIC active-target ionization chamber
Toggle main menu visibility
Loading...
Searching...
No Matches
BinaryToRoot.cpp
Go to the documentation of this file.
1
#include "
BinaryToRoot.hpp
"
2
3
TString
BinaryToRoot::HeaderSidecarName
(Int_t run) {
4
return
Form(
"DataR_run_%d.header"
, run);
5
}
6
7
void
BinaryToRoot::WriteHeaderSidecar
(Int_t run, UShort_t header) {
8
TString path = IO::GetRootFilesBaseDir() +
"/"
+
HeaderSidecarName
(run);
9
gSystem->mkdir(gSystem->DirName(path), kTRUE);
10
std::ofstream f(path.Data());
11
f <<
"0x"
<< std::hex << header << std::endl;
12
}
13
14
Bool_t
BinaryToRoot::ReadHeaderSidecar
(Int_t run, UShort_t &header) {
15
TString path = IO::GetRootFilesBaseDir() +
"/"
+
HeaderSidecarName
(run);
16
if
(gSystem->AccessPathName(path))
17
return
kFALSE;
18
std::ifstream f(path.Data());
19
std::string s;
20
f >> s;
21
if
(s.empty())
22
return
kFALSE;
23
header =
static_cast<
UShort_t
>
(std::stoul(s,
nullptr
, 0));
24
return
kTRUE;
25
}
BinaryToRoot.hpp
BinaryToRoot::ReadHeaderSidecar
static Bool_t ReadHeaderSidecar(Int_t run, UShort_t &header)
Read a run's global header back from its sidecar.
Definition
BinaryToRoot.cpp:14
BinaryToRoot::HeaderSidecarName
static TString HeaderSidecarName(Int_t run)
Sidecar filename for a run.
Definition
BinaryToRoot.cpp:3
BinaryToRoot::WriteHeaderSidecar
static void WriteHeaderSidecar(Int_t run, UShort_t header)
Write a run's global header to its sidecar.
Definition
BinaryToRoot.cpp:7
tooling
src
BinaryToRoot.cpp
Generated by
1.17.0