ATLAS Offline Software
BFieldH8Grid.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //
6 // BFieldH8Grid.h
7 //
8 // A regular x-y-z grid of field data for H8 field map
9 //
10 // Masahiro Morii, Harvard University
11 //
12 #ifndef BFIELDH8GRID_H
13 #define BFIELDH8GRID_H
14 
15 #include <vector>
16 #include <iostream>
17 
18 class BFieldH8Grid {
19 public:
20  // constructor
21  BFieldH8Grid();
22  // read map data from a text file
23  void readMap( std::istream& input );
24  // compute magnetic field + derivatives
25  void getB( const double *xyz, double *B, double *deriv=nullptr ) const;
26  // true if the grid has been defined
27  bool defined() const { return ( m_n[0] > 0 ); }
28  // true if xyz[3] is inside this grid
29  bool inside( const double *xyz ) const
30  { return ( xyz[0]>=m_min[0] && xyz[0]<=m_max[0] &&
31  xyz[1]>=m_min[1] && xyz[1]<=m_max[1] &&
32  xyz[2]>=m_min[2] && xyz[2]<=m_max[2] ); }
33  // set x-y-z offset of the grid coordinates
34  void setOffset( const double *dxyz );
35  // get copies of size vectors
36  void getBounds(double *out_min, double *out_max, double *out_d) const
37  { for (unsigned i = 0; i < 3; i++) {
38  out_min[i] = m_min[i];
39  out_max[i] = m_max[i];
40  out_d[i] = m_d[i];
41  }
42  }
43 private:
44  int m_n[3]; // number of grid points
45  double m_min[3], m_max[3]; // range in x,y,z (mm)
46  double m_d[3]; // offset in x,y,z (mm)
47  std::vector<double> m_B[3]; // Bz,By,Bz (kT)
48 };
49 
50 #endif
BFieldH8Grid::defined
bool defined() const
Definition: BFieldH8Grid.h:27
BFieldH8Grid
Definition: BFieldH8Grid.h:18
xyz
#define xyz
BFieldH8Grid::m_n
int m_n[3]
Definition: BFieldH8Grid.h:44
BFieldH8Grid::getBounds
void getBounds(double *out_min, double *out_max, double *out_d) const
Definition: BFieldH8Grid.h:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
BFieldH8Grid::m_max
double m_max[3]
Definition: BFieldH8Grid.h:45
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
BFieldH8Grid::getB
void getB(const double *xyz, double *B, double *deriv=nullptr) const
Definition: BFieldH8Grid.cxx:77
BFieldH8Grid::BFieldH8Grid
BFieldH8Grid()
Definition: BFieldH8Grid.cxx:12
BFieldH8Grid::readMap
void readMap(std::istream &input)
Definition: BFieldH8Grid.cxx:23
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
BFieldH8Grid::m_d
double m_d[3]
Definition: BFieldH8Grid.h:46
BFieldH8Grid::setOffset
void setOffset(const double *dxyz)
Definition: BFieldH8Grid.cxx:134
BFieldH8Grid::inside
bool inside(const double *xyz) const
Definition: BFieldH8Grid.h:29
BFieldH8Grid::m_min
double m_min[3]
Definition: BFieldH8Grid.h:45
BFieldH8Grid::m_B
std::vector< double > m_B[3]
Definition: BFieldH8Grid.h:47