Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

GLG4HitPhoton.hh

Go to the documentation of this file.
00001 #ifndef __GLG4HitPhoton_hh__
00002 #define __GLG4HitPhoton_hh__
00003 /** @file GLG4HitPhoton.hh
00004     Declares GLG4HitPhoton class and helper functions.
00005     
00006     This file is part of the GenericLAND software library.
00007     $Id: GLG4HitPhoton.hh,v 1.1.1.1 2004/12/21 22:29:48 GLG4sim Exp $
00008     
00009     @author Glenn Horton-Smith
00010 */
00011 
00012 #include <iostream>
00013 
00014 /** GLG4HitPhoton stores information about a photon that makes a
00015     photoelectron in a PMT.  With count>1, it records multiple
00016     p.e. made at the same time at a PMT.
00017 
00018     The general contract for GLG4HitPhoton is as follows:
00019       - remember PMT ID, Time, position, KE, momentum, polarization, and count
00020       - provide Get/Set for all of the above, plus AddCount for count
00021       - initialize count=1, time & id = some invalid value
00022 
00023     This is almost the same "general contract" that was implemented
00024     for KLG4sim's KLHitPhoton by O. Tajima and G. Horton-Smith, but
00025     the code was rewritten for GLG4sim in December 2004.
00026 
00027     @author Glenn Horton-Smith
00028 */
00029 
00030 class GLG4HitPhoton {
00031 public:
00032   GLG4HitPhoton() { }
00033 
00034   void SetPMTID(int id) { fPMTID= id; }
00035   void SetTime(double t) { fTime= t; }
00036   void SetKineticEnergy(double KE);
00037   void SetWavelength(double wl);
00038   void SetPosition(double x, double y, double z);
00039   void SetMomentum(double x, double y, double z);
00040   void SetPolarization(double x, double y, double z);
00041   void SetCount(int count) { fCount= count; }
00042   void AddCount(int dcount) { fCount+= dcount; }
00043 
00044   int GetPMTID() const { return fPMTID; }
00045   double GetTime() const { return fTime; }
00046   double GetKineticEnergy() const;
00047   double GetWavelength() const;
00048   template <class T> inline void GetPosition(T &x, T &y, T &z) const;
00049   template <class T> inline void GetMomentum(T &x, T &y, T &z) const;
00050   template <class T> inline void GetPolarization(T &x, T &y, T &z) const;
00051   int GetCount() const { return fCount; }
00052   void Print(std::ostream &) const;
00053   
00054 private:
00055   double fTime;        /// time of hit 
00056   int fPMTID;          /// ID number of PMT the HitPhoton hit
00057   float fKE;           /// kinetic energy 
00058   float fPosition[3];  /// x,y,z components of position
00059   float fMomentum[3];  /// x,y,z components of momentum (normalized?)
00060   float fPolarization[3]; /// x,y,z components of polarization
00061   int fCount;          /// count of photons, often 1
00062 };
00063 
00064 template <class T> inline void 
00065 GLG4HitPhoton::GetPosition(T &x, T &y, T &z) const {
00066   x= fPosition[0];
00067   y= fPosition[1];
00068   z= fPosition[2];
00069 }
00070 
00071 template <class T> inline void 
00072 GLG4HitPhoton::GetMomentum(T &x, T &y, T &z) const {
00073   x= fMomentum[0];
00074   y= fMomentum[1];
00075   z= fMomentum[2];
00076 }
00077 
00078 template <class T> inline void 
00079 GLG4HitPhoton::GetPolarization(T &x, T &y, T &z) const {
00080   x= fPolarization[0];
00081   y= fPolarization[1];
00082   z= fPolarization[2];
00083 }
00084 
00085 
00086 /** comparison function for sorting GLG4HitPhoton pointers
00087  */
00088 inline bool
00089 Compare_HitPhotonPtr_TimeAscending(const GLG4HitPhoton *a,
00090                                    const GLG4HitPhoton *b)
00091 {
00092   return a->GetTime() < b->GetTime();
00093 }
00094 
00095 #endif // __GLG4HitPhoton_hh__

Generated on Fri Jul 6 13:31:46 2007 for GLG4sim by  doxygen 1.3.9.1