00001 // -------------------------------------------------- 00002 // 00003 // File: SingleParticleGun/SingleParticleGun.h 00004 // Description: 00005 // This code is used to generate a single particle or a poissonly 00006 // distributed set of particles with pt, theta and phi selected as 00007 // specified by the JobOptionsService. Three modes of generation are 00008 // possible: 00009 // FixedMode: Generation with a fixed value 00010 // GaussianMode: Generation with a gaussian of specified mean and 00011 // sigma 00012 // FlatMode: Generation of a flat distribution between a specified 00013 // minimum and maximum value 00014 // The mode can be separately selected for pt, theta and phi. 00015 // or for E, theta and phi 00016 // in PtMode user specifies Pt theta and phi 00017 // in EMode user specifies E, theta and phi 00018 // The particle species can also be specified 00019 // 00020 // The output will be stored in the transient event store so it can be 00021 // passed to the simulation. 00022 00023 00024 #ifndef GENERATORMODULESSINGLEPARTICLEGUN_H 00025 #define GENERATORMODULESSINGLEPARTICLEGUN_H 00026 00027 #include "GeneratorModule/GenModule.h" 00028 00029 #include "CLHEP/Random/RandFlat.h" 00030 #include "CLHEP/Random/RandGauss.h" 00031 #include "CLHEP/Vector/LorentzVector.h" 00032 00033 class IBesRndmGenSvc; 00034 00035 struct SingleParticleGunGenMode { 00036 enum {FixedMode = 1, GaussMode = 2,FlatMode = 3}; 00037 }; 00038 struct SingleEnergyMode { 00039 enum {EMode = 1, PtMode = 2}; 00040 }; 00041 00042 class SingleParticleGun:public GenModule { 00043 public: 00044 SingleParticleGun(const std::string& name, ISvcLocator* pSvcLocator); 00045 virtual ~SingleParticleGun(); 00046 virtual StatusCode genInitialize(); 00047 virtual StatusCode callGenerator(); 00048 virtual StatusCode genFinalize(); 00049 virtual StatusCode fillEvt(GenEvent* evt); 00050 00051 private: 00052 // Setable Properties:- 00053 double m_requestedPt; 00054 double m_requestedPhi; 00055 double m_requestedE; 00056 double m_requestedTheta; 00057 double m_requestedX; 00058 double m_requestedY; 00059 double m_requestedZ; 00060 double m_requestedT; 00061 double m_minPt; 00062 double m_minE; 00063 double m_minTheta; 00064 double m_minPhi; 00065 double m_maxE; 00066 double m_maxPt; 00067 double m_maxTheta; 00068 double m_maxPhi; 00069 double m_sigmaPt; 00070 double m_sigmaE; 00071 double m_sigmaTheta; 00072 double m_sigmaPhi; 00073 int m_PtGenMode; 00074 int m_EGenMode; 00075 int m_ThetaGenMode; 00076 int m_PhiGenMode; 00077 int m_pdgCode; 00078 int m_Emode; 00079 // event counter 00080 int m_events ; 00081 00082 // Local Member Data:- 00083 IBesRndmGenSvc* p_BesRndmGenSvc; 00084 std::vector<long int> m_seeds; 00085 00086 double m_mass; 00087 CLHEP::HepLorentzVector m_fourMom; 00088 CLHEP::HepLorentzVector m_fourPos; 00089 00090 00091 // Private Methods:= 00092 double generateValue(int mode,double val,double sigma,double min, 00093 double max); 00094 00095 }; 00096 00097 #endif