Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:32

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 //
0027 /// \file Par02Smearer.hh
0028 /// \brief Definition of the Par02Smearer class
0029 
0030 #ifndef PAR02_SMEARER_H
0031 #define PAR02_SMEARER_H
0032 
0033 #include "CLHEP/Random/JamesRandom.h"
0034 #include "CLHEP/Random/RandGauss.h"
0035 #include "Par02Output.hh"
0036 
0037 #include "G4Track.hh"
0038 #include "globals.hh"
0039 
0040 /// Smearing of the particle momentum or energy.
0041 ///
0042 /// A singleton class used to smear (alter) the particle momentum (for tracking
0043 /// detectors) and energy (for calorimeters). In case the resolution is given,
0044 /// the momentum (energy) is smeared with Gaussian distribution.
0045 /// @author Anna Zaborowska
0046 
0047 class Par02Smearer
0048 {
0049   public:
0050     /// Allows the access to the unique Par02Smearer class object.
0051     /// @return A pointer to the Par02Smearer class.
0052     static Par02Smearer* Instance();
0053 
0054     /// Smears the momentum with a given resolution.
0055     /// @param aTrack A track to smear.
0056     /// @param aResolution A resolution. Gaussian smearing is done with a
0057     ///                    given resolution as a standard deviation.
0058     G4ThreeVector SmearMomentum(const G4Track* aTrack, G4double aResolution = -1);
0059 
0060     /// Smears the energy deposit with a given resolution.
0061     /// @param aTrack A track to smear.
0062     /// @param aResolution A resolution. Gaussian smearing is done with a
0063     ///                    given resolution as a standard deviation.
0064     G4double SmearEnergy(const G4Track* aTrack, G4double aResolution = -1);
0065 
0066     /// First possible type of smearing. Smears the momentum with a given resolution.
0067     /// @param aTrackOriginal A track to smear.
0068     /// @param aResolution A resolution taken as a standard deviation of a
0069     ///                    Gaussian distribution.
0070     G4ThreeVector SmearGaussian(const G4Track* aTrackOriginal, G4double aResolution);
0071 
0072     /// Returns a random number from a Gaussian distribution.
0073     /// @param aMean The mean of the Gaussian distribution.
0074     /// @param aStandardDeviation The standard deviation of a Gaussian distribution.
0075     G4double Gauss(G4double aMean, G4double aStandardDeviation);
0076 
0077   protected:
0078     /// A default constructor.
0079     Par02Smearer();
0080 
0081     ~Par02Smearer();
0082 
0083   private:
0084     /// A pointer to Par02Smearer object.
0085     static Par02Smearer* fPar02Smearer;
0086 
0087     /// CLHEP random engine.
0088     CLHEP::HepRandomEngine* fRandomEngine;
0089 
0090     /// CLHEP random engine used in gaussian smearing.
0091     CLHEP::RandGauss* fRandomGauss;
0092 };
0093 
0094 #endif