CbmRoot
CbmBeam.cxx
Go to the documentation of this file.
1
6
#include "
CbmBeam.h
"
7
8
#include <cassert>
9
#include <sstream>
10
11
12
// ----- Default constructor --------------------------------------------
13
CbmBeam::CbmBeam
(Double_t
x
,
14
Double_t
y
,
15
Double_t z,
16
Double_t thetaX,
17
Double_t thetaY)
18
: fPosition(
x
,
y
, z)
19
, fDirection(TMath::Tan(thetaX), TMath::Tan(thetaY), 1.) {}
20
// --------------------------------------------------------------------------
21
22
23
// ----- Extrapolation to a plane ---------------------------------------
24
TVector3
CbmBeam::ExtrapolateToPlane
(
const
TVector3& point,
25
const
TVector3& norm)
const
{
26
27
// The beam should not be parallel to the plane
28
assert(norm *
fDirection
);
29
30
// Calculate intersection point. Just some analytic geometry.
31
Double_t numer = norm * (point -
fPosition
);
32
Double_t denom = norm *
fDirection
;
33
return
fPosition
+ (numer / denom) *
fDirection
;
34
}
35
// --------------------------------------------------------------------------
36
37
38
// ----- Info -----------------------------------------------------------
39
std::string
CbmBeam::ToString
()
const
{
40
41
std::stringstream ss;
42
ss <<
"Current beam: position ("
<<
fPosition
.X() <<
", "
<<
fPosition
.Y()
43
<<
", "
<<
fPosition
.Z() <<
") cm, angle ("
<<
fDirection
.X() <<
", "
44
<<
fDirection
.Y() <<
") rad"
;
45
46
return
ss.str();
47
}
48
// --------------------------------------------------------------------------
CbmBeam::ExtrapolateToPlane
TVector3 ExtrapolateToPlane(const TVector3 &point, const TVector3 &normal) const
Extrapolation of the beam to a plane.
Definition:
CbmBeam.cxx:24
CbmBeam::CbmBeam
CbmBeam(Double_t x=0., Double_t y=0., Double_t z=0., Double_t thetaX=0., Double_t thetaY=0.)
Default constructor.
Definition:
CbmBeam.cxx:13
CbmBeam.h
CbmBeam::fDirection
TVector3 fDirection
Direction vector (dx/dz, dy/dz, 1.)
Definition:
CbmBeam.h:89
x
Double_t x
Definition:
CbmMvdSensorDigiToHitTask.cxx:68
CbmBeam::fPosition
TVector3 fPosition
Position vector.
Definition:
CbmBeam.h:88
y
Double_t y
Definition:
CbmMvdSensorDigiToHitTask.cxx:68
CbmBeam::ToString
std::string ToString() const
Info on current beam trajectory.
Definition:
CbmBeam.cxx:39
sim
transport
base
CbmBeam.cxx
Generated on Wed Oct 28 2020 15:11:34 for CbmRoot by
1.8.18