24#include <fmt/format.h>
62 auto fileName = ic.
options().
get<std::string>(
"outfile");
63 mHistoFile = std::make_unique<TFile>(fileName.c_str(),
"RECREATE");
65 fair::Logger::SetConsoleColor(
true);
76 auto nbins =
static_cast<Int_t
>(lastRof.differenceInBC(firstRof));
77 Int_t
bins[1] = {nbins};
78 Double_t xmin[1] = {0.0};
79 Double_t xmax[1] = {nbins * 1.0 + 1};
80 THnSparseL
h(
"rof_times",
"rof times", 1,
bins, xmin, xmax);
81 for (
const auto& p :
mRofs) {
82 const auto& rof = p.first;
83 Double_t
x[1] = {1.0 * rof.getBCData().differenceInBC(firstRof)};
84 Double_t
w = rof.getNEntries();
86 h.SetBinError(
h.GetBin(
x), sqrt(
w));
88 h.Write(
"", TObject::kWriteDelete);
100 if (!shouldProcess) {
105 auto rofs = pc.
inputs().
get<gsl::span<o2::mch::ROFRecord>>(
"rofs");
106 for (
const auto& rof : rofs) {
107 mRofs[rof] += rof.getNEntries();
116 std::map<o2::mch::ROFRecord, int>
mRofs;
121void customize(std::vector<ConfigParamSpec>& workflowOptions)
123 workflowOptions.push_back(
ConfigParamSpec{
"rofs-name", VariantType::String,
"MCH/DIGITROFS", {
"name of the input rofs"}});
132 auto rofName =
cc.options().get<std::string>(
"rofs-name");
133 std::string inputConfig =
"rofs:" + rofName;
136 "mch-rofs-histogrammer",
141 {
"verbose", VariantType::Bool,
false, {
"verbose output"}},
142 {
"max-nof-tfs", VariantType::Int, 10, {
"max number of timeframes to process"}},
143 {
"first-tf", VariantType::Int, 0, {
"first timeframe to process"}},
144 {
"first-orbit", VariantType::Int, 0, {
"force first orbit to use as first orbit (for histogram) (default=-1=auto)"}},
145 {
"last-orbit", VariantType::Int, 0, {
"force last orbit to use as last orbit (for histogram) (default=-1=auto)"}},
146 {
"outfile", VariantType::String,
"rofs-times.root", {
"name of the histogram output file"}}}};
148 specs.push_back(rofHistogrammer);
Header to collect LHC related constants.
bounded_vector< float > bins
Class for time synchronization of RawReader instances.
T get(const char *key) const
ConfigParamRegistry const & options()
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
GLubyte GLubyte GLubyte GLubyte w
constexpr int LHCMaxBunches
AlgorithmSpec adaptFromTask(Args &&... args)
std::vector< DataProcessorSpec > WorkflowSpec
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > select(char const *matcher="")
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
o2::framework::WorkflowSpec WorkflowSpec
WorkflowSpec defineDataProcessing(const ConfigContext &cc)
void customize(std::vector< ConfigParamSpec > &workflowOptions)
std::map< o2::mch::ROFRecord, int > mRofs
void run(ProcessingContext &pc)
std::unique_ptr< TFile > mHistoFile
void init(o2::framework::InitContext &ic)
std::vector< o2::mch::ChannelCode > cc