G4AllITManager.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id: G4AllITManager.hh 64057 2012-10-30 15:04:49Z gcosmo $
00027 //
00028 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr) 
00029 //
00030 // WARNING : This class is released as a prototype.
00031 // It might strongly evolve or even disapear in the next releases.
00032 //
00033 // History:
00034 // -----------
00035 // 10 Oct 2011 M.Karamitros created
00036 //
00037 // -------------------------------------------------------------------
00038 
00039 #ifndef G4AllITManager_h
00040 #define G4AllITManager_h 1
00041 #include <globals.hh>
00042 #include <map>
00043 #include <vector>
00044 #include "G4ITType.hh"
00045 #include "G4ThreeVector.hh"
00046 #include <memory>
00047 
00048 class G4IT;
00049 class G4VITManager;
00050 class G4ITBox;
00051 class G4Track;
00052 template<typename T> class G4ITManager;
00053 
00060 class G4AllITManager
00061 {
00062 public :
00063     static G4AllITManager* Instance();
00064     static void DeleteInstance();
00070     ~G4AllITManager();
00071 
00072     template<typename T>  G4ITManager<T>* Instance();
00073 
00074     G4VITManager* GetInstance(G4ITType);
00075     G4ITBox* GetBox(const G4Track*);
00076 
00077     void RegisterManager(G4VITManager* manager);
00078     void Push(G4Track* track);
00079 
00084     void SetVerboseLevel(G4int level)
00085     {
00086         fVerbose = level;
00087     }
00088     G4int GetVerboseLevel()
00089     {
00090         return fVerbose;
00091     }
00092 
00093     void UpdatePositionMap();
00094     void CreateTree();
00095 
00096     template<typename T> inline std::vector<std::pair<G4IT*, double> >* FindNearest(const G4ThreeVector& pos, const T* it);
00097     template<typename T> inline std::vector<std::pair<G4IT*, double> >* FindNearest(const T* it0, const T* it);
00098     template<typename T> inline std::vector<std::pair<G4IT*, double> >* FindNearestInRange(const G4ThreeVector& pos,
00099                                                                                            const T* it, G4double range);
00100     template<typename T> inline std::vector<std::pair<G4IT*, double> >* FindNearestInRange(const T* it0, const T* it, G4double range);
00101 
00102 private :
00103     G4AllITManager();
00104     static std::auto_ptr<G4AllITManager> fInstance;
00105     std::map<G4ITType, G4VITManager*> fITSubManager ;
00106 
00107     int fVerbose ;
00108 };
00109 
00110 template<typename T>
00111 inline std::vector<std::pair<G4IT*, double> >* G4AllITManager::FindNearest(const G4ThreeVector& pos, const T* it)
00112 {
00113     return G4ITManager<T>::Instance()->FindNearest(pos,it);
00114 }
00115 
00116 template<typename T>
00117 inline std::vector<std::pair<G4IT*, double> >* G4AllITManager::FindNearest(const T* it0, const T* it)
00118 {
00119     return G4ITManager<T>::Instance()->FindNearest(it0, it) ;
00120 }
00121 
00122 template<typename T>
00123 inline std::vector<std::pair<G4IT*, double> >* G4AllITManager::FindNearestInRange(const G4ThreeVector& pos, const T* it, G4double range)
00124 {
00125     return G4ITManager<T>::Instance()->FindNearestInRange(pos, it, range);
00126 }
00127 
00128 template<typename T>
00129 inline std::vector<std::pair<G4IT*, double> >* G4AllITManager::FindNearestInRange(const T* it0, const T* it, G4double range)
00130 {
00131     return G4ITManager<T>::Instance()->FindNearestInRange(it0, it, range);
00132 }
00133 
00134 #endif

Generated on Mon May 27 17:47:38 2013 for Geant4 by  doxygen 1.4.7