G4IT.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: G4IT.hh 65022 2012-11-12 16:43:12Z 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 G4IT_h
00040 #define G4IT_h 1
00041 
00042 #include "globals.hh"
00043 #include "G4ITType.hh"
00044 #include "G4ThreeVector.hh"
00045 #include "G4VUserTrackInformation.hh"
00046 #include "G4TrackingInformation.hh"
00047 
00049 // To implement your own IT class, you should use
00050 // ITDef(MyClass) in the class define in your MyClass.hh
00051 // and ITImp(MyClass) in your MyClass.cc
00052 // For instance, see G4Molecule
00054 
00055 class G4IT;
00056 class G4KDNode;
00057 class G4ITBox;
00058 class G4Track;
00059 
00060 G4IT* GetIT(const G4Track* track) ;
00061 G4IT* GetIT(const G4Track& track) ;
00062 
00063 #if defined G4EM_ALLOC_EXPORT
00064 extern G4DLLEXPORT G4Allocator<G4IT> aITAllocator;
00065 #else
00066 extern G4DLLIMPORT G4Allocator<G4IT> aITAllocator;
00067 #endif
00068 
00069 class G4TrackListNode;
00070 
00082 class G4IT : public virtual G4VUserTrackInformation
00083 {
00084 public :
00085     G4IT();
00086     G4IT(G4Track*);
00087     virtual ~G4IT();
00088 
00089     inline void *operator new(size_t);
00090     inline void operator delete(void *aIT);
00091 
00092     virtual void Print() const {}
00093     virtual const G4String& GetName() const = 0 ;
00094 
00096     // You should not worried of implementing diff, equal
00097     // and GetType.
00098     // When using ITDef(MyClass) this will be done.
00099     // However, you need to implement in the concrete class
00100     // even fake operators for < and ==
00101     // They will be used by diff and equal.
00103     virtual G4bool diff(const G4IT& right) const  = 0 ;
00104     virtual G4bool equal(const G4IT& right) const  = 0 ;
00105     G4bool operator<(const G4IT& right) const;
00106     G4bool operator==(const G4IT& right) const;
00107     G4bool operator!=(const G4IT& right) const;
00108 
00109     void SetTrack(G4Track*);
00110     inline G4Track* GetTrack();
00111     inline const G4Track* GetTrack() const;
00112 
00113     void RecordCurrentPositionNTime();
00114 
00115     inline void SetPrevious(G4IT*);
00116     inline void SetNext(G4IT*);
00117     inline G4IT* GetPrevious();
00118     inline G4IT* GetNext();
00119     inline const G4IT* GetPrevious() const;
00120     inline const G4IT* GetNext() const;
00121     inline void SetITBox(G4ITBox*);
00122     inline const G4ITBox* GetITBox() const;
00123     void TakeOutBox();
00124     inline void SetNode(G4KDNode*);
00125 
00126     inline void SetParentID(int,int);
00127     inline void GetParentID(int&,int&);
00128 
00129     inline const G4ThreeVector&    GetPreStepPosition() const;
00130     inline G4double                GetPreStepLocalTime() const;
00131     inline G4double                GetPreStepGlobalTime() const;
00132     inline G4KDNode*               GetNode() const;
00133 
00134     inline G4TrackingInformation* GetTrackingInfo(){return &fTrackingInformation;}
00135 
00136     inline G4TrackListNode* GetTrackListNode(){return fpTrackNode;}
00137     inline void SetTrackListNode(G4TrackListNode* node){ fpTrackNode = node;}
00138 
00139     virtual const G4ITType GetITType() const = 0 ;
00140 
00141 protected :
00142     G4IT(const G4IT&);
00143     G4IT& operator=(const G4IT&);
00144     G4Track* fpTrack ;
00145 
00146 private :
00147     G4ITBox *   fpITBox;
00148     G4IT*       fpPreviousIT;
00149     G4IT*       fpNextIT;
00150     G4KDNode*   fpKDNode ;
00151 
00152     int fParentID_A;
00153     int fParentID_B;
00154 
00155     G4TrackingInformation fTrackingInformation ;
00156     G4TrackListNode* fpTrackNode;
00157 };
00158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00160 // Inline methods
00162 inline void* G4IT::operator new(size_t)
00163 {
00164     void *aIT;
00165     aIT = (void *) aITAllocator.MallocSingle();
00166     return aIT;
00167 }
00168 
00169 inline void G4IT::operator delete(void *aIT)
00170 { aITAllocator.FreeSingle((G4IT *) aIT);}
00171 
00172 inline const G4ITBox* G4IT::GetITBox() const
00173 {
00174     return fpITBox ;
00175 }
00176 
00177 inline void G4IT::SetITBox(G4ITBox * aITBox)
00178 {
00179     fpITBox = aITBox;
00180 }
00181 
00182 inline void G4IT::SetPrevious(G4IT* aIT)
00183 {
00184     fpPreviousIT = aIT;
00185 }
00186 
00187 inline void G4IT::SetNext(G4IT* aIT)
00188 {
00189     fpNextIT = aIT;
00190 }
00191 
00192 inline G4IT* G4IT::GetPrevious()
00193 {
00194     return fpPreviousIT;
00195 }
00196 
00197 inline G4IT* G4IT::GetNext()
00198 {
00199     return fpNextIT;
00200 }
00201 
00202 inline void G4IT::SetTrack(G4Track* track)
00203 {
00204     fpTrack = track;
00205 }
00206 
00207 inline G4Track* G4IT::GetTrack()
00208 {
00209     return fpTrack;
00210 }
00211 
00212 inline const G4Track* G4IT::GetTrack() const
00213 {
00214     return fpTrack;
00215 }
00216 
00217 inline void G4IT::SetParentID(int p_a, int p_b)
00218 {
00219     fParentID_A = p_a;
00220     fParentID_B = p_b;
00221 }
00222 
00223 inline void G4IT::GetParentID(int& p_a,int&p_b)
00224 {
00225     p_a = fParentID_A;
00226     p_b = fParentID_B ;
00227 }
00228 
00229 inline G4double G4IT::GetPreStepGlobalTime() const
00230 {
00231     return fTrackingInformation.GetPreStepGlobalTime();
00232 }
00233 
00234 inline G4double G4IT::GetPreStepLocalTime() const
00235 {
00236     return fTrackingInformation.GetPreStepLocalTime();
00237 }
00238 
00239 inline const G4ThreeVector& G4IT::GetPreStepPosition() const
00240 {
00241     return fTrackingInformation.GetPreStepPosition();
00242 }
00243 
00244 inline const G4IT* G4IT::GetPrevious() const
00245 {
00246     return fpPreviousIT ;
00247 }
00248 
00249 inline const G4IT* G4IT::GetNext() const
00250 {
00251     return fpNextIT ;
00252 }
00253 
00254 inline void G4IT::SetNode(G4KDNode* aNode)
00255 {
00256     fpKDNode = aNode ;
00257 }
00258 
00259 inline G4KDNode* G4IT::GetNode() const
00260 {
00261     return fpKDNode ;
00262 }
00263 #endif
00264 
00265 
00266 

Generated on Mon May 27 17:48:41 2013 for Geant4 by  doxygen 1.4.7