ATLAS Offline Software
ForwardDetectors
FPTracker
src
DipoleBender.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
FPTracker/DipoleBender.h
"
6
#include "
FPTracker/IParticle.h
"
7
#include "
FPTracker/Point.h
"
8
#include "
FPTracker/FPTrackerConstants.h
"
9
#include <cmath>
10
#include <cassert>
11
#include <iostream>
12
13
namespace
FPTracker
{
14
DipoleBender::DipoleBender
(
15
Bendplane
bendplane,
16
double
magnetLength,
17
double
magnetStrength
,
18
double
pbeam0,
19
int
side
20
):
21
m_bendplane(bendplane),
22
m_length(magnetLength),
23
m_strength(
magnetStrength
),
24
m_pbeam0(pbeam0),
25
m_dside(
side
==0 ? -1.:1.){
26
}
27
28
IBender::ConstPtr_t
DipoleBender::clone
()
const
{
29
IBender::ConstPtr_t
ib
(
new
DipoleBender
(*
this
));
30
return
ib
;
31
}
32
33
void
DipoleBender::bend
(
IParticle
&
particle
)
const
{
34
35
// -- DIPOLE MAGNET
36
// tandir is in x,y,z bearing in mind the sign of z/
37
// But the magnet strength is stored as its effect on dx/ds or dy/ds.
38
// bend = magnet strength, corrected for momentum, = bend for this proton.
39
// dzc = length of magnet, signed
40
// position[i] = New displ. = old + effect of gradient + effect of bend.
41
// position[i-1] = old displacement + effect of gradient in non-bending plane.
42
43
// calculates new x, y coordinates and direction after deflection
44
45
Point
& position =
particle
.position();
46
Point
& direction =
particle
.direction();
47
48
double
tandir = direction[
m_bendplane
]/direction[2] ;
49
double
bend
=
m_strength
*
m_pbeam0
/
particle
.momentum();
50
double
dzc =
m_length
*
m_dside
;
51
52
//std::cout<<"dir [2] from DipoleBender "<<direction[2]<<'\n';
53
54
position[
m_bendplane
] += dzc*tandir +(dzc/
m_dside
)*
std::tan
(0.5*
bend
) ;
55
position[1-
m_bendplane
] += dzc*direction[1-
m_bendplane
]/direction[2];
56
direction[
m_bendplane
] = (tandir*
m_dside
+
std::tan
(
bend
))/(1.-
m_dside
*tandir*
std::tan
(
bend
));
//update part. angles
57
direction[
m_bendplane
] = direction[
m_bendplane
]/std::sqrt(1. + direction[
m_bendplane
]*direction[
m_bendplane
]) ;
58
59
// tan(new angle) = tan(sum of orig. angle + angle of bend)
60
// Then we turn it into the sine, e.g. dx/ds (perhaps unncessarily)
61
62
// If main bending magnet, the local coord system must be redefined.
63
// Rotate wrt the local lab coords if necessary, and return to lab frame.
64
// The main bends are curved, so we must do this before evaluating the aperture.
65
if
(
m_length
> 10.){
// Identifies MB magnet.
66
direction[0] -=
m_strength
;
// Rotates the coords.
67
position[0] -= 0.5*
m_strength
*
m_length
;
68
// Shifts coord system laterally.
69
}
70
71
}
72
73
const
std::string
DipoleBender::s_label
=
"DiplBender"
;
74
std::string
DipoleBender::label
()
const
{
return
s_label
;}
75
}
FPTracker::DipoleBender::DipoleBender
DipoleBender(Bendplane, double length, double strength, double pbeam0, int side)
Definition:
DipoleBender.cxx:14
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition:
ParticleHypothesis.h:76
FPTracker::DipoleBender::clone
std::shared_ptr< IBender > clone() const
Definition:
DipoleBender.cxx:28
FPTracker::IBender::ConstPtr_t
std::shared_ptr< IBender > ConstPtr_t
Definition:
FPTracker/FPTracker/IBender.h:18
Point.h
PlotCalibFromCool.ib
ib
Definition:
PlotCalibFromCool.py:419
FPTracker::DipoleBender::m_dside
double m_dside
Definition:
DipoleBender.h:35
TRT::Hit::side
@ side
Definition:
HitInfo.h:83
FPTracker::DipoleBender::label
std::string label() const
Definition:
DipoleBender.cxx:74
IParticle.h
FPTrackerConstants.h
FPTracker::DipoleBender::m_pbeam0
double m_pbeam0
Definition:
DipoleBender.h:34
drawFromPickle.tan
tan
Definition:
drawFromPickle.py:36
FPTracker::DipoleBender::s_label
static const std::string s_label
Definition:
DipoleBender.h:30
FPTracker::Bendplane
Bendplane
Definition:
FPTrackerConstants.h:11
FPTracker::Point
Definition:
FPTracker/FPTracker/Point.h:14
DipoleBender.h
FPTracker::DipoleBender::m_length
double m_length
Definition:
DipoleBender.h:32
FPTracker
Definition:
FPTracker/FPTracker/Beamline.h:12
FPTracker::DipoleBender::m_strength
double m_strength
Definition:
DipoleBender.h:33
FPTracker::magnetStrength
double magnetStrength(int type, double length, double strength, double Brho)
Definition:
magnetStrength.cxx:8
FPTracker::IParticle
Definition:
ForwardDetectors/FPTracker/FPTracker/IParticle.h:17
FPTracker::DipoleBender::bend
void bend(IParticle &) const
Definition:
DipoleBender.cxx:33
FPTracker::DipoleBender::m_bendplane
Bendplane m_bendplane
Definition:
DipoleBender.h:31
Generated on Tue Dec 24 2024 21:09:26 for ATLAS Offline Software by
1.8.18