Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:53

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // Author: Mathieu Karamitros
0028 
0029 // The code is developed in the framework of the ESA AO7146
0030 //
0031 // We would be very happy hearing from you, send us your feedback! :)
0032 //
0033 // In order for Geant4-DNA to be maintained and still open-source,
0034 // article citations are crucial. 
0035 // If you use Geant4-DNA chemistry and you publish papers about your software, 
0036 // in addition to the general paper on Geant4-DNA:
0037 //
0038 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
0039 //
0040 // we would be very happy if you could please also cite the following
0041 // reference papers on chemistry:
0042 //
0043 // J. Comput. Phys. 274 (2014) 841-882
0044 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 
0045 
0046 #ifndef G4AllITFinder_h
0047 #define G4AllITFinder_h 1
0048 #include "globals.hh"
0049 #include "G4ITType.hh"
0050 #include "G4ThreeVector.hh"
0051 #include "G4KDTreeResult.hh"
0052 
0053 #include <map>
0054 #include <vector>
0055 #include <memory>
0056 
0057 class G4IT;
0058 class G4VITFinder;
0059 class G4ITBox;
0060 class G4Track;
0061 template<typename T>
0062   class G4ITFinder;
0063 
0064 /**
0065  * Holds all IT Manager, and take care of deleting them
0066  * when AllITManager is deleted
0067  * Set general verbose for all IT Manager
0068  */
0069 
0070 class G4AllITFinder
0071 {
0072 public:
0073   static G4AllITFinder* Instance();
0074   static void DeleteInstance();
0075   /**
0076    * To delete the Instance you should use DeleteInstance()
0077    * rather than the destructor
0078    */
0079 
0080   ~G4AllITFinder();
0081 
0082   G4VITFinder* GetInstance(G4ITType);
0083   G4ITBox* GetBox(const G4Track*);
0084 
0085   void RegisterManager(G4VITFinder* manager);
0086   void Push(G4Track* track);
0087 
0088   /**
0089    * Set General verbose for all IT Manager
0090    * See ITManager builder
0091    */
0092   void SetVerboseLevel(G4int level)
0093   {
0094     fVerbose = level;
0095   }
0096   G4int GetVerboseLevel()
0097   {
0098     return fVerbose;
0099   }
0100 
0101   void UpdatePositionMap();
0102 
0103   template<typename T>
0104     inline G4KDTreeResultHandle FindNearest(const G4ThreeVector& pos,
0105                                             const T* it);
0106   template<typename T>
0107     inline G4KDTreeResultHandle FindNearest(const T* it0, const T* it);
0108   template<typename T>
0109     inline G4KDTreeResultHandle FindNearestInRange(const G4ThreeVector& pos,
0110                                                    const T* it,
0111                                                    G4double range);
0112   template<typename T>
0113     inline G4KDTreeResultHandle FindNearestInRange(const T* it0,
0114                                                    const T* it,
0115                                                    G4double range);
0116 
0117 private:
0118   G4AllITFinder();
0119   static G4ThreadLocal G4AllITFinder* fpInstance;
0120   std::map<G4ITType, G4VITFinder*> fITSubManager;
0121 
0122   int fVerbose;
0123 };
0124 
0125 template<typename T>
0126   inline G4KDTreeResultHandle G4AllITFinder::FindNearest(const G4ThreeVector& pos,
0127                                                          const T* it)
0128   {
0129     return G4ITFinder<T>::Instance()->FindNearest(pos, it);
0130   }
0131 
0132 template<typename T>
0133   inline G4KDTreeResultHandle G4AllITFinder::FindNearest(const T* it0,
0134                                                          const T* it)
0135   {
0136     return G4ITFinder<T>::Instance()->FindNearest(it0, it);
0137   }
0138 
0139 template<typename T>
0140   inline G4KDTreeResultHandle G4AllITFinder::FindNearestInRange(const G4ThreeVector& pos,
0141                                                                 const T* it,
0142                                                                 G4double range)
0143   {
0144     return G4ITFinder<T>::Instance()->FindNearestInRange(pos, it, range);
0145   }
0146 
0147 template<typename T>
0148   inline G4KDTreeResultHandle G4AllITFinder::FindNearestInRange(const T* it0,
0149                                                                 const T* it,
0150                                                                 G4double range)
0151   {
0152     return G4ITFinder<T>::Instance()->FindNearestInRange(it0, it, range);
0153   }
0154 
0155 #endif