CMS 3D CMS Logo

rz_harm_poly.h
Go to the documentation of this file.
1 #ifndef rz_harm_poly_h
2 #define rz_harm_poly_h
3 
4 #include <cmath>
5 #include "poly2d_base.h"
6 
8 // //
9 // Pair (Cos(phi),Sin(Phi)). Intended for internal use by rz_harm_poly. //
10 // //
12 
13 //_______________________________________________________________________________
14 namespace magfieldparam {
15  struct trig_pair {
16  double CosPhi;
17  double SinPhi;
18 
19  trig_pair() : CosPhi(1.), SinPhi(0.) {}
21  trig_pair(const double C, const double S) : CosPhi(C), SinPhi(S) {}
22  trig_pair(const double phi) : CosPhi(cos(phi)), SinPhi(sin(phi)) {}
23 
24  //Return trig_pair fo angle increased by angle of tp.
26  return trig_pair(this->CosPhi * tp.CosPhi - this->SinPhi * tp.SinPhi,
27  this->SinPhi * tp.CosPhi + this->CosPhi * tp.SinPhi);
28  }
29  };
30 
32  // //
33  // Harmonic homogeneous polynomial in cylindrical system. //
34  // //
36 
37  //_______________________________________________________________________________
38  class rz_harm_poly : public poly2d_base {
39  private:
40  unsigned L;
41  int M;
42 
43  static unsigned Cnt; //Number of the "rz_harm_poly" objects
44  static double phival; //Last phi value used
45  static bool phi_set; //TRUE if phi value is set
46  static unsigned MaxM; //Max. M among "rz_harm_poly" objects
47 
48  static unsigned TASize; //TrigArr size
49  static trig_pair *TrigArr; //Array with angular data
50 
51  static void SetTrigArrSize(const unsigned N);
52  static void FillTrigArr(const double phi);
53 
54  void PrintLM(std::ostream &out = std::cout) {
55  out << "L=" << std::setw(3) << std::left << L << ", M=" << std::setw(3) << std::left << M << "; ";
56  }
57 
58  public:
59  static int GetMaxM(); //return Max. M for the class
60  static unsigned ParentCount() { return poly2d_base::Count(); }
61  static unsigned Count() { return Cnt; }
62  static void SetPhi(const double phi);
63  static void SetPoint(const double r, const double z, const double phi) {
65  SetPhi(phi);
66  }
67 
68  rz_harm_poly() : poly2d_base(), L(0), M(0) { ++Cnt; }
69  rz_harm_poly(const poly2d_base &S) : poly2d_base(S), L(0), M(0) { ++Cnt; }
70  rz_harm_poly(const rz_harm_poly &S) : poly2d_base(S), L(S.L), M(S.M) { ++Cnt; }
71  rz_harm_poly(const unsigned N);
72  ~rz_harm_poly() override;
73 
74  bool IsPhiSet() { return phi_set; }
75 
76  rz_harm_poly GetDiff(int nvar) {
77  rz_harm_poly R(*this);
78  R.Diff(nvar);
79  return R;
80  }
81  rz_harm_poly GetInt(int nvar) {
82  rz_harm_poly R(*this);
83  R.Int(nvar);
84  return R;
85  }
86  rz_harm_poly GetIncPow(int nvar) {
87  rz_harm_poly R(*this);
88  R.IncPow(nvar);
89  return R;
90  }
91  rz_harm_poly GetDecPow(int nvar) {
92  rz_harm_poly R(*this);
93  R.DecPow(nvar);
94  return R;
95  }
96 
99 
100  unsigned GetL() { return L; }
101  int GetM() { return M; }
102 
103  //Next functions return value of angular terms.
104  //No check is made, wheither the TrigArr is initialized.
105  //User can check if IsPhiSet() == true
106  double GetCos() { return TrigArr[M].CosPhi; }
107  double GetSin() { return TrigArr[M].SinPhi; }
108 
109  void CheatL(const unsigned newL) { L = newL; }
110  void Print(std::ostream &out = std::cout, const std::streamsize prec = 5) {
111  PrintLM(out);
112  poly2d_base::Print(out, prec);
113  }
114 
115  static void PrintTrigArr(std::ostream &out = std::cout, const std::streamsize prec = 5);
116 
117  }; //class rz_harm_poly
118 } // namespace magfieldparam
119 
120 #endif
magfieldparam::poly2d_base::Count
static unsigned Count()
Definition: poly2d_base.h:78
magfieldparam::rz_harm_poly::FillTrigArr
static void FillTrigArr(const double phi)
Definition: rz_harm_poly.cc:114
magfieldparam::trig_pair
Definition: rz_harm_poly.h:15
magfieldparam::rz_harm_poly::TASize
static unsigned TASize
Definition: rz_harm_poly.h:48
magfieldparam::rz_harm_poly::PrintTrigArr
static void PrintTrigArr(std::ostream &out=std::cout, const std::streamsize prec=5)
Definition: rz_harm_poly.cc:125
magfieldparam::rz_harm_poly::LadderUp
rz_harm_poly LadderUp()
Definition: rz_harm_poly.cc:155
magfieldparam::trig_pair::SinPhi
double SinPhi
Definition: rz_harm_poly.h:17
magfieldparam::rz_harm_poly::rz_harm_poly
rz_harm_poly(const poly2d_base &S)
Definition: rz_harm_poly.h:69
magfieldparam::trig_pair::Add
trig_pair Add(const trig_pair &tp)
Definition: rz_harm_poly.h:25
magfieldparam::rz_harm_poly::CheatL
void CheatL(const unsigned newL)
Definition: rz_harm_poly.h:109
gather_cfg.cout
cout
Definition: gather_cfg.py:144
magfieldparam::rz_harm_poly::GetM
int GetM()
Definition: rz_harm_poly.h:101
magfieldparam::rz_harm_poly::rz_harm_poly
rz_harm_poly()
Definition: rz_harm_poly.h:68
magfieldparam::rz_harm_poly::phi_set
static bool phi_set
Definition: rz_harm_poly.h:45
magfieldparam::rz_harm_poly::GetCos
double GetCos()
Definition: rz_harm_poly.h:106
magfieldparam::poly2d_base
Definition: poly2d_base.h:45
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
magfieldparam::poly2d_base::Print
void Print(std::ostream &out=std::cout, const std::streamsize prec=5)
Definition: poly2d_base.cc:214
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
magfieldparam::rz_harm_poly::TrigArr
static trig_pair * TrigArr
Definition: rz_harm_poly.h:49
magfieldparam::rz_harm_poly::rz_harm_poly
rz_harm_poly(const rz_harm_poly &S)
Definition: rz_harm_poly.h:70
magfieldparam::rz_harm_poly
Definition: rz_harm_poly.h:38
N
#define N
Definition: blowfish.cc:9
magfieldparam::rz_harm_poly::GetSin
double GetSin()
Definition: rz_harm_poly.h:107
magfieldparam::rz_harm_poly::phival
static double phival
Definition: rz_harm_poly.h:44
magfieldparam::rz_harm_poly::MaxM
static unsigned MaxM
Definition: rz_harm_poly.h:46
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
magfieldparam::rz_harm_poly::PrintLM
void PrintLM(std::ostream &out=std::cout)
Definition: rz_harm_poly.h:54
magfieldparam::rz_harm_poly::Print
void Print(std::ostream &out=std::cout, const std::streamsize prec=5)
Definition: rz_harm_poly.h:110
magfieldparam
Definition: BCyl.h:23
magfieldparam::trig_pair::trig_pair
trig_pair(const double phi)
Definition: rz_harm_poly.h:22
magfieldparam::poly2d_base::SetPoint
static void SetPoint(const double r, const double z)
Definition: poly2d_base.cc:151
magfieldparam::rz_harm_poly::GetL
unsigned GetL()
Definition: rz_harm_poly.h:100
poly2d_base.h
magfieldparam::rz_harm_poly::GetInt
rz_harm_poly GetInt(int nvar)
Definition: rz_harm_poly.h:81
magfieldparam::trig_pair::trig_pair
trig_pair(const double C, const double S)
Definition: rz_harm_poly.h:21
magfieldparam::rz_harm_poly::Cnt
static unsigned Cnt
Definition: rz_harm_poly.h:43
magfieldparam::rz_harm_poly::IsPhiSet
bool IsPhiSet()
Definition: rz_harm_poly.h:74
magfieldparam::rz_harm_poly::~rz_harm_poly
~rz_harm_poly() override
Definition: rz_harm_poly.cc:53
magfieldparam::trig_pair::trig_pair
trig_pair()
Definition: rz_harm_poly.h:19
magfieldparam::rz_harm_poly::M
int M
Definition: rz_harm_poly.h:41
magfieldparam::rz_harm_poly::GetIncPow
rz_harm_poly GetIncPow(int nvar)
Definition: rz_harm_poly.h:86
alignCSCRings.r
r
Definition: alignCSCRings.py:93
magfieldparam::rz_harm_poly::SetPhi
static void SetPhi(const double phi)
Definition: rz_harm_poly.cc:86
magfieldparam::rz_harm_poly::GetMaxM
static int GetMaxM()
Definition: rz_harm_poly.cc:71
magfieldparam::rz_harm_poly::LadderDwn
rz_harm_poly LadderDwn()
Definition: rz_harm_poly.cc:194
magfieldparam::rz_harm_poly::SetPoint
static void SetPoint(const double r, const double z, const double phi)
Definition: rz_harm_poly.h:63
gen::C
C
Definition: PomwigHadronizer.cc:78
magfieldparam::rz_harm_poly::SetTrigArrSize
static void SetTrigArrSize(const unsigned N)
Definition: rz_harm_poly.cc:100
magfieldparam::rz_harm_poly::GetDecPow
rz_harm_poly GetDecPow(int nvar)
Definition: rz_harm_poly.h:91
S
Definition: CSCDBL1TPParametersExtended.h:16
magfieldparam::rz_harm_poly::L
unsigned L
Definition: rz_harm_poly.h:40
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
magfieldparam::trig_pair::CosPhi
double CosPhi
Definition: rz_harm_poly.h:16
magfieldparam::trig_pair::trig_pair
trig_pair(const trig_pair &tp)
Definition: rz_harm_poly.h:20
magfieldparam::rz_harm_poly::GetDiff
rz_harm_poly GetDiff(int nvar)
Definition: rz_harm_poly.h:76
dttmaxenums::R
Definition: DTTMax.h:29
magfieldparam::rz_harm_poly::Count
static unsigned Count()
Definition: rz_harm_poly.h:61
magfieldparam::rz_harm_poly::ParentCount
static unsigned ParentCount()
Definition: rz_harm_poly.h:60