Skip to content

Commit

Permalink
Adding ROOT writer for TOF currents
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-kleiner committed Jan 23, 2023
1 parent ab773d0 commit 858a822
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
1 change: 1 addition & 0 deletions Detectors/TOF/workflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ o2_add_library(TOFWorkflowUtils
src/CompressedAnalysisTask.cxx
src/EntropyEncoderSpec.cxx
src/EntropyDecoderSpec.cxx
src/TOFIntegrateClusterWriterSpec.cxx
src/TOFIntegrateClusterSpec.cxx
src/TOFMergeIntegrateClusterSpec.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DPLUtils O2::TOFBase O2::DataFormatsTOF O2::TOFReconstruction O2::TOFWorkflowIO O2::Steer O2::TOFCalibration)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef O2_TOF_TOFINTEGRATECLUSTERWRITERSPEC_SPEC
#define O2_TOF_TOFINTEGRATECLUSTERWRITERSPEC_SPEC

#include "Framework/DataProcessorSpec.h"

namespace o2
{
namespace tof
{

o2::framework::DataProcessorSpec getTOFIntegrateClusterWriterSpec();

} // end namespace tof
} // end namespace o2

#endif
37 changes: 37 additions & 0 deletions Detectors/TOF/workflow/src/TOFIntegrateClusterWriterSpec.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// @file TOFIntegrateClusterWriterSpec.cxx

#include <vector>
#include "TOFWorkflowUtils/TOFIntegrateClusterWriterSpec.h"
#include "DPLUtils/MakeRootTreeWriterSpec.h"

using namespace o2::framework;

namespace o2
{
namespace tof
{
template <typename T>
using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition<T>;

DataProcessorSpec getTOFIntegrateClusterWriterSpec()
{
return MakeRootTreeWriterSpec("tof-currents-writer",
"o2currents_tof.root",
"ITOFC",
BranchDefinition<std::vector<float>>{InputSpec{"itofcn", o2::header::gDataOriginTOF, "ITOFCN", 0}, "ITOFCN", 1},
BranchDefinition<std::vector<float>>{InputSpec{"itofcq", o2::header::gDataOriginTOF, "ITOFCQ", 0}, "ITOFCQ", 1})();
}

} // namespace tof
} // namespace o2
7 changes: 6 additions & 1 deletion Detectors/TOF/workflow/src/cluster-integrator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// or submit itself to any jurisdiction.

#include "TOFWorkflowUtils/TOFIntegrateClusterSpec.h"
#include "TOFWorkflowUtils/TOFIntegrateClusterWriterSpec.h"
#include "CommonUtils/ConfigurableParam.h"
#include "Framework/ConfigParamSpec.h"

Expand All @@ -23,7 +24,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
// option allowing to set parameters
std::vector<ConfigParamSpec> options{
ConfigParamSpec{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}},
};
{"disable-root-output", VariantType::Bool, false, {"disable root-files output writers"}}};

std::swap(workflowOptions, options);
}
Expand All @@ -38,5 +39,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
// Update the (declared) parameters if changed from the command line
o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
wf.emplace_back(o2::tof::getTOFIntegrateClusterSpec());
if (!cfgc.options().get<bool>("disable-root-output")) {
wf.emplace_back(o2::tof::getTOFIntegrateClusterWriterSpec());
}

return wf;
}

0 comments on commit 858a822

Please sign in to comment.