Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4AllITManager.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// $Id: G4AllITManager.hh 64057 2012-10-30 15:04:49Z gcosmo $
27//
28// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29//
30// WARNING : This class is released as a prototype.
31// It might strongly evolve or even disapear in the next releases.
32//
33// History:
34// -----------
35// 10 Oct 2011 M.Karamitros created
36//
37// -------------------------------------------------------------------
38
39#ifndef G4AllITManager_h
40#define G4AllITManager_h 1
41#include <globals.hh>
42#include <map>
43#include <vector>
44#include "G4ITType.hh"
45#include "G4ThreeVector.hh"
46#include <memory>
47
48class G4IT;
49class G4VITManager;
50class G4ITBox;
51class G4Track;
52template<typename T> class G4ITManager;
53
54/**
55 * Holds all IT Manager, and take care of deleting them
56 * when AllITManager is deleted
57 * Set general verbose for all IT Manager
58 */
59
61{
62public :
63 static G4AllITManager* Instance();
64 static void DeleteInstance();
65 /**
66 * To delete the Instance you should use DeleteInstance()
67 * rather than the destructor
68 */
69
71
72 template<typename T> G4ITManager<T>* Instance();
73
75 G4ITBox* GetBox(const G4Track*);
76
77 void RegisterManager(G4VITManager* manager);
78 void Push(G4Track* track);
79
80 /**
81 * Set General verbose for all IT Manager
82 * See ITManager builder
83 */
85 {
86 fVerbose = level;
87 }
89 {
90 return fVerbose;
91 }
92
93 void UpdatePositionMap();
94 void CreateTree();
95
96 template<typename T> inline std::vector<std::pair<G4IT*, double> >* FindNearest(const G4ThreeVector& pos, const T* it);
97 template<typename T> inline std::vector<std::pair<G4IT*, double> >* FindNearest(const T* it0, const T* it);
98 template<typename T> inline std::vector<std::pair<G4IT*, double> >* FindNearestInRange(const G4ThreeVector& pos,
99 const T* it, G4double range);
100 template<typename T> inline std::vector<std::pair<G4IT*, double> >* FindNearestInRange(const T* it0, const T* it, G4double range);
101
102private :
104 static std::auto_ptr<G4AllITManager> fInstance;
105 std::map<G4ITType, G4VITManager*> fITSubManager ;
106
107 int fVerbose ;
108};
109
110template<typename T>
111inline std::vector<std::pair<G4IT*, double> >* G4AllITManager::FindNearest(const G4ThreeVector& pos, const T* it)
112{
113 return G4ITManager<T>::Instance()->FindNearest(pos,it);
114}
115
116template<typename T>
117inline std::vector<std::pair<G4IT*, double> >* G4AllITManager::FindNearest(const T* it0, const T* it)
118{
119 return G4ITManager<T>::Instance()->FindNearest(it0, it) ;
120}
121
122template<typename T>
123inline std::vector<std::pair<G4IT*, double> >* G4AllITManager::FindNearestInRange(const G4ThreeVector& pos, const T* it, G4double range)
124{
125 return G4ITManager<T>::Instance()->FindNearestInRange(pos, it, range);
126}
127
128template<typename T>
129inline std::vector<std::pair<G4IT*, double> >* G4AllITManager::FindNearestInRange(const T* it0, const T* it, G4double range)
130{
131 return G4ITManager<T>::Instance()->FindNearestInRange(it0, it, range);
132}
133
134#endif
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
static G4AllITManager * Instance()
static void DeleteInstance()
void UpdatePositionMap()
void SetVerboseLevel(G4int level)
G4VITManager * GetInstance(G4ITType)
std::vector< std::pair< G4IT *, double > > * FindNearestInRange(const G4ThreeVector &pos, const T *it, G4double range)
G4int GetVerboseLevel()
G4ITBox * GetBox(const G4Track *)
void RegisterManager(G4VITManager *manager)
std::vector< std::pair< G4IT *, double > > * FindNearest(const G4ThreeVector &pos, const T *it)
void Push(G4Track *track)
static G4ITManager< T > * Instance()
Definition: G4IT.hh:83