G4IT.cc

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.cc 65022 2012-11-12 16:43:12Z gcosmo $
00027 //
00028 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
00029 //
00030 // History:
00031 // -----------
00032 // 10 Oct 2011 M.Karamitros created
00033 //
00034 // -------------------------------------------------------------------
00035 
00036 #include "G4IT.hh"
00037 #include "G4KDTree.hh"
00038 #include "G4ITBox.hh"
00039 #include "G4Track.hh"
00040 
00041 using namespace std;
00042 
00043 G4Allocator<G4IT> aITAllocator;
00044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00046 // Static functions
00048 G4IT* GetIT(const G4Track* track)
00049 {
00050     return (dynamic_cast<G4IT*>(track->GetUserInformation()));
00051 }
00052 
00053 G4IT* GetIT(const G4Track& track)
00054 {
00055     return (dynamic_cast<G4IT*>(track.GetUserInformation()));
00056 }
00057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00059 // Constructors / Destructors
00061 G4IT::G4IT() : G4VUserTrackInformation("G4IT"),
00062     fpTrack (0),
00063     fpPreviousIT(0), fpNextIT(0),
00064     fTrackingInformation()
00065 //    fpTrackingInformation(new G4TrackingInformation())
00066 {
00067     fpITBox=0;
00068     fpKDNode = 0 ;
00069     fpTrackNode = 0;
00070     fParentID_A = 0;
00071     fParentID_B = 0;
00072 }
00073 
00074 // Use only by inheriting classes
00075 G4IT::G4IT(const G4IT& /*right*/) : G4VUserTrackInformation("G4IT"),
00076     fpTrack (0),
00077     fpPreviousIT(0), fpNextIT(0),
00078     fTrackingInformation()
00079 //    fpTrackingInformation(new G4TrackingInformation())
00080 {
00081     fpITBox=0;
00082     fpKDNode = 0 ;
00083     fpTrackNode = 0;
00084     fParentID_A = 0;
00085     fParentID_B = 0;
00086 }
00087 
00088 // Should not be used
00089 G4IT& G4IT::operator=(const G4IT& right)
00090 {
00091     G4ExceptionDescription exceptionDescription;
00092     exceptionDescription << "The assignment operator of G4IT should not be used, this feature is not supported."
00093                          << "If really needed, please contact the developers.";
00094     G4Exception("G4IT::operator=(const G4IT& right)","G4IT001",FatalException,exceptionDescription);
00095 
00096     if(this == &right) return *this;
00097 
00098     fpTrack = 0;
00099     fpITBox = 0;
00100     fpPreviousIT = 0;
00101     fpNextIT = 0;
00102     fpKDNode = 0 ;
00103     fParentID_A = 0;
00104     fParentID_B = 0;
00105 //    fpTrackingInformation = 0;
00106     fpTrackNode = 0;
00107 
00108     return *this;
00109 }
00110 
00111 G4IT::G4IT(G4Track * aTrack) : G4VUserTrackInformation("G4IT"),
00112     fpPreviousIT(0), fpNextIT(0),
00113     fTrackingInformation()
00114 //    fpTrackingInformation(new G4TrackingInformation())
00115 {
00116     fpITBox = 0;
00117     fpTrack = aTrack;
00118     fpKDNode = 0 ;
00119     fpTrackNode = 0;
00120     fParentID_A = 0;
00121     fParentID_B = 0;
00122     RecordCurrentPositionNTime();
00123 }
00124 
00125 void G4IT::TakeOutBox()
00126 {
00127     if(fpITBox)
00128     {
00129         fpITBox->Extract(this);
00130     }
00131 
00132     if(fpKDNode)
00133     {
00134         InactiveNode(fpKDNode);
00135         fpKDNode = 0;
00136     }
00137 }
00138 
00139 G4IT::~G4IT()
00140 {
00141     TakeOutBox();
00142 
00143 //    if(fpTrackingInformation)
00144 //    {
00145 //        delete fpTrackingInformation;
00146 //        fpTrackingInformation = 0;
00147 //    }
00148 
00149     // Note :
00150     // G4ITTrackingManager will delete fTrackNode.
00151     // fKDNode will be deleted when the KDTree is rebuilt
00152 }
00153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00155 // Methods
00157 void G4IT::RecordCurrentPositionNTime()
00158 {
00159     if(fpTrack)
00160     {
00161         fTrackingInformation.RecordCurrentPositionNTime(fpTrack);
00162     }
00163 }
00164 
00165 G4bool G4IT::operator<(const G4IT& right) const
00166 {
00167     if(GetITType() == right.GetITType() )
00168     {
00169         return  (this->diff(right)) ;
00170     }
00171     else
00172     {
00173         return (GetITType() < right.GetITType());
00174     }
00175     return false;
00176 }
00177 
00178 G4bool G4IT::operator==(const G4IT& right) const
00179 {
00180     if(GetITType() == right.GetITType() )
00181     {
00182         return this->equal(right);
00183     }
00184     return false;
00185 }
00186 
00187 G4bool G4IT::operator!=(const G4IT& right) const
00188 {
00189     return !(this->operator==(right));
00190 }

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