Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class AlignParam
double getZ() const { return mZ; }

/// apply object to geoemetry
bool applyToGeometry() const;
bool applyToGeometry(int printLevel = -1) const;

/// extract global delta matrix
TGeoHMatrix createMatrix() const;
Expand Down
23 changes: 17 additions & 6 deletions DataFormats/Detectors/Common/src/AlignParam.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
/// \file AlignParam.cxx
/// \brief Implementation of the base alignment parameters class

#include <fairlogger/Logger.h>
#include <TGeoManager.h>
#include <TGeoMatrix.h>
#include <TGeoOverlap.h>
#include <TGeoPhysicalNode.h>

#include "Framework/Logger.h"
#include "DetectorsCommonDataFormats/AlignParam.h"

using namespace o2::detectors;
Expand Down Expand Up @@ -261,7 +261,7 @@ bool AlignParam::createLocalMatrix(TGeoHMatrix& m) const
}

//_____________________________________________________________________________
bool AlignParam::applyToGeometry() const
bool AlignParam::applyToGeometry(int printLevel) const
{
/// Apply the current alignment object to the TGeo geometry
/// This method returns FALSE if the symname of the object was not
Expand Down Expand Up @@ -308,13 +308,24 @@ bool AlignParam::applyToGeometry() const
TGeoHMatrix* align = new TGeoHMatrix(createMatrix());
if (mIsGlobal) {
align->Multiply(node->GetMatrix());
TGeoHMatrix* g = node->GetMatrix(node->GetLevel() - 1);
align->MultiplyLeft(node->GetMatrix(node->GetLevel() - 1)->Inverse());
} else {
align->MultiplyLeft(node->GetOriginalMatrix());
}
LOG(debug) << "Aligning volume " << symname;

node->Align(align);

if (getLevel() <= printLevel) {
LOGP(info, "{:*^100}", symname);
LOGP(info, " - Alignment parameter:");
print();
LOGP(info, " - Alignment matrix:");
align->Print();
LOGP(info, " - Node:");
node->Print();
LOGP(info, "{:~^100}", symname);
}

return true;
}

Expand Down Expand Up @@ -347,8 +358,8 @@ int AlignParam::getLevel() const
void AlignParam::print() const
{
// print parameters
printf("%s : %6d | X: %+e Y: %+e Z: %+e | pitch: %+e roll: %+e yaw: %e\n", getSymName().c_str(), getAlignableID(), getX(),
getY(), getZ(), getPsi(), getTheta(), getPhi());
printf("%s (Lvl:%2d): %6d | %s | tra: X: %+e Y: %+e Z: %+e | pitch: %+e roll: %+e yaw: %e\n", getSymName().c_str(), getLevel(), getAlignableID(), (mIsGlobal) ? "G" : "L",
getX(), getY(), getZ(), getPsi(), getTheta(), getPhi());
}

//_____________________________________________________________________________
Expand Down
2 changes: 2 additions & 0 deletions Detectors/Base/include/DetectorsBase/GeometryManagerParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ struct GeometryManagerParam : public o2::conf::ConfigurableParamHelper<GeometryM
bool usePwGeoBVH = false;
bool usePwCaching = false;

int printLevel = -1; // geometry level to print out (determined by the volume path)

O2ParamDef(GeometryManagerParam, "GeometryManagerParam");
};

Expand Down
3 changes: 2 additions & 1 deletion Detectors/Base/src/GeometryManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <numeric>

#include "DetectorsBase/GeometryManager.h"
#include "DetectorsBase/GeometryManagerParam.h"
#include "DetectorsCommonDataFormats/AlignParam.h"
#include "CommonUtils/NameConf.h"
#include "DetectorsBase/Aligner.h"
Expand Down Expand Up @@ -256,7 +257,7 @@ bool GeometryManager::applyAlignment(const std::vector<o2::detectors::AlignParam

bool res = true;
for (int i = 0; i < nvols; i++) {
if (!algPars[ord[i]].applyToGeometry()) {
if (!algPars[ord[i]].applyToGeometry(GeometryManagerParam::Instance().printLevel)) {
res = false;
LOG(error) << "Error applying alignment object for volume" << algPars[ord[i]].getSymName();
}
Expand Down