Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
Par02Smearer Class Reference

Smearing of the particle momentum or energy. More...

#include <Doxymodules_parameterisations.h>

Public Member Functions

G4ThreeVector SmearMomentum (const G4Track *aTrack, G4double aResolution=-1)
 Smears the momentum with a given resolution.
 
G4double SmearEnergy (const G4Track *aTrack, G4double aResolution=-1)
 Smears the energy deposit with a given resolution.
 
G4ThreeVector SmearGaussian (const G4Track *aTrackOriginal, G4double aResolution)
 First possible type of smearing.
 
G4double Gauss (G4double aMean, G4double aStandardDeviation)
 Returns a random number from a Gaussian distribution.
 

Static Public Member Functions

static Par02SmearerInstance ()
 Allows the access to the unique Par02Smearer class object.
 

Protected Member Functions

 Par02Smearer ()
 A default constructor.
 
 ~Par02Smearer ()
 

Private Attributes

CLHEP::HepRandomEnginefRandomEngine
 CLHEP random engine.
 
CLHEP::RandGaussfRandomGauss
 CLHEP random engine used in gaussian smearing.
 

Static Private Attributes

static Par02SmearerfPar02Smearer = nullptr
 A pointer to Par02Smearer object.
 

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 49 of file Doxymodules_parameterisations.h.

Constructor & Destructor Documentation

◆ Par02Smearer()

Par02Smearer::Par02Smearer ( )
protected

A default constructor.

Definition at line 46 of file Par02Smearer.cc.

46 {
47 time_t seed = time( NULL );
48 fRandomEngine = new CLHEP::HepJamesRandom( static_cast< long >( seed ) );
50}
CLHEP::RandGauss * fRandomGauss
CLHEP random engine used in gaussian smearing.
CLHEP::HepRandomEngine * fRandomEngine
CLHEP random engine.

◆ ~Par02Smearer()

Par02Smearer::~Par02Smearer ( )
protecteddefault

Member Function Documentation

◆ Instance()

Par02Smearer * Par02Smearer::Instance ( )
static

Allows the access to the unique Par02Smearer class object.

Returns
A pointer to the Par02Smearer class.

Definition at line 58 of file Par02Smearer.cc.

58 {
59 if ( ! fPar02Smearer ) {
61 }
62 return fPar02Smearer;
63}
static Par02Smearer * fPar02Smearer
A pointer to Par02Smearer object.
Par02Smearer()
A default constructor.

◆ SmearMomentum()

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 67 of file Par02Smearer.cc.

68 {
69 return SmearGaussian( aTrackOriginal, aResolution );
70}
G4ThreeVector SmearGaussian(const G4Track *aTrackOriginal, G4double aResolution)
First possible type of smearing.

◆ SmearEnergy()

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 74 of file Par02Smearer.cc.

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

◆ SmearGaussian()

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 91 of file Par02Smearer.cc.

92 {
93 G4ThreeVector originP = aTrackOriginal->GetMomentum();
94 G4ThreeVector originPos = aTrackOriginal->GetPosition();
95 G4double rdm = Gauss( 1.0, aResolution );
96 G4ThreeVector smearedMom( originP.x()*rdm, originP.y()*rdm, originP.z()*rdm );
97 return smearedMom;
98}

◆ Gauss()

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 102 of file Par02Smearer.cc.

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

Member Data Documentation

◆ fPar02Smearer

Par02Smearer * Par02Smearer::fPar02Smearer = nullptr
staticprivate

A pointer to Par02Smearer object.

Definition at line 86 of file Par02Smearer.hh.

◆ fRandomEngine

CLHEP::HepRandomEngine* Par02Smearer::fRandomEngine
private

CLHEP random engine.

Definition at line 89 of file Par02Smearer.hh.

◆ fRandomGauss

CLHEP::RandGauss* Par02Smearer::fRandomGauss
private

CLHEP random engine used in gaussian smearing.

Definition at line 92 of file Par02Smearer.hh.


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

Applications | User Support | Publications | Collaboration