Project
Loading...
Searching...
No Matches
GRPGeomHelper.h
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
15
16#ifndef ALICEO2_GRPGEOM_HELPER
17#define ALICEO2_GRPGEOM_HELPER
18
19#include <vector>
20#include <memory>
26
27namespace o2::framework
28{
29class ProcessingContext;
31class InputSpec;
32} // namespace o2::framework
33
34namespace o2::detectors
35{
36class AlignParam;
37}
38namespace o2::parameters
39{
40class GRPECSObject;
41class GRPLHCIFData;
42class GRPMagField;
43} // namespace o2::parameters
44
45namespace o2
46{
47namespace base
48{
49class MatLayerCylSet;
50
51/*
52
53 // Helper class to request CCDB condition data from the processor specs definition
54 // User should request wanted objects in the device spec defintion by calling
55
56 std::vector<InputSpec> inputs;
57 ...
58 auto ccdbRequest = std::make_shared<GRPGeomRequest>(..., inputs);
59 // and pass it to the Device class, which must do in the constructor or init method:
60 GRPGeomRequest::instance()->setRequest(ccdbRequest);
61
62 // Then user should call the method GRPGeomRequest::instance()->finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
63 // from the device finaliseCCDB method and call the method GRPGeomRequest::instance()->checkUpdates(pc) in the beginning of the run method
64
65 I.e the task should look like:
66 class MyTask {
67 public:
68 MyTask(std::shared_ptr<GRPGeomRequest> req, ...) : mCCDBReq(req) {
69 ...
70 }
71 void init(o2::framework::InitContext& ic) {
72 GRPGeomHelper::instance().setRequest(mCCDBReq);
73 ...
74 }
75 void finaliseCCDB(ConcreteDataMatcher& matcher, void* obj) {
76 if (GRPGeomHelper::instance().finaliseCCDB(matcher, obj)) {
77 return;
78 }
79 ...
80 }
81 void run(ProcessingContext& pc) {
82 GRPGeomHelper::instance().checkUpdates(pc);
83 ...
84 }
85 protected:
86 std::shared_ptr<GRPGeomRequest> mCCDBReq;
87 }
88*/
89
95
96 bool askAggregateRunInfo = false;
97 bool askGRPECS = false;
98 bool askGRPLHCIF = false;
99 bool askGRPMagField = false;
100 bool askMatLUT = false;
101 bool askTime = false; // need orbit reset time for precise timestamp calculation
102 bool askGeomAlign = false; // load aligned geometry
103 bool askGeomIdeal = false; // load ideal geometry
104 bool askAlignments = false; // load detector alignments but don't apply them
105 bool askOnceAllButField = false; // for all entries but field query only once
106 bool needPropagatorD = false; // init also PropagatorD
107
108 GRPGeomRequest() = delete;
109 GRPGeomRequest(bool orbitResetTime, bool GRPECS, bool GRPLHCIF, bool GRPMagField, bool askMatLUT, GeomRequest geom, std::vector<o2::framework::InputSpec>& inputs, bool askOnce = false, bool needPropD = false, std::string detMaskString = "all");
110 void requireAggregateRunInfo(std::vector<o2::framework::InputSpec>& inputs);
111 void addInput(const o2::framework::InputSpec&& isp, std::vector<o2::framework::InputSpec>& inputs);
112};
113
114// Helper class to process and access GRPs and geometry objects.
115
117{
118
119 public:
121 {
122 static GRPGeomHelper inst;
123 return inst;
124 }
125 void setRequest(std::shared_ptr<GRPGeomRequest> req);
126 bool finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj);
128
129 auto getAlignment(o2::detectors::DetID det) const { return mAlignments[det]; }
130 auto getMatLUT() const { return mMatLUT; }
131 auto getGRPECS() const { return mGRPECS; }
132 auto getGRPLHCIF() const { return mGRPLHCIF; }
133 auto getGRPMagField() const { return mGRPMagField; }
134 auto getOrbitResetTimeMS() const { return mOrbitResetTimeMUS / 1000; }
135 auto getOrbitResetTimeMUS() const { return mOrbitResetTimeMUS; }
136 const o2::parameters::AggregatedRunInfo& getAggregatedRunInfo() const { return mAggregatedRunInfo; }
137 static int getNHBFPerTF();
138
139 private:
140 GRPGeomHelper() = default;
141
142 std::shared_ptr<GRPGeomRequest> mRequest;
143
144 std::array<const std::vector<o2::detectors::AlignParam>*, o2::detectors::DetID::nDetectors> mAlignments{};
145 const o2::base::MatLayerCylSet* mMatLUT = nullptr;
146 const o2::parameters::GRPECSObject* mGRPECS = nullptr;
147 const o2::parameters::GRPLHCIFData* mGRPLHCIF = nullptr;
148 const o2::parameters::GRPMagField* mGRPMagField = nullptr;
149 o2::parameters::AggregatedRunInfo mAggregatedRunInfo{};
150 long mOrbitResetTimeMUS = 0; // orbit reset time in microseconds
151};
152
153} // namespace base
154} // namespace o2
155
156#endif
Header of the AggregatedRunInfo struct.
container for the LHC InterFace data
Header of the General Run Parameters object for B field values.
auto getOrbitResetTimeMS() const
void checkUpdates(o2::framework::ProcessingContext &pc)
auto getAlignment(o2::detectors::DetID det) const
bool finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj)
auto getOrbitResetTimeMUS() const
static GRPGeomHelper & instance()
const o2::parameters::AggregatedRunInfo & getAggregatedRunInfo() const
void setRequest(std::shared_ptr< GRPGeomRequest > req)
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
static constexpr int nDetectors
number of defined detectors
Definition DetID.h:96
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
void requireAggregateRunInfo(std::vector< o2::framework::InputSpec > &inputs)
void addInput(const o2::framework::InputSpec &&isp, std::vector< o2::framework::InputSpec > &inputs)