Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4ITFinder.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 G4ITFinder_hh
0047 #define G4ITFinder_hh 1
0048 
0049 #include <G4AllITFinder.hh>
0050 
0051 #include "globals.hh"
0052 #include <map>
0053 #include "G4KDTree.hh"
0054 #include "G4KDTreeResult.hh"
0055 #include "G4Track.hh"
0056 #include "G4ITTrackHolder.hh"
0057 
0058 class G4VITFinder
0059 {
0060  public:
0061   G4VITFinder() = default;
0062   virtual ~G4VITFinder() = default;
0063   virtual void Clear()                      = 0;
0064   virtual void Push(G4Track* track)         = 0;
0065   virtual G4ITType GetITType()              = 0;
0066   virtual void UpdatePositionMap()          = 0;
0067  protected:
0068   G4int fVerbose = 0;
0069 };
0070 
0071 /**
0072  * Localize the nearest neighbor
0073  * For now, G4KDTree is used
0074  */
0075 
0076 template <class T>  //, class SearcherT = G4KDTree>
0077 class G4ITFinder : public G4VITFinder
0078 {
0079  public:
0080   static G4ITFinder* Instance();
0081   ~G4ITFinder() override;
0082   void Clear() override;
0083   void SetVerboseLevel(G4int level) { fVerbose = level; }
0084   G4int GetVerboseLevel() { return fVerbose; }
0085   void Push(G4Track* track) override;
0086   G4ITType GetITType() override { return T::ITType(); }
0087   void UpdatePositionMap() override;
0088   G4KDTreeResultHandle FindNearestInRange(const T* point /*from this point*/,
0089                                           G4int key /*for this type*/,
0090                                           G4double /*range*/);
0091   G4KDTreeResultHandle FindNearest(const G4ThreeVector&,
0092                                    G4int key /*for this type*/);
0093   G4KDTreeResultHandle FindNearest(const T* /*from this point*/,
0094                                    G4int key /*for this type*/);
0095   G4KDTreeResultHandle FindNearestInRange(
0096     const G4ThreeVector& /*from this point*/, G4int key /*for this type*/,
0097     G4double /*range*/);
0098   G4KDTreeResultHandle FindNearest(const T* /*from this point*/,
0099                                    const T* /*for this type*/);
0100  private:
0101   static G4ThreadLocal G4ITFinder* fInstance;
0102   G4ITFinder();
0103   using TreeMap = std::map<G4int, G4KDTree*> ;
0104   TreeMap fTree;
0105 };
0106 
0107 #ifdef TEMPLATE
0108 #  undef TEMPLATE
0109 #endif
0110 
0111 #define TEMPLATE template <class T>
0112 #define G4ITMANAGER G4ITFinder<T>
0113 
0114 #include "G4ITFinder.icc"
0115 
0116 #undef TEMPLATE
0117 #undef G4ITMANAGER
0118 
0119 #endif