CbmRoot
Loading...
Searching...
No Matches
CaToolsField.h
Go to the documentation of this file.
1/* Copyright (C) 2023 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 "FairField.h"
13#include "FairRunAna.h"
14#include "KfFieldRegion.h"
15
16#include <mutex>
17
18namespace cbm::ca::tools
19{
21 inline void SetOriginalCbmField()
22 {
23 static auto fld = [&](double x, double y, double z) {
24 assert(FairRunAna::Instance());
25 if (FairRunAna::Instance()->GetField()) {
26 double pos[3] = {x, y, z};
27 double B[3] = {0., 0., 0.};
28 // protect the field access
29 // TODO: make CbmField thread-safe
30 static std::mutex mymutex;
31 mymutex.lock();
32 FairRunAna::Instance()->GetField()->GetFieldValue(pos, B);
33 mymutex.unlock();
34 return std::tuple(B[0], B[1], B[2]);
35 }
36 else {
37 return std::tuple(0., 0., 0.);
38 }
39 };
40
42 (FairRunAna::Instance()->GetField() ? cbm::algo::kf::EFieldType::Normal : cbm::algo::kf::EFieldType::Null), //
43 fld);
44 }
45
46} // namespace cbm::ca::tools
Magnetic flux density interpolation along the track vs. z-coordinate (header)
static void SetFieldFunction(EFieldType fldType, const FieldFn_t &fn)
Sets global field function.
@ Normal
Field near the tracker subsystem.
@ Null
No magnetic field.
void SetOriginalCbmField()
pass the original magnetic field to L1Algo