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

GLG4HitPMT.hh

Go to the documentation of this file.
00001 #ifndef __GLG4HitPMT_hh__
00002 #define __GLG4HitPMT_hh__
00003 /** @file GLG4HitPMT.hh
00004     Declares GLG4HitPMT class and helper functions.
00005     
00006     This file is part of the GenericLAND software library.
00007     $Id: GLG4HitPMT.hh,v 1.1.1.1 2004/12/21 22:29:48 GLG4sim Exp $
00008     
00009     @author Glenn Horton-Smith, December 2004
00010 */
00011 
00012 #include "GLG4HitPhoton.hh"
00013 #include <vector>
00014 #include <cstddef>
00015 
00016 /** GLG4HitPMT stores information about a PMT that detected one or more
00017     photoelectrons.
00018 
00019     The general contract for GLG4HitPMT is as follows:
00020       - remember ID and all photons that made photoelectrons in this PMT
00021       - provide Clear, DetectPhoton, SortTimeAscending, GetID, GetEntries,
00022         GetPhoton, and Print(ostream &) functions
00023       - take "ownership" of the photons registered by DetectPhoton,
00024         i.e., delete them when Clear or destrictor is called
00025 
00026     This is almost the same "general contract" that was implemented
00027     for KLG4sim's KLHitPMT by O. Tajima and G. Horton-Smith, but the
00028     code was rewritten for GLG4sim in December 2004.
00029 
00030     @author Glenn Horton-Smith
00031 */
00032 
00033 #include <vector>
00034 
00035 class GLG4HitPMT {
00036 public:
00037   GLG4HitPMT(int ID);
00038   ~GLG4HitPMT();
00039 
00040   void Clear();
00041   void DetectPhoton(GLG4HitPhoton*);
00042   void SortTimeAscending();
00043 
00044   int GetID() const { return fID; }
00045   int GetEntries() const { return fPhotons.size(); }
00046   GLG4HitPhoton* GetPhoton(int i) const { return fPhotons[i]; }
00047 
00048   void Print(std::ostream &, bool fullDetailsMode=false);
00049 
00050   static const size_t kApproxMaxIndividualHitPhotonsPerPMT;
00051   static const double kMergeTime;
00052   
00053 private:
00054   int fID;
00055   std::vector<GLG4HitPhoton*> fPhotons;
00056 };
00057 
00058 
00059 /** comparison function for sorting GLG4HitPMT pointers
00060  */
00061 inline bool
00062 Compare_HitPMTPtr_TimeAscending(const GLG4HitPMT *a,
00063                                 const GLG4HitPMT *b)
00064 {
00065   // put empties at the end
00066   if (!a || a->GetEntries()<=0)
00067     return false;
00068   if (!b || b->GetEntries()<=0)
00069     return true;
00070   return a->GetPhoton(0)->GetTime() < b->GetPhoton(0)->GetTime();
00071 }
00072 
00073 
00074 
00075 #endif // __GLG4HitPMT_hh__

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