5 #include "geartgeo/TGeoGearDistanceProperties.h"
6 #include "TVirtualGeoTrack.h"
8 #include "TGeoManager.h"
14 TGeoGearDistanceProperties::TGeoGearDistanceProperties(TGeoManager *geoMgr){
19 void TGeoGearDistanceProperties::beamOn(
const Vector3D &p0,
const Vector3D &p1)
const
22 if(p0==_p0 && p1==_p1)
38 double startpoint[3], endpoint[3], direction[3];
40 for(
unsigned int i=0; i<3; i++) {
41 startpoint[i] = p0[i];
43 direction[i] = endpoint[i] - startpoint[i];
44 L+=direction[i]*direction[i];
46 double totDist = sqrt( L ) ;
49 for(
unsigned int i=0; i<3; i++)
50 direction[i]=direction[i]/sqrt(L);
52 _tgeomanager->AddTrack(0,12);
53 TGeoNode *node1 = _tgeomanager->InitTrack(startpoint, direction);
56 throw OutsideGeometryException(
"No geometry node found at given location. Either there is no node placed here or position is outside of top volume.");
58 while (!_tgeomanager->IsOutside())
61 TVirtualGeoTrack *track;
62 node2 = _tgeomanager->FindNextBoundaryAndStep(500, 1) ;
64 if(!node2 || _tgeomanager->IsOutside())
67 const double *position =(
double*) _tgeomanager->GetCurrentPoint();
68 const double *previouspos =(
double*) _tgeomanager->GetLastPoint();
69 double length=_tgeomanager->GetStep();
70 track = _tgeomanager->GetLastTrack();
77 _tgeomanager->SetCurrentPoint(position[0]+MINSTEP*direction[0], position[1]+MINSTEP*direction[1], position[2]+MINSTEP*direction[2]);
78 length=_tgeomanager->GetStep();
79 node2 = _tgeomanager->FindNextBoundaryAndStep(500, 1) ;
82 position = (
const double*) _tgeomanager->GetCurrentPoint();
83 previouspos = (
const double*) _tgeomanager->GetLastPoint();
90 Vector3D posV( position ) ;
91 double currDistance = ( posV - p0 ).r() ;
98 if( currDistance > totDist )
100 length=sqrt(pow(endpoint[0]-previouspos[0],2)
101 +pow(endpoint[1]-previouspos[1],2)
102 +pow(endpoint[2]-previouspos[2],2));
104 track->AddPoint(endpoint[0], endpoint[1], endpoint[2], 0.);
105 _distance.push_back(length);
106 std::string svoln(node1->GetName());
107 std::string svolm(node1->GetMedium()->GetMaterial()->GetName());
108 _volNames.push_back(svoln);
109 _matNames.push_back(svolm);
110 _intLen.push_back(node1->GetMedium()->GetMaterial()->GetIntLen());
111 _radLen.push_back(node1->GetMedium()->GetMaterial()->GetRadLen());
115 track->AddPoint(position[0], position[1], position[2], 0.);
116 _distance.push_back(length);
117 std::string svoln(node1->GetName());
118 std::string svolm(node1->GetMedium()->GetMaterial()->GetName());
119 _volNames.push_back(svoln);
120 _matNames.push_back(svolm);
121 _intLen.push_back(node1->GetMedium()->GetMaterial()->GetIntLen());
122 _radLen.push_back(node1->GetMedium()->GetMaterial()->GetRadLen());
126 _tgeomanager->ClearTracks();
127 _tgeomanager->CleanGarbage();
181 for(
unsigned int i=0; i < _radLen.size(); i++){
183 nRadLen += _distance[i]/_radLen[i];
198 double nInterLen = 0;
199 for(
unsigned int i=0; i<_intLen.size(); i++)
202 nInterLen += _distance[i]/_intLen[i];
virtual double getEdL(const Vector3D &p0, const Vector3D &p1) const
The integrated electric field along the distance between [p0,p1] in mVolt.
virtual double getNRadlen(const Vector3D &p0, const Vector3D &p1) const
The number of radiation lengths along the distance between [p0,p1] .
virtual double getNIntlen(const Vector3D &p0, const Vector3D &p1) const
The number of interaction lengths along the distance between [p0,p1] .
virtual const std::vector< std::string > & getMaterialNames(const Vector3D &p0, const Vector3D &p1) const
List of matrial names along the distance between [p0,p1]- WARNING: this method returns a reference to...
virtual const std::vector< std::string > getVolumeNames(const Vector3D &p0, const Vector3D &p1) const
List of traversed volumes by name.
NotImplementedException used for features that are not implemented.
Simple three dimensional vector providing the components for cartesian, cylindrical and spherical coo...
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.