Project
Loading...
Searching...
No Matches
O2GPUDPLDisplay.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
20#include "TRDBase/Geometry.h"
21#include "TOFBase/Geo.h"
25#include "GPUO2InterfaceUtils.h"
28#include "TPCFastTransformPOD.h"
36
37using namespace o2::framework;
38using namespace o2::dataformats;
39using namespace o2::globaltracking;
40using namespace o2::base;
41using namespace o2::gpu;
42using namespace o2::tpc;
43using namespace o2::trd;
44
45void customize(std::vector<ConfigParamSpec>& workflowOptions)
46{
47 std::vector<o2::framework::ConfigParamSpec> options{
48 {"enable-mc", o2::framework::VariantType::Bool, false, {"enable visualization of MC data"}},
49 {"disable-mc", o2::framework::VariantType::Bool, false, {"disable visualization of MC data"}}, // for compatibility, overrides enable-mc
50 {"display-clusters", VariantType::String, "ITS,TPC,TRD,TOF", {"comma-separated list of clusters to display"}},
51 {"display-tracks", VariantType::String, "TPC,ITS,ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF", {"comma-separated list of tracks to display"}},
52 {"read-from-files", o2::framework::VariantType::Bool, false, {"Automatically create readers for input"}},
53 {"disable-root-input", o2::framework::VariantType::Bool, false, {"Disable root input overriding read-from-files"}},
54 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
56 std::swap(workflowOptions, options);
57}
58
60
62{
64 mConfig.reset(new GPUO2InterfaceConfiguration);
65 mConfig->configGRP.solenoidBzNominalGPU = 0;
66 mConfParam.reset(new GPUSettingsO2(mConfig->ReadConfigurableParam()));
67
70 mBufferFastTransform = std::move(buffer);
71 mFastTransform = mBufferFastTransform.get();
72 mConfig->configCalib.fastTransform = mFastTransform;
73
74 mTrdGeo.reset(new o2::trd::GeometryFlat());
75 mConfig->configCalib.trdGeometry = mTrdGeo.get();
76
77 mITSDict = std::make_unique<o2::itsmft::TopologyDictionary>();
78 mConfig->configCalib.itsPatternDict = mITSDict.get();
79
80 mConfig->configProcessing.runMC = mUseMC;
81
82 mTFSettings.reset(new o2::gpu::GPUSettingsTF);
83 mTFSettings->hasSimStartOrbit = 1;
84 auto& hbfu = o2::raw::HBFUtils::Instance();
85 mTFSettings->simStartOrbit = hbfu.getFirstIRofTF(o2::InteractionRecord(0, hbfu.orbitFirstSampled)).orbit;
86 mAutoContinuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin < -1;
87
88 mDisplay.reset(new GPUO2InterfaceDisplay(mConfig.get()));
89}
90
92{
94 if (GRPGeomHelper::instance().getGRPECS()->isDetReadOut(o2::detectors::DetID::TPC) && mConfParam->tpcTriggeredMode ^ !GRPGeomHelper::instance().getGRPECS()->isDetContinuousReadOut(o2::detectors::DetID::TPC)) {
95 LOG(fatal) << "configKeyValue tpcTriggeredMode does not match GRP isDetContinuousReadOut(TPC) setting";
96 }
97 if (mDisplayShutDown) {
98 return;
99 }
100
101 mTFSettings->tfStartOrbit = pc.services().get<o2::framework::TimingInfo>().firstTForbit;
102 mTFSettings->hasTfStartOrbit = 1;
103 mTFSettings->hasNHBFPerTF = 1;
104 mTFSettings->nHBFPerTF = mConfParam->overrideNHbfPerTF ? mConfParam->overrideNHbfPerTF : GRPGeomHelper::instance().getGRPECS()->getNHBFPerTF();
105 mTFSettings->hasRunStartOrbit = 0;
106
107 if (mGRPGeomUpdated) {
108 mGRPGeomUpdated = false;
109 mConfig->configGRP.solenoidBzNominalGPU = GPUO2InterfaceUtils::getNominalGPUBz(*GRPGeomHelper::instance().getGRPMagField());
110 if (mAutoContinuousMaxTimeBin) {
111 mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(mTFSettings->nHBFPerTF);
112 }
113 mDisplay->UpdateGRP(&mConfig->configGRP);
114 if (mGeometryCreated == 0) {
115 auto gm = o2::trd::Geometry::instance();
116 gm->createPadPlaneArray();
117 gm->createClusterMatrixArray();
118 mTrdGeo.reset(new o2::trd::GeometryFlat(*gm));
119 mConfig->configCalib.trdGeometry = mTrdGeo.get();
120 mGeometryCreated = true;
121 mUpdateCalib = true;
122
125 }
126 }
127 if (mUpdateCalib) {
128 mDisplay->UpdateCalib(&mConfig->configCalib);
129 }
130
131 if (mDisplayStarted == false) {
132 if (mDisplay->startDisplay()) {
133 throw std::runtime_error("Error starting event display");
134 }
135 mDisplayStarted = true;
136 }
137
139 recoData.collectData(pc, *mDataRequest);
141 auto tmpContainer = GPUWorkflowHelper::fillIOPtr(ptrs, recoData, mUseMC, &(mConfig->configCalib), mClMask, mTrkMask, mTrkMask);
142
143 ptrs.settingsTF = mTFSettings.get();
144
145 if (mDisplay->show(&ptrs)) {
146 mDisplay->endDisplay();
147 mDisplayShutDown = true;
148 }
149}
150
152{
153 if (mDisplayShutDown) {
154 return;
155 }
156 mDisplay->endDisplay();
157 mDisplayShutDown = true;
158}
159
161{
162 if (matcher == o2::framework::ConcreteDataMatcher("ITS", "CLUSDICT", 0)) {
163 mConfig->configCalib.itsPatternDict = (const o2::itsmft::TopologyDictionary*)obj;
164 mUpdateCalib = true;
165 return;
166 }
167 if (GRPGeomHelper::instance().finaliseCCDB(matcher, obj)) {
168 mGRPGeomUpdated = true;
169 return;
170 }
171}
172
174{
175 WorkflowSpec specs;
176
177 o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
178
179 bool useMC = cfgc.options().get<bool>("enable-mc") && !cfgc.options().get<bool>("disable-mc");
180 GlobalTrackID::mask_t srcTrk = GlobalTrackID::getSourcesMask(cfgc.options().get<std::string>("display-tracks"));
181 GlobalTrackID::mask_t srcCl = GlobalTrackID::getSourcesMask(cfgc.options().get<std::string>("display-clusters"));
182 if (!srcTrk.any() && !srcCl.any()) {
183 throw std::runtime_error("No input configured");
184 }
185 std::shared_ptr<DataRequest> dataRequest = std::make_shared<DataRequest>();
186 dataRequest->requestTracks(srcTrk, useMC);
187 dataRequest->requestClusters(srcCl, useMC);
188
189 if (cfgc.options().get<bool>("read-from-files")) {
190 InputHelper::addInputSpecs(cfgc, specs, srcCl, srcTrk, srcTrk, useMC);
191 }
192
193 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, true, false, true, false, o2::base::GRPGeomRequest::Aligned, dataRequest->inputs, true);
194
195 specs.emplace_back(DataProcessorSpec{
196 "o2-gpu-display",
197 dataRequest->inputs,
198 {},
199 AlgorithmSpec{adaptFromTask<O2GPUDPLDisplaySpec>(useMC, srcTrk, srcCl, dataRequest, ggRequest)}});
200
201 return specs;
202}
Wrapper container for different reconstructed object types.
Definition of the ClusterTopology class.
Definition of the GeometryManager class.
Helper for geometry and GRP related CCDB requests.
Header of the General Run Parameters object.
Definition of the GeometryTGeo class.
Definition of the Names Generator class.
void customize(std::vector< ConfigParamSpec > &workflowOptions)
Struct for input data required by TRD tracking workflow.
class to create TPC fast transformation
POD correction map.
Helper class to obtain TPC clusters / digits / labels from DPL.
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
void checkUpdates(o2::framework::ProcessingContext &pc)
bool finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
static void updateFromString(std::string const &)
static mask_t getSourcesMask(const std::string_view srcList)
static constexpr ID TPC
Definition DetID.h:64
ConfigParamRegistry & options() const
ServiceRegistryRef services()
The services registry associated with this processing context.
static int addInputSpecs(const o2::framework::ConfigContext &configcontext, o2::framework::WorkflowSpec &specs, GID::mask_t maskClusters, GID::mask_t maskMatches, GID::mask_t maskTracks, bool useMC=true, GID::mask_t maskClustersMC=GID::getSourcesMask(GID::ALL), GID::mask_t maskTracksMC=GID::getSourcesMask(GID::ALL), bool subSpecStrict=false)
static uint32_t getTpcMaxTimeBinFromNHbf(uint32_t nHbf)
static float getNominalGPUBz(T &src)
static std::shared_ptr< const tmpDataContainer > fillIOPtr(GPUTrackingInOutPointers &ioPtr, const o2::globaltracking::RecoContainer &recoCont, bool useMC, const GPUCalibObjectsConst *calib=nullptr, GID::mask_t maskCl=GID::MASK_ALL, GID::mask_t maskTrk=GID::MASK_ALL, GID::mask_t maskMatch=GID::MASK_ALL)
void run(o2::framework::ProcessingContext &pc) final
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj) final
void init(o2::framework::InitContext &ic) final
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
static TPCFastTransformPOD * create(aligned_unique_buffer_ptr< TPCFastTransformPOD > &destVector, const TPCFastTransform &src)
Create POD transform from old flat-buffer one. Provided vector will serve as a buffer.
static GeometryTGeo * Instance()
void fillMatrixCache(int mask) override
static void Init()
Definition Geo.cxx:43
static TPCFastTransformHelperO2 * instance()
Singleton.
static Geometry * instance()
Definition Geometry.h:33
GLuint buffer
Definition glcorearb.h:655
Definition of a container to keep/associate and arbitrary number of labels associated to an index wit...
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< DataProcessorSpec > WorkflowSpec
Global TPC definitions and constants.
Definition SimTraits.h:168
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)
static void addITSConfigOption(std::vector< o2::framework::ConfigParamSpec > &opts)
static constexpr int L2G
Definition Cartesian.h:54
static constexpr int T2L
Definition Cartesian.h:55
static constexpr int T2GRot
Definition Cartesian.h:57
static constexpr int T2G
Definition Cartesian.h:56
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"