Skip to content

Commit

Permalink
Base: allow to create alignment for individual detectors other than ITS
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Schlepper <[email protected]>
  • Loading branch information
f3sch committed Jan 23, 2025
1 parent 4d5a07f commit 19676ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
13 changes: 7 additions & 6 deletions Detectors/Base/include/DetectorsBase/GRPGeomHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ struct GRPGeomRequest {
bool askGRPLHCIF = false;
bool askGRPMagField = false;
bool askMatLUT = false;
bool askTime = false; // need orbit reset time for precise timestamp calculation
bool askGeomAlign = false; // load aligned geometry
bool askGeomIdeal = false; // load ideal geometry
bool askAlignments = false; // load detector alignments but don't apply them
bool askOnceAllButField = false; // for all entries but field query only once
bool needPropagatorD = false; // init also PropagatorD
bool askTime = false; // need orbit reset time for precise timestamp calculation
bool askGeomAlign = false; // load aligned geometry
bool askGeomIdeal = false; // load ideal geometry
bool askAlignments = false; // load detector alignments but don't apply them
bool askOnceAllButField = false; // for all entries but field query only once
bool needPropagatorD = false; // init also PropagatorD
o2::detectors::DetID::mask_t algDetMask; // mask of requested alignment objects

GRPGeomRequest() = delete;
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");
Expand Down
11 changes: 8 additions & 3 deletions Detectors/Base/src/GRPGeomHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ using namespace o2::framework;
namespace o2d = o2::dataformats;

GRPGeomRequest::GRPGeomRequest(bool orbitResetTime, bool GRPECS, bool GRPLHCIF, bool GRPMagField, bool askMatLUT, GeomRequest geom, std::vector<o2::framework::InputSpec>& inputs, bool askOnce, bool needPropD, std::string detMaskString)
: askGRPECS(GRPECS), askGRPLHCIF(GRPLHCIF), askGRPMagField(GRPMagField), askMatLUT(askMatLUT), askTime(orbitResetTime), askOnceAllButField(askOnce), needPropagatorD(needPropD)
: askGRPECS(GRPECS), askGRPLHCIF(GRPLHCIF), askGRPMagField(GRPMagField), askMatLUT(askMatLUT), askTime(orbitResetTime), askOnceAllButField(askOnce), needPropagatorD(needPropD), algDetMask(DetID::getMask(detMaskString))
{
if (geom == Aligned) {
askGeomAlign = true;
Expand All @@ -48,7 +48,6 @@ GRPGeomRequest::GRPGeomRequest(bool orbitResetTime, bool GRPECS, bool GRPLHCIF,
}
if (geom == Alignments) {
askAlignments = true;
o2::detectors::DetID::mask_t algDetMask = DetID::getMask(detMaskString);
for (auto id = DetID::First; id <= DetID::Last; id++) {
if (algDetMask[id]) {
std::string binding = fmt::format("align{}", DetID::getName(id));
Expand Down Expand Up @@ -164,6 +163,9 @@ bool GRPGeomHelper::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
constexpr o2::header::DataDescription algDesc{"ALIGNMENT"};
if (mRequest->askAlignments && matcher.description == algDesc) {
for (auto id = DetID::First; id <= DetID::Last; id++) {
if (!mRequest->algDetMask[id]) {
continue;
}
if (matcher.origin == DetID::getDataOrigin(id)) {
LOG(info) << DetID::getName(id) << " alignment updated";
mAlignments[id] = (std::vector<o2::detectors::AlignParam>*)obj;
Expand Down Expand Up @@ -233,9 +235,12 @@ void GRPGeomHelper::checkUpdates(ProcessingContext& pc)
}
if (mRequest->askAlignments) {
for (auto id = DetID::First; id <= DetID::Last; id++) {
if (!mRequest->algDetMask[id]) {
continue;
}
std::string binding = fmt::format("align{}", DetID::getName(id));
if (pc.inputs().getPos(binding.c_str()) < 0) {
return;
LOGP(fatal, "Alignment for detector {} was requested but no binding was found!", id);
} else {
pc.inputs().get<std::vector<o2::detectors::AlignParam>*>(binding);
}
Expand Down

0 comments on commit 19676ca

Please sign in to comment.