Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:09:50

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file Par02Smearer.hh
0027 /// \brief Definition of the Par02Smearer class
0028 
0029 #ifndef PAR02_SMEARER_H
0030 #define PAR02_SMEARER_H
0031 
0032 #include "CLHEP/Random/JamesRandom.h"
0033 #include "CLHEP/Random/RandGauss.h"
0034 #include "Par02Output.hh"
0035 
0036 #include "G4Track.hh"
0037 #include "globals.hh"
0038 
0039 /// Smearing of the particle momentum or energy.
0040 ///
0041 /// A singleton class used to smear (alter) the particle momentum (for tracking
0042 /// detectors) and energy (for calorimeters). In case the resolution is given,
0043 /// the momentum (energy) is smeared with Gaussian distribution.
0044 /// @author Anna Zaborowska
0045 
0046 class Par02Smearer
0047 {
0048   public:
0049     /// Allows the access to the unique Par02Smearer class object.
0050     /// @return A pointer to the Par02Smearer class.
0051     static Par02Smearer* Instance();
0052 
0053     /// Smears the momentum with a given resolution.
0054     /// @param aTrack A track to smear.
0055     /// @param aResolution A resolution. Gaussian smearing is done with a
0056     ///                    given resolution as a standard deviation.
0057     G4ThreeVector SmearMomentum(const G4Track* aTrack, G4double aResolution = -1);
0058 
0059     /// Smears the energy deposit with a given resolution.
0060     /// @param aTrack A track to smear.
0061     /// @param aResolution A resolution. Gaussian smearing is done with a
0062     ///                    given resolution as a standard deviation.
0063     G4double SmearEnergy(const G4Track* aTrack, G4double aResolution = -1);
0064 
0065     /// First possible type of smearing. Smears the momentum with a given resolution.
0066     /// @param aTrackOriginal A track to smear.
0067     /// @param aResolution A resolution taken as a standard deviation of a
0068     ///                    Gaussian distribution.
0069     G4ThreeVector SmearGaussian(const G4Track* aTrackOriginal, G4double aResolution);
0070 
0071     /// Returns a random number from a Gaussian distribution.
0072     /// @param aMean The mean of the Gaussian distribution.
0073     /// @param aStandardDeviation The standard deviation of a Gaussian distribution.
0074     G4double Gauss(G4double aMean, G4double aStandardDeviation);
0075 
0076   protected:
0077     /// A default constructor.
0078     Par02Smearer();
0079 
0080     ~Par02Smearer();
0081 
0082   private:
0083     /// A pointer to Par02Smearer object.
0084     static Par02Smearer* fPar02Smearer;
0085 
0086     /// CLHEP random engine.
0087     CLHEP::HepRandomEngine* fRandomEngine;
0088 
0089     /// CLHEP random engine used in gaussian smearing.
0090     CLHEP::RandGauss* fRandomGauss;
0091 };
0092 
0093 #endif