Project
Loading...
Searching...
No Matches
MisalignmentParameters.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
16#include "Framework/Logger.h"
17
18#include "TFile.h"
19
20#include <memory>
21
23
24namespace o2::its3::align
25{
26
28{
29 SetName("MisalignmentParameters");
30 SetTitle("ITS3 MisalignmentParameters");
31}
32
33bool MisalignmentParameters::store(const std::string& file) const
34{
35 std::unique_ptr<TFile> fOut(TFile::Open(file.c_str(), "RECREATE"));
36 if (fOut == nullptr || fOut->IsZombie()) {
37 LOGP(info, "Unable to save misalignment parameters");
38 return false;
39 }
40 fOut->WriteObjectAny(this, "o2::its3::align::MisalignmentParameters", "ccdb_object");
41 return true;
42}
43
45{
46 std::unique_ptr<TFile> fIn(TFile::Open(file.c_str(), "READ"));
47 auto p = fIn->Get<MisalignmentParameters>("ccdb_object");
48 if (p == nullptr) {
49 LOGP(fatal, "Unable to load parameters from file!");
50 }
51 return p;
52}
53
54void MisalignmentParameters::printParams(unsigned int detID) const
55{
56 LOGP(info, "Parameters for ID={}:", detID);
57 LOGP(info, " - Global Trans: X={} Y={} Z={}", getGloTransX(detID), getGloTransY(detID), getGloTransZ(detID));
58 LOGP(info, " - Global Rots: X={} Y={} Z={}", getGloRotX(detID), getGloRotY(detID), getGloRotZ(detID));
59 if (constants::detID::isDetITS3(detID)) {
60 auto sensorID = constants::detID::getSensorID(detID);
61 LOGP(info, " - Legendre Pol X:");
62 getLegendreCoeffX(sensorID).Print();
63 LOGP(info, " - Legendre Pol Y:");
64 getLegendreCoeffY(sensorID).Print();
65 LOGP(info, " - Legendre Pol Z:");
66 getLegendreCoeffZ(sensorID).Print();
67 }
68}
69
70void MisalignmentParameters::printLegendreParams(unsigned int sensorID) const
71{
72 LOGP(info, " - Legendre Pol X:");
73 getLegendreCoeffX(sensorID).Print();
74 LOGP(info, " - Legendre Pol Y:");
75 getLegendreCoeffY(sensorID).Print();
76 LOGP(info, " - Legendre Pol Z:");
77 getLegendreCoeffZ(sensorID).Print();
78}
79
80} // namespace o2::its3::align
ClassImp(o2::its3::align::MisalignmentParameters)
Definition of the MisalignmentParameters class.
void printLegendreParams(unsigned int sensorID) const
double getGloTransZ(unsigned int detID) const
double getGloRotZ(unsigned int detID) const
const TMatrixD & getLegendreCoeffZ(unsigned int sensorID) const
double getGloRotX(unsigned int detID) const
static MisalignmentParameters * load(const std::string &file)
double getGloTransX(unsigned int detID) const
Global getters.
double getGloRotY(unsigned int detID) const
bool store(const std::string &file) const
const TMatrixD & getLegendreCoeffX(unsigned int sensorID) const
Legendre Coeff. getters.
const TMatrixD & getLegendreCoeffY(unsigned int sensorID) const
double getGloTransY(unsigned int detID) const
bool isDetITS3(T detID)
Definition SpecsV2.h:161