SND@LHC Software
Loading...
Searching...
No Matches
BellField.cc
Go to the documentation of this file.
1/* Copyright 2008-2010, Technische Universitaet Muenchen,
2 Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
3
4 This file is part of GENFIT.
5
6 GENFIT is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 GENFIT is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18*/
19#include "BellField.h"
20#include "math.h"
21#include <iostream>
22using std::cout;
23using std::endl;
24Double_t kilogauss = 1.;
25Double_t tesla = 10*kilogauss;
26Double_t cm = 1; // cm
27Double_t meter = 100*cm; // m
28Double_t mm = 0.1*cm; // mm
29
30// implementation of Bellshape field for Ship
31namespace genfit {
32
34 : AbsBField(),
35 fMiddle(0),fPeak(0)
36 { ; }
37 BellField::BellField(double Peak, double Middle,int orientation, double Btube )
38 : AbsBField(),
39 fMiddle(Middle),fPeak(Peak),fOrient(orientation),fBtube(Btube)
40 { ; }
41
42TVector3 BellField::get(const TVector3& pos) const {
43 Double_t bx,by,bz;
44 get(pos.X(),pos.Y(),pos.Z(),bx,by,bz);
45 TVector3 field_(bx,by,bz);
46 return field_;
47}
48
49void BellField::get(const double& x, const double& y, const double& z, double& Bx, double& By, double& Bz) const {
50 Double_t zlocal=fabs((z-fMiddle)/100.);
51 Bz = 0.;
52 By = 0.;
53 Bx = 0.;
54 if (fOrient==1){ By = fPeak/(1.+pow(fabs(zlocal)/2.1,6.));}
55 if (fOrient==2){
56 //new field based on simulation of Davide Tommasini (22/1/2015)
57
58 //field in box 20 cm larger than inner tube.
59 if ( (fabs(x)<2.7*meter) && (fabs(y)<fBtube+0.2*meter) ) {
60 if (zlocal<3.8) {
61 Bx=0.14361*exp( -0.5 * pow((zlocal-0.45479E-01)/2.5046,2.));
62 }else if (zlocal<11.9) {
63 Bx=0.19532-0.61512E-01*zlocal+0.68447E-02*pow(zlocal,2.)-0.25672E-03*pow(zlocal,3.);
64 }
65 Bx=((fPeak/tesla)/0.14361)*Bx*tesla;
66 }
67 // cout << "genfit Bell " << x << ", " << y << ", " << z << ", Bx= " << Bx << endl;
68 }
69}
70} /* End of namespace genfit */
Double_t tesla
Definition BellField.cc:25
Double_t cm
Definition BellField.cc:26
Double_t meter
Definition BellField.cc:27
Double_t kilogauss
Definition BellField.cc:24
Double_t mm
Definition BellField.cc:28
Double_t tesla
Abstract Interface to magnetic fields in GENFIT.
Definition AbsBField.h:36
TVector3 get(const TVector3 &pos) const
return value at position
Definition BellField.cc:42
Matrix inversion tools.
Definition AbsBField.h:29