Project
Loading...
Searching...
No Matches
HMPMatcherSpec.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
14#include <vector>
15#include <string>
16#include "TStopwatch.h"
24#include "Framework/Task.h"
27
28// from Tracks
37
38// from HMPID
42
43using namespace o2::framework;
44// using MCLabelsTr = gsl::span<const o2::MCCompLabel>;
45// using GID = o2::dataformats::GlobalTrackID;
46// using DetID = o2::detectors::DetID;
47
49using MatchOutputType = std::vector<o2::dataformats::MatchInfoHMP>;
51
52namespace o2
53{
54namespace globaltracking
55{
56
57class HMPMatcherSpec : public Task
58{
59 public:
60 HMPMatcherSpec(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool useMC) : mDataRequest(dr), mGGCCDBRequest(gr), mUseMC(useMC) {}
61 ~HMPMatcherSpec() override = default;
62 void init(InitContext& ic) final;
63 void run(ProcessingContext& pc) final;
65 void finaliseCCDB(ConcreteDataMatcher& matcher, void* obj) final;
66
67 private:
68 std::shared_ptr<DataRequest> mDataRequest;
69 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
70 bool mUseMC = false; // true
71 bool mUseFIT = false;
72 bool mDoTPCRefit = false;
73 bool mStrict = false;
74 MatchHMP mMatcher;
75 TStopwatch mTimer;
76};
77
79{
80 mTimer.Stop();
81 mTimer.Reset();
82 //-------- init geometry and field --------//
84}
85
87{
89 return;
90 }
91}
92
94{
95 mTimer.Start(false);
96
97 RecoContainer recoData;
98 recoData.collectData(pc, *mDataRequest.get());
100
101 auto creationTime = DataRefUtils::getHeader<DataProcessingHeader*>(pc.inputs().getFirstValid(true))->creation;
102
103 // LOG(debug) << "isTrackSourceLoaded: TPC -> " << recoData.isTrackSourceLoaded(o2::dataformats::GlobalTrackID::Source::TPC); LOG(debug) << "isTrackSourceLoaded: ITSTPC -> " << recoData.isTrackSourceLoaded(o2::dataformats::GlobalTrackID::Source::ITSTPC);
104
105 LOG(debug) << "isTrackSourceLoaded: TPC -> " << recoData.isTrackSourceLoaded(o2::dataformats::GlobalTrackID::Source::TPC);
106
107 //:
108 LOG(debug) << "isTrackSourceLoaded: TPCTOF -> " << recoData.isTrackSourceLoaded(o2::dataformats::GlobalTrackID::Source::TPCTOF);
109
110 LOG(debug) << "isTrackSourceLoaded: ITSTPC -> " << recoData.isTrackSourceLoaded(o2::dataformats::GlobalTrackID::Source::ITSTPC);
111 LOG(debug) << "isTrackSourceLoaded: TPCTRD -> " << recoData.isTrackSourceLoaded(o2::dataformats::GlobalTrackID::Source::TPCTRD);
112 LOG(debug) << "isTrackSourceLoaded: ITSTPCTRD -> " << recoData.isTrackSourceLoaded(o2::dataformats::GlobalTrackID::Source::ITSTPCTRD);
113 LOG(debug) << "isTrackSourceLoaded: ITSTPCTOF -> " << recoData.isTrackSourceLoaded(o2::dataformats::GlobalTrackID::Source::ITSTPCTOF);
114 LOG(debug) << "isTrackSourceLoaded: TPCTRDTOF -> " << recoData.isTrackSourceLoaded(o2::dataformats::GlobalTrackID::Source::TPCTRDTOF);
115 LOG(debug) << "isTrackSourceLoaded: ITSTPCTRDTOF -> " << recoData.isTrackSourceLoaded(o2::dataformats::GlobalTrackID::Source::ITSTPCTRDTOF);
116
120
122
127 // uint32_t ss = o2::globaltracking::getSubSpec(mStrict ? o2::globaltracking::MatchingType::Strict : o2::globaltracking::MatchingType::Standard);
128
129 mMatcher.run(recoData);
130
132 if (mUseMC) {
134 }
135
136 mTimer.Stop();
137}
138
140{
141 LOGF(debug, "HMP matching total timing: Cpu: %.3e Real: %.3e s in %d slots",
142 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
143}
144
145DataProcessorSpec getHMPMatcherSpec(GID::mask_t src, bool useMC, float extratolerancetrd, float extratolerancetof)
146{
147 // uint32_t ss = o2::globaltracking::getSubSpec(strict ? o2::globaltracking::MatchingType::Strict : o2::globaltracking::MatchingType::Standard);
148 auto dataRequest = std::make_shared<DataRequest>();
149 /* if (strict) {
150 dataRequest->setMatchingInputStrict();
151 }*/
152
153 dataRequest->requestTracks(src, useMC);
154 dataRequest->requestClusters(GID::getSourceMask(GID::HMP), useMC);
155
156 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
157 true, // GRPECS=true
158 true, // GRPLHCIF
159 true, // GRPMagField
160 true, // askMatLUT
162 dataRequest->inputs,
163 true);
164
165 std::vector<OutputSpec> outputs;
166
167 outputs.emplace_back(o2::header::gDataOriginHMP, "MATCHES", 0, Lifetime::Timeframe);
168 if (useMC) {
169 outputs.emplace_back(o2::header::gDataOriginHMP, "MCLABELS", 0, Lifetime::Timeframe);
170 }
171
172 return DataProcessorSpec{
173 "hmp-matcher",
174 dataRequest->inputs,
175 outputs,
176 AlgorithmSpec{adaptFromTask<HMPMatcherSpec>(dataRequest, ggRequest, useMC)},
177 Options{}};
178}
179
180} // namespace globaltracking
181} // namespace o2
Wrapper container for different reconstructed object types.
Definition of the GeometryManager class.
std::ostringstream debug
Helper for geometry and GRP related CCDB requests.
Header of the General Run Parameters object.
Accessor for TrackParCov derived objects from multiple containers.
Global index for barrel track: provides provenance (detectors combination), index in respective array...
std::vector< o2::dataformats::MatchInfoHMP > MatchOutputType
// ef ; change to hmp
Definition of the Names Generator class.
Definition of the ITS track.
Result of refitting TPC-ITS matched track.
Result of refitting TPC with TOF match constraint.
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
void snapshot(const Output &spec, T const &object)
DataRef getFirstValid(bool throwOnFailure=false) const
Get the ref of the first valid input. If requested, throw an error if none is found.
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
void init(InitContext &ic) final
void run(ProcessingContext &pc) final
~HMPMatcherSpec() override=default
void endOfStream(framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
HMPMatcherSpec(std::shared_ptr< DataRequest > dr, std::shared_ptr< o2::base::GRPGeomRequest > gr, bool useMC)
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj) final
std::vector< o2::dataformats::MatchInfoHMP > & getMatchedTrackVector(o2::globaltracking::MatchHMP::trackType index)
Definition MatchHMP.h:112
std::vector< o2::MCCompLabel > & getMatchedHMPLabelsVector(o2::globaltracking::MatchHMP::trackType index)
get vector of HMP label of matched tracks
Definition MatchHMP.h:114
void run(const o2::globaltracking::RecoContainer &inp)
< perform matching for provided input
Definition MatchHMP.cxx:64
GLenum src
Definition glcorearb.h:1767
constexpr o2::header::DataOrigin gDataOriginHMP
Definition DataHeader.h:569
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
framework::DataProcessorSpec getHMPMatcherSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, float extratolerancetrd, float extratolerancetof)
create a processor spec
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"