// // ******************************************************************** // * DISCLAIMER * // * * // * The following disclaimer summarizes all the specific disclaimers * // * of contributors to this software. The specific disclaimers,which * // * govern, are listed with their locations in: * // * http://cern.ch/geant4/license * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. * // * * // * This code implementation is the intellectual property of the * // * GEANT4 collaboration. * // * By copying, distributing or modifying the Program (or any work * // * based on the Program) you indicate your acceptance of this * // * statement, and all its terms. * // ******************************************************************** // // // $Id: G4PhotoClusterModel.cc,v 1.1 2004/11/09 09:20:34 hpw Exp $ // GEANT4 tag $Name: geant4-07-00-cand-01 $ // #include "G4Timer.hh" #include "G4PhotoClusterModel.hh" #include "Randomize.hh" #include "G4Material.hh" #include "G4MaterialTable.hh" #include "globals.hh" #include "G4Electron.hh" #include "G4Positron.hh" #include "G4Gamma.hh" #include "G4TransportationManager.hh" #include "G4VSensitiveDetector.hh" #include "G4VTouchable.hh" //////////////////////////////////////////////////////////////////////////// // // Constructor, destructor G4PhotoClusterModel::G4PhotoClusterModel(G4Envelope *anEnvelope) : G4VClusterModel("G4PhotoClusterModel",anEnvelope) { fMatIndex = anEnvelope->GetMaterial()->GetIndex() ; ComputePhotoAbsCof() ; } /////////////////////////////////////////////////////////////////////////// G4PhotoClusterModel::~G4PhotoClusterModel() { for(G4int i=0;iGetKineticEnergy() > 1*keV && fastTrack.GetPrimaryTrack()->GetKineticEnergy() < 40*keV ) ; } ////////////////////////////////////////////////////////////////////////////// // // void G4PhotoClusterModel::DoIt( const G4FastTrack& fastTrack , G4FastStep& fastStep ) { G4double energy ; G4double distance, lambda, step ; G4ThreeVector clusterPosition ; energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy() ; G4ParticleMomentum direction(fastTrack.GetPrimaryTrackLocalDirection()); distance = fastTrack.GetEnvelopeSolid()-> DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),direction) ; G4ThreeVector position = fastTrack.GetPrimaryTrackLocalPosition() + distance*direction ; // Set final position: fastStep.SetPrimaryTrackFinalPosition(position); // Cluster counting loop lambda = 1.0/GetLinearPhotoAbs(energy) ; step = RandExponential::shoot(lambda) ; if(step > distance) // no change, return { return ; } else { G4ThreeVector globalStartPosition = fastTrack.GetPrimaryTrack()-> GetPosition() ; G4ParticleMomentum globalDirection = fastTrack.GetPrimaryTrack()-> GetMomentumDirection() ; // global (or local ?) cluster coordinates // clusterPosition = fastTrack.GetPrimaryTrackLocalPosition() + // stepSum*direction ; clusterPosition = globalStartPosition + step*globalDirection ; fClusterPositionVector.push_back(clusterPosition) ; fClusterEnergyVector.push_back(energy) ; fastStep.KillPrimaryTrack(); fastStep.SetPrimaryTrackPathLength(step); fastStep.SetTotalEnergyDeposited(energy); BuildDetectorResponse() ; } return ; } //////////////////////////////////////////////////////////////////////// // // Computes matrix of Sandia photo absorption cross section coefficients for // G4Envelope material void G4PhotoClusterModel::ComputePhotoAbsCof() { G4int i, j, numberOfElements ; static const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); G4SandiaTable thisMaterialSandiaTable(fMatIndex) ; numberOfElements = (*theMaterialTable)[fMatIndex]->GetNumberOfElements() ; G4int* thisMaterialZ = new G4int[numberOfElements] ; for(i=0;i GetElement(i)->GetZ() ; } fIntervalNumber = thisMaterialSandiaTable.SandiaIntervals (thisMaterialZ,numberOfElements) ; fIntervalNumber = thisMaterialSandiaTable.SandiaMixing ( thisMaterialZ , (*theMaterialTable)[fMatIndex]->GetFractionVector() , numberOfElements,fIntervalNumber) ; fPhotoAbsCof = new G4double*[fIntervalNumber] ; for(i=0;iGetDensity() ; } } delete[] thisMaterialZ ; return ; } ////////////////////////////////////////////////////////////////////// // // Returns the value of linear photo absorption coefficient (in reciprocal // length) for G4Envelope material G4double G4PhotoClusterModel::GetLinearPhotoAbs(G4double omega) { G4int i ; G4double omega2, omega3, omega4 ; omega2 = omega*omega ; omega3 = omega2*omega ; omega4 = omega2*omega2 ; for(i=0;i