ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MagField::ForwardRegionFieldSvc Class Reference

#include <ForwardRegionFieldSvc.h>

Inheritance diagram for MagField::ForwardRegionFieldSvc:
Collaboration diagram for MagField::ForwardRegionFieldSvc:

Public Member Functions

 ForwardRegionFieldSvc (const std::string &name, ISvcLocator *svc)
 Constructor with parameters. More...
 
StatusCode initialize () override final
 AthService interface methods. More...
 
void handle (const Incident &runIncident) override final
 IIncidentListener interface methods. More...
 
virtual void getField (const double *xyz, double *bxyz, double *deriv=nullptr) const override final
 IMagFieldSvc interface methods. More...
 
virtual void getFieldZR (const double *xyz, double *bxyz, double *deriv=nullptr) const override final
 get B field value on the z-r plane at given position More...
 
G4ThreeVector getMagInd (G4ThreeVector Point, int q, int beam) const
 Non-inherited public methods FIXME - add new interface? More...
 
double getMag (int magnet, int beam) const
 
G4ThreeVector getKick (int beam) const
 
double getMagXOff (int magnet) const
 
double getMagYOff (int magnet) const
 

Private Member Functions

G4ThreeVector FieldValue (G4ThreeVector Point) const
 
void InitMagData ()
 
std::vector< std::vector< std::string > > loadDataFile (const char *fileName, int cols)
 
std::vector< std::vector< std::string > > loadDataFileNLines (const char *fileName, int cols, int N, std::string &header)
 
double kLToB (double kL, double lenght, double momentum)
 
void InitMagDataFromTwiss (const std::vector< std::vector< std::string > > &loadedTwissFile, int beam, double momentum)
 
void writeOutTwiss (const std::vector< std::vector< std::string >> &loadedTwissFile, int beam, const std::string &header)
 
void getMagnetTransformParams (int beam, int magnet, G4ThreeVector Point, HepGeom::Point3D< double > &pointMagStart, HepGeom::Point3D< double > &pointMagEnd, double &rotZ) const
 
int getMagNumFromName (const std::string &name) const
 

Private Attributes

int m_magnet
 
std::vector< std::vector< std::string > > m_magnets
 
double m_magData [4]
 
int m_magDataType
 
std::string m_MQXA_DataFile
 
std::string m_MQXB_DataFile
 
double m_magIndMQXA [s_rowsMQXA][s_colsMQXA][2]
 
double m_magIndMQXB [s_rowsMQXB][s_colsMQXB][2]
 
FWDMg_CONFIGURATION m_Config
 
ToolHandle< IForwardRegionPropertiesm_properties
 

Static Private Attributes

static const int s_Q1 = 0
 
static const int s_Q2 = 1
 
static const int s_Q3 = 2
 
static const int s_D1 = 3
 
static const int s_D2 = 4
 
static const int s_Q4 = 5
 
static const int s_Q5 = 6
 
static const int s_Q6 = 7
 
static const int s_Q7 = 8
 
static const int s_Q1HKick = 9
 
static const int s_Q1VKick = 10
 
static const int s_Q2HKick = 11
 
static const int s_Q2VKick = 12
 
static const int s_Q3HKick = 13
 
static const int s_Q3VKick = 14
 
static const int s_Q4VKickA = 15
 
static const int s_Q4HKick = 16
 
static const int s_Q4VKickB = 17
 
static const int s_Q5HKick = 18
 
static const int s_Q6VKick = 19
 
static const int s_rowsMQXA = 97
 
static const int s_colsMQXA = 97
 
static const int s_rowsMQXB = 89
 
static const int s_colsMQXB = 89
 

Detailed Description

Definition at line 29 of file ForwardRegionFieldSvc.h.

Constructor & Destructor Documentation

◆ ForwardRegionFieldSvc()

MagField::ForwardRegionFieldSvc::ForwardRegionFieldSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Constructor with parameters.

Definition at line 37 of file ForwardRegionFieldSvc.cxx.

37  :
38  base_class(name,svc),
39  m_magnet(-1),
40  m_magDataType(0),
41  m_MQXA_DataFile(""), //"MQXA_NOMINAL.dat" if name = Q1 or Q3
42  m_MQXB_DataFile(""), //"MQXB_NOMINAL.dat" if name = Q2
43  m_properties("ForwardRegionProperties")
44 {
45 
46  declareProperty("Magnet", m_magnet, "integer property");
47  declareProperty("MQXA_DataFile", m_MQXA_DataFile, "");
48  declareProperty("MQXB_DataFile", m_MQXB_DataFile, "");
49  declareProperty("ForwardRegionProperties", m_properties);
50  m_Config.clear();
51 
52  if(!m_MQXA_DataFile.empty())
53  {
54  const int fileMQXACols(7); //TODO make this a property
55 
56  // load field map MQXA
57  std::vector<std::vector<std::string> > loadedDataFile = loadDataFile(m_MQXA_DataFile.c_str(),fileMQXACols);
58 
59  ATH_MSG_DEBUG("Field map MQXA loaded");
60 
61  // initialize magnetic induction mesh
62  for(int j=0; j < s_colsMQXA; j++)
63  {
64  for(int i=0; i < s_rowsMQXA; i++)
65  {
66  m_magIndMQXA[i][j][0] = atof(loadedDataFile[i+j*s_colsMQXA][4].c_str());
67  m_magIndMQXA[i][j][1] = atof(loadedDataFile[i+j*s_colsMQXA][5].c_str());
68  }
69  }
70  }
71 
72  if(!m_MQXB_DataFile.empty())
73  {
74  const int fileMQXBCols(7); //TODO make this a property
75 
76  // load field map MQXB
77  std::vector<std::vector<std::string> > loadedDataFileB = loadDataFile(m_MQXB_DataFile.c_str(),fileMQXBCols);
78 
79  ATH_MSG_DEBUG("Field map MQXB loaded");
80 
81  // initialize magnetic induction mesh
82  for(int j=0; j < s_colsMQXB; j++)
83  {
84  for(int i=0; i < s_rowsMQXB; i++)
85  {
86  m_magIndMQXB[i][j][0] = atof(loadedDataFileB[i+j*s_colsMQXB][4].c_str());
87  m_magIndMQXB[i][j][1] = atof(loadedDataFileB[i+j*s_colsMQXB][5].c_str());
88  }
89  }
90  }
91 
92 
93 }

Member Function Documentation

◆ FieldValue()

G4ThreeVector MagField::ForwardRegionFieldSvc::FieldValue ( G4ThreeVector  Point) const
private

Definition at line 140 of file ForwardRegionFieldSvc.cxx.

141 {
142  int beam;
143  if(Point[2] < 0) beam = 1;
144  else beam = 2;
145 
146 
147  HepGeom::Point3D<double> pointMagStart;
148  HepGeom::Point3D<double> pointMagEnd;
149  double rotZ = 0;
150 
151  getMagnetTransformParams(beam, m_magnet, Point, pointMagStart, pointMagEnd, rotZ);
152 
153  G4ThreeVector field;
154 
155  // are points defined (non-zero)? If not, only rotation around Z will be applied (if any)
156  bool pointsNotDefined = (pointMagStart.distance2() == 0 || pointMagEnd.distance2() == 0);
157 
158  // calculate x and y shifts -- for quadrupoles only, no effect in dipoles (magnet borders to be solved in GeoModel)
159  double xShift = pointsNotDefined ? getMagXOff(m_magnet) : (pointMagStart[0]+pointMagEnd[0])*0.5;
160  double yShift = pointsNotDefined ? getMagYOff(m_magnet) : (pointMagStart[1]+pointMagEnd[1])*0.5;
161 
162  if(m_magnet <= s_Q3){ // inner triplet
165  else {
166  double gradB = getMag(m_magnet,beam)*CLHEP::tesla/CLHEP::m*pow(-1.0,beam);
167  field = G4ThreeVector(gradB*(Point[1]-yShift),gradB*(Point[0]-xShift),0);
168  }
169  }
170  else if(m_magnet <= s_D2) // dipoles
171  field = G4ThreeVector(0,getMag(m_magnet,beam)*CLHEP::tesla,0);
172  else if(m_magnet <= s_Q7) // other quadrupoles
173  {
174  double gradB = getMag(m_magnet,beam)*CLHEP::tesla/CLHEP::m*pow(-1.0,beam);
175  field = G4ThreeVector(gradB*(Point[1]-yShift),gradB*(Point[0]-xShift),0);
176  }
177  else // kickers
178  return getKick(beam);
179 
180  // No points defined, check if there is rotation around magnet axis, else return unchanged field
181  if(pointsNotDefined){
182  if(rotZ == 0) return field;
183  return HepGeom::RotateZ3D(rotZ)*(HepGeom::Vector3D<double>)field;
184  }
185 
186  // Determine rotation from start and end points, shift is already taken care of
187  HepGeom::Point3D<double> pointMagEndNoShift(pointMagEnd[0]-xShift, pointMagEnd[1]-yShift, pointMagEnd[2]);
188 
189  HepGeom::Point3D<double> pointMagRotCenter(0,0,(pointMagStart[2]+pointMagEnd[2])/2);
190 
191  HepGeom::Vector3D<double> vecNoRot(0,0,pointMagEnd[2]-pointMagRotCenter[2]);
192  HepGeom::Vector3D<double> vecRot = pointMagEndNoShift - pointMagRotCenter;
193 
194  HepGeom::Vector3D<double> vecRotAxis = vecNoRot.cross(vecRot);
195  double angle = vecNoRot.angle(vecRot);
196 
197  HepGeom::Transform3D rotateField = HepGeom::Rotate3D(angle, vecRotAxis);
198 
199  field = rotateField*HepGeom::RotateZ3D(rotZ)*(HepGeom::Vector3D<double>)field;
200  return field;
201 }

◆ getField()

void MagField::ForwardRegionFieldSvc::getField ( const double *  xyz,
double *  bxyz,
double *  deriv = nullptr 
) const
finaloverridevirtual

IMagFieldSvc interface methods.

get B field value at given position xyz[3] is in mm, bxyz[3] is in kT if deriv[9] is given, field derivatives are returned in kT/mm

Definition at line 123 of file ForwardRegionFieldSvc.cxx.

124 {
125  G4ThreeVector f = this->FieldValue(G4ThreeVector(xyz[0],xyz[1],xyz[2]));
126  bxyz[0] = f[0];
127  bxyz[1] = f[1];
128  bxyz[2] = f[2];
129 }

◆ getFieldZR()

void MagField::ForwardRegionFieldSvc::getFieldZR ( const double *  xyz,
double *  bxyz,
double *  deriv = nullptr 
) const
finaloverridevirtual

get B field value on the z-r plane at given position

works only inside the solenoid; otherwise calls getField() above xyz[3] is in mm, bxyz[3] is in kT if deriv[9] is given, field derivatives are returned in kT/mm

Definition at line 135 of file ForwardRegionFieldSvc.cxx.

136 {
137  throw std::logic_error("MagField::ForwardRegionFieldSvc::getFieldZR should not be called"); //FIXME not supported yet.
138 }

◆ getKick()

G4ThreeVector MagField::ForwardRegionFieldSvc::getKick ( int  beam) const

Definition at line 405 of file ForwardRegionFieldSvc.cxx.

406 {
407  if(m_magDataType == 1) return G4ThreeVector(m_magData[beam-1]*CLHEP::tesla,m_magData[beam+1]*CLHEP::tesla,0);
408  return G4ThreeVector(0,0,0); // magnets.dat does not contain kickers
409 }

◆ getMag()

double MagField::ForwardRegionFieldSvc::getMag ( int  magnet,
int  beam 
) const

Definition at line 399 of file ForwardRegionFieldSvc.cxx.

400 {
401  if(m_magDataType == 1) return m_magData[beam-1];
402  return atof(m_magnets[magnet][beam].c_str());
403 }

◆ getMagInd()

G4ThreeVector MagField::ForwardRegionFieldSvc::getMagInd ( G4ThreeVector  Point,
int  q,
int  beam 
) const

Non-inherited public methods FIXME - add new interface?

Definition at line 325 of file ForwardRegionFieldSvc.cxx.

326 {
327  int MQXAB = 0;
328  if(q == 1) MQXAB = 1;
329 
330  //magnet gradient and offsets
331  double gradMQX = getMag(q,beam);
332  double xOffMQX = getMagXOff(q);
333  double yOffMQX = getMagYOff(q);
334 
335  //mapfile parameters
336  double minMQXA = -24*CLHEP::cm;
337  double maxMQXA = 24*CLHEP::cm;
338  double minMQXB = -26*CLHEP::cm;
339  double maxMQXB = 26*CLHEP::cm;
340 
341  double x,y,x1,y1,x2,y2,xstep,ystep;
342  int i1,i2,j1,j2;
343 
344  G4ThreeVector B(0,0,0);
345  if(MQXAB == 0) // field in MQXA
346  {
347  x = Point[0] - xOffMQX;
348  y = Point[1] - yOffMQX;
349 
350  xstep = (maxMQXA - minMQXA)/(s_rowsMQXA-1);
351  ystep = (maxMQXA - minMQXA)/(s_colsMQXA-1);
352 
353 
354  i2 = ceil(x/xstep)+ceil(s_rowsMQXA/2.);
355  j2 = ceil(y/ystep)+ceil(s_colsMQXA/2.);
356  i1 = i2 - 1;
357  j1 = j2 - 1;
358  x2 = (i2-ceil(s_rowsMQXA/2.))*xstep;
359  y2 = (j2-ceil(s_colsMQXA/2.))*ystep;
360  x1 = x2 - xstep;
361  y1 = y2 - ystep;
362 
363  if(x < maxMQXA && x > minMQXA && y < maxMQXA && y > minMQXA) // field in MQXA
364  {
365  B[0] = (m_magIndMQXA[i1][j1][0]*(x2-x)*(y2-y) + m_magIndMQXA[i2][j1][0]*(x-x1)*(y2-y) + m_magIndMQXA[i1][j2][0]*(x2-x)*(y-y1) + m_magIndMQXA[i2][j2][0]*(x-x1)*(y-y1))/xstep/ystep*CLHEP::tesla;
366  B[1] = (m_magIndMQXA[i1][j1][1]*(x2-x)*(y2-y) + m_magIndMQXA[i2][j1][1]*(x-x1)*(y2-y) + m_magIndMQXA[i1][j2][1]*(x2-x)*(y-y1) + m_magIndMQXA[i2][j2][1]*(x-x1)*(y-y1))/xstep/ystep*CLHEP::tesla;
367  B[0] = B[0]*pow(-1.0,beam)*(gradMQX/224.29);
368  B[1] = B[1]*pow(-1.0,beam)*(gradMQX/224.29);
369  }
370  }
371  if(MQXAB == 1) // field in MQXB
372  {
373  x = Point[0] - xOffMQX;
374  y = Point[1] - yOffMQX;
375 
376  xstep = (maxMQXB - minMQXB)/(s_rowsMQXB-1);
377  ystep = (maxMQXB - minMQXB)/(s_colsMQXB-1);
378 
379  i2 = ceil(x/xstep)+ceil(s_rowsMQXB/2);
380  j2 = ceil(y/ystep)+ceil(s_colsMQXB/2);
381  i1 = i2 - 1;
382  j1 = j2 - 1;
383  x2 = (i2-ceil(s_rowsMQXB/2))*xstep;
384  y2 = (j2-ceil(s_colsMQXB/2))*ystep;
385  x1 = x2 - xstep;
386  y1 = y2 - ystep;
387 
388  if(x < maxMQXB && x > minMQXB && y < maxMQXB && y > minMQXB) // field in MQXB
389  {
390  B[0] = (m_magIndMQXB[i1][j1][0]*(x2-x)*(y2-y) + m_magIndMQXB[i2][j1][0]*(x-x1)*(y2-y) + m_magIndMQXB[i1][j2][0]*(x2-x)*(y-y1) + m_magIndMQXB[i2][j2][0]*(x-x1)*(y-y1))/xstep/ystep*CLHEP::tesla;
391  B[1] = (m_magIndMQXB[i1][j1][1]*(x2-x)*(y2-y) + m_magIndMQXB[i2][j1][1]*(x-x1)*(y2-y) + m_magIndMQXB[i1][j2][1]*(x2-x)*(y-y1) + m_magIndMQXB[i2][j2][1]*(x-x1)*(y-y1))/xstep/ystep*CLHEP::tesla;
392  B[0] = B[0]*pow(-1.0,beam)*(gradMQX/216.1787104);
393  B[1] = B[1]*pow(-1.0,beam)*(gradMQX/216.1787104);
394  }
395  }
396  return B;
397 }

◆ getMagnetTransformParams()

void MagField::ForwardRegionFieldSvc::getMagnetTransformParams ( int  beam,
int  magnet,
G4ThreeVector  Point,
HepGeom::Point3D< double > &  pointMagStart,
HepGeom::Point3D< double > &  pointMagEnd,
double &  rotZ 
) const
private

Definition at line 618 of file ForwardRegionFieldSvc.cxx.

619 {
620  // find out which magnet we are in and get corresponding displacements
621  switch(magnet){
622  case s_Q1:
623  pointMagStart = HepGeom::Point3D<double>(m_Config.pointQ1Start[(beam-1)*3],m_Config.pointQ1Start[(beam-1)*3+1],m_Config.pointQ1Start[(beam-1)*3+2]);
624  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointQ1End[(beam-1)*3],m_Config.pointQ1End[(beam-1)*3+1],m_Config.pointQ1End[(beam-1)*3+2]);
625  rotZ = m_Config.fQ1RotZ[beam-1];
626  break;
627  case s_Q2:
628  if(std::abs(Point[2]) < 38*CLHEP::m){
629  pointMagStart = HepGeom::Point3D<double>(m_Config.pointQ2aStart[(beam-1)*3],m_Config.pointQ2aStart[(beam-1)*3+1],m_Config.pointQ2aStart[(beam-1)*3+2]);
630  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointQ2aEnd[(beam-1)*3],m_Config.pointQ2aEnd[(beam-1)*3+1],m_Config.pointQ2aEnd[(beam-1)*3+2]);
631  rotZ = m_Config.fQ2aRotZ[beam-1];
632  }
633  else
634  {
635  pointMagStart = HepGeom::Point3D<double>(m_Config.pointQ2bStart[(beam-1)*3],m_Config.pointQ2bStart[(beam-1)*3+1],m_Config.pointQ2bStart[(beam-1)*3+2]);
636  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointQ2bEnd[(beam-1)*3],m_Config.pointQ2bEnd[(beam-1)*3+1],m_Config.pointQ2bEnd[(beam-1)*3+2]);
637  rotZ = m_Config.fQ2bRotZ[beam-1];
638  }
639  break;
640  case s_Q3:
641  pointMagStart = HepGeom::Point3D<double>(m_Config.pointQ3Start[(beam-1)*3],m_Config.pointQ3Start[(beam-1)*3+1],m_Config.pointQ3Start[(beam-1)*3+2]);
642  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointQ3End[(beam-1)*3],m_Config.pointQ3End[(beam-1)*3+1],m_Config.pointQ3End[(beam-1)*3+2]);
643  rotZ = m_Config.fQ3RotZ[beam-1];
644  break;
645  case s_Q4:
646  pointMagStart = HepGeom::Point3D<double>(m_Config.pointQ4Start[(beam-1)*3],m_Config.pointQ4Start[(beam-1)*3+1],m_Config.pointQ4Start[(beam-1)*3+2]);
647  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointQ4End[(beam-1)*3],m_Config.pointQ4End[(beam-1)*3+1],m_Config.pointQ4End[(beam-1)*3+2]);
648  rotZ = m_Config.fQ4RotZ[beam-1];
649  break;
650  case s_Q5:
651  pointMagStart = HepGeom::Point3D<double>(m_Config.pointQ5Start[(beam-1)*3],m_Config.pointQ5Start[(beam-1)*3+1],m_Config.pointQ5Start[(beam-1)*3+2]);
652  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointQ5End[(beam-1)*3],m_Config.pointQ5End[(beam-1)*3+1],m_Config.pointQ5End[(beam-1)*3+2]);
653  rotZ = m_Config.fQ5RotZ[beam-1];
654  break;
655  case s_Q6:
656  pointMagStart = HepGeom::Point3D<double>(m_Config.pointQ6Start[(beam-1)*3],m_Config.pointQ6Start[(beam-1)*3+1],m_Config.pointQ6Start[(beam-1)*3+2]);
657  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointQ6End[(beam-1)*3],m_Config.pointQ6End[(beam-1)*3+1],m_Config.pointQ6End[(beam-1)*3+2]);
658  rotZ = m_Config.fQ6RotZ[beam-1];
659  break;
660  case s_Q7:
661  if(std::abs(Point[2]) < 263.5*CLHEP::m){
662  pointMagStart = HepGeom::Point3D<double>(m_Config.pointQ7aStart[(beam-1)*3],m_Config.pointQ7aStart[(beam-1)*3+1],m_Config.pointQ7aStart[(beam-1)*3+2]);
663  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointQ7aEnd[(beam-1)*3],m_Config.pointQ7aEnd[(beam-1)*3+1],m_Config.pointQ7aEnd[(beam-1)*3+2]);
664  rotZ = m_Config.fQ7aRotZ[beam-1];
665  }
666  else
667  {
668  pointMagStart = HepGeom::Point3D<double>(m_Config.pointQ7bStart[(beam-1)*3],m_Config.pointQ7bStart[(beam-1)*3+1],m_Config.pointQ7bStart[(beam-1)*3+2]);
669  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointQ7bEnd[(beam-1)*3],m_Config.pointQ7bEnd[(beam-1)*3+1],m_Config.pointQ7bEnd[(beam-1)*3+2]);
670  rotZ = m_Config.fQ7bRotZ[beam-1];
671  }
672  break;
673  case s_D1:
674  if(std::abs(Point[2]) < 63.5*CLHEP::m){
675  pointMagStart = HepGeom::Point3D<double>(m_Config.pointD1aStart[(beam-1)*3],m_Config.pointD1aStart[(beam-1)*3+1],m_Config.pointD1aStart[(beam-1)*3+2]);
676  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointD1aEnd[(beam-1)*3],m_Config.pointD1aEnd[(beam-1)*3+1],m_Config.pointD1aEnd[(beam-1)*3+2]);
677  rotZ = m_Config.fD1aRotZ[beam-1];
678  }
679  else if(std::abs(Point[2]) < 67.5*CLHEP::m){
680  pointMagStart = HepGeom::Point3D<double>(m_Config.pointD1bStart[(beam-1)*3],m_Config.pointD1bStart[(beam-1)*3+1],m_Config.pointD1bStart[(beam-1)*3+2]);
681  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointD1bEnd[(beam-1)*3],m_Config.pointD1bEnd[(beam-1)*3+1],m_Config.pointD1bEnd[(beam-1)*3+2]);
682  rotZ = m_Config.fD1bRotZ[beam-1];
683  }
684 
685  else if(std::abs(Point[2]) < 72*CLHEP::m){
686  pointMagStart = HepGeom::Point3D<double>(m_Config.pointD1cStart[(beam-1)*3],m_Config.pointD1cStart[(beam-1)*3+1],m_Config.pointD1cStart[(beam-1)*3+2]);
687  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointD1cEnd[(beam-1)*3],m_Config.pointD1cEnd[(beam-1)*3+1],m_Config.pointD1cEnd[(beam-1)*3+2]);
688  rotZ = m_Config.fD1cRotZ[beam-1];
689  }
690 
691  else if(std::abs(Point[2]) < 76*CLHEP::m){
692  pointMagStart = HepGeom::Point3D<double>(m_Config.pointD1dStart[(beam-1)*3],m_Config.pointD1dStart[(beam-1)*3+1],m_Config.pointD1dStart[(beam-1)*3+2]);
693  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointD1dEnd[(beam-1)*3],m_Config.pointD1dEnd[(beam-1)*3+1],m_Config.pointD1dEnd[(beam-1)*3+2]);
694  rotZ = m_Config.fD1dRotZ[beam-1];
695  }
696 
697  else if(std::abs(Point[2]) < 80.5*CLHEP::m){
698  pointMagStart = HepGeom::Point3D<double>(m_Config.pointD1eStart[(beam-1)*3],m_Config.pointD1eStart[(beam-1)*3+1],m_Config.pointD1eStart[(beam-1)*3+2]);
699  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointD1eEnd[(beam-1)*3],m_Config.pointD1eEnd[(beam-1)*3+1],m_Config.pointD1eEnd[(beam-1)*3+2]);
700  rotZ = m_Config.fD1eRotZ[beam-1];
701  }
702 
703  else {
704  pointMagStart = HepGeom::Point3D<double>(m_Config.pointD1fStart[(beam-1)*3],m_Config.pointD1fStart[(beam-1)*3+1],m_Config.pointD1fStart[(beam-1)*3+2]);
705  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointD1fEnd[(beam-1)*3],m_Config.pointD1fEnd[(beam-1)*3+1],m_Config.pointD1fEnd[(beam-1)*3+2]);
706  rotZ = m_Config.fD1fRotZ[beam-1];
707  }
708  break;
709  case s_D2:
710  pointMagStart = HepGeom::Point3D<double>(m_Config.pointD2Start[(beam-1)*3],m_Config.pointD2Start[(beam-1)*3+1],m_Config.pointD2Start[(beam-1)*3+2]);
711  pointMagEnd = HepGeom::Point3D<double>(m_Config.pointD2End[(beam-1)*3],m_Config.pointD2End[(beam-1)*3+1],m_Config.pointD2End[(beam-1)*3+2]);
712  rotZ = m_Config.fD2RotZ[beam-1];
713  break;
714  }
715 }

◆ getMagNumFromName()

int MagField::ForwardRegionFieldSvc::getMagNumFromName ( const std::string &  name) const
private

Definition at line 581 of file ForwardRegionFieldSvc.cxx.

582 {
583  // dipoles
584  if (name == "\"MBXW.A4R1\"" || name == "\"MBXW.A4L1\"") return s_D1;
585  if (name == "\"MBXW.B4R1\"" || name == "\"MBXW.B4L1\"") return s_D1;
586  if (name == "\"MBXW.C4R1\"" || name == "\"MBXW.C4L1\"") return s_D1;
587  if (name == "\"MBXW.D4R1\"" || name == "\"MBXW.D4L1\"") return s_D1;
588  if (name == "\"MBXW.E4R1\"" || name == "\"MBXW.E4L1\"") return s_D1;
589  if (name == "\"MBXW.F4R1\"" || name == "\"MBXW.F4L1\"") return s_D1;
590  if (name == "\"MBRC.4R1.B1\"" || name == "\"MBRC.4L1.B2\"") return s_D2;
591 
592  //quadrupoles
593  if(name == "\"MQXA.1R1\"" || name == "\"MQXA.1L1\"") return s_Q1;
594  if(name == "\"MQXB.A2R1\"" || name == "\"MQXB.A2L1\"") return s_Q2;
595  if(name == "\"MQXB.B2R1\"" || name == "\"MQXB.B2L1\"") return s_Q2;
596  if(name == "\"MQXA.3R1\"" || name == "\"MQXA.3L1\"") return s_Q3;
597  if(name == "\"MQY.4R1.B1\"" || name == "\"MQY.4L1.B2\"") return s_Q4;
598  if(name == "\"MQML.5R1.B1\"" || name == "\"MQML.5L1.B2\"") return s_Q5;
599  if(name == "\"MQML.6R1.B1\"" || name == "\"MQML.6L1.B2\"") return s_Q6;
600  if(name == "\"MQM.A7R1.B1\"" || name == "\"MQM.A7L1.B2\"") return s_Q7;
601  if(name == "\"MQM.B7R1.B1\"" || name == "\"MQM.B7L1.B2\"") return s_Q7;
602 
603  // kickers
604  if(name == "\"MCBXH.1R1\"" || name == "\"MCBXH.1L1\"") return s_Q1HKick;
605  if(name == "\"MCBXV.1R1\"" || name == "\"MCBXV.1L1\"") return s_Q1VKick;
606  if(name == "\"MCBXH.2R1\"" || name == "\"MCBXH.2L1\"") return s_Q2HKick;
607  if(name == "\"MCBXV.2R1\"" || name == "\"MCBXV.2L1\"") return s_Q2VKick;
608  if(name == "\"MCBXH.3R1\"" || name == "\"MCBXH.3L1\"") return s_Q3HKick;
609  if(name == "\"MCBXV.3R1\"" || name == "\"MCBXV.3L1\"") return s_Q3VKick;
610  if(name == "\"MCBYV.A4R1.B1\"" || name == "\"MCBYV.A4L1.B2\"") return s_Q4VKickA;
611  if(name == "\"MCBYH.4R1.B1\"" || name == "\"MCBYH.4L1.B2\"") return s_Q4HKick;
612  if(name == "\"MCBYV.B4R1.B1\"" || name == "\"MCBYV.B4L1.B2\"") return s_Q4VKickB;
613  if(name == "\"MCBCH.5R1.B1\"" || name == "\"MCBCH.5L1.B2\"") return s_Q5HKick;
614  if(name == "\"MCBCV.6R1.B1\"" || name == "\"MCBCV.6L1.B2\"") return s_Q6VKick;
615  return -1;
616 }

◆ getMagXOff()

double MagField::ForwardRegionFieldSvc::getMagXOff ( int  magnet) const

Definition at line 411 of file ForwardRegionFieldSvc.cxx.

412 {
413  if(m_magDataType == 1) return m_magData[2];
414  return atof(m_magnets[magnet][3].c_str())*CLHEP::mm;
415 }

◆ getMagYOff()

double MagField::ForwardRegionFieldSvc::getMagYOff ( int  magnet) const

Definition at line 417 of file ForwardRegionFieldSvc.cxx.

418 {
419  if(m_magDataType == 1) return m_magData[3];
420  return atof(m_magnets[magnet][4].c_str())*CLHEP::mm;
421 }

◆ handle()

void MagField::ForwardRegionFieldSvc::handle ( const Incident &  runIncident)
finaloverride

IIncidentListener interface methods.

Definition at line 108 of file ForwardRegionFieldSvc.cxx.

109 {
110  ATH_MSG_INFO("handling incidents ..."); //FIXME drop to DEBUG level
111  if (runIncident.type() == IncidentType::BeginRun)
112  {
113  InitMagData();
114  }
115  ATH_MSG_INFO("BeginRun incident handled");
116 }

◆ initialize()

StatusCode MagField::ForwardRegionFieldSvc::initialize ( )
finaloverride

AthService interface methods.

Definition at line 95 of file ForwardRegionFieldSvc.cxx.

96 {
97  ATH_CHECK(m_properties.retrieve());
98 
99  ATH_MSG_INFO("Postponing magnet strengths initialization of " << this->name() << " till the begin of run");
100  ServiceHandle<IIncidentSvc> incidentSvc("IncidentSvc", this->name());
101  ATH_CHECK(incidentSvc.retrieve());
102  incidentSvc->addListener( this, IncidentType::BeginRun );
103  ATH_MSG_INFO("Added listener to BeginRun incident");
104  return StatusCode::SUCCESS;
105 }

◆ InitMagData()

void MagField::ForwardRegionFieldSvc::InitMagData ( )
private

Definition at line 213 of file ForwardRegionFieldSvc.cxx.

214 {
215  ATH_MSG_INFO("Initializing magnetic field");
216 
217  m_Config = *(m_properties->getConf());
218 
219  if(m_Config.twissFileB1 == "" || m_Config.twissFileB2 == "" || m_Config.momentum == 0){
220  m_magDataType = 0;
221 
222  ATH_MSG_INFO("Using magnets.dat as the field settings source");
223 
224  const std::string fileMagnets("magnets.dat");
225  m_magnets = loadDataFile(fileMagnets.c_str(),5);
226  }
227  else
228  {
229  m_magDataType = 1;
230 
231  ATH_MSG_INFO("Using twiss files (" << m_Config.twissFileB1 << ", " << m_Config.twissFileB2 << ") as the field settings source");
232 
233  std::string headerB1;
234  std::string headerB2;
235  // Load twiss files and calculate field values for magnets
236  std::vector<std::vector<std::string> > loadedTwissFileB1 = loadDataFileNLines(m_Config.twissFileB1.c_str(),30,200,headerB1);
237  std::vector<std::vector<std::string> > loadedTwissFileB2 = loadDataFileNLines(m_Config.twissFileB2.c_str(),30,200,headerB2);
238 
239  // Beam 1
240  InitMagDataFromTwiss(loadedTwissFileB1, 1, m_Config.momentum);
241 
242  // Beam 2
243  InitMagDataFromTwiss(loadedTwissFileB2, 2, m_Config.momentum);
244 
245  //writeOutTwiss(loadedTwissFileB1,1,headerB1);
246  //writeOutTwiss(loadedTwissFileB2,2,headerB2);
247  ATH_MSG_INFO("Field initialized.");
248  }
249 }

◆ InitMagDataFromTwiss()

void MagField::ForwardRegionFieldSvc::InitMagDataFromTwiss ( const std::vector< std::vector< std::string > > &  loadedTwissFile,
int  beam,
double  momentum 
)
private

Definition at line 251 of file ForwardRegionFieldSvc.cxx.

252 {
253  int textIndex = 0;
254  int lengthIndex = 4;
255  int hkick = 5;
256  int vkick = 6;
257  int k0LIndex = 7;
258  int k1LIndex = 8;
259 
260  bool dipole = false;
261  bool quadrupole = false;
262  bool kicker = false;
263  double length;
264 
265  // init offsets (Q4--Q7 have dx=-97 mm, others 0), do not apply to kickers
266  if(m_magnet <= s_Q7) {
267  if(m_magnet >= s_Q4)
268  m_magData[2] = -97*CLHEP::mm;
269  else
270  m_magData[2] = 0;
271 
272  m_magData[3] = 0;
273  }
274 
275  for(int i=0; i < 150; i++)
276  {
277  // dipoles
278  dipole = (m_magnet == s_D1 && (loadedTwissFile[i][textIndex] == "\"MBXW.A4R1\"" || loadedTwissFile[i][textIndex] == "\"MBXW.A4L1\""))
279  || (m_magnet == s_D2 && (loadedTwissFile[i][textIndex] == "\"MBRC.4R1.B1\"" || loadedTwissFile[i][textIndex] == "\"MBRC.4L1.B2\""));
280  if(dipole){
281  m_magData[beam-1] = kLToB(atof(loadedTwissFile[i][k0LIndex].c_str()), atof(loadedTwissFile[i][lengthIndex].c_str()), momentum);
282  return;
283  }
284 
285  //quadrupoles
286  quadrupole = (m_magnet == s_Q1 && (loadedTwissFile[i][textIndex] == "\"MQXA.1R1\"" || loadedTwissFile[i][textIndex] == "\"MQXA.1L1\""))
287  || (m_magnet == s_Q2 && (loadedTwissFile[i][textIndex] == "\"MQXB.A2R1\"" || loadedTwissFile[i][textIndex] == "\"MQXB.A2L1\""))
288  || (m_magnet == s_Q3 && (loadedTwissFile[i][textIndex] == "\"MQXA.3R1\"" || loadedTwissFile[i][textIndex] == "\"MQXA.3L1\""))
289  || (m_magnet == s_Q4 && (loadedTwissFile[i][textIndex] == "\"MQY.4R1.B1\"" || loadedTwissFile[i][textIndex] == "\"MQY.4L1.B2\""))
290  || (m_magnet == s_Q5 && (loadedTwissFile[i][textIndex] == "\"MQML.5R1.B1\"" || loadedTwissFile[i][textIndex] == "\"MQML.5L1.B2\""))
291  || (m_magnet == s_Q6 && (loadedTwissFile[i][textIndex] == "\"MQML.6R1.B1\"" || loadedTwissFile[i][textIndex] == "\"MQML.6L1.B2\""))
292  || (m_magnet == s_Q7 && (loadedTwissFile[i][textIndex] == "\"MQM.A7R1.B1\"" || loadedTwissFile[i][textIndex] == "\"MQM.A7L1.B2\""));
293  if(quadrupole){
294  m_magData[beam-1] = kLToB(atof(loadedTwissFile[i][k1LIndex].c_str()), atof(loadedTwissFile[i][lengthIndex].c_str()), momentum);
295  return;
296  }
297 
298  // kickers
299  kicker = (m_magnet == s_Q1HKick && (loadedTwissFile[i][textIndex] == "\"MCBXH.1R1\"" || loadedTwissFile[i][textIndex] == "\"MCBXH.1L1\""))
300  || (m_magnet == s_Q1VKick && (loadedTwissFile[i][textIndex] == "\"MCBXV.1R1\"" || loadedTwissFile[i][textIndex] == "\"MCBXV.1L1\""))
301  || (m_magnet == s_Q2HKick && (loadedTwissFile[i][textIndex] == "\"MCBXH.2R1\"" || loadedTwissFile[i][textIndex] == "\"MCBXH.2L1\""))
302  || (m_magnet == s_Q2VKick && (loadedTwissFile[i][textIndex] == "\"MCBXV.2R1\"" || loadedTwissFile[i][textIndex] == "\"MCBXV.2L1\""))
303  || (m_magnet == s_Q3HKick && (loadedTwissFile[i][textIndex] == "\"MCBXH.3R1\"" || loadedTwissFile[i][textIndex] == "\"MCBXH.3L1\""))
304  || (m_magnet == s_Q3VKick && (loadedTwissFile[i][textIndex] == "\"MCBXV.3R1\"" || loadedTwissFile[i][textIndex] == "\"MCBXV.3L1\""))
305  || (m_magnet == s_Q4VKickA && (loadedTwissFile[i][textIndex] == "\"MCBYV.A4R1.B1\"" || loadedTwissFile[i][textIndex] == "\"MCBYV.A4L1.B2\""))
306  || (m_magnet == s_Q4HKick && (loadedTwissFile[i][textIndex] == "\"MCBYH.4R1.B1\"" || loadedTwissFile[i][textIndex] == "\"MCBYH.4L1.B2\""))
307  || (m_magnet == s_Q4VKickB && (loadedTwissFile[i][textIndex] == "\"MCBYV.B4R1.B1\"" || loadedTwissFile[i][textIndex] == "\"MCBYV.B4L1.B2\""))
308  || (m_magnet == s_Q5HKick && (loadedTwissFile[i][textIndex] == "\"MCBCH.5R1.B1\"" || loadedTwissFile[i][textIndex] == "\"MCBCH.5L1.B2\""))
309  || (m_magnet == s_Q6VKick && (loadedTwissFile[i][textIndex] == "\"MCBCV.6R1.B1\"" || loadedTwissFile[i][textIndex] == "\"MCBCV.6L1.B2\""));
310 
311  if(kicker){
312  // length of s_Q1--s_Q3 kickers in twiss files is zero -> it is set to 0.001 m (also the length of corresponding GeoModel volumes)
313  length = atof(loadedTwissFile[i][lengthIndex].c_str()) ? atof(loadedTwissFile[i][lengthIndex].c_str()) : 0.001;
314  // calculation of the B from deflection angle --- beam going down at the IP
315  m_magData[beam-1] = pow(-1.0, beam+1)*kLToB(atof(loadedTwissFile[i][vkick].c_str()), length, momentum);
316  m_magData[beam+1] = kLToB(atof(loadedTwissFile[i][hkick].c_str()), length, momentum);
317  return;
318  }
319  }
320 }

◆ kLToB()

double MagField::ForwardRegionFieldSvc::kLToB ( double  kL,
double  lenght,
double  momentum 
)
private

Definition at line 515 of file ForwardRegionFieldSvc.cxx.

516 {
517  return kL*momentum/length/0.299792458;
518 }

◆ loadDataFile()

std::vector< std::vector< std::string > > MagField::ForwardRegionFieldSvc::loadDataFile ( const char *  fileName,
int  cols 
)
private

Definition at line 508 of file ForwardRegionFieldSvc.cxx.

509 {
510  std::string header;
511  return loadDataFileNLines(fileName, cols, 0, header);
512 }

◆ loadDataFileNLines()

std::vector< std::vector< std::string > > MagField::ForwardRegionFieldSvc::loadDataFileNLines ( const char *  fileName,
int  cols,
int  N,
std::string &  header 
)
private

Definition at line 424 of file ForwardRegionFieldSvc.cxx.

425 {
426  std::vector<std::vector<std::string> > loadedData;
427 
428  header = "";
429 
430  MsgStream LogStream(Athena::getMessageSvc(), "MagField::ForwardRegionFieldSvc::loadDataFile()");
431 
432  std::ifstream file (fileName);
433  if(!file){
435  LogStream << MSG::DEBUG << "File " << fileName << " not found in run directory, trying to load it from DATAPATH" << endmsg;
436  file.open(datapath.c_str());
437  }
438 
439  if(!file)
440  LogStream << MSG::FATAL << "Unable to load " << fileName << endmsg;
441 
442  if(file.is_open())
443  {
444  std::vector<std::string> row (cols);
445  char c;
446  char temp[1024];
447 
448  bool unlimited = false;
449  if(N==0) unlimited = true;
450  int i = 0;
451  while(file.get(c) && (i < N || unlimited))
452  {
453  if(c != '@' && c != '#' && c != '*' && c != '$' && c != '%' && c!='\n')
454  {
455  file.unget();
456  for(int i = 0; i<cols; i++) // load desired columns
457  {
458  file >> row[i];
459  }
460  loadedData.push_back(row); //store them
461  file.ignore(1024,'\n'); // discard rest of line
462  }
463  else if(c == '@')
464  {
465  file.unget();
466  file.getline(temp,1024);
467  header.append(temp);
468  header.append("\n");
469  }
470  else if(c == '*')
471  {
472  file.unget();
473  file.getline(temp,1024);
474  header.append(temp);
475  header.append(" PosXStart");
476  header.append(" PosYStart");
477  header.append(" PosZStart");
478  header.append(" PosXEnd ");
479  header.append(" PosYEnd ");
480  header.append(" PosZEnd ");
481  header.append(" RotZ");
482  header.append("\n");
483  }
484  else if(c == '$')
485  {
486  file.unget();
487  file.getline(temp,1024);
488  header.append(temp);
489  header.append(" %le ");
490  header.append(" %le ");
491  header.append(" %le ");
492  header.append(" %le ");
493  header.append(" %le ");
494  header.append(" %le ");
495  header.append(" %le ");
496  header.append("\n");
497  }
498  else
499  file.ignore(1024, '\n'); // discard commented lines
500  i++;
501  }
502  LogStream << MSG::INFO << "File " << fileName << " succesfully loaded." << endmsg;
503  file.close();
504  }
505  return loadedData;
506 }

◆ writeOutTwiss()

void MagField::ForwardRegionFieldSvc::writeOutTwiss ( const std::vector< std::vector< std::string >> &  loadedTwissFile,
int  beam,
const std::string &  header 
)
private

Definition at line 520 of file ForwardRegionFieldSvc.cxx.

521 {
522  MsgStream LogStream(Athena::getMessageSvc(), "MagField::ForwardRegionFieldSvc::writeOutTwiss()");
523 
524 
525  std::ostringstream fileName;
526  fileName << "alfaTwiss" << beam << ".txt";
527  std::ofstream file (fileName.str().c_str());
528  int magID;
529  HepGeom::Point3D<double> pointMagStart;
530  HepGeom::Point3D<double> pointMagEnd;
531  double rotZ = 0;
532  double PointZ;
533  G4ThreeVector Point;
534 
535  if(!file)
536  LogStream << MSG::ERROR << "Unable to write to " << fileName.str() << endmsg;
537 
538  if(file.is_open())
539  {
540  file << header;
541  int fileSize = loadedTwissFile.size();
542  int rowSize = 0;
543  for(int i=0; i < fileSize;i++)
544  {
545  rowSize = loadedTwissFile[i].size();
546  for(int j=0; j<rowSize; j++)
547  {
548  if(j < 3) file << std::left;
549  else file << std::right;
550  file << std::setw(20) << loadedTwissFile[i][j];
551  }
552  magID = getMagNumFromName(loadedTwissFile[i][0]);
553  if(magID >= 0){
554  PointZ = atof(loadedTwissFile[i][3].c_str())*CLHEP::m;
555  Point.set(0,0,PointZ);
556  getMagnetTransformParams(beam, magID, Point, pointMagStart, pointMagEnd, rotZ);
557  file << std::setw(20) << pointMagStart[0]/CLHEP::m;
558  file << std::setw(20) << pointMagStart[1]/CLHEP::m;
559  file << std::setw(20) << pointMagStart[2]/CLHEP::m;
560  file << std::setw(20) << pointMagEnd[0]/CLHEP::m;
561  file << std::setw(20) << pointMagEnd[1]/CLHEP::m;
562  file << std::setw(20) << pointMagEnd[2]/CLHEP::m;
563  file << std::setw(20) << rotZ;
564  }
565  else {
566  file << std::setw(20) << 0;
567  file << std::setw(20) << 0;
568  file << std::setw(20) << 0;
569  file << std::setw(20) << 0;
570  file << std::setw(20) << 0;
571  file << std::setw(20) << 0;
572  file << std::setw(20) << 0;
573  }
574 
575  file << std::endl;
576  }
577  }
578  file.close();
579 }

Member Data Documentation

◆ m_Config

FWDMg_CONFIGURATION MagField::ForwardRegionFieldSvc::m_Config
private

Definition at line 130 of file ForwardRegionFieldSvc.h.

◆ m_magData

double MagField::ForwardRegionFieldSvc::m_magData[4]
private

Definition at line 80 of file ForwardRegionFieldSvc.h.

◆ m_magDataType

int MagField::ForwardRegionFieldSvc::m_magDataType
private

Definition at line 83 of file ForwardRegionFieldSvc.h.

◆ m_magIndMQXA

double MagField::ForwardRegionFieldSvc::m_magIndMQXA[s_rowsMQXA][s_colsMQXA][2]
private

Definition at line 117 of file ForwardRegionFieldSvc.h.

◆ m_magIndMQXB

double MagField::ForwardRegionFieldSvc::m_magIndMQXB[s_rowsMQXB][s_colsMQXB][2]
private

Definition at line 118 of file ForwardRegionFieldSvc.h.

◆ m_magnet

int MagField::ForwardRegionFieldSvc::m_magnet
private

Definition at line 71 of file ForwardRegionFieldSvc.h.

◆ m_magnets

std::vector<std::vector<std::string> > MagField::ForwardRegionFieldSvc::m_magnets
private

Definition at line 75 of file ForwardRegionFieldSvc.h.

◆ m_MQXA_DataFile

std::string MagField::ForwardRegionFieldSvc::m_MQXA_DataFile
private

Definition at line 85 of file ForwardRegionFieldSvc.h.

◆ m_MQXB_DataFile

std::string MagField::ForwardRegionFieldSvc::m_MQXB_DataFile
private

Definition at line 86 of file ForwardRegionFieldSvc.h.

◆ m_properties

ToolHandle<IForwardRegionProperties> MagField::ForwardRegionFieldSvc::m_properties
private

Definition at line 132 of file ForwardRegionFieldSvc.h.

◆ s_colsMQXA

const int MagField::ForwardRegionFieldSvc::s_colsMQXA = 97
staticprivate

Definition at line 113 of file ForwardRegionFieldSvc.h.

◆ s_colsMQXB

const int MagField::ForwardRegionFieldSvc::s_colsMQXB = 89
staticprivate

Definition at line 115 of file ForwardRegionFieldSvc.h.

◆ s_D1

const int MagField::ForwardRegionFieldSvc::s_D1 = 3
staticprivate

Definition at line 94 of file ForwardRegionFieldSvc.h.

◆ s_D2

const int MagField::ForwardRegionFieldSvc::s_D2 = 4
staticprivate

Definition at line 95 of file ForwardRegionFieldSvc.h.

◆ s_Q1

const int MagField::ForwardRegionFieldSvc::s_Q1 = 0
staticprivate

Definition at line 91 of file ForwardRegionFieldSvc.h.

◆ s_Q1HKick

const int MagField::ForwardRegionFieldSvc::s_Q1HKick = 9
staticprivate

Definition at line 100 of file ForwardRegionFieldSvc.h.

◆ s_Q1VKick

const int MagField::ForwardRegionFieldSvc::s_Q1VKick = 10
staticprivate

Definition at line 101 of file ForwardRegionFieldSvc.h.

◆ s_Q2

const int MagField::ForwardRegionFieldSvc::s_Q2 = 1
staticprivate

Definition at line 92 of file ForwardRegionFieldSvc.h.

◆ s_Q2HKick

const int MagField::ForwardRegionFieldSvc::s_Q2HKick = 11
staticprivate

Definition at line 102 of file ForwardRegionFieldSvc.h.

◆ s_Q2VKick

const int MagField::ForwardRegionFieldSvc::s_Q2VKick = 12
staticprivate

Definition at line 103 of file ForwardRegionFieldSvc.h.

◆ s_Q3

const int MagField::ForwardRegionFieldSvc::s_Q3 = 2
staticprivate

Definition at line 93 of file ForwardRegionFieldSvc.h.

◆ s_Q3HKick

const int MagField::ForwardRegionFieldSvc::s_Q3HKick = 13
staticprivate

Definition at line 104 of file ForwardRegionFieldSvc.h.

◆ s_Q3VKick

const int MagField::ForwardRegionFieldSvc::s_Q3VKick = 14
staticprivate

Definition at line 105 of file ForwardRegionFieldSvc.h.

◆ s_Q4

const int MagField::ForwardRegionFieldSvc::s_Q4 = 5
staticprivate

Definition at line 96 of file ForwardRegionFieldSvc.h.

◆ s_Q4HKick

const int MagField::ForwardRegionFieldSvc::s_Q4HKick = 16
staticprivate

Definition at line 107 of file ForwardRegionFieldSvc.h.

◆ s_Q4VKickA

const int MagField::ForwardRegionFieldSvc::s_Q4VKickA = 15
staticprivate

Definition at line 106 of file ForwardRegionFieldSvc.h.

◆ s_Q4VKickB

const int MagField::ForwardRegionFieldSvc::s_Q4VKickB = 17
staticprivate

Definition at line 108 of file ForwardRegionFieldSvc.h.

◆ s_Q5

const int MagField::ForwardRegionFieldSvc::s_Q5 = 6
staticprivate

Definition at line 97 of file ForwardRegionFieldSvc.h.

◆ s_Q5HKick

const int MagField::ForwardRegionFieldSvc::s_Q5HKick = 18
staticprivate

Definition at line 109 of file ForwardRegionFieldSvc.h.

◆ s_Q6

const int MagField::ForwardRegionFieldSvc::s_Q6 = 7
staticprivate

Definition at line 98 of file ForwardRegionFieldSvc.h.

◆ s_Q6VKick

const int MagField::ForwardRegionFieldSvc::s_Q6VKick = 19
staticprivate

Definition at line 110 of file ForwardRegionFieldSvc.h.

◆ s_Q7

const int MagField::ForwardRegionFieldSvc::s_Q7 = 8
staticprivate

Definition at line 99 of file ForwardRegionFieldSvc.h.

◆ s_rowsMQXA

const int MagField::ForwardRegionFieldSvc::s_rowsMQXA = 97
staticprivate

Definition at line 112 of file ForwardRegionFieldSvc.h.

◆ s_rowsMQXB

const int MagField::ForwardRegionFieldSvc::s_rowsMQXB = 89
staticprivate

Definition at line 114 of file ForwardRegionFieldSvc.h.


The documentation for this class was generated from the following files:
_FWDMg_CONFIGURATION::pointD1aStart
std::vector< double > pointD1aStart
Definition: IForwardRegionProperties.h:26
query_example.row
row
Definition: query_example.py:24
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
PathResolver::RecursiveSearch
@ RecursiveSearch
Definition: PathResolver.h:28
header
Definition: hcg.cxx:526
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
MagField::ForwardRegionFieldSvc::s_Q5HKick
static const int s_Q5HKick
Definition: ForwardRegionFieldSvc.h:109
MagField::ForwardRegionFieldSvc::s_Q2HKick
static const int s_Q2HKick
Definition: ForwardRegionFieldSvc.h:102
MagField::ForwardRegionFieldSvc::getMagnetTransformParams
void getMagnetTransformParams(int beam, int magnet, G4ThreeVector Point, HepGeom::Point3D< double > &pointMagStart, HepGeom::Point3D< double > &pointMagEnd, double &rotZ) const
Definition: ForwardRegionFieldSvc.cxx:618
_FWDMg_CONFIGURATION::fQ6RotZ
std::vector< double > fQ6RotZ
Definition: IForwardRegionProperties.h:57
MagField::ForwardRegionFieldSvc::loadDataFile
std::vector< std::vector< std::string > > loadDataFile(const char *fileName, int cols)
Definition: ForwardRegionFieldSvc.cxx:508
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
MagField::ForwardRegionFieldSvc::m_magIndMQXA
double m_magIndMQXA[s_rowsMQXA][s_colsMQXA][2]
Definition: ForwardRegionFieldSvc.h:117
MagField::ForwardRegionFieldSvc::s_rowsMQXA
static const int s_rowsMQXA
Definition: ForwardRegionFieldSvc.h:112
_FWDMg_CONFIGURATION::pointD1fEnd
std::vector< double > pointD1fEnd
Definition: IForwardRegionProperties.h:48
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
_FWDMg_CONFIGURATION::twissFileB1
std::string twissFileB1
Definition: IForwardRegionProperties.h:14
MagField::ForwardRegionFieldSvc::m_properties
ToolHandle< IForwardRegionProperties > m_properties
Definition: ForwardRegionFieldSvc.h:132
_FWDMg_CONFIGURATION::pointD1bEnd
std::vector< double > pointD1bEnd
Definition: IForwardRegionProperties.h:44
MagField::ForwardRegionFieldSvc::s_Q4VKickB
static const int s_Q4VKickB
Definition: ForwardRegionFieldSvc.h:108
_FWDMg_CONFIGURATION::pointD1aEnd
std::vector< double > pointD1aEnd
Definition: IForwardRegionProperties.h:43
MagField::ForwardRegionFieldSvc::getMag
double getMag(int magnet, int beam) const
Definition: ForwardRegionFieldSvc.cxx:399
_FWDMg_CONFIGURATION::fQ1RotZ
std::vector< double > fQ1RotZ
Definition: IForwardRegionProperties.h:51
_FWDMg_CONFIGURATION::pointQ2bEnd
std::vector< double > pointQ2bEnd
Definition: IForwardRegionProperties.h:36
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
MagField::ForwardRegionFieldSvc::s_Q1VKick
static const int s_Q1VKick
Definition: ForwardRegionFieldSvc.h:101
MagField::ForwardRegionFieldSvc::s_Q2VKick
static const int s_Q2VKick
Definition: ForwardRegionFieldSvc.h:103
MagField::ForwardRegionFieldSvc::m_magnet
int m_magnet
Definition: ForwardRegionFieldSvc.h:71
_FWDMg_CONFIGURATION::pointD1dEnd
std::vector< double > pointD1dEnd
Definition: IForwardRegionProperties.h:46
xyz
#define xyz
_FWDMg_CONFIGURATION::pointQ1Start
std::vector< double > pointQ1Start
Definition: IForwardRegionProperties.h:17
_FWDMg_CONFIGURATION::pointD2Start
std::vector< double > pointD2Start
Definition: IForwardRegionProperties.h:32
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
_FWDMg_CONFIGURATION::fD2RotZ
std::vector< double > fD2RotZ
Definition: IForwardRegionProperties.h:66
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
MagField::ForwardRegionFieldSvc::m_magData
double m_magData[4]
Definition: ForwardRegionFieldSvc.h:80
MagField::ForwardRegionFieldSvc::s_Q1
static const int s_Q1
Definition: ForwardRegionFieldSvc.h:91
MagField::ForwardRegionFieldSvc::s_D2
static const int s_D2
Definition: ForwardRegionFieldSvc.h:95
MagField::ForwardRegionFieldSvc::getMagInd
G4ThreeVector getMagInd(G4ThreeVector Point, int q, int beam) const
Non-inherited public methods FIXME - add new interface?
Definition: ForwardRegionFieldSvc.cxx:325
MagField::ForwardRegionFieldSvc::kLToB
double kLToB(double kL, double lenght, double momentum)
Definition: ForwardRegionFieldSvc.cxx:515
_FWDMg_CONFIGURATION::fD1fRotZ
std::vector< double > fD1fRotZ
Definition: IForwardRegionProperties.h:65
MagField::ForwardRegionFieldSvc::m_magIndMQXB
double m_magIndMQXB[s_rowsMQXB][s_colsMQXB][2]
Definition: ForwardRegionFieldSvc.h:118
MagField::ForwardRegionFieldSvc::m_magDataType
int m_magDataType
Definition: ForwardRegionFieldSvc.h:83
_FWDMg_CONFIGURATION::fQ7aRotZ
std::vector< double > fQ7aRotZ
Definition: IForwardRegionProperties.h:58
_FWDMg_CONFIGURATION::pointQ4End
std::vector< double > pointQ4End
Definition: IForwardRegionProperties.h:38
x
#define x
MagField::ForwardRegionFieldSvc::s_colsMQXA
static const int s_colsMQXA
Definition: ForwardRegionFieldSvc.h:113
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MagField::ForwardRegionFieldSvc::s_Q7
static const int s_Q7
Definition: ForwardRegionFieldSvc.h:99
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
_FWDMg_CONFIGURATION::fD1bRotZ
std::vector< double > fD1bRotZ
Definition: IForwardRegionProperties.h:61
MagField::ForwardRegionFieldSvc::s_colsMQXB
static const int s_colsMQXB
Definition: ForwardRegionFieldSvc.h:115
_FWDMg_CONFIGURATION::pointQ7bStart
std::vector< double > pointQ7bStart
Definition: IForwardRegionProperties.h:25
MagField::ForwardRegionFieldSvc::s_Q3
static const int s_Q3
Definition: ForwardRegionFieldSvc.h:93
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
_FWDMg_CONFIGURATION::fQ4RotZ
std::vector< double > fQ4RotZ
Definition: IForwardRegionProperties.h:55
_FWDMg_CONFIGURATION::fQ2bRotZ
std::vector< double > fQ2bRotZ
Definition: IForwardRegionProperties.h:53
MagField::ForwardRegionFieldSvc::m_MQXA_DataFile
std::string m_MQXA_DataFile
Definition: ForwardRegionFieldSvc.h:85
beamspotnt.cols
list cols
Definition: bin/beamspotnt.py:1114
_FWDMg_CONFIGURATION::pointQ7bEnd
std::vector< double > pointQ7bEnd
Definition: IForwardRegionProperties.h:42
MagField::ForwardRegionFieldSvc::s_Q2
static const int s_Q2
Definition: ForwardRegionFieldSvc.h:92
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
_FWDMg_CONFIGURATION::pointD1cStart
std::vector< double > pointD1cStart
Definition: IForwardRegionProperties.h:28
MagField::ForwardRegionFieldSvc::s_D1
static const int s_D1
Definition: ForwardRegionFieldSvc.h:94
MagField::ForwardRegionFieldSvc::loadDataFileNLines
std::vector< std::vector< std::string > > loadDataFileNLines(const char *fileName, int cols, int N, std::string &header)
Definition: ForwardRegionFieldSvc.cxx:424
MagField::ForwardRegionFieldSvc::getMagNumFromName
int getMagNumFromName(const std::string &name) const
Definition: ForwardRegionFieldSvc.cxx:581
_FWDMg_CONFIGURATION::pointD1dStart
std::vector< double > pointD1dStart
Definition: IForwardRegionProperties.h:29
doubleTestComp.j1
j1
Definition: doubleTestComp.py:21
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
MagField::ForwardRegionFieldSvc::m_MQXB_DataFile
std::string m_MQXB_DataFile
Definition: ForwardRegionFieldSvc.h:86
MagField::ForwardRegionFieldSvc::s_Q6VKick
static const int s_Q6VKick
Definition: ForwardRegionFieldSvc.h:110
lumiFormat.i
int i
Definition: lumiFormat.py:85
python.html.AtlRunQueryDQSummary.datapath
datapath
Definition: AtlRunQueryDQSummary.py:1205
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MagField::ForwardRegionFieldSvc::getKick
G4ThreeVector getKick(int beam) const
Definition: ForwardRegionFieldSvc.cxx:405
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:73
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
_FWDMg_CONFIGURATION::pointQ6End
std::vector< double > pointQ6End
Definition: IForwardRegionProperties.h:40
_FWDMg_CONFIGURATION::pointQ7aStart
std::vector< double > pointQ7aStart
Definition: IForwardRegionProperties.h:24
MagField::ForwardRegionFieldSvc::s_Q1HKick
static const int s_Q1HKick
Definition: ForwardRegionFieldSvc.h:100
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
_FWDMg_CONFIGURATION::fQ2aRotZ
std::vector< double > fQ2aRotZ
Definition: IForwardRegionProperties.h:52
MagField::ForwardRegionFieldSvc::m_Config
FWDMg_CONFIGURATION m_Config
Definition: ForwardRegionFieldSvc.h:130
file
TFile * file
Definition: tile_monitor.h:29
_FWDMg_CONFIGURATION::pointQ5Start
std::vector< double > pointQ5Start
Definition: IForwardRegionProperties.h:22
_FWDMg_CONFIGURATION::pointD1eStart
std::vector< double > pointD1eStart
Definition: IForwardRegionProperties.h:30
MagField::ForwardRegionFieldSvc::s_Q4VKickA
static const int s_Q4VKickA
Definition: ForwardRegionFieldSvc.h:106
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
_FWDMg_CONFIGURATION::fD1dRotZ
std::vector< double > fD1dRotZ
Definition: IForwardRegionProperties.h:63
hist_file_dump.f
f
Definition: hist_file_dump.py:135
_FWDMg_CONFIGURATION::clear
void clear()
Definition: IForwardRegionProperties.h:72
_FWDMg_CONFIGURATION::fQ3RotZ
std::vector< double > fQ3RotZ
Definition: IForwardRegionProperties.h:54
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
MagField::ForwardRegionFieldSvc::m_magnets
std::vector< std::vector< std::string > > m_magnets
Definition: ForwardRegionFieldSvc.h:75
_FWDMg_CONFIGURATION::momentum
double momentum
Definition: IForwardRegionProperties.h:15
_FWDMg_CONFIGURATION::pointQ1End
std::vector< double > pointQ1End
Definition: IForwardRegionProperties.h:34
jobOptions.beam
beam
Definition: jobOptions.SuperChic_ALP2.py:16
_FWDMg_CONFIGURATION::fD1cRotZ
std::vector< double > fD1cRotZ
Definition: IForwardRegionProperties.h:62
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition: Control/CxxUtils/Root/StringUtils.cxx:91
MagField::ForwardRegionFieldSvc::s_Q4HKick
static const int s_Q4HKick
Definition: ForwardRegionFieldSvc.h:107
_FWDMg_CONFIGURATION::fD1eRotZ
std::vector< double > fD1eRotZ
Definition: IForwardRegionProperties.h:64
MagField::ForwardRegionFieldSvc::s_Q3HKick
static const int s_Q3HKick
Definition: ForwardRegionFieldSvc.h:104
_FWDMg_CONFIGURATION::pointQ3End
std::vector< double > pointQ3End
Definition: IForwardRegionProperties.h:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ChargedTracksWeightFilter::Spline::Point
Linear spline representation of a function used to calculate weights.
Definition: ChargedTracksWeightFilter.h:28
_FWDMg_CONFIGURATION::pointQ3Start
std::vector< double > pointQ3Start
Definition: IForwardRegionProperties.h:20
python.SystemOfUnits.tesla
int tesla
Definition: SystemOfUnits.py:228
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
_FWDMg_CONFIGURATION::pointQ2aStart
std::vector< double > pointQ2aStart
Definition: IForwardRegionProperties.h:18
_FWDMg_CONFIGURATION::pointD1cEnd
std::vector< double > pointD1cEnd
Definition: IForwardRegionProperties.h:45
_FWDMg_CONFIGURATION::pointQ2aEnd
std::vector< double > pointQ2aEnd
Definition: IForwardRegionProperties.h:35
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
MagField::ForwardRegionFieldSvc::InitMagData
void InitMagData()
Definition: ForwardRegionFieldSvc.cxx:213
MagField::ForwardRegionFieldSvc::getMagXOff
double getMagXOff(int magnet) const
Definition: ForwardRegionFieldSvc.cxx:411
y
#define y
_FWDMg_CONFIGURATION::pointQ2bStart
std::vector< double > pointQ2bStart
Definition: IForwardRegionProperties.h:19
MagField::ForwardRegionFieldSvc::getMagYOff
double getMagYOff(int magnet) const
Definition: ForwardRegionFieldSvc.cxx:417
_FWDMg_CONFIGURATION::pointQ4Start
std::vector< double > pointQ4Start
Definition: IForwardRegionProperties.h:21
MagField::ForwardRegionFieldSvc::s_Q4
static const int s_Q4
Definition: ForwardRegionFieldSvc.h:96
MagField::ForwardRegionFieldSvc::s_Q6
static const int s_Q6
Definition: ForwardRegionFieldSvc.h:98
DEBUG
#define DEBUG
Definition: page_access.h:11
_FWDMg_CONFIGURATION::pointQ6Start
std::vector< double > pointQ6Start
Definition: IForwardRegionProperties.h:23
_FWDMg_CONFIGURATION::bUseFLUKAMapsForInnerTriplet
bool bUseFLUKAMapsForInnerTriplet
Definition: IForwardRegionProperties.h:68
extractSporadic.q
list q
Definition: extractSporadic.py:98
_FWDMg_CONFIGURATION::twissFileB2
std::string twissFileB2
Definition: IForwardRegionProperties.h:14
_FWDMg_CONFIGURATION::fD1aRotZ
std::vector< double > fD1aRotZ
Definition: IForwardRegionProperties.h:60
makeTOC.header
header
Definition: makeTOC.py:28
MagField::ForwardRegionFieldSvc::InitMagDataFromTwiss
void InitMagDataFromTwiss(const std::vector< std::vector< std::string > > &loadedTwissFile, int beam, double momentum)
Definition: ForwardRegionFieldSvc.cxx:251
_FWDMg_CONFIGURATION::pointQ5End
std::vector< double > pointQ5End
Definition: IForwardRegionProperties.h:39
_FWDMg_CONFIGURATION::fQ7bRotZ
std::vector< double > fQ7bRotZ
Definition: IForwardRegionProperties.h:59
python.compressB64.c
def c
Definition: compressB64.py:93
_FWDMg_CONFIGURATION::pointD1fStart
std::vector< double > pointD1fStart
Definition: IForwardRegionProperties.h:31
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
_FWDMg_CONFIGURATION::fQ5RotZ
std::vector< double > fQ5RotZ
Definition: IForwardRegionProperties.h:56
MagField::ForwardRegionFieldSvc::s_rowsMQXB
static const int s_rowsMQXB
Definition: ForwardRegionFieldSvc.h:114
doubleTestComp.j2
j2
Definition: doubleTestComp.py:22
MagField::ForwardRegionFieldSvc::s_Q5
static const int s_Q5
Definition: ForwardRegionFieldSvc.h:97
MagField::ForwardRegionFieldSvc::s_Q3VKick
static const int s_Q3VKick
Definition: ForwardRegionFieldSvc.h:105
MagField::ForwardRegionFieldSvc::FieldValue
G4ThreeVector FieldValue(G4ThreeVector Point) const
Definition: ForwardRegionFieldSvc.cxx:140
_FWDMg_CONFIGURATION::pointQ7aEnd
std::vector< double > pointQ7aEnd
Definition: IForwardRegionProperties.h:41
_FWDMg_CONFIGURATION::pointD2End
std::vector< double > pointD2End
Definition: IForwardRegionProperties.h:49
ServiceHandle< IIncidentSvc >
_FWDMg_CONFIGURATION::pointD1bStart
std::vector< double > pointD1bStart
Definition: IForwardRegionProperties.h:27
_FWDMg_CONFIGURATION::pointD1eEnd
std::vector< double > pointD1eEnd
Definition: IForwardRegionProperties.h:47