Kamil Sedlak 2009-05-18
This is the first version of the muSR simulation code (musrSim) based on the merged codes of Kamil Sedlak and Toni Shiroka. It should be a running version of the simulation code, however it has not been very well tested, therefore it will probably need some further development.
This commit is contained in:
108
include/musrPrimaryGeneratorAction.hh
Normal file
108
include/musrPrimaryGeneratorAction.hh
Normal file
@ -0,0 +1,108 @@
|
||||
|
||||
#ifndef musrPrimaryGeneratorAction_h
|
||||
#define musrPrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
class G4GeneralParticleSource;
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
class musrDetectorConstruction;
|
||||
class musrPrimaryGeneratorMessenger;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
class musrPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
musrPrimaryGeneratorAction(musrDetectorConstruction*);
|
||||
~musrPrimaryGeneratorAction();
|
||||
|
||||
public:
|
||||
void GeneratePrimaries(G4Event*);
|
||||
void SetRndmFlag(G4String val) { rndmFlag = val;}
|
||||
void Setvertex(G4ThreeVector v) {x0=v[0]; y0=v[1]; z0=v[2];}
|
||||
void SetvertexSigma(G4ThreeVector v) {xSigma=v[0]; ySigma=v[1]; zSigma=v[2];}
|
||||
void SetvertexBoundary(G4ThreeVector v) {rMaxAllowed=v[0]; zMinAllowed=v[1]; zMaxAllowed=v[2];}
|
||||
void SetKEnergy(G4double val);
|
||||
void SetMomentum(G4double val) {p0=val;}
|
||||
void SetMomentumSmearing(G4double val) {pSigma=val;}
|
||||
void SetMomentumBoundary(G4ThreeVector v){pMinAllowed=v[0]; pMaxAllowed=v[1];}
|
||||
void SetTilt(G4ThreeVector v) {xangle0=v[0]; yangle0=v[1];}
|
||||
void SetSigmaTilt(G4ThreeVector v) {xangleSigma=v[0]; yangleSigma=v[1];}
|
||||
void SetPitch(G4double val) {pitch=val;}
|
||||
void SetInitialMuonPolariz(G4ThreeVector vIniPol);
|
||||
void SetInitialPolarizFraction(G4double val) {
|
||||
if ((val>1.)||(val<-1.)) {
|
||||
G4cout<<"musrPrimaryGeneratorAction.hh: SetInitialPolarizFraction(): polarisation fraction out of range ("<<val<<")"<<G4endl;
|
||||
exit(1);
|
||||
}
|
||||
polarisFraction=val;
|
||||
}
|
||||
void SetMuonDecayTimeLimits(G4ThreeVector decayTimeLimits);
|
||||
void SetTurtleInput(G4String turtleFileName);
|
||||
void SetTurtleInputFileToEventNo(G4int lineNumberOfTurtleFile);
|
||||
void SetTurtleZ0(G4double val) {z0_InitialTurtle=val;}
|
||||
void SetOrReadTheRandomNumberSeeds(G4int eventID);
|
||||
void SetTurtleMomentumBite (G4ThreeVector smearingParam)
|
||||
{turtleMomentumBite=true; turtleMomentumP0=smearingParam[0]*MeV; turtleSmearingFactor=smearingParam[1]*0.01;}
|
||||
|
||||
static G4String GetPrimaryName();
|
||||
|
||||
private:
|
||||
G4ParticleGun* particleGun; // pointer a to G4 service class
|
||||
G4GeneralParticleSource* particleSource; // pointer to the G4GeneralParticleSource, needed for radioactive samples
|
||||
musrDetectorConstruction* musrDetector; // pointer to the geometry
|
||||
|
||||
musrPrimaryGeneratorMessenger* gunMessenger; // messenger of this class
|
||||
G4String rndmFlag; // flag for a random impact point
|
||||
|
||||
// cks Implement also alpha and proton particles for the simulation of Juan Pablo Urrego
|
||||
G4ParticleDefinition* alphaParticle;
|
||||
G4ParticleDefinition* protonParticle;
|
||||
// csk
|
||||
|
||||
static G4String thePrimaryParticleName ;
|
||||
|
||||
G4double x0, y0, z0, xSigma, ySigma, zSigma, rMaxAllowed, zMinAllowed, zMaxAllowed;
|
||||
G4double p0, pSigma, pMinAllowed, pMaxAllowed;
|
||||
G4double xangle0, yangle0, xangleSigma, yangleSigma, pitch;
|
||||
G4bool UnpolarisedMuonBeam, TransversalyUnpolarisedMuonBeam;
|
||||
G4double xPolarisIni, yPolarisIni, zPolarisIni;
|
||||
G4double polarisFraction;
|
||||
G4double muonDecayTimeMin;
|
||||
G4double muonDecayTimeMax;
|
||||
G4double muonMeanLife;
|
||||
// For the Turtle input:
|
||||
FILE* fTurtleFile;
|
||||
G4bool takeMuonsFromTurtleFile;
|
||||
G4double z0_InitialTurtle; // z0 at whith the turtle file was generated.
|
||||
G4int numberOfGeneratedEvents; // number of generated events at the input (e.g. including Turtle events out of the beampipe)
|
||||
G4bool boolPrintInfoAboutGeneratedParticles;
|
||||
G4bool turtleMomentumBite;
|
||||
G4double turtleMomentumP0;
|
||||
G4double turtleSmearingFactor;
|
||||
|
||||
public:
|
||||
static G4bool setRandomNrSeedAccordingEventNr;
|
||||
static G4bool setRandomNrSeedFromFile;
|
||||
static G4bool setRandomNrSeedFromFile_RNDM;
|
||||
static G4int nRndmEventToSaveSeeds;
|
||||
static std::vector<int> * GetPointerToSeedVector();
|
||||
|
||||
G4double decaytime;
|
||||
|
||||
private:
|
||||
static std::vector<int> * pointerToSeedVector;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user