ATLAS Offline Software
Loading...
Searching...
No Matches
magnetStrength.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <cassert>
7namespace FPTracker{
8 double magnetStrength(int type, double length, double strength, double brho) {
9 // calculate qpole gradient from formula g = K1L brho /L
10 // K1L from CERN database
11 // brho = 23349. = 3.345*7000 - now pbeam0/speedOflight (12//11/09)
12 // L = mag length
13
14 assert(type>=0 and type<5);
15
16 if(type==0 || type==4) return strength;
17 strength = brho*strength/length;
18
19 if (type == 1){ return strength;}
20 if (type == 2){ return -strength;}
21 //itype == 3 only remains....
22 return strength >=0. ? strength:-strength;
23
24 // strength = bend angle for dipoles, -> gradient for quadrupoles
25 // type = 0 for dipole,
26 // 1 for hor focussing qpoles,
27 // 2 for vert focussing qpoles.
28 }
29}
double length(const pvec &v)
double magnetStrength(int type, double length, double strength, double Brho)