ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtConstField.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 version 3 (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 // -------------------------------------------------------------------------
10 // ----- AtConstField source file -----
11 // ----- Created 06/01/04 by M. Al/Turany -----
12 // ----- Redesign 13/02/06 by V. Friese -----
13 // -------------------------------------------------------------------------
14 #include "AtConstField.h"
15 
16 #include "AtFieldPar.h"
17 
18 #include <FairField.h>
19 
20 #include <TString.h>
21 
22 #include <iomanip>
23 #include <iostream>
24 
25 using std::cerr;
26 using std::cout;
27 using std::endl;
28 using std::setw;
29 
30 // ----- Default constructor -------------------------------------------
32  : FairField(), fXmin(0.), fXmax(0.), fYmin(0.), fYmax(0.), fZmin(0.), fZmax(0.), fBx(0.), fBy(0.), fBz(0.)
33 {
34  fType = 0;
35 }
36 // -------------------------------------------------------------------------
37 
38 // ----- Standard constructor ------------------------------------------
39 AtConstField::AtConstField(const char *name, Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin,
40  Double_t zMax, Double_t bX, Double_t bY, Double_t bZ)
41  : FairField(name), fXmin(xMin), fXmax(xMax), fYmin(yMin), fYmax(yMax), fZmin(zMin), fZmax(zMax), fBx(bX), fBy(bY),
42  fBz(bZ)
43 {
44  fType = 0;
45 }
46 // -------------------------------------------------------------------------
47 
48 // -------- Constructor from CbmFieldPar -------------------------------
50  : FairField(), fXmin(0.), fXmax(0.), fYmin(0.), fYmax(0.), fZmin(0.), fZmax(0.), fBx(0.), fBy(0.), fBz(0.)
51 {
52  if (!fieldPar) {
53  cerr << "-W- AtConstField::AtConstField: empty parameter container!" << endl;
54  fType = 0;
55  } else {
56  fXmin = fieldPar->GetXmin();
57  fXmax = fieldPar->GetXmax();
58  fYmin = fieldPar->GetYmin();
59  fYmax = fieldPar->GetYmax();
60  fZmin = fieldPar->GetZmin();
61  fZmax = fieldPar->GetZmax();
62  fBx = fieldPar->GetBx();
63  fBy = fieldPar->GetBy();
64  fBz = fieldPar->GetBz();
65  fType = fieldPar->GetType();
66  }
67 }
68 // -------------------------------------------------------------------------
69 
70 // ----- Destructor ----------------------------------------------------
71 AtConstField::~AtConstField() = default;
72 // -------------------------------------------------------------------------
73 
74 // ----- Set field region ----------------------------------------------
75 void AtConstField::SetFieldRegion(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin,
76  Double_t zMax)
77 {
78  fXmin = xMin;
79  fXmax = xMax;
80  fYmin = yMin;
81  fYmax = yMax;
82  fZmin = zMin;
83  fZmax = zMax;
84 }
85 // -------------------------------------------------------------------------
86 
87 // ----- Set field values ----------------------------------------------
88 void AtConstField::SetField(Double_t bX, Double_t bY, Double_t bZ)
89 {
90  fBx = bX;
91  fBy = bY;
92  fBz = bZ;
93 }
94 // -------------------------------------------------------------------------
95 
96 // ----- Get x component of field --------------------------------------
97 Double_t AtConstField::GetBx(Double_t x, Double_t y, Double_t z)
98 {
99  if (x < fXmin || x > fXmax || y < fYmin || y > fYmax || z < fZmin || z > fZmax)
100  return 0.;
101  return fBx;
102 }
103 // -------------------------------------------------------------------------
104 
105 // ----- Get y component of field --------------------------------------
106 Double_t AtConstField::GetBy(Double_t x, Double_t y, Double_t z)
107 {
108  if (x < fXmin || x > fXmax || y < fYmin || y > fYmax || z < fZmin || z > fZmax)
109  return 0.;
110  return fBy;
111 }
112 // -------------------------------------------------------------------------
113 
114 // ----- Get z component of field --------------------------------------
115 Double_t AtConstField::GetBz(Double_t x, Double_t y, Double_t z)
116 {
117  if (x < fXmin || x > fXmax || y < fYmin || y > fYmax || z < fZmin || z > fZmax)
118  return 0.;
119  return fBz;
120 }
121 // -------------------------------------------------------------------------
122 
123 // ----- Screen output -------------------------------------------------
125 {
126  cout << "======================================================" << endl;
127  cout << "---- " << fTitle << " : " << fName << endl;
128  cout << "----" << endl;
129  cout << "---- Field type : constant" << endl;
130  cout << "----" << endl;
131  cout << "---- Field regions : " << endl;
132  cout << "---- x = " << setw(4) << fXmin << " to " << setw(4) << fXmax << " cm" << endl;
133  cout << "---- y = " << setw(4) << fYmin << " to " << setw(4) << fYmax << " cm" << endl;
134  cout << "---- z = " << setw(4) << fZmin << " to " << setw(4) << fZmax << " cm" << endl;
135  cout.precision(4);
136  cout << "---- B = ( " << fBx << ", " << fBy << ", " << fBz << " ) kG" << endl;
137  cout << "======================================================" << endl;
138 }
139 // -------------------------------------------------------------------------
140 
AtConstField::GetBz
Double_t GetBz() const
Definition: AtConstField.h:86
AtFieldPar::GetZmax
Double_t GetZmax() const
Definition: AtFieldPar.h:58
AtFieldPar::GetZmin
Double_t GetZmin() const
Definition: AtFieldPar.h:57
AtFieldPar::GetYmin
Double_t GetYmin() const
Definition: AtFieldPar.h:55
AtFieldPar
Definition: AtFieldPar.h:30
AtFieldPar::GetType
Int_t GetType() const
Definition: AtFieldPar.h:52
AtFieldPar::GetYmax
Double_t GetYmax() const
Definition: AtFieldPar.h:56
ClassImp
ClassImp(AtFindVertex)
AtConstField::~AtConstField
virtual ~AtConstField()
AtConstField
Definition: AtConstField.h:34
AtFieldPar::GetBy
Double_t GetBy() const
Definition: AtFieldPar.h:60
AtConstField::Print
virtual void Print()
Definition: AtConstField.cxx:124
AtFieldPar::GetXmin
Double_t GetXmin() const
Definition: AtFieldPar.h:53
AtFieldPar::GetBx
Double_t GetBx() const
Definition: AtFieldPar.h:59
AtFieldPar::GetXmax
Double_t GetXmax() const
Definition: AtFieldPar.h:54
y
const double * y
Definition: lmcurve.cxx:20
AtConstField::GetBx
Double_t GetBx() const
Definition: AtConstField.h:84
AtConstField::AtConstField
AtConstField()
Definition: AtConstField.cxx:31
AtConstField::SetFieldRegion
void SetFieldRegion(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Definition: AtConstField.cxx:75
AtConstField.h
AtFieldPar.h
AtConstField::SetField
void SetField(Double_t bX, Double_t bY, Double_t bZ)
Definition: AtConstField.cxx:88
AtFieldPar::GetBz
Double_t GetBz() const
Definition: AtFieldPar.h:61
AtConstField::GetBy
Double_t GetBy() const
Definition: AtConstField.h:85