Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

TrackRep.cxx

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/geomrep/src/TrackRep.cxx,v 1.1.1.1 1999/12/20 22:28:17 burnett Exp $
00002 //  Author: T. Burnett
00003 
00004 #include "geomrep/TrackRep.h"
00005 #include "geometry/Ray.h"
00006 
00007 bool TrackRep::useColor=true;
00008 unsigned TrackRep::charged_color_index=1;  //black
00009 unsigned TrackRep::neutral_color_index=0;  //white
00010 
00011 float TrackRep::delta = 0.005f;
00012 // maximum error allowed between true trajectory and straight line approx
00013 float TrackRep::minStepSize = 0.5f;
00014 
00015 
00016 void TrackRep::update()
00017 {
00018     if( useColor )
00019         set_col_index( m_track.charged()? charged_color_index : neutral_color_index );
00020     else
00021         set_line_style( m_track.charged()? SOLID_LINE : DOTTED_LINE );
00022 
00023     noDetailCheck(); // prevent detail checks
00024     move_to(m_track.position(0));
00025 
00026     for( Track::const_iterator it= m_track.begin(); it !=m_track.end(); ++it) {
00027         const Ray* r = *it;
00028         float stot = r->getArcLength();
00029         float kappa;
00030         if( (kappa=r->curvature())!=0 ){
00031             // helix segment--determine how many steps to take
00032             float step = sqrt(8*delta/fabs(kappa));  // minimum step for delta
00033             if( step< minStepSize) step=minStepSize;
00034             if(stot > 100000) continue;
00035             int nstep = (int) ( stot / step );
00036             if(nstep>1) {
00037                 step = stot/nstep;
00038                 float s=0;
00039                 for( int j=0; j<nstep ; j++ )
00040                     line_to(r->position(s+=step));
00041             }
00042         }
00043         line_to(r->position(stot));   // step to each boundary
00044     }
00045     flush();
00046 }
00047 
00048 

Generated at Mon Nov 26 18:18:45 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000