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: G4VITProcess.cc 64057 2012-10-30 15:04:49Z gcosmo $ 00027 // 00028 #include "G4VITProcess.hh" 00029 #include "G4SystemOfUnits.hh" 00030 #include "G4IT.hh" 00031 00032 size_t G4VITProcess::fNbProcess = 0; 00033 00034 G4VITProcess::G4VITProcess(const G4String& name, G4ProcessType type) : 00035 G4VProcess( name, type ), 00036 fpState (0), 00037 fProcessID(fNbProcess) 00038 { 00039 fNbProcess++; 00040 SetInstantiateProcessState(true); 00041 currentInteractionLength = 0; 00042 theInteractionTimeLeft = 0; 00043 theNumberOfInteractionLengthLeft = 0; 00044 fProposesTimeStep = false; 00045 } 00046 00047 G4VITProcess::G4ProcessState::G4ProcessState() 00048 { 00049 theNumberOfInteractionLengthLeft = -1.0 ; 00050 theInteractionTimeLeft = -1.0 ; 00051 currentInteractionLength = -1.0 ; 00052 } 00053 00054 G4VITProcess::G4ProcessState::~G4ProcessState() 00055 {;} 00056 00057 G4VITProcess::~G4VITProcess() 00058 { 00059 //dtor 00060 // As the owner, G4IT should delete fProcessState 00061 } 00062 00063 G4VITProcess::G4VITProcess(const G4VITProcess& other) : G4VProcess(other), fProcessID(other.fProcessID) 00064 { 00065 //copy ctor 00066 fpState = 0 ; 00067 currentInteractionLength = 0; 00068 theInteractionTimeLeft = 0; 00069 theNumberOfInteractionLengthLeft = 0; 00070 fInstantiateProcessState = other.fInstantiateProcessState; 00071 fProposesTimeStep = other.fProposesTimeStep; 00072 } 00073 00074 G4VITProcess& G4VITProcess::operator=(const G4VITProcess& rhs) 00075 { 00076 if (this == &rhs) return *this; // handle self assignment 00077 //assignment operator 00078 return *this; 00079 } 00080 00081 void G4VITProcess::StartTracking(G4Track* track) 00082 { 00083 G4TrackingInformation* trackingInfo = GetIT(track)->GetTrackingInfo(); 00084 if(InstantiateProcessState()) 00085 { 00086 fpState = new G4ProcessState(); 00087 } 00088 00089 theNumberOfInteractionLengthLeft = &(fpState->theNumberOfInteractionLengthLeft ); 00090 theInteractionTimeLeft = &(fpState->theInteractionTimeLeft ); 00091 currentInteractionLength = &(fpState->currentInteractionLength ); 00092 trackingInfo->RecordProcessState(fpState,fProcessID); 00093 fpState = 0; 00094 } 00095 00096 void G4VITProcess::SubtractNumberOfInteractionLengthLeft( 00097 G4double previousStepSize ) 00098 { 00099 if (fpState->currentInteractionLength>0.0) { 00100 fpState->theNumberOfInteractionLengthLeft -= previousStepSize/(fpState->currentInteractionLength); 00101 if(fpState->theNumberOfInteractionLengthLeft<0.) { 00102 fpState->theNumberOfInteractionLengthLeft=perMillion; 00103 } 00104 00105 } else { 00106 #ifdef G4VERBOSE 00107 if (verboseLevel>0) { 00108 G4cerr << "G4VProcess::SubtractNumberOfInteractionLengthLeft()"; 00109 G4cerr << " [" << theProcessName << "]" <<G4endl; 00110 G4cerr << " currentInteractionLength = " << *currentInteractionLength/cm << " [cm]"; 00111 G4cerr << " previousStepSize = " << previousStepSize/cm << " [cm]"; 00112 G4cerr << G4endl; 00113 } 00114 #endif 00115 G4Exception("G4VProcess::SubtractNumberOfInteractionLengthLeft()", 00116 "Negative currentInteractionLength",EventMustBeAborted,theProcessName); 00117 } 00118 }