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
9 changes: 8 additions & 1 deletion Detectors/EMCAL/base/include/EMCALBase/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
#include <TNamed.h>
#include <TParticle.h>
#include <TVector3.h>
#include <TObjArray.h>

#include "CCDB/BasicCCDBManager.h"
#include "DataFormatsEMCAL/Constants.h"
#include "EMCALBase/GeometryBase.h"
#include "MathUtils/Cartesian.h"
Expand Down Expand Up @@ -57,7 +59,7 @@ class Geometry
/// | EMCAL_COMPLETE12SMV1_DCAL | Full EMCAL, 10 DCAL Supermodules (not used in practice) |
/// | EMCAL_COMPLETE12SMV1_DCAL_8SM | Full EMCAL, 8 DCAL Supermodules (run2) |
/// | EMCAL_COMPLETE12SMV1_DCAL_DEV | Full EMCAL, DCAL development geometry (not used) |
Geometry(const std::string_view name, const std::string_view mcname = "", const std::string_view mctitle = "");
explicit Geometry(const std::string_view name, const std::string_view mcname = "", const std::string_view mctitle = "");

/// \brief Copy constructor.
Geometry(const Geometry& geom);
Expand Down Expand Up @@ -564,6 +566,11 @@ class Geometry
///
void SetMisalMatrix(const TGeoHMatrix* m, Int_t smod) const;

///
/// Method to set shift-rotational matrixes from CCDB
///
void SetMisalMatrixFromCcdb(const char* path = "Users/m/mhemmer/EMCAL/Config/GeometryAligned", int timestamp = 10000) const;

///
/// Transform clusters cell position into global with alternative method, taking into account the depth calculation.
/// Input are:
Expand Down
31 changes: 28 additions & 3 deletions Detectors/EMCAL/base/src/Geometry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "EMCALBase/Geometry.h"

#include <fairlogger/Logger.h>

#include <iomanip>
#include <string>
#include <algorithm>
#include <cstdio>
#include <tuple>

#include <TGeoBBox.h>
#include <TGeoManager.h>
#include <TGeoMatrix.h>
#include <TList.h>

#include <fairlogger/Logger.h>

#include "EMCALBase/Geometry.h"
#include "EMCALBase/ShishKebabTrd1Module.h"

#include <boost/algorithm/string/predicate.hpp>
Expand Down Expand Up @@ -1557,6 +1562,7 @@ const TGeoHMatrix* Geometry::GetMatrixForSuperModule(Int_t smod) const

if (!SMODULEMATRIX[smod]) {
if (gGeoManager) {
LOG(info) << "Loading EMCAL misalignment matrix for SM " << smod << " from GeoManager.";
SetMisalMatrix(GetMatrixForSuperModuleFromGeoManager(smod), smod);
} else {
LOG(fatal) << "Cannot find EMCAL misalignment matrices! Recover them either: \n"
Expand Down Expand Up @@ -1762,6 +1768,25 @@ void Geometry::SetMisalMatrix(const TGeoHMatrix* m, Int_t smod) const
}
}

void Geometry::SetMisalMatrixFromCcdb(const char* path, int timestamp) const
{
LOG(info) << "Using CCDB to obtain EMCal alignment.";
o2::ccdb::CcdbApi api;
map<string, string> metadata; // can be empty
api.init("http://alice-ccdb.cern.ch");
TObjArray* matrices = api.retrieveFromTFileAny<TObjArray>(path, metadata, timestamp);

for (int iSM = 0; iSM < mNumberOfSuperModules; ++iSM) {
TGeoHMatrix* mat = reinterpret_cast<TGeoHMatrix*>(matrices->At(iSM));
if (mat) {

SetMisalMatrix(mat, iSM);
} else {
LOG(info) << "Could not obtain Alignment Matrix for SM " << iSM;
}
}
}

Bool_t Geometry::IsDCALSM(Int_t iSupMod) const
{
if (mEMCSMSystem[iSupMod] == DCAL_STANDARD || mEMCSMSystem[iSupMod] == DCAL_EXT) {
Expand Down