CbmRoot
Loading...
Searching...
No Matches
CaTripletSearchWindowMap.h
Go to the documentation of this file.
1/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergey Gorbunov, Sergei Zharko [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 std::tuple<SearchWindowMap::SearchWindow, float> GetSearchWindowAndMs( //
44 float x1, float y1, float z1, float dx1, float dy1, //
45 float x2, float y2, float z2, float dx2, float dy2 //
46 ) const
47 {
48 // hit : x, y, z
49 // track : straight line at (x1, y1, z1)
50 // tx = (x2 - x1) / (z2 - z1)
51 // ty = (y2 - y1) / (z2 - z1)
52 // intersection with the plane at zRef
53 // c = (fRefZ - z1) / (z2 - z1);
54 // xe = x1 + tx * (zRef-z1) = x1 + (x2 - x1) * c = x1 * (1. - c) + x2 * c
55 // ye = y1 + ty * (zRef-z1) = y1 + (y2 - y1) * c = y1 * (1. - c) + y2 * c
56 // dxe^2 = dx1^2 * (1. - c)^2 + dx2^2 * c^2
57 // dye^2 = dy1^2 * (1. - c)^2 + dy2^2 * c^2
58
59 float c = (fRefZ - z1) / (z2 - z1);
60 float cm1 = (1.f - c);
61 float xe = x1 + (x2 - x1) * c;
62 float ye = y1 + (y2 - y1) * c;
63 float dxe = std::sqrt(dx1 * dx1 * cm1 * cm1 + dx2 * dx2 * c * c);
64 float dye = std::sqrt(dy1 * dy1 * cm1 * cm1 + dy2 * dy2 * c * c);
65 auto [window, ms] = fMap.GetSearchWindowAndMs(xe, ye);
66 window.xMin -= dxe;
67 window.xMax += dxe;
68 window.yMin -= dye;
69 window.yMax += dye;
70 return {window, ms};
71 };
72
74
76 std::string ToString() const;
77
78 // TODO: make the members private
79 public:
81 float fTargetX{0.f};
82 float fTargetY{0.f};
83 float fTargetZ{0.f};
84 float fRefZ{0.f};
85
88 template<class Archive>
89 void serialize(Archive& ar, const unsigned int)
90 {
91 ar& fMap;
92 ar& fTargetX;
93 ar& fTargetY;
94 ar& fTargetZ;
95 ar& fRefZ;
96 }
97 };
98} // namespace cbm::algo::ca
Provides parameterisation for hit search windows in the CA tracking.
Class SearchWindowMap parameterisation for hit search windows in the CA tracking.
std::tuple< SearchWindowMap::SearchWindow, float > GetSearchWindowAndMs(float x1, float y1, float z1, float dx1, float dy1, float x2, float y2, float z2, float dx2, float dy2) const
~TripletSearchWindowMap()=default
Destructor.
void serialize(Archive &ar, const unsigned int)
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.
std::string ToString() const
String representation of the contents.
SearchWindowMap fMap
Search window map.
TripletSearchWindowMap()=default
Default constructor.
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14