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 // 00027 // $Id$ 00028 // 00029 // ---------------------------------------------------------------------- 00030 // GEANT 4 class source file 00031 // 00032 // G4CellSCoreComposer.cc 00033 // 00034 // ---------------------------------------------------------------------- 00035 00036 #include "G4CellScoreComposer.hh" 00037 #include "G4Step.hh" 00038 00039 G4CellScoreComposer::G4CellScoreComposer(): 00040 fSCScoreValues() 00041 {} 00042 00043 G4CellScoreComposer::~G4CellScoreComposer() 00044 {} 00045 00046 void G4CellScoreComposer::EstimatorCalculation(const G4Step &aStep){ 00047 00048 G4StepPoint *p = 0; 00049 p = aStep.GetPreStepPoint(); 00050 if (!p) { 00051 G4Exception("G4CellScoreComposer::EstimatorCalculation","Det0191",FatalException," no pointer to pre PreStepPoint!"); 00052 } 00053 G4double sl = aStep.GetStepLength(); 00054 G4double slw = sl * p->GetWeight(); 00055 G4double slwe = slw * p->GetKineticEnergy(); 00056 00057 G4double v = p->GetVelocity(); 00058 if (!(v>0.)) { 00059 v = 10e-9; 00060 } 00061 00062 fSCScoreValues.fSumSL += sl; 00063 fSCScoreValues.fSumSLW += slw; 00064 fSCScoreValues.fSumSLW_v += slw / v; 00065 fSCScoreValues.fSumSLWE += slwe; 00066 fSCScoreValues.fSumSLWE_v += slwe / v; 00067 00068 } 00069 void G4CellScoreComposer::TrackEnters(){ 00070 fSCScoreValues.fSumTracksEntering++; 00071 } 00072 void G4CellScoreComposer::NewTrackPopedUp(){ 00073 fSCScoreValues.fSumPopulation++; 00074 } 00075 00076 void G4CellScoreComposer::SetCollisionWeight(G4double weight){ 00077 fSCScoreValues.fSumCollisions++; 00078 fSCScoreValues.fSumCollisionsWeight+=weight; 00079 } 00080 00081 00082 const G4CellScoreValues &G4CellScoreComposer:: 00083 GetStandardCellScoreValues() const { 00084 if (fSCScoreValues.fSumSLW > 0.) { 00085 //divide by SumSLW or SumSLW_v ? 00086 fSCScoreValues.fNumberWeightedEnergy = 00087 fSCScoreValues.fSumSLWE_v / fSCScoreValues.fSumSLW_v; 00088 00089 fSCScoreValues.fFluxWeightedEnergy = 00090 fSCScoreValues.fSumSLWE / fSCScoreValues.fSumSLW; 00091 00092 fSCScoreValues.fAverageTrackWeight = 00093 fSCScoreValues.fSumSLW / fSCScoreValues.fSumSL; 00094 } 00095 return fSCScoreValues; 00096 } 00097 00098 void G4CellScoreComposer::SetImportnace(G4double importance){ 00099 fSCScoreValues.fImportance = importance; 00100 } 00101 00102 std::ostream& operator<<(std::ostream &out, 00103 const G4CellScoreComposer &ps) { 00104 G4CellScoreValues scores = ps.GetStandardCellScoreValues(); 00105 out << "Tracks entering: " << scores.fSumTracksEntering << G4endl; 00106 out << "Population: " << scores.fSumPopulation << G4endl; 00107 out << "Collisions: " << scores.fSumCollisions << G4endl; 00108 out << "Collisions*Wgt: " << scores.fSumCollisionsWeight << G4endl; 00109 out << "NumWGTedEnergy: " << scores.fNumberWeightedEnergy << G4endl; 00110 out << "FluxWGTedEnergy: " << scores.fFluxWeightedEnergy << G4endl; 00111 out << "Aver.TrackWGT*I: " << scores.fAverageTrackWeight* 00112 scores.fImportance << G4endl; 00113 return out; 00114 } 00115