BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RkFitCylinder.cxx
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// File from RkFit module
3//
4// Filename : RkFitCylinder.cc
5//------------------------------------------------------------------------
6// Description :
7// Cylinder is an Element whose shape is a cylinder.
8//------------------------------------------------------------------------
9// Modif :
10//------------------------------------------------------------------------
11#include "CLHEP/Geometry/Point3D.h"
12#include <float.h>
13#ifndef ENABLE_BACKWARDS_COMPATIBILITY
14typedef HepGeom::Point3D<double> HepPoint3D;
15#endif
16#include "TrackUtil/Helix.h"
17#include "TrkReco/RkFitCylinder.h"
18#include "TrkReco/RkFitMaterial.h"
19#include "TrkReco/TRunge.h"
20
21double RkFitCylinder::intersect( TRunge& track, HepPoint3D& x ) const {
22 double dPhi[4];
23 dPhi[0] = track.intersect_cylinder( ro_ );
24 if ( dPhi[0] == 0 ) return -1;
25 dPhi[1] = track.intersect_cylinder( ri_ );
26 if ( dPhi[1] == 0 ) return -1;
27 dPhi[2] = track.intersect_xy_plane( zf_ );
28 dPhi[3] = track.intersect_xy_plane( zb_ );
29
30 int n[2];
31 int j = 0;
32 for ( int i = 0; i < 4 && j < 2; i++ )
33 {
34 HepPoint3D xx = track.helix().x( dPhi[i] );
35 if ( isInside( xx ) ) n[j++] = i;
36 }
37 if ( j < 2 ) return -1;
38
39 x = track.helix().x( ( dPhi[n[0]] + dPhi[n[1]] ) * .5 );
40
41 double tanl = track.helix().tanl();
42 // cout<<"RkFitCylinder: track radius"<<track.radius()<<" dphi0 "
43 // <<dPhi[n[0]]<<" dphi1 "<<dPhi[n[1]]<<" tanl "<<tanl<<endl;
44 return fabs( track.helix().radius() * ( dPhi[n[0]] - dPhi[n[1]] ) *
45 sqrt( 1 + tanl * tanl ) );
46 // return 0;
47}
48
50 const HepPoint3D& point ) const {
51
52 const double ro = sqrt( point.x() * point.x() + point.y() * point.y() );
53
54 // std::cout<<" ro: "<<ro<<std::endl;
55
56 double dPhi[4];
57 dPhi[0] = track.intersect_cylinder( ro );
58 if ( dPhi[0] == 0 ) return -1;
59 dPhi[1] = track.intersect_cylinder( ri_ );
60 if ( dPhi[1] == 0 ) return -1;
61 dPhi[2] = track.intersect_xy_plane( zf_ );
62 dPhi[3] = track.intersect_xy_plane( zb_ );
63
64 // for(int ii=0; ii<4; ii++)
65 // std::cout<<"dPhi["<<ii<<"]"<<dPhi[ii]<<std::endl;
66
67 int n[2];
68 int j = 0;
69 for ( int i = 0; i < 4 && j < 2; i++ )
70 {
71 HepPoint3D xx = track.helix().x( dPhi[i] );
72 if ( isInside( xx ) ) n[j++] = i;
73 }
74
75 if ( j < 2 ) return -1;
76
77 x = track.helix().x( ( dPhi[n[0]] + dPhi[n[1]] ) * .5 );
78
79 double tanl = track.helix().tanl();
80
81 return fabs( track.helix().radius() * ( dPhi[n[0]] - dPhi[n[1]] ) *
82 sqrt( 1 + tanl * tanl ) );
83}
84
85void RkFitCylinder::updateTrack( TRunge& track, double y[6] ) const {
86 HepPoint3D x;
87 double path = intersect( track, x );
88 double mass = 0.000511;
89 if ( path > 0 )
90 {
91 // move pivot
92 // multiple scattering and energy loss
93 // if(muls_) track.ms(path, *material_, index_element);
94 track.eloss( path, material_, mass, y, 1 );
95 // track.Propagate(path,y);
96 }
97}
98
99bool RkFitCylinder::isInside( const HepPoint3D& x ) const {
100 double r = x.perp();
101 double z = x.z();
102 // std::cout<<"r: "<<r<<" z: "<<z<<" ri: "<<ri_<<" ro: "<<ro_<<" zb_: "<<zb_<<"zf:
103 // "<<zf_<<std::endl;
104
105 return ( r >= ri_ - FLT_EPSILON && r <= ro_ + FLT_EPSILON && z >= zb_ - FLT_EPSILON &&
106 z <= zf_ + FLT_EPSILON );
107}
108
109bool RkFitCylinder::isInside2( const HepPoint3D& x ) const {
110 double r = x.perp();
111 double z = x.z();
112 // std::cout<<"r: "<<r<<" z: "<<z<<" ri: "<<ri_<<" ro: "<<ro_<<" zb_: "<<zb_<<"zf:
113 // "<<zf_<<std::endl;
114
115 return ( r <= ro_ + FLT_EPSILON && z >= zb_ - FLT_EPSILON && z <= zf_ + FLT_EPSILON );
116}
double mass
HepGeom::Point3D< double > HepPoint3D
const Int_t n
HepGeom::Point3D< double > HepPoint3D
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
double radius(void) const
returns radious of helix.
bool isInside2(const HepPoint3D &x) const
bool isInside(const HepPoint3D &x) const
Check if the position x is inside the current cylinder.
void updateTrack(TRunge &track, double y[6]) const
double intersect(TRunge &track, HepPoint3D &x) const
Find intersection with Helix.
A class to represent a track in tracking.
Helix helix(void) const
returns helix class
Definition TRunge.cxx:253
void eloss(double path, const RkFitMaterial *material, double mass, double y[6], int index) const
Definition TRunge.cxx:1322
double intersect_xy_plane(double z) const
Definition TRunge.cxx:1380
double intersect_cylinder(double r) const
Definition TRunge.cxx:1338