![]() |
|
|||
File indexing completed on 2025-04-02 08:47:06
0001 /** 0002 \file 0003 Declaration of class Smear::Device. 0004 0005 \author Michael Savastio 0006 \date 2011-08-19 0007 \copyright 2011 Brookhaven National Lab 0008 */ 0009 0010 #ifndef INCLUDE_EICSMEAR_SMEAR_DEVICE_H_ 0011 #define INCLUDE_EICSMEAR_SMEAR_DEVICE_H_ 0012 0013 #include <cmath> 0014 #include <vector> 0015 0016 #include <Math/ParamFunctor.h> // For ROOT::TMath::ParamFunctor 0017 #include <TF1.h> 0018 #include <TF2.h> 0019 #include <TRandom3.h> 0020 #include <TString.h> 0021 0022 #include "eicsmear/smear/Acceptance.h" 0023 #include "eicsmear/smear/Distributor.h" 0024 #include "eicsmear/smear/Smear.h" 0025 #include "eicsmear/smear/Smearer.h" 0026 0027 class TRandom3; 0028 0029 namespace erhic { 0030 0031 class VirtualParticle; 0032 0033 } // namespace erhic 0034 0035 namespace Smear { 0036 0037 class FormulaString; 0038 class ParticleMCS; 0039 0040 /** 0041 Performs smearing of a single kinematic variable according to a simple 0042 expression defined via a string. 0043 */ 0044 class Device : public Smearer { 0045 public: 0046 /** 0047 Constructor. 0048 The first argument is the type of kinematic variable to smear. 0049 The second argument is a formula giving the width of the 0050 resolution in the variable selected with the first argument, i.e. 0051 sigma(A) = f(B, C...) 0052 where A, B, C... are selected from: E, P, theta, phi, pZ and pT, A 0053 is the variable type given for the first argument and B, C... are 0054 the variables listed in the formula. 0055 For example, for resolution in pT of 1% pT times sin of polar angle: 0056 Smear::Device(Smear::kPt, "0.01 * pT * sin(theta)"); 0057 See ROOT::TFormula for the form of valid expressions. 0058 Formulae can be a function of up to four variables. 0059 The third argument allows selection of the types of particles that are 0060 smeared: electromagnetic, hadronic or all. 0061 */ 0062 Device(KinType = kE, const TString& formula = "0", EGenre = kAll); 0063 0064 /** 0065 Constructor for smearing with an arbitrary function of a single variable. 0066 The first argument is a function of E, P, theta, phi, pT, or pZ. 0067 See ROOT::TFormula for syntax. 0068 For example, to smear in 1/pT: 0069 Smear::Device('1/pT', '<some resolution function>') 0070 */ 0071 Device(const TString&, const TString& resolution = "0", EGenre = kAll); 0072 0073 /** 0074 Copy constructor. 0075 */ 0076 Device(const Device&); 0077 0078 /** 0079 Destructor. 0080 */ 0081 virtual ~Device(); 0082 0083 /** 0084 Returns a dynamically allocated copy of this object. 0085 The argument is unused and is present for compatibility with 0086 ROOT::TObject::Clone(). 0087 */ 0088 virtual Device* Clone(const char* = "") const; 0089 0090 /** 0091 Smear the kinematic value of the input particle and store the 0092 result in the ParticleMCS. 0093 Smearing works in the following way. If we smear a variable 0094 VirtualParticle.X == x with parametrization f(x), 0095 then z[x,f(x)] will be stored in ParticleMCS.X, where z is a 0096 randomly generated number from a distribution of which x is 0097 the mean and f(xi) is the standard deviation. 0098 By default a Gaussian distribution is used. 0099 Use SetDistribution() for other distributions 0100 (and see Smear::Distributor). 0101 */ 0102 virtual void Smear(const erhic::VirtualParticle&, ParticleMCS&); 0103 0104 /** 0105 Set the random distribution from which to sample smeared kinematics. 0106 By default a Gaussian distribution is used. 0107 */ 0108 virtual void SetDistribution(const Distributor&); 0109 0110 /** 0111 Print information about this device to standard output. 0112 */ 0113 virtual void Print(Option_t* = "") const; 0114 0115 protected: 0116 bool Init(const TString&, const TString&, int); 0117 0118 KinType mSmeared; ///< Smeared variable 0119 TF1* mKinematicFunction; 0120 FormulaString* mFormula; ///< Expression for resolution standard deviation 0121 std::vector<Smear::KinType> mDimensions; ///< Variables on which smearing 0122 ///< is dependent (up to 4) 0123 Distributor mDistribution; ///< Random distribution 0124 0125 private: 0126 // Assignment is not supported 0127 Device& operator=(const Device&) { return *this; } 0128 0129 ClassDef(Smear::Device, 1) 0130 }; 0131 0132 inline void Device::SetDistribution(const Distributor& d) { 0133 mDistribution = d; 0134 } 0135 0136 } // namespace Smear 0137 0138 #endif // INCLUDE_EICSMEAR_SMEAR_DEVICE_H_
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |