FairShip
Loading...
Searching...
No Matches
genfit::FairShipFields Class Reference

Field for SHiP. More...

#include <FairShipFields.h>

Inheritance diagram for genfit::FairShipFields:
[legend]
Collaboration diagram for genfit::FairShipFields:
[legend]

Public Member Functions

 FairShipFields ()
void setField (ShipCompField *gField)
 set field if not gMC present
TVector3 get (const TVector3 &pos) const override
 return value at position
void get (const double &posX, const double &posY, const double &posZ, double &Bx, double &By, double &Bz) const override

Private Attributes

ShipCompField * gField_ {nullptr}

Detailed Description

Field for SHiP.

Author
Thomas Ruf CERN

Definition at line 21 of file FairShipFields.h.

Constructor & Destructor Documentation

◆ FairShipFields()

genfit::FairShipFields::FairShipFields ( )

Default constructor

Definition at line 20 of file FairShipFields.cxx.

20: AbsBField() { ; }

Member Function Documentation

◆ get() [1/2]

void genfit::FairShipFields::get ( const double & posX,
const double & posY,
const double & posZ,
double & Bx,
double & By,
double & Bz ) const
override

Definition at line 29 of file FairShipFields.cxx.

30 {
31 Double_t X[3] = {x, y, z};
32 Double_t B[3] = {0., 0., 0.};
33 Bx = 0.;
34 By = 0.;
35 Bz = 0.;
36 if (!gMC && !gField_) {
37 cout << "no Field Manager instantiated" << endl;
38 return;
39 }
40 if (gMC) {
41 TVirtualMagField* magField = gMC->GetMagField();
42 if (!magField) {
43 cout << "no magnetic field set in the Virtual MC" << endl;
44 return;
45 }
46 magField->Field(X, B);
47 } else {
48 gField_->Field(X, B);
49 }
50 Bx = B[0];
51 By = B[1];
52 Bz = B[2];
53}
ShipCompField * gField_

◆ get() [2/2]

TVector3 genfit::FairShipFields::get ( const TVector3 & pos) const
override

return value at position

Definition at line 22 of file FairShipFields.cxx.

22 {
23 Double_t bx, by, bz;
24 get(pos.X(), pos.Y(), pos.Z(), bx, by, bz);
25 TVector3 field_(bx, by, bz);
26 return field_;
27}
TVector3 get(const TVector3 &pos) const override
return value at position

◆ setField()

void genfit::FairShipFields::setField ( ShipCompField * gField)
inline

set field if not gMC present

Definition at line 27 of file FairShipFields.h.

27{ gField_ = gField; }

Member Data Documentation

◆ gField_

ShipCompField* genfit::FairShipFields::gField_ {nullptr}
private

Definition at line 35 of file FairShipFields.h.

35{nullptr};

The documentation for this class was generated from the following files: