#include <musrPrimaryGeneratorAction.hh>
Public Member Functions | |
| musrPrimaryGeneratorAction (musrDetectorConstruction *) | |
| ~musrPrimaryGeneratorAction () | |
| void | GeneratePrimaries (G4Event *) |
| void | SetRndmFlag (G4String val) |
| void | Setxvertex (G4double x) |
| void | Setyvertex (G4double y) |
| void | Setzvertex (G4double z) |
| void | Setpxanglevertex (G4double px) |
| void | Setpyanglevertex (G4double py) |
| void | SetMomentum (G4double p) |
| void | SetBeamWidth (G4double w) |
Static Public Member Functions | |
| static G4String | GetPrimaryName () |
Public Attributes | |
| G4double | decaytime |
| HepRandomEngine * | theEngine |
Definition at line 16 of file musrPrimaryGeneratorAction.hh.
|
|
Definition at line 21 of file musrPrimaryGeneratorAction.cc. 00023 :musrDetector(musrDC),rndmFlag("off"),xvertex(0.),yvertex(0.),zvertex(0.), 00024 xyvertexdefined(false), zvertexdefined(false),pxanglevertex(0.),pyanglevertex(0.),pvertexdefined(false), 00025 pMomentum(0.),pMomentumdefined(false),TheSetWidth(0.),Widthdefined(false) 00026 { 00027 G4int n_particle = 1; 00028 particleGun = new musrParticleGun(n_particle); 00029 00030 //create a messenger for this class 00031 gunMessenger = new musrPrimaryGeneratorMessenger(this); 00032 00033 // default particle kinematic 00034 00035 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); 00036 G4ParticleDefinition* particle= particleTable->FindParticle("mu+"); 00037 particleGun->SetParticleDefinition(particle); 00038 00039 }
|
|
|
Definition at line 43 of file musrPrimaryGeneratorAction.cc.
|
|
|
Definition at line 51 of file musrPrimaryGeneratorAction.cc. References decaytime, musrParticleGun::GeneratePrimaryVertex(), musrParticleGun::SetDecayTime(), and theEngine. 00052 { 00053 00054 00055 00056 //this function is called at the begining of event 00057 // 00058 00059 00060 G4double tau=0.000002197; 00061 G4double rnddecaytime = -tau*log(1-G4UniformRand()); 00062 decaytime = rnddecaytime*s; 00063 particleGun->SetDecayTime(decaytime); 00064 00065 00066 //Set the initial particle position 00067 const double stdFWHMfactor=sqrt(2*log(2)); 00068 G4double TheWidth; 00069 00070 if(Widthdefined) 00071 { 00072 TheWidth=TheSetWidth; 00073 } 00074 else 00075 { 00076 TheWidth=40.*mm; 00077 } 00078 00079 00080 G4double xbeamwidthFWHM = TheWidth; 00081 G4double ybeamwidthFWHM = TheWidth; 00082 00083 G4double x0,y0,z0 ; 00084 00085 00086 G4double xstdposition = xbeamwidthFWHM/(2*stdFWHMfactor); 00087 G4double ystdposition = ybeamwidthFWHM/(2*stdFWHMfactor); 00088 G4RandGauss* jRndGauss = new G4RandGauss(theEngine, 0, xstdposition); 00089 G4double xrndposition = jRndGauss->shoot(0, xstdposition); 00090 G4double yrndposition = jRndGauss->shoot(0, ystdposition); 00091 G4double xposition = xrndposition*mm; 00092 G4double yposition = yrndposition*mm; 00093 00094 00095 // temporary lines 00096 // xposition = xbeamwidthFWHM/2.0; 00097 // yposition = ybeamwidthFWHM/2.0; 00098 00099 00100 00101 // G4cout<<"Initial muon position = " << xposition <<", " 00102 // << yposition << "mm \n" <<G4endl; 00103 00104 00105 00106 if(xyvertexdefined) 00107 { 00108 x0 = xvertex ; 00109 y0 = yvertex ; 00110 } 00111 else 00112 { 00113 x0 = xposition ; 00114 y0 = yposition ; 00115 } 00116 00117 00118 if(zvertexdefined) 00119 { 00120 z0 = zvertex ; 00121 } 00122 else 00123 { 00124 z0 = 0.*mm ; 00125 } 00126 00127 00128 //Set the initial particle momentum 00129 00130 G4double pxangle0,pyangle0 ; 00131 00132 if(pvertexdefined) 00133 { 00134 pxangle0 = pxanglevertex ; 00135 pyangle0 = pyanglevertex ; 00136 } 00137 else 00138 { 00139 pxangle0 = 0.*deg ; 00140 pyangle0 = 0.*deg ; 00141 } 00142 00143 G4double myMomentum; 00144 00145 if(pMomentumdefined) 00146 { 00147 myMomentum=pMomentum; 00148 } 00149 else 00150 { 00151 myMomentum=0.0; 00152 } 00153 00154 00155 particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0)); 00156 00157 00158 00159 G4double xpitch = sin(pxangle0); 00160 G4double ypitch = sin(pyangle0); 00161 G4double zpitch = sqrt(1-(sin(pxangle0)*sin(pxangle0) 00162 +sin(pyangle0)*sin(pyangle0))); 00163 00164 // Then orient the spin relative to the beam pitch 00165 00166 00167 //longitudinal 00168 particleGun->SetParticlePolarization(G4ThreeVector(xpitch,ypitch,-zpitch)); 00169 00170 //transverse 00171 // particleGun->SetParticlePolarization(G4ThreeVector(zpitch,0,-xpitch)); 00172 00173 00174 G4double energy = sqrt(1e6*myMomentum*myMomentum+11163.82428)-105.659; 00175 particleGun->SetParticleEnergy(energy*MeV); 00176 particleGun->SetParticleMomentumDirection(G4ThreeVector(xpitch,ypitch,zpitch)); particleGun->GeneratePrimaryVertex(anEvent); 00177 00178 00179 00180 }
|
|
|
|
|
|
Definition at line 228 of file musrPrimaryGeneratorAction.cc. Referenced by musrPrimaryGeneratorMessenger::SetNewValue(). 00229 { 00230 Widthdefined = true; 00231 TheSetWidth=w; 00232 G4cout<< "FWHM beam width set to "<< TheSetWidth <<"mm" <<G4endl; 00233 00234 }
|
|
|
Definition at line 220 of file musrPrimaryGeneratorAction.cc. Referenced by musrPrimaryGeneratorMessenger::SetNewValue().
|
|
|
Definition at line 207 of file musrPrimaryGeneratorAction.cc. Referenced by musrPrimaryGeneratorMessenger::SetNewValue().
|
|
|
Definition at line 214 of file musrPrimaryGeneratorAction.cc. Referenced by musrPrimaryGeneratorMessenger::SetNewValue().
|
|
|
Definition at line 24 of file musrPrimaryGeneratorAction.hh.
|
|
|
Definition at line 187 of file musrPrimaryGeneratorAction.cc. Referenced by musrPrimaryGeneratorMessenger::SetNewValue().
|
|
|
Definition at line 194 of file musrPrimaryGeneratorAction.cc. Referenced by musrPrimaryGeneratorMessenger::SetNewValue().
|
|
|
Definition at line 200 of file musrPrimaryGeneratorAction.cc. Referenced by musrPrimaryGeneratorMessenger::SetNewValue().
|
|
|
Definition at line 55 of file musrPrimaryGeneratorAction.hh. Referenced by GeneratePrimaries(). |
|
|
Definition at line 56 of file musrPrimaryGeneratorAction.hh. Referenced by GeneratePrimaries(). |
1.4.6