Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
+10 -35
View File
@@ -1,44 +1,19 @@
# $Id: GNUmakefile,v 1.4 2004/06/01 15:37:23 gcosmo Exp $
# ---------------------------------------------------------------
# GNUmakefile for parameterisations library. G.Cosmo, 14/11/2000
# ---------------------------------------------------------------
# $Id: GNUmakefile,v 1.9 2004/12/15 08:49:47 gcosmo Exp $
# ----------------------------------------------------------------
# GNUmakefile for parameterisations library. HPW 09-Nov-04.
# ----------------------------------------------------------------
name := G4parmodels
ifndef G4INSTALL
G4INSTALL = ../..
endif
SUBDIRS := gflash trd_clusters
SUBLIBS = G4gflash G4trdmodels
GLOBLIBS = libG4processes.lib libG4digits_hits.lib libG4track.lib
GLOBLIBS += libG4particles.lib libG4geometry.lib libG4materials.lib
GLOBLIBS += libG4graphics_reps.lib libG4intercoms.lib libG4global.lib
include $(G4INSTALL)/config/architecture.gmk
ifndef G4INSTALL
G4INSTALL = ../..
endif
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/navigation/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/processes/parameterisation/include \
-I$(G4BASE)/processes/electromagnetic/standard/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/hadrons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/digits_hits/detector/include \
-I$(G4BASE)/digits_hits/hits/include
include $(G4INSTALL)/config/common.gmk
.PHONY: global
global: lib
include $(G4INSTALL)/config/globlib.gmk
+12 -49
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.10 2004/06/07 13:36:16 gcosmo Exp $
$Id: History,v 1.13 2004/12/15 08:54:50 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,54 +17,17 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Jun 7th, 2004 G.Cosmo (parmodels-V06-01-00)
- GNUmakefile: added definition of GLOBLIBS for DLLs support on Windows.
Dec 15th, 2004 G.Cosmo (gpara-V06-02-02)
----------------------
- Corrected library names (global library and trd_models library)
to allow DLL build on Windows.
Oct 4th, 2003 G.Cosmo (parmodels-V05-02-01)
Dec 7th, 2004 G.Cosmo (gpara-V06-02-01)
---------------------
- GNUmakefile:
o replaced "digits+hits" with "digits_hits".
o added dependency to new module "geometry/navigation".
- Coworks with "geometry-V05-02-00" and "digits_hits-V05-02-00".
- Implemented migration to <cmath>.
Sep 25th, 2003 H.Kurashige (parmodels-V05-02-00)
--------------------------
- Modify GNUmakefile to use processes/cuts category
May 21st, 2003 G.Cosmo - (parmodels-V05-01-00)
----------------------
- Fixed pedantic warnings in G4IrregularXrayTRmodel.cc and G4VXrayTRmodel.cc.
Feb 12th, 2003 G.Cosmo - (parmodels-V05-00-01)
----------------------
- Replaced call to RandPoisson::shoot() with G4Poisson(), more performant.
Affected files: G4IrregularXrayTRmodel.cc, G4VXTRdEdx.cc, G4VXrayTRadModel.cc.
Jan 23rd, 2003 G.Cosmo - (parmodels-V05-00-00)
----------------------
- Updated header files to remove redundant header inclusions
and properly order inclusion for complex numbers, to allow
porting on Windows .NET VC++ compiler.
Nov 8th, 2001 M.Verderi - (parmodels-V03-02-02)
-----------------------
- Minor change in G4VClusterModel.cc
Nov 8th, 2001 G.Cosmo - (parmodels-V03-02-01)
---------------------
- Introduced changes in G4VClusterModel[.hh.cc] for reference-counted
touchables (R.Chytracek).
Sep 18th, 2001 V.Grichine - (parmodels-V03-02-00)
-------------------------
- Added new classes describing X-ray transition radiation generation
inside radiators (i.e. just along incident particle track):
G4FoamXTRdEdx[.hh.cc], G4GamDistrXTRdEdx[.hh.cc], G4IrregularXTRdEdx[.hh.cc],
G4PlateIrrGasXTRdEdx[.hh.cc], G4RegularXTRdEdx[.hh.cc], G4VXTRdEdx[.hh.cc]
and G4VXrayTRadModel[.hh.cc]
- Modifications in existing classes, introducing some new parameters,
class fields and methods.
Nov 14th, 2000 G.Cosmo - (parmodels-V02-00-00)
----------------------
- Created.
Nov 26th, 2004 H.P.Wellisch (gpara-V06-02-00)
---------------------------
- New 'gflash' submodule, contribution of CMS and ATLAS.
- Moved original TRD classes to 'trd_models' submodule.
- Created History file
@@ -0,0 +1,42 @@
# --------------------------------------------------------------------
# GNUmakefile for gflash sub-library. HP, 26/10/04.
# --------------------------------------------------------------------
name := G4gflash
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/navigation/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/digits_hits/detector/include \
-I$(G4BASE)/digits_hits/hits/include \
-I$(G4BASE)/processes/parameterisation/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/electromagnetic/muons/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
CXXFLAGS_WITHOUT_O := $(filter-out -O% , $(CXXFLAGS))
CXXFLAGS_WITHOUT_O := $(filter-out +O% , $(CXXFLAGS_WITHOUT_O))
+4
View File
@@ -0,0 +1,4 @@
This directory contains the code re-implementing the gflash package
in C++ for geant4. At the time of first release, the homogenous shower parametrization
part is included.
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef G4GFlashSpot_h
#define G4GFlashSpot_h
#include "G4ThreeVector.hh"
#include "G4FastTrack.hh"
#include "GFlashEnergySpot.hh"
#include "G4TouchableHandle.hh"
class G4GFlashSpot
{
public:
G4GFlashSpot(const GFlashEnergySpot * aSpot, const G4FastTrack * aTrack, G4TouchableHandle aH)
: theSpot(aSpot), theTrack(aTrack), theHandle(aH) {}
~G4GFlashSpot() {}
const GFlashEnergySpot * GetEnergySpot() const {return theSpot;}
const G4FastTrack * GetOriginatorTrack() const {return theTrack;}
G4TouchableHandle GetTouchableHandle() const {return theHandle;}
G4ThreeVector GetPosition() const {return GetOriginatorTrack()->GetPrimaryTrack()->GetPosition();}
private:
const GFlashEnergySpot * theSpot;
const G4FastTrack * theTrack;
G4TouchableHandle theHandle;
};
#endif
@@ -0,0 +1,101 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef G4VGFlashSensitiveDetector_h
#define G4VGFlashSensitiveDetector_h 1
#include "G4Step.hh"
#include "G4VReadOutGeometry.hh"
#include "G4TouchableHistory.hh"
#include "GFlashEnergySpot.hh"
#include "G4GFlashSpot.hh"
// class description:
//
// This is the abstract base class of the sensitive detector for use with GFlash. The user's
// sensitive detector which generates hits must be derived from this
// class, and G4VSensitiveDetector.
class G4VGFlashSensitiveDetector
{
public: // with description
G4VGFlashSensitiveDetector() {}
G4VGFlashSensitiveDetector(const G4VGFlashSensitiveDetector &) {}
// Constructors. The user's concrete class must use one of these constructors
// by the constructor initializer of the derived class. The name of
// the sensitive detector must be the same as for the corresponding GG4VSensitiveDetector.
public:
virtual ~G4VGFlashSensitiveDetector() {}
G4int operator==(const G4VGFlashSensitiveDetector &right) const {return this == &right;}
G4int operator!=(const G4VGFlashSensitiveDetector &right) const {return this != &right;};
protected: // with description
virtual G4bool ProcessHits(G4GFlashSpot*aSpot,G4TouchableHistory*ROhist) = 0;
// The user MUST implement this method for generating hit(s) from the GFlashSpots
// Be aware that this method is a protected method and it will be invoked
// by Hit() method of the Base class once the Readout geometry that may be associated to the
// corresponding G4VSensitiveDetector was taken into account.
public: // with description
inline G4bool Hit(G4GFlashSpot * aSpot)
{
G4bool result = true;
G4VSensitiveDetector * This = dynamic_cast<G4VSensitiveDetector *>(this);
if(!This)
{
G4Exception("Sensitive detector using GFlash needs to also inherit from G4VSensitiveDetector");
}
if(This->isActive())
{
G4VReadOutGeometry * ROgeometry = 0;
G4TouchableHistory* ROhis = 0;
if(This) ROgeometry = This->GetROgeometry();
if(ROgeometry)
{
// fake pre-step point for touchable from read-out geometry.
G4Step fakeStep;
G4StepPoint * tmpPoint = fakeStep.GetPreStepPoint();
tmpPoint->SetTouchableHandle(aSpot->GetTouchableHandle());
tmpPoint->SetPosition(aSpot->GetPosition());
tmpPoint->SetMomentumDirection(aSpot->GetOriginatorTrack()->GetPrimaryTrack()->GetMomentumDirection());
result = ROgeometry->CheckROVolume(&fakeStep, ROhis);
}
if(result) result = ProcessHits(aSpot, ROhis);
}
else
{
result = false;
}
return result;
}
// This is the public method invoked by GFlashHitMaker for generating
// hit(s). The actual user's implementation for generating hit(s) must be
// implemented in GenerateHits() virtual protected method.
};
#endif
@@ -0,0 +1,46 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Created by Joanna Weng, 9.11.04
#ifndef GFlashEnergySpot_h
#define GFlashEnergySpot_h
#include "G4ThreeVector.hh"
class GFlashEnergySpot
{
public:
GFlashEnergySpot();
GFlashEnergySpot(const G4ThreeVector& point, G4double E);
~GFlashEnergySpot();
inline void SetEnergy(const G4double& E) {Energy = E;}
inline G4double GetEnergy() const {return Energy;}
inline void SetPosition(const G4ThreeVector& point) {Point = point;}
inline G4ThreeVector GetPosition() const {return Point;}
private:
G4double Energy; // energy deposition
G4ThreeVector Point; // locus of energy deposition
};
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Created by Joanna Weng 9.11.2004
#ifndef GFlashHitMaker_h
#define GFlashHitMaker_h 1
// has singleton semantics
#include "G4TouchableHandle.hh"
#include "G4Navigator.hh"
#include "GFlashEnergySpot.hh"
#include "G4GFlashSpot.hh"
#include "G4FastTrack.hh"
class GFlashHitMaker
{
public:
GFlashHitMaker();
~GFlashHitMaker();
void make(GFlashEnergySpot * aSpot, const G4FastTrack * aT );
private:
G4TouchableHandle fTouchableHandle;
G4Navigator *fpNavigator;
G4bool fNaviSetup;
private:
GFlashHitMaker(const GFlashHitMaker & )
{
G4Exception("GFlashHitMaker copy constructor not publicly available");
}
GFlashHitMaker & operator = (const GFlashHitMaker & )
{
G4Exception("GFlashHitMaker asignment operator not publicly available");
return *this;
}
};
#endif
@@ -0,0 +1,123 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Created by J. Weng 02.2004
#ifndef GFlashHomoShowerParamterisation_h
#define GFlashHomoShowerParamterisation_h 1
#include "globals.hh"
#include "GVFlashHomoShowerTuning.hh"
class G4Material;
class GFlashHomoShowerParamterisation
{
public:
GFlashHomoShowerParamterisation(G4Material * aMat, GVFlashHomoShowerTuning * aPar = 0);
~GFlashHomoShowerParamterisation();
void ComputeRadialParameters(G4double y, G4double Tau);
void GenerateLongitudinalProfile(G4double Energy);
void ComputeZAX0EFFetc();
G4double IntegrateEneLongitudinal(G4double LongitudinalStep);
G4double IntegrateNspLongitudinal(G4double LongitudinalStep);
G4double ComputeTau(G4double LongitudinalPosition);
G4double GeneratePhi();
G4double GenerateRadius(G4int ispot, G4double Energy, G4double LongitudinalPosition);
G4double GenerateExponential(G4double Energy);
//Gets
//R
inline G4double GetAveR99() {return (3.5 * Rm);}
inline G4double GetAveR90() {return (1.5 * Rm);} //ok
//T
inline G4double GetAveTmx() {return (X0 * std::exp(AveLogTmaxh));} //exp ?
inline G4double GetAveT99() {return (X0 * AveLogTmaxh/(AveLogAlphah-1.00));}
inline G4double GetAveT90() {return (2.5 * X0 * std::exp( AveLogTmaxh) );}
//
inline G4double GetNspot(){ return NSpot;}
G4double GetEffZ(const G4Material * material);
G4double GetEffA(const G4Material * material);
G4double gam(G4double x, G4double a) const; // @@@@ gamma function
private:
// medium related quantities
G4double density, A, Z, X0, Ec, Rm;
G4Material *material;
public:
inline G4double GetX0(){return X0;}
inline G4double GetEc(){return Ec;}
inline G4double GetRm(){return Rm;}
void SetMaterial (G4Material *mat);
void PrintMaterial();
private:
//Resolution
G4double ConstantResolution;
G4double NoiseResolution;
G4double SamplingResolution;
// parametrization parameters
GVFlashHomoShowerTuning * thePar;
// Cashed parameters:
// Longitudinal Coefficients for a homogenious calo
G4double ParAveT1;
G4double ParAveA1,ParAveA2,ParAveA3;
G4double ParSigLogT1,ParSigLogT2;
G4double ParSigLogA1,ParSigLogA2;
G4double ParRho1,ParRho2;
void ComputeLongitudinalParameters(G4double y);
void GenerateEnergyProfile(G4double y);
void GenerateNSpotProfile(G4double y);
// Radial Coefficients
G4double ParRC1,ParRC2,ParRC3,ParRC4;
G4double ParWC1,ParWC2,ParWC3;
G4double ParWC4,ParWC5,ParWC6;
G4double ParRT1,ParRT2,ParRT3,ParRT4;
G4double ParRT5,ParRT6;
//Spot multiplicity Coefficients
G4double ParSpotT1,ParSpotT2,ParSpotA1, ParSpotA2;
G4double ParSpotN1,ParSpotN2;
//PARAMETRISATION variables (Energy & position dependent)
//Longitudinal
//homogenous
G4double AveLogAlphah,AveLogTmaxh;
G4double SigmaLogAlphah,SigmaLogTmaxh;
G4double Rhoh;
G4double Alphah,Tmaxh,Betah;
//MMultiplicity
G4double NSpot,AlphaNSpot,TNSpot,BetaNSpot;
//Radial
G4double RadiusCore, WeightCore,RadiusTail;
};
#endif
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Created by Joanna Weng 9.11.2004
#ifndef GFlashParticleBounds_h
#define GFlashParticleBounds_h
#include "G4ParticleDefinition.hh"
class GFlashParticleBounds
{
public:
GFlashParticleBounds();
~GFlashParticleBounds();
// methods to get/set ELE/Gamma max & min energy bounds
G4double GetMinEneToParametrise(G4ParticleDefinition &particleType);
G4double GetMaxEneToParametrise(G4ParticleDefinition &particleType);
G4double GetEneToKill(G4ParticleDefinition &particleType) ;
void SetMinEneToParametrise(G4ParticleDefinition &particleType,G4double enemin);
void SetMaxEneToParametrise(G4ParticleDefinition &particleType,G4double enemax);
void SetEneToKill(G4ParticleDefinition &particleType,G4double enekill);
private:
// electron and positron
G4double EMinEneToParametrise;
G4double EMaxEneToParametrise;
G4double EEneToKill;
};
#endif
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// Created by E.Barberio, Joanna Weng 9.11.2004
#ifndef GFlashShowerModel_h
#define GFlashShowerModel_h 1
//G4 Standard
#include "G4VFastSimulationModel.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ios.hh"
//GFlash
#include "GFlashShowerModelMessenger.hh"
#include "GFlashParticleBounds.hh"
#include "GFlashEnergySpot.hh"
#include "GFlashHitMaker.hh"
#include <vector>
class GFlashHomoShowerParamterisation;
class GFlashShowerModel : public G4VFastSimulationModel
{
public:
/// Constructor, destructor
GFlashShowerModel (G4String, G4LogicalVolume*);
GFlashShowerModel (G4String);
~GFlashShowerModel ();
/// Checks whether conditions of fast
/// parametrisation are fullfilled
G4bool ModelTrigger(const G4FastTrack &);
G4bool IsApplicable(const G4ParticleDefinition&);
void DoIt(const G4FastTrack&, G4FastStep&);
// setting
inline void SetFlagParamType(G4int I) { FlagParamType = I; }
inline void SetFlagParticleContainment(G4int I) { FlagParticleContainment = I; }
inline void SetStepInX0(G4double Lenght) { StepInX0=Lenght; }
inline void SetParametrisation(GFlashHomoShowerParamterisation &DetectorParametrisation){ Parametrisation=&DetectorParametrisation;}
inline void SetHitMaker(GFlashHitMaker &Maker){ HMaker=&Maker;}
inline void SetParticleBounds(GFlashParticleBounds &SpecificBound){PBound =&SpecificBound;}
//getting
inline G4int GetFlagParamType() { return FlagParamType; }
inline G4int GetFlagParticleContainment() { return FlagParticleContainment; }
inline G4double GetStepInX0() { return StepInX0; }
// Gets ?
GFlashParticleBounds *PBound;
private:
GFlashHomoShowerParamterisation *Parametrisation;
GFlashHitMaker *HMaker;
GFlashShowerModelMessenger* Messenger;
//Control Flags
G4int FlagParamType; ///0=no GFlash 1=only em showers parametrized
G4int FlagParticleContainment; ///0=no check ///1=only fully contained...
G4double StepInX0;
G4double EnergyStop;
// private methods
void ElectronDoIt(const G4FastTrack&, G4FastStep&);
// void GammaDoIt(const G4FastTrack&, G4FastStep&);
// void NeutrinoDoIt(const G4FastTrack&, G4FastStep&);
G4bool CheckParticleDefAndContainment(const G4FastTrack &fastTrack);
G4bool CheckContainment(const G4FastTrack &fastTrack);
};
#endif
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Created by Joanna Weng, 9.11.04
#ifndef GFlashShowerModelMessenger_h
#define GFlashShowerModelMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class GFlashShowerModel;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithADouble;
class GFlashShowerModelMessenger: public G4UImessenger
{
public:
GFlashShowerModelMessenger(GFlashShowerModel * myModel);
~GFlashShowerModelMessenger();
void SetNewValue(G4UIcommand * command,G4String newValues);
G4String GetCurrentValue(G4UIcommand * command);
private:
GFlashShowerModel* myModel;
G4UIdirectory* myParaDir;
G4UIcmdWithAString* SwitchCmd;
G4UIcmdWithAnInteger* FlagCmd;
G4UIcmdWithAnInteger* ContCmd; // Containment Check
G4UIcmdWithADouble* StepInX0Cmd;
G4UIcmdWithADoubleAndUnit* EmaxCmd;
G4UIcmdWithADoubleAndUnit* EminCmd;
G4UIcmdWithADoubleAndUnit* EkillCmd;
};
#endif
@@ -0,0 +1,122 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef GVFlashHomoShowerTuning_hh
#define GVFlashHomoShowerTuning_hh
// J.P. Wellisch, Oct. 2004
class GVFlashHomoShowerTuning
{
public:
// Definitions:
// <t>: shower center of gravity
// T: Depth at shower maximum
// Ec: Critical energy
// y = E/Ec
// X0: Radiation length
// Homogeneous media:
// Avarage shower profile
// (1/E)(dE(t)/dt) = f(t) = (beta*t)**(alpha-1)*beta*std::exp(-beta*t)/Gamma(alpha)
// where Gamma: The Gamma function
//
// <t> = alpha/beta
// T = (alpha-1)/beta
// and
// T = ln(y) + t1
// alpha = a1+(a2+a3/Z)ln(y)
virtual G4double ParAveT1(){ return -0.858;} // t1
virtual G4double ParAveA1(){ return 0.21; } // a1
virtual G4double ParAveA2(){ return 0.492; } // a2
virtual G4double ParAveA3(){ return 2.38; } // a3
// std::sqrt(var(ln(T))) = 1/(t+t2*ln(y))
virtual G4double ParSigLogT1(){ return -1.4;} // t1
virtual G4double ParSigLogT2(){ return 1.26;} // t2
// std::sqrt(var(ln(alpha))) = 1/(a1+a2*ln(y))
virtual G4double ParSigLogA1(){ return -0.58;} // a1
virtual G4double ParSigLogA2(){ return 0.86; } // a2
// Correlation(ln(T),ln(alpha))=r1+r2*ln(y)
virtual G4double ParRho1(){ return 0.705; } // r1
virtual G4double ParRho2(){ return -0.023;} // r2
// Radial profiles
// f(r) := (1/dE(t))(dE(t,r)/dr)
// Ansatz:
// f(r) = p(2*r*Rc**2)/(r**2+Rc**2)**2+(1-p)*(2*r*Rt**2)/(r**2+Rt**2)**2, 0<p<1
//
// Rc (t/T)= z1 +z2*t/T
// z1 = c1+c2*ln(E/GeV)
// z2 = c3+c4*Z
virtual G4double ParRC1(){ return 0.0251; } // c1
virtual G4double ParRC2(){ return 0.00319; } // c2
virtual G4double ParRC3(){ return 0.1162; } // c3
virtual G4double ParRC4(){ return -0.000381;} // c4
// Rt (t/T)= k1*(std::exp(k3*(t/T-k2))+std::exp(k4*(t/T-k2)))
// k1 = t1+t2*Z
// k4 = t5+t6*ln(E/GeV)
virtual G4double ParRT1(){ return 0.659; } // t1
virtual G4double ParRT2(){ return -0.00309;} // t2
virtual G4double ParRT3(){ return 0.645; } // k2
virtual G4double ParRT4(){ return -2.59; } // k3
virtual G4double ParRT5(){ return 0.3585; } // t5
virtual G4double ParRT6(){ return 0.0412; } // t6
// p(t/T) = p1*std::exp((p2-t/T)/p3 - std::exp((p2-t/T)/p3))
// p1 = c1+c2*Z
// p2 = c3+c4*Z
// p3 = c5 + c6*ln(E/GeV)
virtual G4double ParWC1(){ return 2.632; } // c1
virtual G4double ParWC2(){ return -0.00094;} // c2
virtual G4double ParWC3(){ return 0.401; } // c3
virtual G4double ParWC4(){ return 0.00187; } // c4
virtual G4double ParWC5(){ return 1.313; } // c5
virtual G4double ParWC6(){ return -0.0686; } // c6
// Fluctuations on radial profiles through number of spots
// The total number of spots needed for a shower is
// Ns = n1*ln(Z)(E/GeV)**n2
virtual G4double ParSpotN1(){ return 93.; } // n1
virtual G4double ParSpotN2(){ return 0.876;} // n2
// The number of spots per longitudinal interval is:
// (1/Ns)(dNs(t)/dt) = f(t) = (beta*t)**(alpha-1)*beta*std::exp(-beta*t)/Gamma(alpha)
// <t> = alpha_s/beta_s
// Ts = (alpha_s-1)/beta_s
// and
// Ts = T*(t1+t2*Z)
// alpha_s = alpha*(a1+a2*Z)
virtual G4double ParSpotT1(){ return 0.698; } // t1
virtual G4double ParSpotT2(){ return 0.00212;} // t2
virtual G4double ParSpotA1(){ return 0.639; } //a1
virtual G4double ParSpotA2(){ return 0.00334;} //a2
};
#endif
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef MYGAMMA_H
#define MYGAMMA_H
#include <cmath>
class MyGamma {
public:
MyGamma ();
~MyGamma();
double Gamma(double z);
double Gamma(double a,double x);
private:
double GamCf(double a,double x);
double GamSer(double a,double x);
// Abs
static short Abs(short d) { return (d > 0) ? d : -d; }
static int Abs(int d) { return (d > 0) ? d : -d; }
static long Abs(long d) { return (d > 0) ? d : -d; }
static float Abs(float d){ return (d > 0) ? d : -d; }
static double Abs(double d) { return (d > 0) ? d : -d; }
static double LnGamma(double z);
static double Log(double x){ return std::log(x); }
static double Exp(double x){ return std::exp(x); }
};
#endif
@@ -0,0 +1,42 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Created by Joanna Weng, 9.11.04
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4Polyline.hh"
#include "G4VVisManager.hh"
#include "G4Step.hh"
//GFlash
#include "GFlashEnergySpot.hh"
GFlashEnergySpot::GFlashEnergySpot() {}
GFlashEnergySpot::GFlashEnergySpot(const G4ThreeVector& point, G4double E)
{
Point = point;
Energy = E;
// initialize shower start @@@@@
}
GFlashEnergySpot::~GFlashEnergySpot() {}
@@ -0,0 +1,104 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Created by E.Barberio & Joanna Weng 9.11.2004
#include "G4ios.hh"
#include "G4TransportationManager.hh"
#include "G4VSensitiveDetector.hh"
#include "G4TouchableHandle.hh"
#include "G4VGFlashSensitiveDetector.hh"
#include "GFlashHitMaker.hh"
#include "G4GFlashSpot.hh"
GFlashHitMaker::GFlashHitMaker()
{
fTouchableHandle = new G4TouchableHistory(); // talk to ?@@@
fpNavigator = new G4Navigator();
fNaviSetup = false;
}
GFlashHitMaker::~GFlashHitMaker()
{
delete fpNavigator;
}
void GFlashHitMaker::make(GFlashEnergySpot * aSpot, const G4FastTrack * aT)
{
// Locate the spot
if (!fNaviSetup)
{
fpNavigator->
SetWorldVolume(G4TransportationManager::GetTransportationManager()->
GetNavigatorForTracking()->GetWorldVolume() );
fpNavigator->
LocateGlobalPointAndUpdateTouchable(aSpot->GetPosition(), fTouchableHandle(), false);
fNaviSetup = true;
}
else
{
fpNavigator->
LocateGlobalPointAndUpdateTouchable(aSpot->GetPosition(), fTouchableHandle());
}
//--------------------------------------
// Fills attribute of the G4Step needed
// by our sensitive detector:
//-------------------------------------
// set spot information:
G4GFlashSpot theSpot(aSpot, aT, fTouchableHandle);
///Navigator
//--------------------------------------
// Produce Hits
// call sensitive part: taken/adapted from the stepping:
// Send G4Step information to Hit/Dig if the volume is sensitive
//--------------G4TouchableHistory----------------------------------------
G4VPhysicalVolume* pCurrentVolume = fTouchableHandle()->GetVolume();
G4VSensitiveDetector* pSensitive;
if( pCurrentVolume != 0 )
{
pSensitive = pCurrentVolume->GetLogicalVolume()->GetSensitiveDetector();
G4VGFlashSensitiveDetector * gflashSensitive =
dynamic_cast<G4VGFlashSensitiveDetector * > (pSensitive);
if( gflashSensitive )
{
gflashSensitive->Hit(&theSpot);
}
else if ( (!gflashSensitive) && ( pCurrentVolume->GetLogicalVolume()->GetFastSimulationManager() ) ) // Using gflash without implementing the
// gflashSensitive detector interface -> not allowed!
{
std::cout<<"When using GFlash in geant4, please implement the "<<std::endl;
std::cout<<"G4VGFlashSensitiveDetector interface in addition to the"<<std::endl;
std::cout<<"G4VSensitiveDetector interface in the relevant sensitive detector."<<std::endl;
G4Exception("GFlashHitMaker: G4VGFlashSensitiveDetector interface not implemented");
}
}
else
{
#ifdef GFLASH_DEBUG
std::cout << "GFlashHitMaker::Out of volume "<<endl;
#endif
}
}
@@ -0,0 +1,339 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//E.Barberio + Joanna Weng 9.11.2004
#include "GFlashHomoShowerParamterisation.hh"
#include <cmath>
#include <CLHEP/Random/Randomize.h>
#include "G4ios.hh"
#include "G4Material.hh"
#include "Gamma.hh" // @@@@
#include "G4MaterialTable.hh"
#include "Randomize.hh"
GFlashHomoShowerParamterisation::
GFlashHomoShowerParamterisation(G4Material * aMat, GVFlashHomoShowerTuning * aPar)
{
if(!aPar) thePar = new GVFlashHomoShowerTuning;
else thePar = aPar;
SetMaterial(aMat);
/********************************************/
/* Homo Calorimeter */
/********************************************/
// Longitudinal Coefficients for a homogenious calo
// shower max
ParAveT1 = thePar->ParAveT1(); // ln (ln y -0.812)
ParAveA1 = thePar->ParAveA1(); // ln a (0.81 + (0.458 + 2.26/Z)ln y)
ParAveA2 = thePar->ParAveA2();
ParAveA3 = thePar->ParAveA3();
// Variance of shower max
ParSigLogT1 = thePar->ParSigLogT1(); // Sigma T1 (-1.4 + 1.26 ln y)**-1
ParSigLogT2 = thePar->ParSigLogT2();
// variance of 'alpha'
ParSigLogA1 = thePar->ParSigLogA1(); // Sigma a (-0.58 + 0.86 ln y)**-1
ParSigLogA2 = thePar->ParSigLogA2();
// correlation alpha%T
ParRho1 = thePar->ParRho1(); // Rho = 0.705 -0.023 ln y
ParRho2 = thePar->ParRho2();
// Radial Coefficients
// r_C (tau)= z_1 +z_2 tau
// r_t (tau)= k1 (std::exp (k3(tau -k2 ))+std::exp (k_4 (tau- k_2))))
ParRC1 = thePar->ParRC1(); // z_1 = 0.0251 + 0.00319 ln E
ParRC2 = thePar->ParRC2();
ParRC3 = thePar->ParRC3(); // z_2 = 0.1162 + - 0.000381 Z
ParRC4 = thePar->ParRC4();
ParWC1 = thePar->ParWC1();
ParWC2 = thePar->ParWC2();
ParWC3 = thePar->ParWC3();
ParWC4 = thePar->ParWC4();
ParWC5 = thePar->ParWC5();
ParWC6 = thePar->ParWC6();
ParRT1 = thePar->ParRT1();
ParRT2 = thePar->ParRT2();
ParRT3 = thePar->ParRT3();
ParRT4 = thePar->ParRT4();
ParRT5 = thePar->ParRT5();
ParRT6 = thePar->ParRT6();
// Coeff for fluctuedted radial profiles for a uniform media
ParSpotT1 = thePar->ParSpotT1(); // T_spot = T_hom =(0.698 + 0.00212)
ParSpotT2 = thePar->ParSpotT2();
ParSpotA1 = thePar->ParSpotA1(); // a_spot= a_hom (0.639 + 0.00334)
ParSpotA2 = thePar->ParSpotA2();
ParSpotN1 = thePar->ParSpotN1(); // N_Spot 93 * ln(Z) E ** 0.876
ParSpotN2 = thePar->ParSpotN2();
// Inits
NSpot = 0.00;
AlphaNSpot = 0.00;
TNSpot = 0.00;
BetaNSpot = 0.00;
RadiusCore = 0.00;
WeightCore = 0.00;
RadiusTail = 0.00;
std::cout<<"/********************************************/ " <<std::endl;
std::cout<<" - GFlashHomoShowerParamterisation::Constructor - " <<std::endl;
std::cout<<"/********************************************/ " <<std::endl;
}
void GFlashHomoShowerParamterisation::SetMaterial(G4Material *mat)
{
material= mat;
Z = GetEffZ(material);
A = GetEffA(material);
density = material->GetDensity()/(g/cm3);
X0 = material->GetRadlen();
Ec = 2.66 * std::pow((X0 * Z / A),1.1);
G4double Es = 21*MeV;
Rm = X0*Es/Ec;
// PrintMaterial();
}
G4double GFlashHomoShowerParamterisation::GetEffZ(const G4Material * material )
{
// Returns Z or effective Z=sum(pi*Zi) (if compound/mixture)
// of given material.
// ---
G4double z = 0.;
G4int nofElements = material->GetNumberOfElements();
if (nofElements > 1)
{
// G4String text = "Effective Z for material mixture (";
// text = text + material->GetName();
// text = text + ") is used.";
// cout << text <<endl;
for (G4int i=0; i<nofElements; i++) {
G4double zOfElement = material->GetElement(i)->GetZ();
G4double massFraction = material->GetFractionVector()[i];
// cout << material->GetElement(i)->GetName() <<" Z= "<<zOfElement << " , Fraction= "<<massFraction <<endl;
z += zOfElement*massFraction;
}
}
else {
z = material->GetZ();
}
return z;
}
G4double GFlashHomoShowerParamterisation::GetEffA (const G4Material * material )
{
// Returns A or effective A=sum(pi*Ai) (if compound/mixture)
// of given material.
// ---
G4double a = 0.;
G4int nofElements = material->GetNumberOfElements();
if (nofElements > 1)
{
// G4String text = "Effective A for material mixture (";
// text = text + material->GetName();
// text = text + ") is used."
// cout << text <<endl;
for (G4int i=0; i<nofElements; i++)
{
G4double aOfElement = material->GetElement(i)->GetA()/(g/mole);
G4double massFraction = material->GetFractionVector()[i];
// cout << material->GetElement(i)->GetName() <<" A= "<<aOfElement << " g/mole, Fraction= "<< massFraction <<endl;
a += aOfElement*massFraction;
}
}
else
{
a = material->GetA()/(g/mole);
}
return a;
}
void GFlashHomoShowerParamterisation::PrintMaterial()
{
std::cout<<"/********************************************/ " <<std::endl;
std::cout<<" - GFlashHomoShowerParamterisation::Material - " <<std::endl;
std::cout<<" Material : " << material->GetName() << std::endl;
std::cout<<" Z = "<< Z << std::endl;
std::cout<<" A = "<< A << std::endl;
std::cout<<" X0 = "<<X0/cm <<" cm" <<std::endl;
std::cout<<" Rm= "<<Rm/cm <<" cm" <<std::endl;
std::cout<<" Ec = "<<Ec/MeV << " MeV"<<std::endl;
std::cout<<"/********************************************/ " <<std::endl;
}
GFlashHomoShowerParamterisation::~GFlashHomoShowerParamterisation()
{}
void GFlashHomoShowerParamterisation::GenerateLongitudinalProfile(G4double Energy)
{
if (material==NULL)
{
G4Exception("GFlashHomoShowerParamterisation: no material initialized");
}
G4double y = Energy/Ec;
ComputeLongitudinalParameters(y);
GenerateEnergyProfile(y);
GenerateNSpotProfile(y);
}
void GFlashHomoShowerParamterisation::ComputeLongitudinalParameters(G4double y)
{
AveLogTmaxh = std::log(ParAveT1 +std::log(y)); //ok //<ln T hom>
AveLogAlphah = std::log(ParAveA1 + (ParAveA2+ParAveA3/Z)*std::log(y)); //ok //<ln alpha hom>
SigmaLogTmaxh = 1.00/( ParSigLogT1 + ParSigLogT2*std::log(y)) ; //ok sigma (ln T hom)
SigmaLogAlphah = 1.00/( ParSigLogA1 + ParSigLogA2*std::log(y)); //ok sigma (ln alpha hom)
Rhoh = ParRho1+ParRho2*std::log(y); //ok
}
void GFlashHomoShowerParamterisation::GenerateEnergyProfile(G4double /* y */)
{
G4double Correlation1h = std::sqrt((1+Rhoh)/2);
G4double Correlation2h = std::sqrt((1-Rhoh)/2);
G4double Random1 = RandGauss::shoot();
G4double Random2 = RandGauss::shoot();
//Parameters for Enenrgy Profile including correaltion and sigmas
Tmaxh = std::exp( AveLogTmaxh + SigmaLogTmaxh *
(Correlation1h*Random1 + Correlation2h*Random2) );
Alphah = std::exp( AveLogAlphah + SigmaLogAlphah *
(Correlation1h*Random1 - Correlation2h*Random2) );
Betah = (Alphah-1.00)/Tmaxh;
}
void GFlashHomoShowerParamterisation::GenerateNSpotProfile(const G4double y)
{
TNSpot = Tmaxh * (ParSpotT1+ParSpotT2*Z); //ok.
AlphaNSpot = Alphah * (ParSpotA1+ParSpotA2*Z);
BetaNSpot = (AlphaNSpot-1.00)/TNSpot; // ok
NSpot = ParSpotN1 * std::log(Z)*std::pow((y*Ec)/GeV,ParSpotN2 ); //ok
}
G4double GFlashHomoShowerParamterisation::IntegrateEneLongitudinal(G4double LongitudinalStep)
{
G4double LongitudinalStepInX0 = LongitudinalStep / X0;
G4float x1= Betah*LongitudinalStepInX0;
G4float x2= Alphah;
float x3 = gam(x1,x2);
G4double DEne=x3;
return DEne;
}
G4double GFlashHomoShowerParamterisation::IntegrateNspLongitudinal(const G4double LongitudinalStep)
{
G4double LongitudinalStepInX0 = LongitudinalStep / X0;
G4float x1 = BetaNSpot*LongitudinalStepInX0;
G4float x2 = AlphaNSpot;
float x3 = gam(x1,x2);
G4double DNsp = x3;
return DNsp;
}
G4double GFlashHomoShowerParamterisation::GeneratePhi()
{
G4double Phi = twopi*G4UniformRand() ;
return Phi;
}
G4double GFlashHomoShowerParamterisation::GenerateRadius(G4int ispot, G4double Energy,
G4double LongitudinalPosition)
{
if(ispot < 1)
{
//determine lateral parameters in the middle of the step
//They depend on energy & position along step
G4double Tau = ComputeTau(LongitudinalPosition);
ComputeRadialParameters(Energy,Tau);
}
G4double Radius;
G4double Random1 = RandFlat::shoot();
G4double Random2 = RandFlat::shoot();
if(Random1 <WeightCore) //WeightCore = p < w_i
{
Radius = Rm * RadiusCore * std::sqrt( Random2/(1. - Random2) );
}
else
{
Radius = Rm * RadiusTail * std::sqrt( Random2/(1. - Random2) );
}
return Radius;
}
G4double GFlashHomoShowerParamterisation::ComputeTau(G4double LongitudinalPosition)
{
G4double tau = LongitudinalPosition / Tmaxh / X0 //<t> = T* a /(a - 1)
* (Alphah-1.00) /Alphah *
std::exp(AveLogAlphah)/(std::exp(AveLogAlphah)-1.); //ok
return tau;
}
void GFlashHomoShowerParamterisation::ComputeRadialParameters(G4double Energy, G4double Tau)
{
G4double z1 = ParRC1 + ParRC2* std::log(Energy/GeV) ; //ok
G4double z2 = ParRC3+ParRC4*Z ; //ok
RadiusCore = z1 + z2 * Tau ; // ok
G4double p1 = ParWC1+ParWC2*Z; //ok
G4double p2 = ParWC3+ParWC4*Z; //ok
G4double p3 = ParWC5+ParWC6*std::log(Energy/GeV); //ok
WeightCore = p1 * std::exp( (p2-Tau)/p3- std::exp( (p2-Tau) /p3) ); //ok
G4double k1 = ParRT1+ParRT2*Z; // ok
G4double k2 = ParRT3; // ok
G4double k3 = ParRT4; // ok
G4double k4 = ParRT5+ParRT6* std::log(Energy/GeV); // ok
RadiusTail = k1*(std::exp(k3*(Tau-k2)) +
std::exp(k4*(Tau-k2)) ); //ok
}
G4double GFlashHomoShowerParamterisation::GenerateExponential(const G4double /* Energy */ )
{
G4double ParExp1 = 9./7.*X0;
G4double random = -ParExp1*RandExponential::shoot() ;
return random;
}
double GFlashHomoShowerParamterisation::gam(double x, double a) const
{
static MyGamma theG;
return theG.Gamma(a, x);
}
@@ -0,0 +1,96 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Created by Joanna Weng 9.11.2004
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "GFlashParticleBounds.hh"
GFlashParticleBounds::GFlashParticleBounds()
{
// e+e- defaults
EMinEneToParametrise = 0.10*GeV;
EMaxEneToParametrise = 10000.00*GeV;
EEneToKill = 0.1*GeV; // Energie at which electrons are killed
}
GFlashParticleBounds::~GFlashParticleBounds()
{
}
void GFlashParticleBounds::SetMinEneToParametrise(G4ParticleDefinition &particleType,G4double enemin)
{
if( &particleType == G4Electron::ElectronDefinition()||
&particleType == G4Positron::PositronDefinition())
EMinEneToParametrise = enemin;
}
void GFlashParticleBounds::SetMaxEneToParametrise(G4ParticleDefinition &particleType,G4double enemax)
{
if( &particleType == G4Electron::ElectronDefinition()||
&particleType == G4Positron::PositronDefinition())
EMaxEneToParametrise = enemax;
}
void GFlashParticleBounds::SetEneToKill(G4ParticleDefinition &particleType,G4double enekill)
{
if( &particleType == G4Electron::ElectronDefinition()||
&particleType == G4Positron::PositronDefinition())
EEneToKill = enekill;
}
G4double GFlashParticleBounds::GetMinEneToParametrise(G4ParticleDefinition &particleType)
{
G4double result = DBL_MAX;
if( &particleType == G4Electron::ElectronDefinition()||
&particleType == G4Positron::PositronDefinition())
{
result = EMinEneToParametrise;
}
return result;
}
G4double GFlashParticleBounds::GetMaxEneToParametrise(G4ParticleDefinition &particleType)
{
G4double result = 0;
if( &particleType == G4Electron::ElectronDefinition()||
&particleType == G4Positron::PositronDefinition())
{
result = EMaxEneToParametrise;
}
return result;
}
G4double GFlashParticleBounds::GetEneToKill(G4ParticleDefinition & particleType)
{
if (&particleType == G4Electron::ElectronDefinition() ||
&particleType == G4Positron::PositronDefinition())
return EEneToKill;
else return (-DBL_MAX);
}
@@ -0,0 +1,346 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//E.Barberio & Joanna Weng
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Gamma.hh"
#include "G4NeutrinoE.hh"
#include "G4NeutrinoMu.hh"
#include "G4NeutrinoTau.hh"
#include "G4AntiNeutrinoE.hh"
#include "G4AntiNeutrinoMu.hh"
#include "G4AntiNeutrinoTau.hh"
#include "G4PionZero.hh"
#include "G4VProcess.hh"
#include "G4ios.hh"
#include "G4LogicalVolume.hh"
#include "geomdefs.hh"
#include "GFlashShowerModel.hh"
#include "GFlashHomoShowerParamterisation.hh"
#include "GFlashEnergySpot.hh"
GFlashShowerModel::GFlashShowerModel(G4String modelName, G4LogicalVolume* envelope)
: G4VFastSimulationModel(modelName, envelope)
{
FlagParamType = 0;
FlagParticleContainment = 1;
StepInX0 = 0.1;
Messenger = new GFlashShowerModelMessenger(this);
}
GFlashShowerModel::GFlashShowerModel(G4String modelName)
: G4VFastSimulationModel(modelName)
{
FlagParamType =1;
FlagParticleContainment = 1;
StepInX0 = 0.1;
Messenger = new GFlashShowerModelMessenger(this);
}
GFlashShowerModel::~GFlashShowerModel()
{
Messenger = new GFlashShowerModelMessenger(this);
}
G4bool GFlashShowerModel::IsApplicable(const G4ParticleDefinition& particleType)
{
return
&particleType == G4Electron::ElectronDefinition() ||
&particleType == G4Positron::PositronDefinition();
}
/*********************************************************************/
/* Checks whether conditions of fast parametrisation are fullfilled */
/**********************************************************************/
G4bool GFlashShowerModel::ModelTrigger(const G4FastTrack & fastTrack )
{
G4bool select = false;
if(FlagParamType != 0)
{
G4double ParticleEnergy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
G4ParticleDefinition &ParticleType = *(fastTrack.GetPrimaryTrack()->GetDefinition());
if(ParticleEnergy > PBound->GetMinEneToParametrise(ParticleType) ||
ParticleEnergy < PBound->GetMaxEneToParametrise(ParticleType) )
{
///check conditions depending on particle flavour
Parametrisation->GenerateLongitudinalProfile(ParticleEnergy); // performance to be optimized @@@@@@@
select = CheckParticleDefAndContainment(fastTrack);
if (select) EnergyStop= PBound->GetEneToKill(ParticleType);
}
}
return select;
}
G4bool GFlashShowerModel::CheckParticleDefAndContainment(const G4FastTrack& fastTrack)
{
G4bool filter=false;
G4ParticleDefinition * ParticleType = fastTrack.GetPrimaryTrack()->GetDefinition();
if( ParticleType == G4Electron::ElectronDefinition() ||
ParticleType == G4Positron::PositronDefinition() )
{
filter=true;
if(FlagParticleContainment == 1)
{
filter=CheckContainment(fastTrack);
}
}
return filter;
}
G4bool GFlashShowerModel::CheckContainment(const G4FastTrack& fastTrack)
{
//Note: typedef Hep3Vector G4ThreeVector;
G4bool filter=false;
//track informations
G4ThreeVector DirectionShower = fastTrack.GetPrimaryTrackLocalDirection();
G4ThreeVector InitialPositionShower = fastTrack.GetPrimaryTrackLocalPosition();
G4ThreeVector OrthoShower, CrossShower;
//Returns orthogonal vector
OrthoShower = DirectionShower.orthogonal();
// Shower in direction perpendicular to OrthoShower and DirectionShower
CrossShower = DirectionShower.cross(OrthoShower);
G4double R = Parametrisation->GetAveR90();
G4double Z = Parametrisation->GetAveT90();
G4int CosPhi[4] = {1,0,-1,0};
G4int SinPhi[4] = {0,1,0,-1};
G4ThreeVector Position;
G4int NlateralInside=0;
//pointer to soild we're in
G4VSolid *SolidCalo = fastTrack.GetEnvelopeSolid();
for(int i=0; i<4 ;i++)
{
// polar coordinates
Position = InitialPositionShower +
Z*DirectionShower +
R*CosPhi[i]*OrthoShower +
R*SinPhi[i]*CrossShower ;
if(SolidCalo->Inside(Position) != kOutside)
NlateralInside=NlateralInside++;
}
//chose to parametrise or flag when all inetc...
if(NlateralInside==4) filter=true;
// std::cout << " points = " <<NlateralInside << std::endl;
return filter;
}
void GFlashShowerModel::DoIt(const G4FastTrack& fastTrack, G4FastStep& fastStep)
{
// parametrise electrons
if(fastTrack.GetPrimaryTrack()->GetDefinition() == G4Electron::ElectronDefinition() ||
fastTrack.GetPrimaryTrack()->GetDefinition() == G4Positron::PositronDefinition() )
ElectronDoIt(fastTrack,fastStep);
}
void GFlashShowerModel::ElectronDoIt(const G4FastTrack& fastTrack, G4FastStep& fastStep)
{
// std::cout<<"--- ElectronDoit --- "<<std::endl;
fastStep.KillPrimaryTrack();
fastStep.SetPrimaryTrackPathLength(0.0);
fastStep.SetTotalEnergyDeposited(fastTrack.GetPrimaryTrack()->GetKineticEnergy());
//-----------------------------
// Get track parameters
//-----------------------------
//E,vect{p} and t,vec(x)
G4double Energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
// axis of the shower, in global reference frame:
G4ThreeVector DirectionShower = fastTrack.GetPrimaryTrack()->GetMomentumDirection();
G4ThreeVector OrthoShower, CrossShower;
OrthoShower = DirectionShower.orthogonal();
CrossShower = DirectionShower.cross(OrthoShower);
//--------------------------------
///Generate longitudinal profile
//--------------------------------
Parametrisation->GenerateLongitudinalProfile(Energy); // performane iteration @@@@@@@
///Initialisation of long. loop variables
G4VSolid *SolidCalo = fastTrack.GetEnvelopeSolid();
G4ThreeVector pos = fastTrack.GetPrimaryTrackLocalPosition();
G4ThreeVector dir = fastTrack.GetPrimaryTrackLocalDirection();
G4double Bound = SolidCalo->DistanceToOut(pos,dir);
G4double Dz = 0.00;
G4double ZEndStep = 0.00;
G4double EnergyNow = Energy;
G4double EneIntegral = 0.00;
G4double LastEneIntegral = 0.00;
G4double DEne = 0.00;
G4double NspIntegral = 0.00;
G4double LastNspIntegral = 0.00;
G4double DNsp = 0.00;
// starting point of the shower:
G4ThreeVector PositionShower = fastTrack.GetPrimaryTrack()->GetPosition();
G4ThreeVector NewPositionShower = PositionShower;
G4double StepLenght = 0.00;
G4int NSpotDeposited =0;
//--------------------------
/// Begin Longitudinal Loop
//-------------------------
do
{
//determine step size=min(1Xo,next boundary)
G4double stepLength = StepInX0*Parametrisation->GetX0();
if(Bound < stepLength)
{
Dz = Bound;
Bound = 0.00;
}
else
{
Dz = stepLength;
Bound = Bound-Dz;
}
ZEndStep=ZEndStep+Dz;
// Determine Energy Release in Step
if(EnergyNow > EnergyStop)
{
LastEneIntegral = EneIntegral;
EneIntegral = Parametrisation->IntegrateEneLongitudinal(ZEndStep);
DEne = std::min( EnergyNow, (EneIntegral-LastEneIntegral)*Energy);
LastNspIntegral = NspIntegral;
NspIntegral = Parametrisation->IntegrateNspLongitudinal(ZEndStep);
DNsp = std::max(1., std::floor( (NspIntegral-LastNspIntegral)*Parametrisation->GetNspot() ) );
}
// end of the shower
else
{
DEne = EnergyNow;
DNsp = std::max(1., std::floor( (1.- NspIntegral)*Parametrisation->GetNspot() ));
}
EnergyNow = EnergyNow - DEne;
// apply sampling fluctuation
// G4double DEneSampling = Parametrisation->ApplySampling(DEne,Energy);
//move particle in the middle of the step
StepLenght = StepLenght + Dz/2.00;
NewPositionShower = NewPositionShower +
StepLenght*DirectionShower;
StepLenght = Dz/2.00;
//generate spots & hits:
for (int i = 0; i < DNsp; i++)
{
NSpotDeposited=NSpotDeposited++;
GFlashEnergySpot Spot;
//Spot energy: the same for all spots
Spot.SetEnergy( DEne / DNsp );
G4double PhiSpot = Parametrisation->GeneratePhi(); // phi of spot
G4double RSpot = Parametrisation->GenerateRadius(i,Energy,ZEndStep-Dz/2.); // radius of spot
///check reference-> may be need to introduce rot matrix @@@
//Position: equally spaced in z
G4ThreeVector SpotPosition = NewPositionShower +
Dz/DNsp*DirectionShower*(i+1/2.-DNsp/2.) +
RSpot*std::cos(PhiSpot)*OrthoShower +
RSpot*std::sin(PhiSpot)*CrossShower;
Spot.SetPosition(SpotPosition);
//Generate Hits of this spot
HMaker->make(&Spot, &fastTrack);
}
}
while(EnergyNow > 0.0 && Bound> 0.0);
//---------------
/// End Loop
//-------------
}
/* void GFlashShowerModel::GammaDoIt(const G4FastTrack& fastTrack, G4FastStep& fastStep)
{
if( fastTrack.GetPrimaryTrack()->GetKineticEnergy() > EnergyStop )
return;
//deposita in uno spot unico l'energia
//con andamento exp decrescente.
// Kill the particle to be parametrised
fastStep.KillPrimaryTrack();
fastStep.SetPrimaryTrackPathLength(0.0);
fastStep.SetTotalEnergyDeposited(fastTrack.GetPrimaryTrack()->GetKineticEnergy());
//other settings????
feSpotList.clear();
//-----------------------------
// Get track parameters
//-----------------------------
//E,vect{p} and t,vec(x)
G4double Energy =
fastTrack.GetPrimaryTrack()->GetKineticEnergy();
// axis of the shower, in global reference frame:
G4ThreeVector DirectionShower
= fastTrack.GetPrimaryTrack()->GetMomentumDirection();
// starting point of the shower:
G4ThreeVector PositionShower
= fastTrack.GetPrimaryTrack()->GetPosition();
//G4double DEneSampling = Parametrisation->ApplySampling(Energy,Energy);
//if(DEneSampling <= 0.00) DEneSampling=Energy;
if(Energy > 0.0)
{
G4double dist = Parametrisation->GenerateExponential(Energy);
GFlashEnergySpot Spot;
Spot.SetEnergy( Energy );
G4ThreeVector SpotPosition = PositionShower + dist*DirectionShower;
Spot.SetPosition(SpotPosition);
// Record the Spot:
feSpotList.push_back(Spot);
//Generate Hits of this spot
HMaker->make(Spot);
}
}
*/
@@ -0,0 +1,156 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Created by Joanna Weng, 9.11.04
#include "GFlashShowerModelMessenger.hh"
#include "GFlashShowerModel.hh"
#include "GFlashParticleBounds.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "globals.hh"
#include <iomanip>
#include <strstream>
GFlashShowerModelMessenger::GFlashShowerModelMessenger(GFlashShowerModel * myModel)
{
myParaDir = new G4UIdirectory("/GFlash/");
myParaDir->SetGuidance("Parametrisation control.");
this->myModel= myModel;
FlagCmd = new G4UIcmdWithAnInteger("/GFlash/flag",this);
FlagCmd->SetGuidance("Defines if GFlash is activated");
FlagCmd->SetParameterName("flag",false,false);
ContCmd = new G4UIcmdWithAnInteger("/GFlash/containment ",this);
ContCmd->SetGuidance("Defines if Containment is checked");
ContCmd->SetParameterName("flag",false,false);
StepInX0Cmd = new G4UIcmdWithADouble("/GFlash/stepXo",this);
StepInX0Cmd->SetGuidance("Defines step lenghts");
StepInX0Cmd->SetParameterName("flag",false,false);
EminCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emin",this);
EminCmd->SetGuidance("Set minimum kinetic energy to trigger parametrisation");
EminCmd->SetParameterName("Emin",false,false);
EminCmd->SetDefaultUnit("GeV");
EminCmd->SetUnitCategory("Energy");
EminCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
EmaxCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emax",this);
EmaxCmd->SetGuidance("Set maximum kinetic energy to trigger parametrisation");
EmaxCmd->SetParameterName("Emax",false,false);
EmaxCmd->SetDefaultUnit("GeV");
EmaxCmd->SetUnitCategory("Energy");
EmaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
EkillCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Ekill",this);
EkillCmd->SetGuidance("Set maximum kinetic energy for electrons to be killed");
EkillCmd->SetParameterName("Ekill",false,false);
EkillCmd->SetDefaultUnit("GeV");
EkillCmd->SetUnitCategory("Energy");
EkillCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
GFlashShowerModelMessenger::~GFlashShowerModelMessenger()
{
delete ContCmd;
delete FlagCmd;
delete StepInX0Cmd;
delete EminCmd;
delete EmaxCmd;
delete EkillCmd;
}
void GFlashShowerModelMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
{
if( command == FlagCmd ) {
myModel->SetFlagParamType(FlagCmd->GetNewIntValue(newValues));
this->GetCurrentValue(command);
}
if( command == ContCmd ) {
myModel->SetFlagParticleContainment(ContCmd->GetNewIntValue(newValues));
this->GetCurrentValue(command);
}
if( command == StepInX0Cmd ) {
myModel->SetStepInX0(StepInX0Cmd->GetNewDoubleValue(newValues));
this->GetCurrentValue(command);
}
else if( command == EminCmd ) {
myModel->PBound->SetMinEneToParametrise(*G4Electron::ElectronDefinition() ,EminCmd->GetNewDoubleValue(newValues));
this->GetCurrentValue(command);
}
else if( command == EmaxCmd ) {
myModel->PBound->SetMaxEneToParametrise(*G4Electron::ElectronDefinition(), EmaxCmd->GetNewDoubleValue(newValues));
this->GetCurrentValue(command);
}
else if( command == EkillCmd ) {
myModel->PBound->SetEneToKill(*G4Electron::ElectronDefinition(), EkillCmd->GetNewDoubleValue(newValues));
this->GetCurrentValue(command);
}
}
G4String GFlashShowerModelMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String returnValue('\0');
char line[255];
std::ostrstream os(line,255);
if( command == FlagCmd ) {
os <<"/GFlash/flag " << myModel->GetFlagParamType() << '\0';
returnValue = G4String(line);
}
else if( command == EkillCmd ) {
os <<"/GFlash/Ekill "<< myModel->PBound->GetEneToKill(*G4Electron::ElectronDefinition())/GeV << " GeV" << '\0';
returnValue = G4String(line);
}
else if( command == EminCmd ) {
os <<"/GFlash/Emin "<< myModel->PBound->GetMinEneToParametrise(*G4Electron::ElectronDefinition())/GeV << " GeV" << '\0';
returnValue = G4String(line);
}
else if( command == EmaxCmd ) {
os <<"/GFlash/Emax " <<myModel->PBound->GetMaxEneToParametrise(*G4Electron::ElectronDefinition())/GeV << " GeV" << '\0';
returnValue = G4String(line);
}
return returnValue;
}
@@ -0,0 +1,170 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include <math.h>
#include <string.h>
#include "Gamma.hh"
MyGamma::MyGamma(){}
MyGamma::~MyGamma(){}
//______________________________________________________________________________
double MyGamma::Gamma(double z)
{
// Computation of gamma(z) for all z>0.
//
// The algorithm is based on the article by C.Lanczos [1] as denoted in
// Numerical Recipes 2nd ed. on p. 207 (W.H.Press et al.).
//
// [1] C.Lanczos, SIAM Journal of Numerical Analysis B1 (1964), 86.
//
//--- Nve 14-nov-1998 UU-SAP Utrecht
if (z<=0) return 0;
double v = LnGamma(z);
return std::exp(v);
}
//______________________________________________________________________________
double MyGamma::Gamma(double a,double x)
{ // Computation of the incomplete gamma function P(a,x)
//
// The algorithm is based on the formulas and code as denoted in
// Numerical Recipes 2nd ed. on p. 210-212 (W.H.Press et al.).
//
//--- Nve 14-nov-1998 UU-SAP Utrecht
if (a <= 0 || x <= 0) return 0;
if (x < (a+1)) return GamSer(a,x);
else return GamCf(a,x);
}
//______________________________________________________________________________
double MyGamma::GamCf(double a,double x)
{
// Computation of the incomplete gamma function P(a,x)
// via its continued fraction representation.
//
// The algorithm is based on the formulas and code as denoted in
// Numerical Recipes 2nd ed. on p. 210-212 (W.H.Press et al.).
//
//--- Nve 14-nov-1998 UU-SAP Utrecht
int itmax = 100; // Maximum number of iterations
double eps = 3.e-7; // Relative accuracy
double fpmin = 1.e-30; // Smallest double value allowed here
if (a <= 0 || x <= 0) return 0;
double gln = LnGamma(a);
double b = x+1-a;
double c = 1/fpmin;
double d = 1/b;
double h = d;
double an,del;
for (int i=1; i<=itmax; i++) {
an = double(-i)*(double(i)-a);
b += 2;
d = an*d+b;
if (Abs(d) < fpmin) d = fpmin;
c = b+an/c;
if (Abs(c) < fpmin) c = fpmin;
d = 1/d;
del = d*c;
h = h*del;
if (Abs(del-1) < eps) break;
//if (i==itmax) cout << "*GamCf(a,x)* a too large or itmax too small" << endl;
}
double v = Exp(-x+a*Log(x)-gln)*h;
return (1-v);
}
//______________________________________________________________________________
double MyGamma::GamSer(double a,double x)
{
// Computation of the incomplete gamma function P(a,x)
// via its series representation.
//
// The algorithm is based on the formulas and code as denoted in
// Numerical Recipes 2nd ed. on p. 210-212 (W.H.Press et al.).
//
//--- Nve 14-nov-1998 UU-SAP Utrecht
int itmax = 100; // Maximum number of iterations
double eps = 3.e-7; // Relative accuracy
if (a <= 0 || x <= 0) return 0;
double gln = LnGamma(a);
double ap = a;
double sum = 1/a;
double del = sum;
for (int n=1; n<=itmax; n++) {
ap += 1;
del = del*x/ap;
sum += del;
if (MyGamma::Abs(del) < Abs(sum*eps)) break;
//if (n==itmax) cout << "*GamSer(a,x)* a too large or itmax too small" << endl;
}
double v = sum*Exp(-x+a*Log(x)-gln);
return v;
}
double MyGamma::LnGamma(double z)
{
// Computation of ln[gamma(z)] for all z>0.
//
// The algorithm is based on the article by C.Lanczos [1] as denoted in
// Numerical Recipes 2nd ed. on p. 207 (W.H.Press et al.).
//
// [1] C.Lanczos, SIAM Journal of Numerical Analysis B1 (1964), 86.
//
// The accuracy of the result is better than 2e-10.
//
//--- Nve 14-nov-1998 UU-SAP Utrecht
if (z<=0) return 0;
// Coefficients for the series expansion
double c[7] = { 2.5066282746310005, 76.18009172947146, -86.50532032941677
,24.01409824083091, -1.231739572450155, 0.1208650973866179e-2
,-0.5395239384953e-5};
double x = z;
double y = x;
double tmp = x+5.5;
tmp = (x+0.5)*Log(tmp)-tmp;
double ser = 1.000000000190015;
for (int i=1; i<7; i++) {
y += 1;
ser += c[i]/y;
}
double v = tmp+Log(c[0]*ser/x);
return v;
}
@@ -0,0 +1,36 @@
# $Id: GNUmakefile,v 1.4 2004/12/15 08:44:55 gcosmo Exp $
# ---------------------------------------------------------------
# GNUmakefile for trd_models library. G.Cosmo, 14/11/2000
# ---------------------------------------------------------------
name := G4trdmodels
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/navigation/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/processes/parameterisation/include \
-I$(G4BASE)/processes/electromagnetic/standard/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/hadrons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/digits_hits/detector/include \
-I$(G4BASE)/digits_hits/hits/include
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,80 @@
$Id: History,v 1.3 2004/11/30 10:29:33 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Nov 30th, 2004 G.Cosmo (trdmodels-V06-02-01)
----------------------
- Removed unnecessary inclusion of G4PAIonisation.hh from G4VClusterModel
and G4PhotoClusterModel.
Nov 26th, 2004 H.P.Wellisch (trdmodels-V06-02-00)
---------------------------
- Moved to submodule.
Jun 7th, 2004 G.Cosmo (parmodels-V06-01-00)
---------------------
- GNUmakefile: added definition of GLOBLIBS for DLLs support on Windows.
Oct 4th, 2003 G.Cosmo (parmodels-V05-02-01)
---------------------
- GNUmakefile:
o replaced "digits+hits" with "digits_hits".
o added dependency to new module "geometry/navigation".
- Coworks with "geometry-V05-02-00" and "digits_hits-V05-02-00".
Sep 25th, 2003 H.Kurashige (parmodels-V05-02-00)
--------------------------
- Modify GNUmakefile to use processes/cuts category
May 21st, 2003 G.Cosmo - (parmodels-V05-01-00)
----------------------
- Fixed pedantic warnings in G4IrregularXrayTRmodel.cc and G4VXrayTRmodel.cc.
Feb 12th, 2003 G.Cosmo - (parmodels-V05-00-01)
----------------------
- Replaced call to RandPoisson::shoot() with G4Poisson(), more performant.
Affected files: G4IrregularXrayTRmodel.cc, G4VXTRdEdx.cc, G4VXrayTRadModel.cc.
Jan 23rd, 2003 G.Cosmo - (parmodels-V05-00-00)
----------------------
- Updated header files to remove redundant header inclusions
and properly order inclusion for complex numbers, to allow
porting on Windows .NET VC++ compiler.
Nov 8th, 2001 M.Verderi - (parmodels-V03-02-02)
-----------------------
- Minor change in G4VClusterModel.cc
Nov 8th, 2001 G.Cosmo - (parmodels-V03-02-01)
---------------------
- Introduced changes in G4VClusterModel[.hh.cc] for reference-counted
touchables (R.Chytracek).
Sep 18th, 2001 V.Grichine - (parmodels-V03-02-00)
-------------------------
- Added new classes describing X-ray transition radiation generation
inside radiators (i.e. just along incident particle track):
G4FoamXTRdEdx[.hh.cc], G4GamDistrXTRdEdx[.hh.cc], G4IrregularXTRdEdx[.hh.cc],
G4PlateIrrGasXTRdEdx[.hh.cc], G4RegularXTRdEdx[.hh.cc], G4VXTRdEdx[.hh.cc]
and G4VXrayTRadModel[.hh.cc]
- Modifications in existing classes, introducing some new parameters,
class fields and methods.
Nov 14th, 2000 G.Cosmo - (parmodels-V02-00-00)
----------------------
- Created.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FoamXTRdEdx.hh,v 1.3 2003/01/23 11:30:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4FoamXTRdEdx.hh,v 1.1 2004/11/09 09:20:31 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FoamXrayTRmodel.hh,v 1.4 2003/01/23 11:30:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4FoamXrayTRmodel.hh,v 1.1 2004/11/09 09:20:31 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GamDistrXTRdEdx.hh,v 1.3 2003/01/23 11:30:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4GamDistrXTRdEdx.hh,v 1.2 2004/12/07 09:00:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -31,7 +31,7 @@
// Thicknesses of plates and gas gaps are distributed according to gamma
// distribution. x are thicknesses of plates or gas gaps:
//
// p(x) = (alpha/<x>)^alpha * x^(alpha-1) * exp(-alpha*x/<x>) / G(alpha)
// p(x) = (alpha/<x>)^alpha * x^(alpha-1) * std::exp(-alpha*x/<x>) / G(alpha)
//
// G(alpha) is Euler's gamma function.
// Plates have mean <x> = fPlateThick > 0 and power alpha = fAlphaPlate > 0 :
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GamDistrXrayTRmodel.hh,v 1.4 2003/01/23 11:30:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4GamDistrXrayTRmodel.hh,v 1.2 2004/12/07 09:00:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -31,7 +31,7 @@
// Thicknesses of plates and gas gaps are distributed according to gamma
// distribution. x are thicknesses of plates or gas gaps:
//
// p(x) = (alpha/<x>)^alpha * x^(alpha-1) * exp(-alpha*x/<x>) / G(alpha)
// p(x) = (alpha/<x>)^alpha * x^(alpha-1) * std::exp(-alpha*x/<x>) / G(alpha)
//
// G(alpha) is Euler's gamma function.
// Plates have mean <x> = fPlateThick > 0 and power alpha = fAlphaPlate > 0 :
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4IrregularXTRdEdx.hh,v 1.3 2003/01/23 11:30:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4IrregularXTRdEdx.hh,v 1.1 2004/11/09 09:20:32 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4IrregularXrayTRmodel.hh,v 1.4 2003/01/23 11:30:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4IrregularXrayTRmodel.hh,v 1.1 2004/11/09 09:20:32 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PAIclusterModel.hh,v 1.4 2003/01/23 11:30:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PAIclusterModel.hh,v 1.2 2004/11/10 10:03:12 grichine Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -41,7 +41,7 @@
#include "globals.hh"
#include "G4PAIonisation.hh"
#include "G4PAIModel.hh"
#include "G4VClusterModel.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
@@ -67,7 +67,7 @@ public:
private:
G4PAIonisation* fPAIonisation ;
G4PAIModel* fPAIonisation ;
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhotoClusterModel.hh,v 1.4 2003/01/23 11:30:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PhotoClusterModel.hh,v 1.2 2004/11/30 10:27:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -41,7 +41,6 @@
#include "globals.hh"
#include "G4PAIonisation.hh"
#include "G4VClusterModel.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PlateIrrGasXTRdEdx.hh,v 1.3 2003/01/23 11:30:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PlateIrrGasXTRdEdx.hh,v 1.1 2004/11/09 09:20:32 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PlateIrrGasXrayTRmodel.hh,v 1.4 2003/01/23 11:30:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PlateIrrGasXrayTRmodel.hh,v 1.1 2004/11/09 09:20:32 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4RegularXTRdEdx.hh,v 1.3 2003/01/23 11:30:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4RegularXTRdEdx.hh,v 1.1 2004/11/09 09:20:32 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4RegularXrayTRmodel.hh,v 1.4 2003/01/23 11:30:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4RegularXrayTRmodel.hh,v 1.1 2004/11/09 09:20:32 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VClusterModel.hh,v 1.6 2003/06/16 16:56:29 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4VClusterModel.hh,v 1.2 2004/11/30 10:27:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -42,7 +42,6 @@
#include "globals.hh"
#include <vector>
#include "G4PAIonisation.hh"
#include "G4VFastSimulationModel.hh"
#include "G4Step.hh"
#include "G4TouchableHandle.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VXTRdEdx.hh,v 1.7 2003/06/16 16:56:30 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4VXTRdEdx.hh,v 1.1 2004/11/09 09:20:33 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VXrayTRadModel.hh,v 1.4 2003/06/16 16:56:31 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4VXrayTRadModel.hh,v 1.1 2004/11/09 09:20:34 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VXrayTRmodel.hh,v 1.5 2003/06/16 16:56:32 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4VXrayTRmodel.hh,v 1.1 2004/11/09 09:20:34 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
///////////////////////////////////////////////////////////////////////////
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FoamXTRdEdx.cc,v 1.4 2003/06/16 16:56:33 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4FoamXTRdEdx.cc,v 1.1 2004/11/09 09:20:34 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include <complex>
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FoamXrayTRmodel.cc,v 1.4 2003/06/16 16:56:34 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4FoamXrayTRmodel.cc,v 1.2 2004/12/07 09:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
#include <complex>
@@ -92,9 +92,9 @@ G4FoamXrayTRmodel::GetStackFactor( G4double energy,
G4complex F2 = (1.0-Ha)*(Qa-Ha)*Hb/(1.0-H)/(Q-H) ;
F2 *= pow(Q,G4double(fPlateNumber)) - std::pow(H,fPlateNumber) ;
F2 *= std::pow(Q,G4double(fPlateNumber)) - std::pow(H,fPlateNumber) ;
result = ( 1 - pow(Q,G4double(fPlateNumber)) )/( 1 - Q ) ;
result = ( 1 - std::pow(Q,G4double(fPlateNumber)) )/( 1 - Q ) ;
result *= 2.0*std::real(F1) ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GamDistrXTRdEdx.cc,v 1.4 2003/06/16 16:56:35 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4GamDistrXTRdEdx.cc,v 1.1 2004/11/09 09:20:34 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include <complex>
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GamDistrXrayTRmodel.cc,v 1.4 2003/06/16 16:56:36 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4GamDistrXrayTRmodel.cc,v 1.2 2004/12/07 09:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
#include <complex>
@@ -83,9 +83,9 @@ G4GamDistrXrayTRmodel::GetStackFactor( G4double energy,
Mb = GetGasLinearPhotoAbs(energy) ;
Qa = ( 1.0 + fPlateThick*Ma/fAlphaPlate ) ;
Qa = pow(Qa,-fAlphaPlate) ;
Qa = std::pow(Qa,-fAlphaPlate) ;
Qb = ( 1.0 + fGasThick*Mb/fAlphaGas ) ;
Qb = pow(Qb,-fAlphaGas) ;
Qb = std::pow(Qb,-fAlphaGas) ;
Q = Qa*Qb ;
G4complex Ca(1.0+0.5*fPlateThick*Ma/fAlphaPlate,fPlateThick/Za/fAlphaPlate) ;
@@ -99,9 +99,9 @@ G4GamDistrXrayTRmodel::GetStackFactor( G4double energy,
G4complex F2 = (1.0-Ha)*(Qa-Ha)*Hb/(1.0-H)/(Q-H) ;
F2 *= pow(Q,G4double(fPlateNumber)) - std::pow(H,fPlateNumber) ;
F2 *= std::pow(Q,G4double(fPlateNumber)) - std::pow(H,fPlateNumber) ;
result = ( 1 - pow(Q,G4double(fPlateNumber)) )/( 1 - Q ) ;
result = ( 1 - std::pow(Q,G4double(fPlateNumber)) )/( 1 - Q ) ;
result *= 2.0*std::real(F1) ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4IrregularXTRdEdx.cc,v 1.4 2003/06/16 16:56:37 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4IrregularXTRdEdx.cc,v 1.1 2004/11/09 09:20:34 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4IrregularXrayTRmodel.cc,v 1.6 2003/05/21 16:39:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4IrregularXrayTRmodel.cc,v 1.2 2004/12/07 09:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
@@ -162,7 +162,7 @@ void G4IrregularXrayTRmodel::DoIt( const G4FastTrack& fastTrack ,
sumEnergyTR += energyTR ;
theta = abs(G4RandGauss::shoot(0.0,pi/gamma)) ;
theta = std::abs(G4RandGauss::shoot(0.0,pi/gamma)) ;
if( theta >= 0.1 ) theta = 0.1 ;
@@ -170,9 +170,9 @@ void G4IrregularXrayTRmodel::DoIt( const G4FastTrack& fastTrack ,
phi = twopi*G4UniformRand() ;
dirX = sin(theta)*cos(phi) ;
dirY = sin(theta)*sin(phi) ;
dirZ = cos(theta) ;
dirX = std::sin(theta)*std::cos(phi) ;
dirY = std::sin(theta)*std::sin(phi) ;
dirZ = std::cos(theta) ;
G4ThreeVector directionTR(dirX,dirY,dirZ) ;
directionTR.rotateUz(particleDir) ;
@@ -223,7 +223,7 @@ G4IrregularXrayTRmodel::GetStackFactor( G4double energy, G4double, G4double )
factor = plateFactor*gasFactor ;
result = ( 1 - pow(factor,G4double(fPlateNumber)) )/( 1 - factor ) ;
result = ( 1 - std::pow(factor,G4double(fPlateNumber)) )/( 1 - factor ) ;
result *= 1 + plateFactor ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PAIclusterModel.cc,v 1.6 2001/09/18 09:30:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PAIclusterModel.cc,v 1.2 2004/11/10 10:03:12 grichine Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4Timer.hh"
@@ -33,6 +33,7 @@
#include "G4MaterialTable.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Gamma.hh"
@@ -48,7 +49,10 @@
G4PAIclusterModel::G4PAIclusterModel(G4Envelope *anEnvelope) :
G4VClusterModel("G4PAIclusterModel",anEnvelope)
{
fPAIonisation = new G4PAIonisation(anEnvelope->GetMaterial()->GetName()) ;
const G4ParticleDefinition* theElectron = G4Electron::Electron();
G4DataVector data;
fPAIonisation = new G4PAIModel(theElectron,"PAIclusterModel");
fPAIonisation->Initialise(theElectron,data);
}
///////////////////////////////////////////////////////////////////////////
@@ -125,7 +129,7 @@ void G4PAIclusterModel::DoIt( const G4FastTrack& fastTrack ,
// Cluster counting loop
lambda = fPAIonisation->GetFreePath( scaledTkin, charge2 ) ;
lambda = 1*mm;// fPAIonisation->GetFreePath( scaledTkin, charge2 ) ;
step = RandExponential::shoot(lambda) ;
// if (step < 0.0) step = 0.0 ;
stepSum += step ;
@@ -149,7 +153,7 @@ void G4PAIclusterModel::DoIt( const G4FastTrack& fastTrack ,
// stepSum*direction ;
clusterPosition = globalStartPosition + stepSum*globalDirection ;
energyTransfer = fPAIonisation->GetRandomEnergyTransfer(scaledTkin) ;
energyTransfer = fPAIonisation->GetPostStepTransfer(scaledTkin) ;
fClusterPositionVector.push_back(clusterPosition) ;
fClusterEnergyVector.push_back(energyTransfer) ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhotoClusterModel.cc,v 1.3 2001/09/18 09:30:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $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"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PlateIrrGasXTRdEdx.cc,v 1.4 2003/06/16 16:56:38 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PlateIrrGasXTRdEdx.cc,v 1.2 2004/12/07 09:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
#include <complex>
@@ -80,8 +80,8 @@ G4PlateIrrGasXTRdEdx::GetStackFactor( G4double energy,
// G4complex Ca(1.0+0.5*fPlateThick*Ma,fPlateThick/Za) ;
G4complex Ha( exp(-0.5*fPlateThick*Ma)*cos(fPlateThick/Za),
-exp(-0.5*fPlateThick*Ma)*sin(fPlateThick/Za) ) ;
G4complex Ha( std::exp(-0.5*fPlateThick*Ma)*std::cos(fPlateThick/Za),
-std::exp(-0.5*fPlateThick*Ma)*std::sin(fPlateThick/Za) ) ;
G4complex R = (1.0 - Ha) ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PlateIrrGasXrayTRmodel.cc,v 1.5 2003/06/16 16:56:39 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PlateIrrGasXrayTRmodel.cc,v 1.2 2004/12/07 09:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
#include <complex>
@@ -77,8 +77,8 @@ G4PlateIrrGasXrayTRmodel::GetStackFactor( G4double energy,
Ma = GetPlateLinearPhotoAbs(energy) ;
Mb = GetGasLinearPhotoAbs(energy) ;
Qa = exp(-fPlateThick*Ma) ;
Qb = exp(-fGasThick*Mb) ;
Qa = std::exp(-fPlateThick*Ma) ;
Qb = std::exp(-fGasThick*Mb) ;
Q = Qa*Qb ;
/* *****************************************************
@@ -86,20 +86,20 @@ G4PlateIrrGasXrayTRmodel::GetStackFactor( G4double energy,
// G4complex Ca(1.0+0.5*fPlateThick*Ma,fPlateThick/Za) ;
// G4complex Cb(1.0+0.5*fGasThick*Mb,fGasThick/Zb) ;
G4complex Ha( exp(-0.5*fPlateThick*Ma)*cos(fPlateThick/Za),
-exp(-0.5*fPlateThick*Ma)*sin(fPlateThick/Za) ) ;
G4complex Ha( std::exp(-0.5*fPlateThick*Ma)*std::cos(fPlateThick/Za),
-std::exp(-0.5*fPlateThick*Ma)*std::sin(fPlateThick/Za) ) ;
G4complex Hb( exp(-0.5*fGasThick*Mb)*cos(fGasThick/Zb),
-exp(-0.5*fGasThick*Mb)*sin(fGasThick/Za) ) ;
G4complex Hb( std::exp(-0.5*fGasThick*Mb)*std::cos(fGasThick/Zb),
-std::exp(-0.5*fGasThick*Mb)*std::sin(fGasThick/Za) ) ;
G4complex H = Ha*Hb ;
G4complex F1 = ( 0.5*(1+Qa)*(1+H) - Ha - Qa*Hb )/(1-H) ;
G4complex F2 = (1-Ha)*(Qa-Ha)*Hb/(1-H)/(Q-H) ;
F2 *= pow(Q,G4double(fPlateNumber)) - std::pow(H,fPlateNumber) ;
F2 *= std::pow(Q,G4double(fPlateNumber)) - std::pow(H,fPlateNumber) ;
result = ( 1 - pow(Q,G4double(fPlateNumber)) )/( 1 - Q ) ;
result = ( 1 - std::pow(Q,G4double(fPlateNumber)) )/( 1 - Q ) ;
result *= 2.0*std::real(F1) ;
@@ -107,9 +107,9 @@ G4PlateIrrGasXrayTRmodel::GetStackFactor( G4double energy,
***************************************************************** */
result = ( 1 - pow(Q,G4double(fPlateNumber)) )/( 1 - Q ) ;
result = ( 1 - std::pow(Q,G4double(fPlateNumber)) )/( 1 - Q ) ;
result *= 1 + Qa -2*sqrt(Qa)*cos(fPlateThick/Za) ;
result *= 1 + Qa -2*std::sqrt(Qa)*std::cos(fPlateThick/Za) ;
return result ;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4RegularXTRdEdx.cc,v 1.4 2003/06/16 16:56:40 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4RegularXTRdEdx.cc,v 1.2 2004/12/07 09:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
#include <complex>
@@ -77,22 +77,22 @@ G4RegularXTRdEdx::GetStackFactor( G4double energy,
aMa = fPlateThick*GetPlateLinearPhotoAbs(energy) ;
bMb = fGasThick*GetGasLinearPhotoAbs(energy) ;
Qa = exp(-aMa) ;
Qb = exp(-bMb) ;
Qa = std::exp(-aMa) ;
Qb = std::exp(-bMb) ;
Q = Qa*Qb ;
G4complex Ha( exp(-0.5*aMa)*cos(aZa),
-exp(-0.5*aMa)*sin(aZa) ) ;
G4complex Ha( std::exp(-0.5*aMa)*std::cos(aZa),
-std::exp(-0.5*aMa)*std::sin(aZa) ) ;
G4complex Hb( exp(-0.5*bMb)*cos(bZb),
-exp(-0.5*bMb)*sin(bZb) ) ;
G4complex Hb( std::exp(-0.5*bMb)*std::cos(bZb),
-std::exp(-0.5*bMb)*std::sin(bZb) ) ;
G4complex H = Ha*Hb ;
G4complex Hs = std::conj(H) ;
D = 1.0 /( (1 - sqrt(Q))*(1 - sqrt(Q)) +
4*sqrt(Q)*sin(0.5*(aZa+bZb))*sin(0.5*(aZa+bZb)) ) ;
D = 1.0 /( (1 - std::sqrt(Q))*(1 - std::sqrt(Q)) +
4*std::sqrt(Q)*std::sin(0.5*(aZa+bZb))*std::sin(0.5*(aZa+bZb)) ) ;
G4complex F1 = (1.0 - Ha)*(1.0 - Hb)*(1.0 - Hs)
* G4double(fPlateNumber)*D ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4RegularXrayTRmodel.cc,v 1.4 2003/06/16 16:56:41 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4RegularXrayTRmodel.cc,v 1.2 2004/12/07 09:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
#include <complex>
@@ -77,18 +77,18 @@ G4RegularXrayTRmodel::GetStackFactor( G4double energy,
aMa = fPlateThick*GetPlateLinearPhotoAbs(energy) ;
bMb = fGasThick*GetGasLinearPhotoAbs(energy) ;
Qa = exp(-aMa) ;
Qb = exp(-bMb) ;
Qa = std::exp(-aMa) ;
Qb = std::exp(-bMb) ;
Q = Qa*Qb ;
// G4complex Ca(1.0+0.5*fPlateThick*Ma,fPlateThick/Za) ;
// G4complex Cb(1.0+0.5*fGasThick*Mb,fGasThick/Zb) ;
G4complex Ha( exp(-0.5*aMa)*cos(aZa),
-exp(-0.5*aMa)*sin(aZa) ) ;
G4complex Ha( std::exp(-0.5*aMa)*std::cos(aZa),
-std::exp(-0.5*aMa)*std::sin(aZa) ) ;
G4complex Hb( exp(-0.5*bMb)*cos(bZb),
-exp(-0.5*bMb)*sin(bZb) ) ;
G4complex Hb( std::exp(-0.5*bMb)*std::cos(bZb),
-std::exp(-0.5*bMb)*std::sin(bZb) ) ;
G4complex H = Ha*Hb ;
@@ -98,22 +98,22 @@ G4RegularXrayTRmodel::GetStackFactor( G4double energy,
G4complex F2 = (1.0-Ha)*(Qa-Ha)*Hb*(1.0-Hs)*(Q-Hs) ;
F2 *= pow(Q,G4double(fPlateNumber)) - std::pow(H,fPlateNumber) ;
F2 *= std::pow(Q,G4double(fPlateNumber)) - std::pow(H,fPlateNumber) ;
result = ( 1 - pow(Q,G4double(fPlateNumber)) )/( 1 - Q ) ;
result = ( 1 - std::pow(Q,G4double(fPlateNumber)) )/( 1 - Q ) ;
result *= (1 - Qa)*(1 + Qa - 2*sqrt(Qa)*cos(aZa)) ;
result *= (1 - Qa)*(1 + Qa - 2*std::sqrt(Qa)*std::cos(aZa)) ;
result /= (1 - sqrt(Q))*(1 - sqrt(Q)) +
4*sqrt(Q)*sin(0.5*(aZa+bZb))*sin(0.5*(aZa+bZb)) ;
result /= (1 - std::sqrt(Q))*(1 - std::sqrt(Q)) +
4*std::sqrt(Q)*std::sin(0.5*(aZa+bZb))*std::sin(0.5*(aZa+bZb)) ;
I2 = 2.0*std::real(F2) ;
I2 /= (1 - sqrt(Q))*(1 - sqrt(Q)) +
4*sqrt(Q)*sin(0.5*(aZa+bZb))*sin(0.5*(aZa+bZb)) ;
I2 /= (1 - std::sqrt(Q))*(1 - std::sqrt(Q)) +
4*std::sqrt(Q)*std::sin(0.5*(aZa+bZb))*std::sin(0.5*(aZa+bZb)) ;
I2 /= Q*( (sqrt(Q)-cos(aZa+bZb))*(sqrt(Q)-cos(aZa+bZb)) +
sin(aZa+bZb)*sin(aZa+bZb) ) ;
I2 /= Q*( (std::sqrt(Q)-std::cos(aZa+bZb))*(std::sqrt(Q)-std::cos(aZa+bZb)) +
std::sin(aZa+bZb)*std::sin(aZa+bZb) ) ;
result += I2 ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VClusterModel.cc,v 1.6 2001/11/08 13:53:51 mverderi Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4VClusterModel.cc,v 1.1 2004/11/09 09:20:35 hpw Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4Timer.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VXTRdEdx.cc,v 1.9 2003/06/16 16:56:42 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4VXTRdEdx.cc,v 1.2 2004/12/07 09:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
#include "G4Timer.hh"
@@ -167,7 +167,7 @@ void G4VXTRdEdx::DoIt( const G4FastTrack& fastTrack ,
sumEnergyTR += energyTR ;
theta = abs(G4RandGauss::shoot(0.0,pi/gamma)) ;
theta = std::abs(G4RandGauss::shoot(0.0,pi/gamma)) ;
if( theta >= 0.1 ) theta = 0.1 ;
@@ -175,9 +175,9 @@ void G4VXTRdEdx::DoIt( const G4FastTrack& fastTrack ,
phi = twopi*G4UniformRand() ;
dirX = sin(theta)*cos(phi) ;
dirY = sin(theta)*sin(phi) ;
dirZ = cos(theta) ;
dirX = std::sin(theta)*std::cos(phi) ;
dirY = std::sin(theta)*std::sin(phi) ;
dirZ = std::cos(theta) ;
G4ThreeVector directionTR(dirX,dirY,dirZ) ;
directionTR.rotateUz(direction) ;
@@ -316,7 +316,7 @@ void G4VXTRdEdx::BuildAngleTable()
// charged particle crosses interface between two materials.
// The high energy small theta approximation is applied.
// (matter1 -> matter2, or 2->1)
// varAngle =2* (1 - cos(theta)) or approximately = theta*theta
// varAngle =2* (1 - std::cos(theta)) or approximately = theta*theta
//
G4complex G4VXTRdEdx::OneInterfaceXTRdEdx( G4double energy,
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VXrayTRadModel.cc,v 1.5 2003/06/16 16:56:43 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4VXrayTRadModel.cc,v 1.2 2004/12/07 09:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
#include "G4Timer.hh"
@@ -165,7 +165,7 @@ void G4VXrayTRadModel::DoIt( const G4FastTrack& fastTrack ,
sumEnergyTR += energyTR ;
theta = abs(G4RandGauss::shoot(0.0,pi/gamma)) ;
theta = std::abs(G4RandGauss::shoot(0.0,pi/gamma)) ;
if( theta >= 0.1 ) theta = 0.1 ;
@@ -173,9 +173,9 @@ void G4VXrayTRadModel::DoIt( const G4FastTrack& fastTrack ,
phi = twopi*G4UniformRand() ;
dirX = sin(theta)*cos(phi) ;
dirY = sin(theta)*sin(phi) ;
dirZ = cos(theta) ;
dirX = std::sin(theta)*std::cos(phi) ;
dirY = std::sin(theta)*std::sin(phi) ;
dirZ = std::cos(theta) ;
G4ThreeVector directionTR(dirX,dirY,dirZ) ;
directionTR.rotateUz(direction) ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VXrayTRmodel.cc,v 1.7 2003/06/16 16:56:44 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4VXrayTRmodel.cc,v 1.2 2004/12/07 09:00:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
#include "G4Timer.hh"
@@ -102,12 +102,12 @@ G4VXrayTRmodel::G4VXrayTRmodel(G4Envelope *anEnvelope, G4double a, G4double b) :
fSigma1 = fPlasmaCof*anEnvelope->GetDaughter(0)->GetLogicalVolume()->
GetMaterial()->GetElectronDensity() ;
// fSigma1 = (20.9*eV)*(20.9*eV) ;
G4cout<<"plate plasma energy = "<<sqrt(fSigma1)/eV<<" eV"<<G4endl ;
G4cout<<"plate plasma energy = "<<std::sqrt(fSigma1)/eV<<" eV"<<G4endl ;
// plasma energy squared for gas material
fSigma2 = fPlasmaCof*anEnvelope->GetMaterial()->GetElectronDensity() ;
G4cout<<"gas plasma energy = "<<sqrt(fSigma2)/eV<<" eV"<<G4endl ;
G4cout<<"gas plasma energy = "<<std::sqrt(fSigma2)/eV<<" eV"<<G4endl ;
// Compute cofs for preparation of linear photo absorption
@@ -543,7 +543,7 @@ void G4VXrayTRmodel::GetGasZmuProduct()
// charged particle crosses interface between two materials.
// The high energy small theta approximation is applied.
// (matter1 -> matter2, or 2->1)
// varAngle =2* (1 - cos(theta)) or approximately = theta*theta
// varAngle =2* (1 - std::cos(theta)) or approximately = theta*theta
//
G4double