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

RCParticle.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/gismo/gismo/RCParticle.h,v 1.1 2001/09/22 16:41:37 burnett Exp $
00002 //
00003 //
00004 #ifndef GISMO_RCParticle_H
00005 #define GISMO_RCParticle_H
00006 
00007 #include "gismo/GParticle.h"
00008 #include "geometry/Ray.h"
00009 #include <vector>
00010 
00011 class Medium;
00012 
00014 //
00015 //  This class generates and contains methods that provide information  
00016 //  about the material that is encountered along a Ray in Glast as well  
00017 //  as the location on the Ray as is passes through the various Glast Mediums. 
00018 //  The propagating particle is a 1 GeV, non-interacting "electron." 
00019 // 
00020 class RCParticle : public GParticle
00021 {
00022     
00023 public:
00025     RCParticle(Point x0, Vector t0, float dist);
00026     
00028     ~RCParticle();
00029     
00031     enum Status {ALIVE, LEFT, LOST, STUCK, DONE};
00032     
00034     RCParticle::Status status() const;
00036     void setStatus(RCParticle::Status);
00037 
00039     void setMaxArcLength(float dist); 
00040 
00042     float increaseMaxArcLenBy(float dist); 
00043 
00045     virtual void propagate();
00046  
00048     bool propagate(const char * title);
00049 
00050     void printOn( std::ostream& ) const;
00051     
00052     
00054     int stepCount() const ;
00055     float stepLength() const;
00056     float arclength() const;
00057     float radlength() const;
00058     float currentTime() const;
00059     Point position(float s) const;
00060     Point position() const;
00061     Point getHit(int) const; 
00062     Vector direction(float s) const;
00063     Vector direction() const;
00064     float mScat_Angle(float momentum, float s) const;
00065     float mScat_Angle(float momentum, int step_no) const;
00066     float mScat_Dist(float momentum, float s) const;
00067     float mScat_Dist(float momentum, int step_no) const;
00068     
00070     const Medium *medium() const;
00071 
00073     int findMedium(const char * name) const;
00074 
00076     const Medium*  getCurrentMedium () { return m_currentMedium; }
00077 
00079     const Medium*  getMedium (int) const;
00080 
00081     // Internal class Step to record all the Mediums crossed. The location is 
00082     // the entry point into the medium or the starting point in the case
00083     // of the starting medium. 
00084 
00085     class Step 
00086     {
00087     public:
00088         Step(const Medium * med, Point x, Vector t, float s, float x0);
00089         ~Step() {};
00090         
00091         Point  position()  const {return m_pos;}
00092         Vector direction() const {return m_dir;}
00093         float  length()    const {return m_step_length;}
00094         float  rad_len()   const {return m_rad_length;}
00095         const  Medium * place() const {return m_region;}
00096         void   printOn( std::ostream& ) const;
00097         
00098     private:
00099         Point  m_pos;           // Starting point
00100         Vector m_dir;           // Direction unit vector        
00101         float m_step_length;    // Distance along trajectory to traverse Medium
00102         float m_rad_length;     // Radiation lengths accumulated in this Medium         
00103         const Medium * m_region;// Pointer to the Medium inwhich this seg. occurs
00104     };
00105 
00106     // Access methods for getting the individual steps
00107     typedef std::vector<Step> StepList; 
00108     typedef std::vector<Step>::const_iterator const_iterator;
00109 
00110     const StepList& steps() const {return m_stepList;}
00111     const_iterator begin()  const {return m_stepList.begin();}
00112     const_iterator end()    const {return m_stepList.end();}
00113 
00114     // A Pointer to the simulation World geometry 
00115     static const Medium* s_world;
00116 
00117     protected:
00118         
00119         Status m_status;            // current status
00120         const Medium *m_lastMedium; // pointer to medium in which track ends
00121         void  stepBy(float, Ray&);  // Method to increment through Mediums
00122         void ini();                 // Zero's out counts... initializes particle
00123              
00124         StepList m_stepList;          // List of Steps along trajectory (see above)
00125         
00126         double   m_startingEnergy;  // Energy at start of step 
00127         float    m_arcLength;       // Total distance swum so far
00128         float    m_radLength;       // Total radiation length swum so far
00129         float    m_properTime;      // Total proper time since creation.
00130         float    m_step;            // Distance of present step
00131         float    m_maxStep;         // max. allowed distance for the current step
00132         float    m_maxArcLen;       // Distance through which to swim trajectory
00133         int      m_stepcount;       // Step counter   
00134         const Medium* m_currentMedium; // The current medium
00135         
00136 };
00137 
00138 inline RCParticle::Status RCParticle::status()const{return m_status;}
00139 inline void RCParticle::setStatus(RCParticle::Status s){m_status = s;}
00140 inline int RCParticle::stepCount()    const  {return m_stepcount;}
00141 
00142 inline void  RCParticle::setMaxArcLength(float dist)   {m_maxArcLen = dist; return;}
00143 inline float RCParticle::increaseMaxArcLenBy(float dist)
00144 {
00145             m_maxArcLen += dist; return m_maxArcLen;
00146 }  
00147 inline float RCParticle::stepLength() const  {return m_step;}
00148 inline float RCParticle::arclength()  const  {return m_arcLength;}
00149 inline float RCParticle::radlength()  const  {return m_radLength;}
00150 inline float RCParticle::currentTime()const  {return m_properTime;}
00151 inline Point RCParticle::position()   const
00152 {
00153     return GParticle::position();
00154 }
00155 inline Vector RCParticle::direction() const
00156 {
00157     return GParticle::direction();
00158 }
00159 inline Point RCParticle::position(float s) const
00160 { 
00161    return position() + s*direction();
00162 }
00163 inline Vector RCParticle::direction(float s) const
00164 {
00165    return GParticle::direction();
00166 }
00167 
00168 inline const Medium * RCParticle::medium()const {return m_lastMedium;}
00169 inline const Medium * RCParticle::getMedium(int ith) const
00170 {
00171     return m_stepList[ith].place();
00172 }
00173 inline Point RCParticle::getHit(int ith) const
00174 {
00175     return m_stepList[ith].position();
00176 }
00177 #endif
00178 

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