Skip to content

Commit 79e7f5e

Browse files
committed
Make o2-create-aligned-geometry-workflow respect align-geom.mDetectors
So far the tool ignored the align-geom configurable and always applied the alignment of all detectors, so an MC transported without alignment was reconstructed with the aligned geometry.
1 parent 5d77620 commit 79e7f5e

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

‎Detectors/GRP/workflows/src/create-aligned-geometry.cxx‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <ctime>
1313
#include <chrono>
1414
#include "DetectorsBase/GeometryManager.h"
15+
#include "DetectorsBase/Aligner.h"
1516
#include "CCDB/BasicCCDBManager.h"
1617
#include "CCDB/CCDBTimeStampUtils.h"
1718
#include "CommonUtils/NameConf.h"
@@ -42,6 +43,11 @@ using namespace o2::framework;
4243
To create the geometry using specific timestamp and ITS alignment from the test CCDB server and MFT alignment
4344
from the local snapshot file in the locCCDB directory
4445
o2-create-aligned-geometry-workflow --condition-remap http://ccdb-test.cern.ch:8080=ITS/Calib/Align;file://locCCDB=MFT/Calib/Align --configKeyValues "HBFUtils.startTime=1546300800000"
46+
47+
The alignment is applied only to the detectors also selected by align-geom.mDetectors, as in o2-sim. The others keep
48+
the ideal geometry, but their GeometryTGeo files are still written. E.g. to create the ideal geometry for an MC
49+
transported with align-geom.mDetectors=none:
50+
o2-create-aligned-geometry-workflow --configKeyValues "HBFUtils.startTime=1546300800000;align-geom.mDetectors=none"
4551
*/
4652

4753
namespace o2::base
@@ -73,7 +79,7 @@ class SeederTask : public Task
7379
class AlignerTask : public Task
7480
{
7581
public:
76-
AlignerTask(DetID::mask_t dets, std::shared_ptr<o2::base::GRPGeomRequest> gr) : mDetsMask(dets), mGGCCDBRequest(gr) {}
82+
AlignerTask(DetID::mask_t dets, DetID::mask_t algDets, std::shared_ptr<o2::base::GRPGeomRequest> gr) : mDetsMask(dets), mAlgDetsMask(algDets), mGGCCDBRequest(gr) {}
7783
~AlignerTask() override = default;
7884

7985
void init(InitContext& ic) final
@@ -85,14 +91,16 @@ class AlignerTask : public Task
8591
{
8692
o2::base::GRPGeomHelper::instance().checkUpdates(pc);
8793
for (auto id = DetID::First; id <= DetID::Last; id++) {
88-
if (mDetsMask[id]) {
94+
if (mAlgDetsMask[id]) {
8995
auto alg = o2::base::GRPGeomHelper::instance().getAlignment(id);
9096
if (!alg->empty()) {
9197
LOGP(info, "Applying alignment for detector {}", DetID::getName(id));
9298
o2::base::GeometryManager::applyAlignment(*alg);
9399
} else {
94100
LOGP(info, "Alignment for detector {} is empty", DetID::getName(id));
95101
}
102+
} else if (mDetsMask[id]) {
103+
LOGP(info, "Detector {} is kept ideal (not in align-geom.mDetectors)", DetID::getName(id));
96104
}
97105
}
98106
gGeoManager->SetName(std::string(o2::base::NameConf::CCDBOBJECT).c_str());
@@ -135,13 +143,14 @@ class AlignerTask : public Task
135143
}
136144

137145
private:
138-
DetID::mask_t mDetsMask{};
146+
DetID::mask_t mDetsMask{}; // detectors to account, including their GeometryTGeo
147+
DetID::mask_t mAlgDetsMask{}; // detectors to align
139148
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
140149
};
141150

142151
} // namespace o2::base
143152

144-
DataProcessorSpec getAlignerSpec(DetID::mask_t dets)
153+
DataProcessorSpec getAlignerSpec(DetID::mask_t dets, DetID::mask_t algDets)
145154
{
146155
std::vector<InputSpec> inputs{{"STFDist", "FLP", "DISTSUBTIMEFRAME", 0}}; // just to have some input
147156
auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
@@ -153,13 +162,13 @@ DataProcessorSpec getAlignerSpec(DetID::mask_t dets)
153162
inputs, // inputs
154163
false, // ask-once
155164
false, // dprop
156-
DetID::getNames(dets)); // only selected detectors
165+
DetID::getNames(algDets)); // only detectors to align
157166

158167
return DataProcessorSpec{
159168
"geometry-aligned-producer",
160169
inputs,
161170
{},
162-
AlgorithmSpec{adaptFromTask<o2::base::AlignerTask>(dets, ggRequest)},
171+
AlgorithmSpec{adaptFromTask<o2::base::AlignerTask>(dets, algDets, ggRequest)},
163172
Options{}};
164173
}
165174

@@ -191,7 +200,9 @@ WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& configcont
191200
// Update the (declared) parameters if changed from the command line
192201
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
193202
DetID::mask_t dets = DetID::FullMask & DetID::getMask(configcontext.options().get<std::string>("onlyDet"));
194-
o2::framework::WorkflowSpec specs{getAlignerSpec(dets), getSeederSpec()};
203+
// align only what o2-sim would align with the same align-geom.mDetectors
204+
DetID::mask_t algDets = dets & DetID::getMask(o2::base::Aligner::Instance().getDetectors());
205+
o2::framework::WorkflowSpec specs{getAlignerSpec(dets, algDets), getSeederSpec()};
195206

196207
return std::move(specs);
197208
}

0 commit comments

Comments
 (0)