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"
27#include "TPCFastTransform.h"
37
38using namespace o2::framework;
39using namespace o2::dataformats;
40using namespace o2::globaltracking;
41using namespace o2::base;
42using namespace o2::gpu;
43using namespace o2::tpc;
44using namespace o2::trd;
45
46void customize(std::vector<ConfigParamSpec>& workflowOptions)
47{
48 std::vector<o2::framework::ConfigParamSpec> options{
49 {"enable-mc", o2::framework::VariantType::Bool, false, {"enable visualization of MC data"}},
50 {"disable-mc", o2::framework::VariantType::Bool, false, {"disable visualization of MC data"}}, // for compatibility, overrides enable-mc
51 {"display-clusters", VariantType::String, "ITS,TPC,TRD,TOF", {"comma-separated list of clusters to display"}},
52 {"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"}},
53 {"read-from-files", o2::framework::VariantType::Bool, false, {"Automatically create readers for input"}},
54 {"disable-root-input", o2::framework::VariantType::Bool, false, {"Disable root input overriding read-from-files"}},
55 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
56
57 std::swap(workflowOptions, options);
58}
59
61
63{
65 mConfig.reset(new GPUO2InterfaceConfiguration);
66 mConfig->configGRP.solenoidBzNominalGPU = 0;
67 mConfParam.reset(new GPUSettingsO2(mConfig->ReadConfigurableParam()));
68
69 mFastTransformHelper.reset(new o2::tpc::CorrectionMapsLoader());
70 mFastTransform = std::move(TPCFastTransformHelperO2::instance()->create(0));
71 mFastTransformRef = std::move(TPCFastTransformHelperO2::instance()->create(0));
72 mFastTransformMShape = std::move(TPCFastTransformHelperO2::instance()->create(0));
73 mFastTransformHelper->setCorrMap(mFastTransform.get());
74 mFastTransformHelper->setCorrMapRef(mFastTransformRef.get());
75 mFastTransformHelper->setCorrMapMShape(mFastTransformMShape.get());
76 mConfig->configCalib.fastTransform = mFastTransformHelper->getCorrMap();
77 mConfig->configCalib.fastTransformRef = mFastTransformHelper->getCorrMapRef();
78 mConfig->configCalib.fastTransformMShape = mFastTransformHelper->getCorrMapMShape();
79 mConfig->configCalib.fastTransformHelper = mFastTransformHelper.get();
80
81 mTrdGeo.reset(new o2::trd::GeometryFlat());
82 mConfig->configCalib.trdGeometry = mTrdGeo.get();
83
84 mITSDict = std::make_unique<o2::itsmft::TopologyDictionary>();
85 mConfig->configCalib.itsPatternDict = mITSDict.get();
86
87 mConfig->configProcessing.runMC = mUseMC;
88
89 mTFSettings.reset(new o2::gpu::GPUSettingsTF);
90 mTFSettings->hasSimStartOrbit = 1;
91 auto& hbfu = o2::raw::HBFUtils::Instance();
92 mTFSettings->simStartOrbit = hbfu.getFirstIRofTF(o2::InteractionRecord(0, hbfu.orbitFirstSampled)).orbit;
93 mAutoContinuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin < -1;
94
95 mDisplay.reset(new GPUO2InterfaceDisplay(mConfig.get()));
96}
97
99{
101 if (GRPGeomHelper::instance().getGRPECS()->isDetReadOut(o2::detectors::DetID::TPC) && mConfParam->tpcTriggeredMode ^ !GRPGeomHelper::instance().getGRPECS()->isDetContinuousReadOut(o2::detectors::DetID::TPC)) {
102 LOG(fatal) << "configKeyValue tpcTriggeredMode does not match GRP isDetContinuousReadOut(TPC) setting";
103 }
104 if (mDisplayShutDown) {
105 return;
106 }
107
108 mTFSettings->tfStartOrbit = pc.services().get<o2::framework::TimingInfo>().firstTForbit;
109 mTFSettings->hasTfStartOrbit = 1;
110 mTFSettings->hasNHBFPerTF = 1;
111 mTFSettings->nHBFPerTF = mConfParam->overrideNHbfPerTF ? mConfParam->overrideNHbfPerTF : GRPGeomHelper::instance().getGRPECS()->getNHBFPerTF();
112 mTFSettings->hasRunStartOrbit = 0;
113
114 if (mGRPGeomUpdated) {
115 mGRPGeomUpdated = false;
116 mConfig->configGRP.solenoidBzNominalGPU = GPUO2InterfaceUtils::getNominalGPUBz(*GRPGeomHelper::instance().getGRPMagField());
117 if (mAutoContinuousMaxTimeBin) {
118 mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(mTFSettings->nHBFPerTF);
119 }
120 mDisplay->UpdateGRP(&mConfig->configGRP);
121 if (mGeometryCreated == 0) {
122 auto gm = o2::trd::Geometry::instance();
123 gm->createPadPlaneArray();
124 gm->createClusterMatrixArray();
125 mTrdGeo.reset(new o2::trd::GeometryFlat(*gm));
126 mConfig->configCalib.trdGeometry = mTrdGeo.get();
127 mGeometryCreated = true;
128 mUpdateCalib = true;
129
132 }
133 }
134 if (mUpdateCalib) {
135 mDisplay->UpdateCalib(&mConfig->configCalib);
136 }
137
138 if (mDisplayStarted == false) {
139 if (mDisplay->startDisplay()) {
140 throw std::runtime_error("Error starting event display");
141 }
142 mDisplayStarted = true;
143 }
144
146 recoData.collectData(pc, *mDataRequest);
148 auto tmpContainer = GPUWorkflowHelper::fillIOPtr(ptrs, recoData, mUseMC, &(mConfig->configCalib), mClMask, mTrkMask, mTrkMask);
149
150 ptrs.settingsTF = mTFSettings.get();
151
152 if (mDisplay->show(&ptrs)) {
153 mDisplay->endDisplay();
154 mDisplayShutDown = true;
155 }
156}
157
159{
160 if (mDisplayShutDown) {
161 return;
162 }
163 mDisplay->endDisplay();
164 mDisplayShutDown = true;
165}
166
168{
169 if (matcher == o2::framework::ConcreteDataMatcher("ITS", "CLUSDICT", 0)) {
170 mConfig->configCalib.itsPatternDict = (const o2::itsmft::TopologyDictionary*)obj;
171 mUpdateCalib = true;
172 return;
173 }
174 if (GRPGeomHelper::instance().finaliseCCDB(matcher, obj)) {
175 mGRPGeomUpdated = true;
176 return;
177 }
178}
179
181{
182 WorkflowSpec specs;
183
184 o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
185
186 bool useMC = cfgc.options().get<bool>("enable-mc") && !cfgc.options().get<bool>("disable-mc");
187 GlobalTrackID::mask_t srcTrk = GlobalTrackID::getSourcesMask(cfgc.options().get<std::string>("display-tracks"));
188 GlobalTrackID::mask_t srcCl = GlobalTrackID::getSourcesMask(cfgc.options().get<std::string>("display-clusters"));
189 if (!srcTrk.any() && !srcCl.any()) {
190 throw std::runtime_error("No input configured");
191 }
192 std::shared_ptr<DataRequest> dataRequest = std::make_shared<DataRequest>();
193 dataRequest->requestTracks(srcTrk, useMC);
194 dataRequest->requestClusters(srcCl, useMC);
195
196 if (cfgc.options().get<bool>("read-from-files")) {
197 InputHelper::addInputSpecs(cfgc, specs, srcCl, srcTrk, srcTrk, useMC);
198 }
199
200 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, true, false, true, false, o2::base::GRPGeomRequest::Aligned, dataRequest->inputs, true);
201
202 specs.emplace_back(DataProcessorSpec{
203 "o2-gpu-display",
204 dataRequest->inputs,
205 {},
206 AlgorithmSpec{adaptFromTask<O2GPUDPLDisplaySpec>(useMC, srcTrk, srcCl, dataRequest, ggRequest)}});
207
208 return specs;
209}
Helper class to access correction maps.
Helper class to access load maps from CCDB.
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
Definition of TPCFastTransform class.
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 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
Definition of a container to keep/associate and arbitrary number of labels associated to an index wit...
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
Global TPC definitions and constants.
Definition SimTraits.h:167
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)
const GPUSettingsTF * settingsTF
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"