Skip to content

Commit c35a2cd

Browse files
committed
Geo: optional print out alignment matrices
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 6c35d65 commit c35a2cd

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/AlignParam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class AlignParam
5555
double getZ() const { return mZ; }
5656

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

6060
/// extract global delta matrix
6161
TGeoHMatrix createMatrix() const;

DataFormats/Detectors/Common/src/AlignParam.cxx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
/// \file AlignParam.cxx
1313
/// \brief Implementation of the base alignment parameters class
1414

15-
#include <fairlogger/Logger.h>
1615
#include <TGeoManager.h>
1716
#include <TGeoMatrix.h>
1817
#include <TGeoOverlap.h>
1918
#include <TGeoPhysicalNode.h>
2019

20+
#include "Framework/Logger.h"
2121
#include "DetectorsCommonDataFormats/AlignParam.h"
2222

2323
using namespace o2::detectors;
@@ -261,7 +261,7 @@ bool AlignParam::createLocalMatrix(TGeoHMatrix& m) const
261261
}
262262

263263
//_____________________________________________________________________________
264-
bool AlignParam::applyToGeometry() const
264+
bool AlignParam::applyToGeometry(int printLevel) const
265265
{
266266
/// Apply the current alignment object to the TGeo geometry
267267
/// This method returns FALSE if the symname of the object was not
@@ -311,10 +311,20 @@ bool AlignParam::applyToGeometry() const
311311
TGeoHMatrix* g = node->GetMatrix(node->GetLevel() - 1);
312312
align->MultiplyLeft(node->GetMatrix(node->GetLevel() - 1)->Inverse());
313313
}
314-
LOG(debug) << "Aligning volume " << symname;
315314

316315
node->Align(align);
317316

317+
if (getLevel() <= printLevel) {
318+
LOGP(info, "{:*^100}", symname);
319+
LOGP(info, " - Alignment parameter:");
320+
print();
321+
LOGP(info, " - Alignment matrix:");
322+
align->Print();
323+
LOGP(info, " - Node:");
324+
node->Print();
325+
LOGP(info, "{:~^100}", symname);
326+
}
327+
318328
return true;
319329
}
320330

Detectors/Base/include/DetectorsBase/GeometryManagerParam.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ struct GeometryManagerParam : public o2::conf::ConfigurableParamHelper<GeometryM
2323
bool usePwGeoBVH = false;
2424
bool usePwCaching = false;
2525

26+
int printLevel = -1; // geometry level to print out (determined by the volume path)
27+
2628
O2ParamDef(GeometryManagerParam, "GeometryManagerParam");
2729
};
2830

Detectors/Base/src/GeometryManager.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <numeric>
2525

2626
#include "DetectorsBase/GeometryManager.h"
27+
#include "DetectorsBase/GeometryManagerParam.h"
2728
#include "DetectorsCommonDataFormats/AlignParam.h"
2829
#include "CommonUtils/NameConf.h"
2930
#include "DetectorsBase/Aligner.h"
@@ -256,7 +257,7 @@ bool GeometryManager::applyAlignment(const std::vector<o2::detectors::AlignParam
256257

257258
bool res = true;
258259
for (int i = 0; i < nvols; i++) {
259-
if (!algPars[ord[i]].applyToGeometry()) {
260+
if (!algPars[ord[i]].applyToGeometry(GeometryManagerParam::Instance().printLevel)) {
260261
res = false;
261262
LOG(error) << "Error applying alignment object for volume" << algPars[ord[i]].getSymName();
262263
}

0 commit comments

Comments
 (0)