00001 00002 // GeoSwimmer 00003 // 00004 // January 20, 2006 M.Ishitsuka First version for GeoSwimmer 00005 // ref. SwimSwimmer.h 00006 // 00008 // $Id: GeoSwimmer.h,v 1.5 2008/03/17 17:51:30 ishi Exp $ 00009 // 00010 // Swimming through a particle, forward or backward 00011 // 00012 // seun@huhepl.harvard.edu 00014 #ifndef GEOSWIMMER_H 00015 #define GEOSWIMMER_H 00016 00017 #include <cassert> 00018 #include <TMath.h> 00019 #include "Validity/VldContext.h" 00020 #include "UgliGeometry/UgliGeomHandle.h" 00021 00022 class GeoSwimZCondition; 00023 class GeoSwimParticle; 00024 class GeoSwimApplication; 00025 00026 class SwimParticle; 00027 00028 //...................................................................... 00029 00030 class GeoSwimmer 00031 { 00032 public: 00033 static GeoSwimmer* Instance(); 00034 00035 void SetUseGeoSwimmer(bool b) {fUseGeoSwimmer = b;} 00036 bool GetUseGeoSwimmer() {if(fUseGeoSwimmer) return true; return false;} 00037 00038 void Initialize(const VldContext& vldc); 00039 00040 bool SwimForward(GeoSwimParticle& particle, double z); 00041 bool SwimBackward(GeoSwimParticle& particle, double z); 00042 00043 bool Swim(GeoSwimParticle& particle, GeoSwimZCondition& zc, int dir); 00044 00045 // To be compatible with Swimmer 00046 bool SwimForward(SwimParticle& particle, double z); 00047 bool SwimBackward(SwimParticle& particle, double z); 00048 00049 virtual ~GeoSwimmer(); 00050 00051 protected: 00052 GeoSwimmer(); 00053 00054 private: 00055 static GeoSwimmer *fgInstance; 00056 00057 struct Cleaner { 00058 void ClassIsUsed() { }; // dummy method 00059 ~Cleaner() { 00060 if (GeoSwimmer::fgInstance!=0) { 00061 delete GeoSwimmer::fgInstance; 00062 GeoSwimmer::fgInstance = 0; 00063 } 00064 } 00065 }; 00066 friend struct Cleaner; 00067 00068 bool fUseGeoSwimmer; 00069 GeoSwimApplication* fMCAppUser; 00070 std::string fMCConfig; 00071 00072 bool fHallSizeSet; 00073 TVector3 fHallMin; 00074 TVector3 fHallMax; 00075 }; 00076 00078 inline GeoSwimmer* GeoSwimmer::Instance() 00079 { 00083 static Cleaner cleaner; 00084 00085 if (fgInstance == 0) { 00086 cleaner.ClassIsUsed(); // dummy call 00087 fgInstance = new GeoSwimmer(); 00088 } 00089 return fgInstance; 00090 } 00091 00092 #endif //GEOSWIMMER_H
1.3.9.1