CbmRoot
Loading...
Searching...
No Matches
CaDoubletSearchWindowMap.h
Go to the documentation of this file.
1/* Copyright (C) 2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergey Gorbunov [committer] */
4
9
10#pragma once // include this header only once per compilation unit
11
12#include "CaSearchWindowMap.h"
13
14#include <boost/serialization/array.hpp>
15#include <boost/serialization/string.hpp>
16
17#include <cmath>
18
19namespace cbm::algo::ca
20{
24 public:
27
30
32 void Init(float targetX, float targetY, float targetZ, float refZ, float xMin, float xMax, int nBinsX, float yMin,
33 float yMax, int nBinsY)
34 {
35 fTargetX = targetX;
36 fTargetY = targetY;
37 fTargetZ = targetZ;
38 fRefZ = refZ;
39 fMap.SetRange(xMin, xMax, nBinsX, yMin, yMax, nBinsY);
40 }
41
43 SearchWindowMap::SearchWindow GetSearchWindow(float x, float y, float z, float dx, float dy) const
44 {
45 // hit : x, y, z
46 // track : straight line at (x, y, z)
47 // tx = tx = (x - fTargetX) / (z - fTargetZ)
48 // ty = (y - fTargetY) / (z - fTargetZ)
49 // intersection with the plane at zRef
50 // c = (fRefZ - z) / (z - fTargetZ);
51 // xr = x + tx * (zRef-z) = x * (1. + c) - fTargetX * c
52 // yr = y + ty * (zRef-z) = y * (1. + c) - fTargetY * c
53 // dxr^2 = dx^2 * (1. + c)^2
54 // dyr^2 = dy^2 * (1. + c)^2
55
56 float c = (fRefZ - z) / (z - fTargetZ);
57 float cp1 = (1.f + c);
58 float xe = x + (x - fTargetX) * c;
59 float ye = y + (y - fTargetY) * c;
60 float dxe = std::fabs(dx * cp1);
61 float dye = std::fabs(dy * cp1);
62 auto window = fMap.GetSearchWindow(xe, ye);
63 window.xMin -= dxe;
64 window.xMax += dxe;
65 window.yMin -= dye;
66 window.yMax += dye;
67 return window;
68 };
69
71
73 std::string ToString() const;
74
75 // TODO: make the members private
76 public:
78 float fTargetX{0.f};
79 float fTargetY{0.f};
80 float fTargetZ{0.f};
81 float fRefZ{0.f};
82
85 template<class Archive>
86 void serialize(Archive& ar, const unsigned int)
87 {
88 ar& fMap;
89 ar& fTargetX;
90 ar& fTargetY;
91 ar& fTargetZ;
92 ar& fRefZ;
93 }
94 };
95} // namespace cbm::algo::ca
Provides parameterisation for hit search windows in the CA tracking.
std::string ToString() const
String representation of the contents.
DoubletSearchWindowMap()=default
Default constructor.
~DoubletSearchWindowMap()=default
Destructor.
SearchWindowMap fMap
Search window map.
void serialize(Archive &ar, const unsigned int)
SearchWindowMap::SearchWindow GetSearchWindow(float x, float y, float z, float dx, float dy) const
void Init(float targetX, float targetY, float targetZ, float refZ, float xMin, float xMax, int nBinsX, float yMin, float yMax, int nBinsY)
Constructor.
friend class boost::serialization::access
Serialization function.
Class SearchWindowMap parameterisation for hit search windows in the CA tracking.
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14