Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:32

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 G4IT_h
0047 #define G4IT_h 1
0048 
0049 #include "globals.hh"
0050 #include "G4ITType.hh"
0051 #include "G4ThreeVector.hh"
0052 #include "G4VUserTrackInformation.hh"
0053 #include "G4KDNode.hh"
0054 
0055 ///
0056 // To implement your own IT class, you should use
0057 // ITDef(MyClass) in the class define in your MyClass.hh
0058 // and ITImp(MyClass) in your MyClass.cc
0059 // For instance, see G4Molecule
0060 ///
0061 
0062 class G4IT;
0063 template<>
0064 G4KDNode<G4IT>::~G4KDNode();
0065 
0066 class G4TrackingInformation;
0067 //template<typename PointT> class G4KDNode;
0068 class G4KDNode_Base;
0069 class G4ITBox;
0070 class G4Track;
0071 
0072 G4IT* GetIT(const G4Track* track);
0073 G4IT* GetIT(const G4Track& track);
0074 
0075 template<class OBJECT> class G4FastListNode;
0076 using G4TrackListNode = G4FastListNode<G4Track>;
0077 
0078 /**
0079  * G4IT is a interface which allows the inheriting object
0080  * to be tracked using G4ITStepProcessor
0081  * The inheriting class must implement the operator < , ==
0082  * and != in order to enable the sorting out.
0083  * also the concrete header of MyIT ("MyIt.hh") should contain : ITDef(MyIT)
0084  * and the source of MyIT.cc : ITImp(MyIT)
0085  */
0086 
0087 class G4IT : public virtual G4VUserTrackInformation
0088 {
0089 public:
0090   G4IT();
0091   G4IT(G4Track*);
0092   ~G4IT() override;
0093 
0094 //  inline void *operator new(size_t);
0095 //  inline void operator delete(void *aIT);
0096 
0097   void Print() const override
0098   {
0099     ;
0100   }
0101   virtual const G4String& GetName() const = 0;
0102 
0103   ///
0104   // You should not worried of implementing diff, equal
0105   // and GetType.
0106   // When using ITDef(MyClass) this will be done.
0107   // However, you need to implement in the concrete class
0108   // even fake operators for < and ==
0109   // They will be used by diff and equal.
0110   ///
0111   virtual G4bool diff(const G4IT& right) const = 0;
0112   virtual G4bool equal(const G4IT& right) const = 0;
0113   G4bool operator<(const G4IT& right) const;
0114   G4bool operator==(const G4IT& right) const;
0115   G4bool operator!=(const G4IT& right) const;
0116 
0117   void SetTrack(G4Track*);
0118   inline G4Track* GetTrack();
0119   inline const G4Track* GetTrack() const;
0120 
0121   void RecordCurrentPositionNTime();
0122   const G4ThreeVector& GetPosition() const;
0123   double operator[](int i) const;
0124   const G4ThreeVector& GetPreStepPosition() const;
0125   G4double GetPreStepLocalTime() const;
0126   G4double GetPreStepGlobalTime() const;
0127 
0128   inline void SetPrevious(G4IT*);
0129   inline void SetNext(G4IT*);
0130   inline G4IT* GetPrevious();
0131   inline G4IT* GetNext();
0132   inline const G4IT* GetPrevious() const;
0133   inline const G4IT* GetNext() const;
0134   inline void SetITBox(G4ITBox*);
0135   inline const G4ITBox* GetITBox() const;
0136   void TakeOutBox();
0137   inline void SetNode(G4KDNode_Base*);
0138   inline G4KDNode_Base* GetNode() const;
0139 
0140   inline void SetParentID(int, int);
0141   inline void GetParentID(int&, int&);
0142 
0143   inline G4TrackingInformation* GetTrackingInfo()
0144   {
0145     return fpTrackingInformation;
0146   }
0147 
0148   inline G4TrackListNode* GetListNode()
0149   {
0150     return fpTrackNode;
0151   }
0152   inline void SetListNode(G4TrackListNode* node)
0153   {
0154     fpTrackNode = node;
0155   }
0156 
0157   virtual const G4ITType GetITType() const = 0;
0158 
0159   virtual G4ITType GetITSubType() const
0160   {
0161     return 0;
0162   }
0163 
0164 protected:
0165   G4IT(const G4IT&);
0166   G4IT& operator=(const G4IT&);
0167   G4Track* fpTrack;
0168 
0169 private:
0170   G4ITBox * fpITBox;
0171   G4IT* fpPreviousIT;
0172   G4IT* fpNextIT;
0173   G4KDNode_Base* fpKDNode;
0174 
0175   int fParentID_A;
0176   int fParentID_B;
0177 
0178   G4TrackingInformation* fpTrackingInformation;
0179   G4TrackListNode* fpTrackNode;
0180 };
0181 //------------------------------------------------------------------------------
0182 
0183 inline const G4ITBox* G4IT::GetITBox() const
0184 {
0185   return fpITBox;
0186 }
0187 
0188 inline void G4IT::SetITBox(G4ITBox * aITBox)
0189 {
0190   fpITBox = aITBox;
0191 }
0192 
0193 inline void G4IT::SetPrevious(G4IT* aIT)
0194 {
0195   fpPreviousIT = aIT;
0196 }
0197 
0198 inline void G4IT::SetNext(G4IT* aIT)
0199 {
0200   fpNextIT = aIT;
0201 }
0202 
0203 inline G4IT* G4IT::GetPrevious()
0204 {
0205   return fpPreviousIT;
0206 }
0207 
0208 inline G4IT* G4IT::GetNext()
0209 {
0210   return fpNextIT;
0211 }
0212 
0213 inline void G4IT::SetTrack(G4Track* track)
0214 {
0215   fpTrack = track;
0216 }
0217 
0218 inline G4Track* G4IT::GetTrack()
0219 {
0220   return fpTrack;
0221 }
0222 
0223 inline const G4Track* G4IT::GetTrack() const
0224 {
0225   return fpTrack;
0226 }
0227 
0228 inline void G4IT::SetParentID(int p_a, int p_b)
0229 {
0230   fParentID_A = p_a;
0231   fParentID_B = p_b;
0232 }
0233 
0234 inline void G4IT::GetParentID(int& p_a, int&p_b)
0235 {
0236   p_a = fParentID_A;
0237   p_b = fParentID_B;
0238 }
0239 
0240 inline const G4IT* G4IT::GetPrevious() const
0241 {
0242   return fpPreviousIT;
0243 }
0244 
0245 inline const G4IT* G4IT::GetNext() const
0246 {
0247   return fpNextIT;
0248 }
0249 
0250 inline void G4IT::SetNode(G4KDNode_Base* aNode)
0251 {
0252   fpKDNode = aNode;
0253 }
0254 
0255 inline G4KDNode_Base* G4IT::GetNode() const
0256 {
0257   return fpKDNode;
0258 }
0259 #endif