Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ScalingCalibrator.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ScalingCalibrator.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2023 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
13 
14 #include <filesystem>
15 
16 #include <TFile.h>
17 #include <TH2D.h>
18 
19 namespace ActsExamples {
20 
22  public:
23  struct ConstantTuple {
24  double x_offset{0};
25  double x_scale{1};
26  double y_offset{0};
27  double y_scale{1};
28  };
29 
30  struct MapTuple {
31  TH2D x_offset;
32  TH2D x_scale;
33  TH2D y_offset;
34  TH2D y_scale;
35 
36  ConstantTuple at(size_t sizeLoc0, size_t sizeLoc1) const {
37  ConstantTuple ct;
38  ct.x_offset =
39  x_offset.GetBinContent(x_offset.FindFixBin(sizeLoc0, sizeLoc1));
40  ct.x_scale =
41  x_scale.GetBinContent(x_scale.FindFixBin(sizeLoc0, sizeLoc1));
42  ct.y_offset =
43  y_offset.GetBinContent(y_offset.FindFixBin(sizeLoc0, sizeLoc1));
44  ct.y_scale =
45  y_scale.GetBinContent(y_scale.FindFixBin(sizeLoc0, sizeLoc1));
46  return ct;
47  }
48  };
49 
51 
52  void calibrate(
53  const MeasurementContainer& measurements,
55  const Acts::CalibrationContext& cctx, const Acts::SourceLink& sourceLink,
56  Acts::VectorMultiTrajectory::TrackStateProxy& trackState) const override;
57 
58  bool needsClusters() const override { return true; }
59 
60  private:
61  std::map<Acts::GeometryIdentifier, MapTuple> m_calib_maps;
62  std::bitset<3> m_mask;
63 };
64 
65 } // namespace ActsExamples