51 std::string detStrL = dec ?
"o2_" :
"";
53 std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower);
54 auto digitSizes = std::make_shared<std::array<size_t, NLayers>>();
55 auto digitSizeGetter = [digitSizes](std::vector<o2::itsmft::Digit>
const& inDigits,
DataRef const&
ref) {
56 auto const* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
57 (*digitSizes)[dh->subSpecification] = inDigits.size();
59 auto rofSizes = std::make_shared<std::array<size_t, NLayers>>();
60 auto rofSizeGetter = [rofSizes](std::vector<o2::itsmft::ROFRecord>
const& inROFs,
DataRef const&
ref) {
61 auto const* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
62 (*rofSizes)[dh->subSpecification] = inROFs.size();
66 auto finishWriting = [](TFile* outputfile, TTree* outputtree) {
67 const auto* brArr = outputtree->GetListOfBranches();
69 for (
const auto* brc : *brArr) {
70 int64_t
n = ((
const TBranch*)brc)->GetEntries();
71 if (nent && (nent !=
n)) {
72 LOG(error) <<
"Branches have different number of entries";
76 outputtree->SetEntries(nent);
80 outputfile->Write(
"", TObject::kOverwrite);
87 auto fillLabels = [digitSizes, rofSizes](TBranch& branch, std::vector<char>
const& labelbuffer,
DataRef const&
ref) {
89 auto const* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
90 auto layer =
static_cast<size_t>(dh->subSpecification);
91 LOG(info) <<
"WRITING " <<
labels.getNElements() <<
" LABELS FOR " <<
layer <<
" WITH " << (*digitSizes)[
layer] <<
" DIGITS IN " << (*rofSizes)[
layer] <<
" ROFS";
94 auto ptr = &outputcontainer;
96 outputcontainer.
adopt(labelbuffer);
101 auto getIndex = [](
DataRef const&
ref) ->
size_t {
102 auto const* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
103 return static_cast<size_t>(dh->subSpecification);
105 auto getName = [](std::string base,
size_t index) -> std::string {
112 (detStrL +
"digits.root").c_str(),
116 detStr +
"Digit",
"digit-branch",
122 detStr +
"DigitROF",
"digit-rof-branch",
128 detStr +
"DigitMCTruth",
"digit-mctruth-branch",
129 (mctruth ? NLayers : 0),
134 detStr +
"DigitMC2ROF",
"digit-mc2rof-branch",
135 (mctruth ? NLayers : 0),
139 detStr +
"Calib",
"digit-calib-branch",
145 return getDigitWriterSpec<o2::detectors::DetID::ITS>(mctruth, dec, calib);
150 return getDigitWriterSpec<o2::detectors::DetID::MFT>(mctruth, dec, calib);
std::vector< std::string > labels
std::string getName(const TDataMember *dm, int index, int size)
A const (ready only) version of MCTruthContainer.
o2::framework::DataAllocator::SubSpecificationType SubSpecificationType
Calibration data from GBT data.
A special IO container - splitting a given vector to enable ROOT IO.
Configurable generator for RootTreeWriter processor spec.
static constexpr const char * getName(ID id)
names of defined detectors
o2::header::DataHeader::SubSpecificationType SubSpecificationType
Generate a processor spec for the RootTreeWriter utility.
WriterType::CustomClose CustomClose
static TBranch * remapBranch(TBranch &branchRef, T **newdata)
GLenum GLuint GLint GLint layer
constexpr o2::header::DataOrigin gDataOriginMFT
constexpr o2::header::DataOrigin gDataOriginITS
Defining PrimaryVertex explicitly as messageable.
DataProcessorSpec getDigitWriterSpec(bool mctruth, bool dec, bool calib)
o2::framework::DataProcessorSpec getITSDigitWriterSpec(bool mctruth=true, bool dec=false, bool calib=false)
o2::framework::DataProcessorSpec getMFTDigitWriterSpec(bool mctruth=true, bool dec=false, bool calib=false)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string to_string(gsl::span< T, Size > span)
static constexpr int getNLayers()
static constexpr bool supportsStaggering() noexcept
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"