Project
Loading...
Searching...
No Matches
TOFMatchedWriterSpec.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
13
18#include "Headers/DataHeader.h"
28#include <sstream>
29
30using namespace o2::framework;
31
32namespace o2
33{
34namespace tof
35{
36
37template <typename T>
39using MatchInfo = std::vector<o2::dataformats::MatchInfoTOF>;
40using TrackInfo = std::vector<o2::dataformats::TrackTPCTOF>;
41using LabelsType = std::vector<o2::MCCompLabel>;
42using namespace o2::header;
43
44DataProcessorSpec getTOFMatchedWriterSpec(bool useMC, const char* outdef, bool writeTracks, int mode, bool strict)
45{
46 // spectators for logging
47 auto loggerMatched = [](MatchInfo const& indata) {
48 LOG(debug) << "RECEIVED MATCHED SIZE " << indata.size();
49 };
50 auto loggerTofLabels = [](LabelsType const& labeltof) {
51 LOG(debug) << "TOF LABELS GOT " << labeltof.size() << " LABELS ";
52 };
53 // o2::header::DataDescription ddMatchInfo{"MTC_ITSTPC"}, ddMatchInfo_tpc{"MTC_TPC"},
54 // ddMCMatchTOF{"MCMTC_ITSTPC"}, ddMCMatchTOF_tpc{"MCMTC_TPC"};
55
56 o2::header::DataDescription ddMatchInfo[4] = {{"MTC_TPC"}, {"MTC_ITSTPC"}, {"MTC_TPCTRD"}, {"MTC_ITSTPCTRD"}};
57 o2::header::DataDescription ddMCMatchTOF[4] = {{"MCMTC_TPC"}, {"MCMTC_ITSTPC"}, {"MCMTC_TPCTRD"}, {"MCMTC_ITSTPCTRD"}};
58
59 uint32_t ss = o2::globaltracking::getSubSpec(strict ? o2::globaltracking::MatchingType::Strict : o2::globaltracking::MatchingType::Standard);
60
61 const char* match_name[4] = {"TOFMatchedWriter_TPC", "TOFMatchedWriter_ITSTPC", "TOFMatchedWriter_TPCTRD", "TOFMatchedWriter_ITSTPCTRD"};
62 const char* match_name_strict[4] = {"TOFMatchedWriter_TPC_str", "TOFMatchedWriter_ITSTPC_str", "TOFMatchedWriter_TPCTRD_str", "TOFMatchedWriter_ITSTPCTRD_str"};
63
64 const char* taskName = match_name[mode];
65 if (strict) {
66 taskName = match_name_strict[mode];
67 }
68
69 // inputBindings better be unique for each data spec, otherwise
70 // they can not be "combined" into a single DPL device
71 std::stringstream inputBinding1, inputBinding2, inputBinding3;
72 inputBinding1 << "tofmatching_" << mode;
73 inputBinding2 << "tpctofTracks_" << mode;
74 inputBinding3 << "matchtoflabels_" << mode;
75
76 return MakeRootTreeWriterSpec(taskName,
77 outdef,
78 "matchTOF",
79 BranchDefinition<MatchInfo>{InputSpec{inputBinding1.str().c_str(), gDataOriginTOF, ddMatchInfo[mode], ss},
80 "TOFMatchInfo",
81 "TOFMatchInfo-branch-name",
82 1,
83 loggerMatched},
84 BranchDefinition<TrackInfo>{InputSpec{inputBinding2.str().c_str(), gDataOriginTOF, "TOFTRACKS_TPC", ss},
85 "TPCTOFTracks",
86 "TPCTOFTracks-branch-name",
87 writeTracks},
88 BranchDefinition<LabelsType>{InputSpec{inputBinding3.str().c_str(), gDataOriginTOF, ddMCMatchTOF[mode], ss},
89 "MatchTOFMCTruth",
90 "MatchTOFMCTruth-branch-name",
91 (useMC ? 1 : 0), // one branch if mc labels enabled
92 loggerTofLabels})();
93}
94} // namespace tof
95} // namespace o2
Class to store the output of the matching to TOF for calibration.
Definition of the TOF cluster.
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Definition of a container to keep Monte Carlo truth external to simulation objects.
Configurable generator for RootTreeWriter processor spec.
Class to store the output of the matching to TOF.
Defintions for the inter-detector matching type.
Result of refitting TPC with TOF match constraint.
std::ostringstream debug
Generate a processor spec for the RootTreeWriter utility.
GLenum mode
Definition glcorearb.h:266
constexpr o2::header::DataOrigin gDataOriginTOF
Definition DataHeader.h:575
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
O2 data header classes and API, v0.1.
Definition DetID.h:49
o2::framework::DataProcessorSpec getTOFMatchedWriterSpec(bool useMC, const char *outdef="o2match_tof.root", bool writeTracks=false, int mode=0, bool strict=false)
std::vector< o2::dataformats::MatchInfoTOF > MatchInfo
std::vector< o2::dataformats::TrackTPCTOF > TrackInfo
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"