Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Par02Smearer Class Reference

#include <Par02Smearer.hh>

Public Member Functions

G4ThreeVector SmearMomentum (const G4Track *aTrack, G4double aResolution=-1)
 
G4double SmearEnergy (const G4Track *aTrack, G4double aResolution=-1)
 
G4ThreeVector SmearGaussian (const G4Track *aTrackOriginal, G4double aResolution)
 
G4double Gauss (G4double aMean, G4double aStandardDeviation)
 

Static Public Member Functions

static Par02SmearerInstance ()
 

Protected Member Functions

 Par02Smearer ()
 A default constructor. More...
 
 ~Par02Smearer ()
 

Detailed Description

Smearing of the particle momentum or energy.

A singleton class used to smear (alter) the particle momentum (for tracking detectors) and energy (for calorimeters). In case the resolution is given, the momentum (energy) is smeared with Gaussian distribution.

Author
Anna Zaborowska

Definition at line 47 of file Par02Smearer.hh.

Constructor & Destructor Documentation

Par02Smearer::Par02Smearer ( )
protected

A default constructor.

Definition at line 47 of file Par02Smearer.cc.

47  {
48  time_t seed = time( NULL );
49  fRandomEngine = new CLHEP::HepJamesRandom( static_cast< long >( seed ) );
50  fRandomGauss = new CLHEP::RandGauss( fRandomEngine );
51 }
long seed
Definition: chem4.cc:68

Here is the caller graph for this function:

Par02Smearer::~Par02Smearer ( )
protected

Definition at line 55 of file Par02Smearer.cc.

55 {}

Member Function Documentation

G4double Par02Smearer::Gauss ( G4double  aMean,
G4double  aStandardDeviation 
)

Returns a random number from a Gaussian distribution.

Parameters
aMeanThe mean of the Gaussian distribution.
aStandardDeviationThe standard deviation of a Gaussian distribution.

Definition at line 103 of file Par02Smearer.cc.

103  {
104  return fRandomGauss->fire( aMean, aStandardDeviation );
105 }

Here is the call graph for this function:

Here is the caller graph for this function:

Par02Smearer * Par02Smearer::Instance ( void  )
static

Allows the access to the unique Par02Smearer class object.

Returns
A pointer to the Par02Smearer class.

Definition at line 59 of file Par02Smearer.cc.

59  {
60  if ( ! fPar02Smearer ) {
61  fPar02Smearer = new Par02Smearer();
62  }
63  return fPar02Smearer;
64 }
Par02Smearer()
A default constructor.
Definition: Par02Smearer.cc:47

Here is the call graph for this function:

Here is the caller graph for this function:

G4double Par02Smearer::SmearEnergy ( const G4Track aTrack,
G4double  aResolution = -1 
)

Smears the energy deposit with a given resolution.

Parameters
aTrackA track to smear.
aResolutionA resolution. Gaussian smearing is done with a given resolution as a standard deviation.

Definition at line 75 of file Par02Smearer.cc.

76  {
77  G4double newE = -1.0;
78  while ( newE < 0.0 ) { // To ensure that the resulting value is not negative
79  // (vital for energy smearing, does not change direction
80  // for momentum smearing)
81  if ( aResolution != -1.0 ) {
82  newE = aTrackOriginal->GetKineticEnergy() * Gauss( 1.0, aResolution );
83  } else {
84  newE = aTrackOriginal->GetKineticEnergy();
85  }
86  }
87  return newE;
88 }
double G4double
Definition: G4Types.hh:76
G4double Gauss(G4double aMean, G4double aStandardDeviation)

Here is the call graph for this function:

G4ThreeVector Par02Smearer::SmearGaussian ( const G4Track aTrackOriginal,
G4double  aResolution 
)

First possible type of smearing. Smears the momentum with a given resolution.

Parameters
aTrackOriginalA track to smear.
aResolutionA resolution taken as a standard deviation of a Gaussian distribution.

Definition at line 92 of file Par02Smearer.cc.

93  {
94  G4ThreeVector originP = aTrackOriginal->GetMomentum();
95  G4ThreeVector originPos = aTrackOriginal->GetPosition();
96  G4double rdm = Gauss( 1.0, aResolution );
97  G4ThreeVector smearedMom( originP.x()*rdm, originP.y()*rdm, originP.z()*rdm );
98  return smearedMom;
99 }
double x() const
const G4ThreeVector & GetPosition() const
double z() const
G4ThreeVector GetMomentum() const
double y() const
double G4double
Definition: G4Types.hh:76
G4double Gauss(G4double aMean, G4double aStandardDeviation)

Here is the call graph for this function:

Here is the caller graph for this function:

G4ThreeVector Par02Smearer::SmearMomentum ( const G4Track aTrack,
G4double  aResolution = -1 
)

Smears the momentum with a given resolution.

Parameters
aTrackA track to smear.
aResolutionA resolution. Gaussian smearing is done with a given resolution as a standard deviation.

Definition at line 68 of file Par02Smearer.cc.

69  {
70  return SmearGaussian( aTrackOriginal, aResolution );
71 }
G4ThreeVector SmearGaussian(const G4Track *aTrackOriginal, G4double aResolution)
Definition: Par02Smearer.cc:92

Here is the call graph for this function:


The documentation for this class was generated from the following files: