GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
CGAGearDistanceProperties.cc
1 #include <string>
2 #include <vector>
3 
4 #include "gear/GEAR.h"
5 #include "CGADefs.h"
6 #include "gearcga/CGAGearDistanceProperties.h"
7 #include "gearcga/CGAGeometryInitializer.h"
8 
9 namespace gear {
10 
11  CGAGearDistanceProperties::CGAGearDistanceProperties(std::string steer,
12  std::string model, std::string setup, std::string host,
13  std::string user, std::string password) {
14 
15  CGAGeometryInitializer::GetCGAGeometryInitializer(steer, model,
16  setup, host, user, password);
17 
18  }
19 
20  void CGAGearDistanceProperties::beamOn(const Vector3D & p0, const Vector3D & p1) const{
21 
22  double initial[3], final[3], direction[3];
23  // p0 and p1 are in mm; CGABeamOn requires cm
24  for(unsigned int i=0; i<3; i++) {
25  initial[i] = (p0[i])*0.1;
26  final[i] = (p1[i])*0.1;
27  direction[i] = final[i] - initial[i];
28  }
29 
30  char particle[]="geantino";
31  CGABeamOn(initial, final, direction, particle, 20, 1);
32  }
33 
36  const std::vector<std::string> & CGAGearDistanceProperties::getMaterialNames(const Vector3D & p0, const Vector3D & p1) const throw (NotImplementedException, std::exception ) {
37 
38  std::vector<std::string> volNames;
39  static std::vector<std::string> matNames;
40  std::vector<double> distance;
41  std::vector<double> x;
42  std::vector<double> y;
43  std::vector<double> z;
44  std::vector<double> nbX0;
45  std::vector<double> nInterLen;
46 
47  beamOn(p0, p1);
48 
49  CGAGetStepsForJava(volNames,matNames,distance,x,y,z,nbX0,nInterLen);
50 
51  return matNames;
52  }
53 
57  const std::vector<double> & CGAGearDistanceProperties::getMaterialThicknesses(const Vector3D & p0, const Vector3D & p1) const throw (NotImplementedException, std::exception ) {
58 
59  std::vector<std::string> volNames;
60  std::vector<std::string> matNames;
61  static std::vector<double> distance;
62  std::vector<double> x;
63  std::vector<double> y;
64  std::vector<double> z;
65  std::vector<double> nbX0;
66  std::vector<double> nInterLen;
67 
68  beamOn(p0, p1);
69 
70  CGAGetStepsForJava(volNames,matNames,distance,x,y,z,nbX0,nInterLen);
71 
72  return distance;
73  }
74 
77  double CGAGearDistanceProperties::getNRadlen(const Vector3D & p0, const Vector3D & p1) const throw (NotImplementedException, std::exception ) {
78 
79  std::vector<std::string> volNames;
80  std::vector<std::string> matNames;
81  std::vector<double> distance;
82  std::vector<double> x;
83  std::vector<double> y;
84  std::vector<double> z;
85  std::vector<double> nbX0;
86  std::vector<double> nInterLen;
87 
88  beamOn(p0, p1);
89 
90  CGAGetStepsForJava(volNames,matNames,distance,x,y,z,nbX0,nInterLen);
91 
92  double nRadLen=0;
93  for(unsigned int i=0; i < nbX0.size(); i++)
94  nRadLen += nbX0[i];
95 
96  return nRadLen;
97  }
98 
99 
102  double CGAGearDistanceProperties::getNIntlen(const Vector3D & p0, const Vector3D & p1) const throw (NotImplementedException, std::exception ) {
103 
104  std::vector<std::string> volNames;
105  std::vector<std::string> matNames;
106  std::vector<double> distance;
107  std::vector<double> x;
108  std::vector<double> y;
109  std::vector<double> z;
110  std::vector<double> nbX0;
111  std::vector<double> nbIL;
112 
113  beamOn(p0, p1);
114 
115  CGAGetStepsForJava(volNames,matNames,distance,x,y,z,nbX0,nbIL);
116 
117  double nInterLen = 0;
118  for(unsigned int i=0; i<nbIL.size(); i++)
119  nInterLen += nbIL[i];
120 
121  return nInterLen;
122  }
123 
124 
127  double CGAGearDistanceProperties::getBdL(const Vector3D & p0, const Vector3D & p1) const throw (NotImplementedException, std::exception ) {
128 
129  double start[3], end[3];
130  for(int i=0; i<3; i++) {
131  start[i] = p0[i];
132  end[i] = p1[i];
133  }
134 
135  return CGAGetBdl(start, end);
136  }
137 
140  double CGAGearDistanceProperties::getEdL(const Vector3D & p0, const Vector3D & p1) const throw (NotImplementedException, std::exception ) {
141 
142  double start[3], end[3];
143  for(int i=0; i<3; i++) {
144  start[i] = p0[i];
145  end[i] = p1[i];
146  }
147 
148  return CGAGetEdl(start, end);
149  }
150 } // namespace gear
NotImplementedException used for features that are not implemented.
Definition: GEAR.h:81
virtual double getNIntlen(const Vector3D &p0, const Vector3D &p1) const
The number of interaction lengths along the distance between [p0,p1] .
Simple three dimensional vector providing the components for cartesian, cylindrical and spherical coo...
Definition: Vector3D.h:18
virtual const std::vector< std::string > & getMaterialNames(const Vector3D &p0, const Vector3D &p1) const
List of matrial names along the distance between [p0,p1] .
virtual const std::vector< double > & getMaterialThicknesses(const Vector3D &p0, const Vector3D &p1) const
List of matrial thicknesses in mm along the distance between [p0,p1] - runs parallel to the array ret...
virtual double getBdL(const Vector3D &p0, const Vector3D &p1) const
The integrated magnetic field along the distance between [p0,p1] in Tesla*mm.
virtual double getNRadlen(const Vector3D &p0, const Vector3D &p1) const
The number of radiation lengths along the distance between [p0,p1] .
virtual double getEdL(const Vector3D &p0, const Vector3D &p1) const
The integrated electric field along the distance between [p0,p1] in mVolt.