BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnFieldConst.cxx
Go to the documentation of this file.
1/********************************************************************************
2 * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3 * *
4 * This software is distributed under the terms of the *
5 * GNU Lesser General Public Licence (LGPL) version 3, *
6 * copied verbatim in the file "LICENSE" *
7 ********************************************************************************/
8// -------------------------------------------------------------------------
9// ----- BmnFieldConst source file -----
10// ----- Created 30/01/07 by M. Al/Turany -----
11// -------------------------------------------------------------------------
12#include "BmnFieldConst.h"
13
14#include "BmnFieldPar.h"
15#include "FairLogger.h" // for logging
16#include "FairRun.h" // for FairRun
17#include "FairRuntimeDb.h" // for FairRuntimeDb
18
19#include <TString.h> // for operator<<, TString
20#include <iomanip> // for operator<<, setw
21
22using std::setprecision;
23using std::setw;
24
26 : FairField()
27 , fXmin(0)
28 , fXmax(0)
29 , fYmin(0)
30 , fYmax(0)
31 , fZmin(0)
32 , fZmax(0)
33 , fBx(0)
34 , fBy(0)
35 , fBz(0)
36 , fIsOff(kFALSE)
37{
38 fType = 0;
39}
40
42 Double_t xMin,
43 Double_t xMax,
44 Double_t yMin,
45 Double_t yMax,
46 Double_t zMin,
47 Double_t zMax,
48 Double_t bX,
49 Double_t bY,
50 Double_t bZ)
51 : FairField(name)
52 , fXmin(xMin)
53 , fXmax(xMax)
54 , fYmin(yMin)
55 , fYmax(yMax)
56 , fZmin(zMin)
57 , fZmax(zMax)
58 , fBx(bX)
59 , fBy(bY)
60 , fBz(bZ)
61 , fIsOff(kFALSE)
62
63{
64 fType = 0;
65}
66
68 : FairField()
69 , fXmin(0)
70 , fXmax(0)
71 , fYmin(0)
72 , fYmax(0)
73 , fZmin(0)
74 , fZmax(0)
75 , fBx(0)
76 , fBy(0)
77 , fBz(0)
78 , fIsOff(kFALSE)
79{
80 if (!fieldPar) {
81 LOG(warn) << "BmnFieldConst::BmnFieldConst: empty parameter container!";
82 fType = -1;
83 } else {
84 fXmin = fieldPar->GetXmin();
85 fXmax = fieldPar->GetXmax();
86 fYmin = fieldPar->GetYmin();
87 fYmax = fieldPar->GetYmax();
88 fZmin = fieldPar->GetZmin();
89 fZmax = fieldPar->GetZmax();
90 fBx = fieldPar->GetBx();
91 fBy = fieldPar->GetBy();
92 fBz = fieldPar->GetBz();
93 fType = fieldPar->GetType();
94 fIsOff = fieldPar->IsFieldOff();
95 }
96}
97
99
101 Double_t xMax,
102 Double_t yMin,
103 Double_t yMax,
104 Double_t zMin,
105 Double_t zMax)
106{
107 fXmin = xMin;
108 fXmax = xMax;
109 fYmin = yMin;
110 fYmax = yMax;
111 fZmin = zMin;
112 fZmax = zMax;
113}
114
116{
117 fBx = bX;
118 fBy = bY;
119 fBz = bZ;
120 if ((bX == 0) && (bY == 0) && (bZ == 0))
121 fIsOff = kTRUE;
122 else
123 fIsOff = kFALSE;
124}
125
127{
128 if (x < fXmin || x > fXmax || y < fYmin || y > fYmax || z < fZmin || z > fZmax) {
129 return 0.;
130 }
131 return fBx;
132}
133
135{
136 if (x < fXmin || x > fXmax || y < fYmin || y > fYmax || z < fZmin || z > fZmax) {
137 return 0.;
138 }
139 return fBy;
140}
141
143{
144 if (x < fXmin || x > fXmax || y < fYmin || y > fYmax || z < fZmin || z > fZmax) {
145 return 0.;
146 }
147 return fBz;
148}
149
151{
152 LOG(info) << "======================================================";
153 LOG(info) << "---- " << fTitle << " : " << fName;
154 LOG(info) << "----";
155 LOG(info) << "---- Field type : constant";
156 if (fIsOff)
157 LOG(info) << "---- Field is off ----";
158 LOG(info) << "----";
159 LOG(info) << "---- Field regions : ";
160 LOG(info) << "---- x = " << setw(4) << fXmin << " to " << setw(4) << fXmax << " cm";
161 LOG(info) << "---- y = " << setw(4) << fYmin << " to " << setw(4) << fYmax << " cm";
162 LOG(info) << "---- z = " << setw(4) << fZmin << " to " << setw(4) << fZmax << " cm";
163 LOG(info) << "---- B = ( " << setprecision(4) << fBx << ", " << fBy << ", " << fBz << " ) kG";
164 LOG(info) << "======================================================";
165}
166
168{
169 TString MapName = GetName();
170 // LOG(info) << "BmnFieldConst::FillParContainer() ";
171 FairRun* fRun = FairRun::Instance();
172 FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
173 // Bool_t kParameterMerged = kTRUE;
174 BmnFieldPar* Par = static_cast<BmnFieldPar*>(rtdb->getContainer("BmnFieldPar"));
175 Par->SetParameters(this);
176 Par->setInputVersion(fRun->GetRunId(), 1);
177 Par->setChanged();
178}
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
const char Option_t
Double_t fXmin
Limits of the field region.
void SetField(Double_t bX, Double_t bY, Double_t bZ)
Set the field values.
virtual ~BmnFieldConst()
Destructor.
Bool_t fIsOff
Whether magnetic field is off.
virtual void Print(Option_t *) const
Screen output.
void SetFieldRegion(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Set the field region.
Double_t GetBy() const
Double_t GetBz() const
Double_t fBx
Field components inside the field region.
Double_t GetBx() const
Accessors to field values.
BmnFieldConst()
Default constructor.
Double_t GetXmin() const
Definition BmnFieldPar.h:49
Bool_t IsFieldOff() const
Definition BmnFieldPar.h:63
Double_t GetYmax() const
Definition BmnFieldPar.h:52
Double_t GetBz() const
Definition BmnFieldPar.h:57
Double_t GetZmin() const
Definition BmnFieldPar.h:53
Int_t GetType() const
Accessors.
Definition BmnFieldPar.h:48
Double_t GetZmax() const
Definition BmnFieldPar.h:54
Double_t GetBy() const
Definition BmnFieldPar.h:56
Double_t GetBx() const
Definition BmnFieldPar.h:55
Double_t GetXmax() const
Definition BmnFieldPar.h:50
void SetParameters(FairField *field)
Set parameters from BmnField.
Double_t GetYmin() const
Definition BmnFieldPar.h:51