Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:01

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2023 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include <Acts/Geometry/GeometryIdentifier.hpp>
0012 #include <ActsExamples/EventData/MeasurementCalibration.hpp>
0013 
0014 #include <filesystem>
0015 
0016 #include <TFile.h>
0017 #include <TH2D.h>
0018 
0019 namespace ActsExamples {
0020 
0021 class ScalingCalibrator : public MeasurementCalibrator {
0022  public:
0023   struct ConstantTuple {
0024     double x_offset{0};
0025     double x_scale{1};
0026     double y_offset{0};
0027     double y_scale{1};
0028   };
0029 
0030   struct MapTuple {
0031     TH2D x_offset;
0032     TH2D x_scale;
0033     TH2D y_offset;
0034     TH2D y_scale;
0035 
0036     ConstantTuple at(std::size_t sizeLoc0, std::size_t sizeLoc1) const {
0037       ConstantTuple ct;
0038       ct.x_offset =
0039           x_offset.GetBinContent(x_offset.FindFixBin(sizeLoc0, sizeLoc1));
0040       ct.x_scale =
0041           x_scale.GetBinContent(x_scale.FindFixBin(sizeLoc0, sizeLoc1));
0042       ct.y_offset =
0043           y_offset.GetBinContent(y_offset.FindFixBin(sizeLoc0, sizeLoc1));
0044       ct.y_scale =
0045           y_scale.GetBinContent(y_scale.FindFixBin(sizeLoc0, sizeLoc1));
0046       return ct;
0047     }
0048   };
0049 
0050   ScalingCalibrator(const std::filesystem::path& path);
0051 
0052   void calibrate(
0053       const MeasurementContainer& measurements,
0054       const ClusterContainer* clusters, const Acts::GeometryContext& gctx,
0055       const Acts::CalibrationContext& cctx, const Acts::SourceLink& sourceLink,
0056       Acts::VectorMultiTrajectory::TrackStateProxy& trackState) const override;
0057 
0058   bool needsClusters() const override { return true; }
0059 
0060  private:
0061   std::map<Acts::GeometryIdentifier, MapTuple> m_calib_maps;
0062   std::bitset<3> m_mask;
0063 };
0064 
0065 }  // namespace ActsExamples