Project
Loading...
Searching...
No Matches
tracks-dumper-workflow.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
17#include "TrackDumperSpec.h"
18#include <fmt/format.h>
19#include <gsl/span>
20#include <iostream>
21#include <vector>
22
23void dump(std::ostream& os, const o2::mch::TrackMCH& t)
24{
25 auto pt = std::sqrt(t.getPx() * t.getPx() + t.getPy() * t.getPy());
26 os << fmt::format("({:s}) p {:7.2f} pt {:7.2f} nclusters: {} \n", t.getSign() == -1 ? "-" : "+", t.getP(), pt, t.getNClusters());
27}
28
29using namespace o2::framework;
30
31// we need to add workflow options before including Framework/runDataProcessing
32void customize(std::vector<ConfigParamSpec>& workflowOptions)
33{
34 std::vector<ConfigParamSpec> options{
35 {"enable-mc", VariantType::Bool, false, ConfigParamSpec::HelpString{"Read MC info"}}};
37 std::swap(workflowOptions, options);
38}
39
41
43{
44 bool useMC = config.options().get<bool>("enable-mc");
45 WorkflowSpec specs{o2::mch::getTrackDumperSpec(useMC, "mch-tracks-dumper")};
46 o2::raw::HBFUtilsInitializer hbfIni(config, specs);
47 return specs;
48}
Definition of the MCH ROFrame record.
Definition of the MCH track.
ConfigParamRegistry & options() const
MCH track external format.
Definition TrackMCH.h:34
double getP() const
Definition TrackMCH.cxx:68
double getPx() const
Definition TrackMCH.cxx:43
int getNClusters() const
get the number of clusters attached to the track
Definition TrackMCH.h:106
double getPy() const
Definition TrackMCH.cxx:50
short getSign() const
get the muon sign
Definition TrackMCH.h:65
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
DataProcessorSpec getTrackDumperSpec(bool useMC, const char *specName)
static void addConfigOption(std::vector< o2::framework::ConfigParamSpec > &opts, const std::string &defOpt=std::string(o2::base::NameConf::DIGITIZATIONCONFIGFILE))
void dump(std::ostream &os, const o2::mch::TrackMCH &t)
WorkflowSpec defineDataProcessing(const ConfigContext &config)
void customize(std::vector< ConfigParamSpec > &workflowOptions)