9.3.2010 Kamil Sedlak

Changes needed by Pavel Bakule for low energy moun beem excited by laser.
  (The user can restrict a box-like region for the generated particles (muons)).
This commit is contained in:
2010-03-09 16:49:53 +00:00
parent 610abf6591
commit a71842dd81
7 changed files with 73 additions and 13 deletions

Binary file not shown.

View File

@ -506,6 +506,24 @@ Three special volumes ``Target, M0, M1 and M2''.
only the restriction on the maximum radius \emph{R\_max} only the restriction on the maximum radius \emph{R\_max}
is applied on the initial particles, while \emph{z\_min} and \emph{z\_max} are ignored. is applied on the initial particles, while \emph{z\_min} and \emph{z\_max} are ignored.
\item{\bf /gun/vertexrelativer \emph{relativeRMaxAllowed} \emph{unit}}\\
Set maximum allowed radius of the beam relative to x0 and y0,
i.e.\ relative to the centre of the beam. This command might be useful when the beam
centre is not created at x0=y0=0, but the user wishes to restrict the beam
within a symmetric cone around x0 and y0. \\
(Ignored by the TURTLE input).
\item{\bf /gun/boxboundarycentre \emph{xMaxSource0} \emph{yMaxSource0} \emph{xMaxSource0} \emph{unit}} \\
See below ``/gun/boxboundary''.
\item{\bf /gun/boxboundary \emph{xMaxSource} \emph{yMaxSource} \emph{xMaxSource} \emph{unit}} \\
Define a box, within which the generated particles (muons) are created.
The variables \emph{xMaxSource0}, \emph{yMaxSource0} and \emph{xMaxSource0} define the
centre of the box, the variables \emph{xMaxSource}, \emph{yMaxSource} and \emph{xMaxSource} define the
halfwidth, halfheight and halflength of the box. \\
This command can be useful for muonium excitations by laser (low energy muon beam induced by laser).\\
(Ignored by the TURTLE input).
\item{\bf /gun/kenergy \emph{kineticEnergy} \emph{unit}}\\ \item{\bf /gun/kenergy \emph{kineticEnergy} \emph{unit}}\\
Set the mean kinetic energy of the initial particles (muons).\\ Set the mean kinetic energy of the initial particles (muons).\\
(Ignored by the TURTLE input). (Ignored by the TURTLE input).

View File

@ -52,6 +52,9 @@ class musrPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
void Setvertex(G4ThreeVector v) {x0=v[0]; y0=v[1]; z0=v[2];} 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 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 SetvertexBoundary(G4ThreeVector v) {rMaxAllowed=v[0]; zMinAllowed=v[1]; zMaxAllowed=v[2];}
void SetvertexRelativeR(G4double val) {relativeRMaxAllowed=val;}
void SetboxBoundary(G4ThreeVector v) {xMaxSource=v[0]; yMaxSource=v[1]; zMaxSource=v[2];} //P.B. 15 Dec 2009
void SetboxBoundaryCentre(G4ThreeVector v) {xMaxSource0=v[0]; yMaxSource0=v[1]; zMaxSource0=v[2];} //P.B. 15 Dec 2009
void SetMuonTime(G4double val) {t0=val;} //P.B. 13 May 2009 void SetMuonTime(G4double val) {t0=val;} //P.B. 13 May 2009
void SetMuonTimeSigma(G4double val) {tSigma=val;} //P.B. 13 May 2009 void SetMuonTimeSigma(G4double val) {tSigma=val;} //P.B. 13 May 2009
void SetKEnergy(G4double val); void SetKEnergy(G4double val);
@ -98,7 +101,10 @@ class musrPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
static G4String thePrimaryParticleName ; static G4String thePrimaryParticleName ;
G4double x0, y0, z0, xSigma, ySigma, zSigma, rMaxAllowed, zMinAllowed, zMaxAllowed; G4double x0, y0, z0, xSigma, ySigma, zSigma, rMaxAllowed, zMinAllowed, zMaxAllowed;
G4double t0, tSigma; //P.B. 13 May 2009 G4double t0, tSigma; //P.B. 13 May 2009
G4double relativeRMaxAllowed;
G4double xMaxSource0, yMaxSource0, zMaxSource0; //P.B. 15 Dec 2009
G4double xMaxSource, yMaxSource, zMaxSource; //P.B. 15 Dec 2009
G4double p0, pSigma, pMinAllowed, pMaxAllowed; G4double p0, pSigma, pMinAllowed, pMaxAllowed;
G4double xangle0, yangle0, xangleSigma, yangleSigma, pitch; G4double xangle0, yangle0, xangleSigma, yangleSigma, pitch;
G4bool UnpolarisedMuonBeam, TransversalyUnpolarisedMuonBeam; G4bool UnpolarisedMuonBeam, TransversalyUnpolarisedMuonBeam;

View File

@ -51,8 +51,11 @@ class musrPrimaryGeneratorMessenger: public G4UImessenger
G4UIcmdWith3VectorAndUnit* setvertexCmd; G4UIcmdWith3VectorAndUnit* setvertexCmd;
G4UIcmdWith3VectorAndUnit* setvertexSigmaCmd; G4UIcmdWith3VectorAndUnit* setvertexSigmaCmd;
G4UIcmdWith3VectorAndUnit* setvertexBoundaryCmd; G4UIcmdWith3VectorAndUnit* setvertexBoundaryCmd;
G4UIcmdWithADoubleAndUnit* setStarttimeCmd; //P.B. 13 May 2009 G4UIcmdWithADoubleAndUnit* setvertexRelativeRCmd;
G4UIcmdWithADoubleAndUnit* setStarttimeSigmaCmd; //P.B. 13 May 2009 G4UIcmdWithADoubleAndUnit* setStarttimeCmd; //P.B. 13 May 2009
G4UIcmdWithADoubleAndUnit* setStarttimeSigmaCmd; //P.B. 13 May 2009
G4UIcmdWith3VectorAndUnit* setboxBoundaryCmd; //P.B. 15 Dec 2009
G4UIcmdWith3VectorAndUnit* setboxBoundaryCentreCmd; //P.B. 15 Dec 2009
G4UIcmdWithADoubleAndUnit* setKEnergyCmd; G4UIcmdWithADoubleAndUnit* setKEnergyCmd;
G4UIcmdWithADoubleAndUnit* setMomentumCmd; G4UIcmdWithADoubleAndUnit* setMomentumCmd;
G4UIcmdWithADoubleAndUnit* setMomentumSmearingCmd; G4UIcmdWithADoubleAndUnit* setMomentumSmearingCmd;

View File

@ -59,6 +59,9 @@ musrPrimaryGeneratorAction::musrPrimaryGeneratorAction(
:musrDetector(musrDC), x0(0), y0(0), z0(-10*cm), xSigma(0), ySigma(0), zSigma(0), :musrDetector(musrDC), x0(0), y0(0), z0(-10*cm), xSigma(0), ySigma(0), zSigma(0),
rMaxAllowed(1e10*mm), zMinAllowed(-1e10*mm), zMaxAllowed(1e10*mm), rMaxAllowed(1e10*mm), zMinAllowed(-1e10*mm), zMaxAllowed(1e10*mm),
t0(0), tSigma(0), t0(0), tSigma(0),
relativeRMaxAllowed(1e10*mm),
xMaxSource0(0), yMaxSource0(0), zMaxSource0(0),
xMaxSource(1e10*mm), yMaxSource(1e10*mm), zMaxSource(1e10*mm),
p0(0), pSigma(0), pMinAllowed(0), pMaxAllowed(1e10*mm), p0(0), pSigma(0), pMinAllowed(0), pMaxAllowed(1e10*mm),
xangle0(0), yangle0(0), xangleSigma(0), yangleSigma(0), pitch(0), xangle0(0), yangle0(0), xangleSigma(0), yangleSigma(0), pitch(0),
UnpolarisedMuonBeam(false), TransversalyUnpolarisedMuonBeam(false), xPolarisIni(1.), yPolarisIni(0.), zPolarisIni(0.), UnpolarisedMuonBeam(false), TransversalyUnpolarisedMuonBeam(false), xPolarisIni(1.), yPolarisIni(0.), zPolarisIni(0.),
@ -196,10 +199,13 @@ void musrPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
} }
else { // Generate the starting position of the muon by random else { // Generate the starting position of the muon by random
// rMaxAllowed ... maximal radius, within which the muon can be generated // rMaxAllowed ... maximal radius, within which the muon can be generated
// x0, y0, z0 ... central point around which the muons are generated // relativeRMaxAllowed ... maximal radius, within which the muon can be generated, relative to x0 and y0 position
// xMaxSource0, yMaxSource0...
// xMaxSource, yMaxSource ...
// x0, y0, z0 ... central point around which the muons are generated
// xSigma, ySigma, zSigma ... sigma of the (gaussian) distributions of the beam // xSigma, ySigma, zSigma ... sigma of the (gaussian) distributions of the beam
// x, y, z ... actual initial position of the generated muon // x, y, z ... actual initial position of the generated muon
G4int checkNrOfCounts=0; G4int checkNrOfCounts=0;
numberOfGeneratedEvents++; numberOfGeneratedEvents++;
@ -220,10 +226,11 @@ void musrPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
if (checkNrOfCounts>1000) { if (checkNrOfCounts>1000) {
G4cout<<"musrPrimaryGeneratorAction::GeneratePrimaries: Too strict requirements on the r or z position!"<<G4endl; G4cout<<"musrPrimaryGeneratorAction::GeneratePrimaries: Too strict requirements on the r or z position!"<<G4endl;
} }
} while( ((x*x+y*y)>(rMaxAllowed*rMaxAllowed))||(z>zMaxAllowed)||(z<zMinAllowed) ); } while(
// The generated muon has to stay ((x*x+y*y)>(rMaxAllowed*rMaxAllowed))||(z>zMaxAllowed)||(z<zMinAllowed) ||
// within some well defined region, (((x-x0)*(x-x0)+(y-y0)*(y-y0))>(relativeRMaxAllowed*relativeRMaxAllowed))||
// e.g. within the beampipe (fabs(x-xMaxSource0)>xMaxSource)||(fabs(y-yMaxSource0)>yMaxSource)||(fabs(z-zMaxSource0)>zMaxSource)
); // The generated muon has to stay within some well defined region, e.g. within the beampipe
// Now generate the momentum // Now generate the momentum
checkNrOfCounts=0; checkNrOfCounts=0;

View File

@ -54,6 +54,12 @@ musrPrimaryGeneratorMessenger::musrPrimaryGeneratorMessenger(musrPrimaryGenerato
setvertexBoundaryCmd->SetParameterName("mes_rMaxAllowed","mes_zMinAllowed","mes_zMaxAllowed",true,true); setvertexBoundaryCmd->SetParameterName("mes_rMaxAllowed","mes_zMinAllowed","mes_zMaxAllowed",true,true);
setvertexBoundaryCmd->SetDefaultUnit("mm"); setvertexBoundaryCmd->SetDefaultUnit("mm");
setvertexRelativeRCmd = new G4UIcmdWithADoubleAndUnit("/gun/vertexrelativer",this);
setvertexRelativeRCmd->SetGuidance(" Set maximum allowed radius of the beam relative to x0 and y0,");
setvertexRelativeRCmd->SetGuidance(" i.e. relative to the centre of the beam (with unit)");
setvertexRelativeRCmd->SetParameterName("mes_relativeRMaxAllowed",true);
setvertexRelativeRCmd->SetDefaultUnit("mm");
setStarttimeCmd = new G4UIcmdWithADoubleAndUnit("/gun/starttime",this); //P.B. 13 May 2009 setStarttimeCmd = new G4UIcmdWithADoubleAndUnit("/gun/starttime",this); //P.B. 13 May 2009
setStarttimeCmd->SetGuidance(" Set start time t of the generated muons (with unit)"); //P.B. 13 May 2009 setStarttimeCmd->SetGuidance(" Set start time t of the generated muons (with unit)"); //P.B. 13 May 2009
setStarttimeCmd->SetParameterName("mes_t0",true); //P.B. 13 May 2009 setStarttimeCmd->SetParameterName("mes_t0",true); //P.B. 13 May 2009
@ -64,6 +70,16 @@ musrPrimaryGeneratorMessenger::musrPrimaryGeneratorMessenger(musrPrimaryGenerato
setStarttimeSigmaCmd->SetParameterName("mes_tSigma",true); //P.B. 13 May 2009 setStarttimeSigmaCmd->SetParameterName("mes_tSigma",true); //P.B. 13 May 2009
setStarttimeSigmaCmd->SetDefaultUnit("ns"); //P.B. 13 May 2009 setStarttimeSigmaCmd->SetDefaultUnit("ns"); //P.B. 13 May 2009
setboxBoundaryCentreCmd = new G4UIcmdWith3VectorAndUnit("/gun/boxboundarycentre",this); //P.B. 15 Dec 2009
setboxBoundaryCentreCmd->SetGuidance(" Set centre point (x,y,z)MaxSource0 (with unit) of the restriction source box"); //P.B. 15 Dec 2009
setboxBoundaryCentreCmd->SetParameterName("mes_xMaxSource0","mes_yMaxSource0","mes_zMaxSource0",true,true); //P.B. 15 Dec 2009
setboxBoundaryCentreCmd->SetDefaultUnit("mm"); //P.B. 15 Dec 2009
setboxBoundaryCmd = new G4UIcmdWith3VectorAndUnit("/gun/boxboundary",this); //P.B. 15 Dec 2009
setboxBoundaryCmd->SetGuidance(" Set maximum deviation from (x,y,z)MaxSource0 (with unit)"); //P.B. 15 Dec 2009
setboxBoundaryCmd->SetParameterName("mes_xMaxSource","mes_yMaxSource","mes_zMaxSource",true,true); //P.B. 15 Dec 2009
setboxBoundaryCmd->SetDefaultUnit("mm"); //P.B. 15 Dec 2009
setKEnergyCmd = new G4UIcmdWithADoubleAndUnit("/gun/kenergy",this); setKEnergyCmd = new G4UIcmdWithADoubleAndUnit("/gun/kenergy",this);
setKEnergyCmd->SetGuidance(" Set kinetic energy of the generated muons (with unit)"); setKEnergyCmd->SetGuidance(" Set kinetic energy of the generated muons (with unit)");
setKEnergyCmd->SetParameterName("mes_E0",true); setKEnergyCmd->SetParameterName("mes_E0",true);
@ -161,8 +177,11 @@ musrPrimaryGeneratorMessenger::~musrPrimaryGeneratorMessenger()
delete setvertexCmd; delete setvertexCmd;
delete setvertexSigmaCmd; delete setvertexSigmaCmd;
delete setvertexBoundaryCmd; delete setvertexBoundaryCmd;
delete setvertexRelativeRCmd;
delete setStarttimeCmd; //P.B. 13 May 2009 delete setStarttimeCmd; //P.B. 13 May 2009
delete setStarttimeSigmaCmd; //P.B. 13 May 2009 delete setStarttimeSigmaCmd; //P.B. 13 May 2009
delete setboxBoundaryCentreCmd; //P.B. 15 Dec 2009
delete setboxBoundaryCmd; //P.B. 15 Dec 2009
delete setKEnergyCmd; delete setKEnergyCmd;
delete setMomentumCmd; delete setMomentumCmd;
delete setMomentumSmearingCmd; delete setMomentumSmearingCmd;
@ -187,15 +206,21 @@ void musrPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String n
if( command == setPrimaryParticleCmd) if( command == setPrimaryParticleCmd)
{ musrAction->SetPrimaryParticule(newValue); } { musrAction->SetPrimaryParticule(newValue); }
if( command == setvertexCmd) if( command == setvertexCmd)
{ musrAction->Setvertex(setvertexCmd->GetNew3VectorValue(newValue));} { musrAction->Setvertex(setvertexCmd->GetNew3VectorValue(newValue));}
if( command == setvertexSigmaCmd) if( command == setvertexSigmaCmd)
{ musrAction->SetvertexSigma(setvertexSigmaCmd->GetNew3VectorValue(newValue));} { musrAction->SetvertexSigma(setvertexSigmaCmd->GetNew3VectorValue(newValue));}
if( command == setvertexBoundaryCmd) if( command == setvertexBoundaryCmd)
{ musrAction->SetvertexBoundary(setvertexBoundaryCmd->GetNew3VectorValue(newValue));} { musrAction->SetvertexBoundary(setvertexBoundaryCmd->GetNew3VectorValue(newValue));}
if( command == setvertexRelativeRCmd)
{ musrAction->SetvertexRelativeR(setvertexRelativeRCmd->GetNewDoubleValue(newValue));}
if( command == setStarttimeCmd) //P.B. 13 May 2009 if( command == setStarttimeCmd) //P.B. 13 May 2009
{ musrAction->SetMuonTime(setStarttimeCmd->GetNewDoubleValue(newValue));} //P.B. 13 May 2009 { musrAction->SetMuonTime(setStarttimeCmd->GetNewDoubleValue(newValue));} //P.B. 13 May 2009
if( command == setStarttimeSigmaCmd) //P.B. 13 May 2009 if( command == setStarttimeSigmaCmd) //P.B. 13 May 2009
{ musrAction->SetMuonTimeSigma(setStarttimeSigmaCmd->GetNewDoubleValue(newValue));} //P.B. 13 May 2009 { musrAction->SetMuonTimeSigma(setStarttimeSigmaCmd->GetNewDoubleValue(newValue));} //P.B. 13 May 2009
if( command == setboxBoundaryCentreCmd) //P.B. 15 Dec 2009
{ musrAction->SetboxBoundaryCentre(setboxBoundaryCentreCmd->GetNew3VectorValue(newValue));} //P.B. 15 Dec 2009
if( command == setboxBoundaryCmd) //P.B. 15 Dec 2009
{ musrAction->SetboxBoundary(setboxBoundaryCmd->GetNew3VectorValue(newValue));} //P.B. 15 Dec 2009
if( command == setKEnergyCmd) if( command == setKEnergyCmd)
{ musrAction->SetKEnergy(setKEnergyCmd->GetNewDoubleValue(newValue));} { musrAction->SetKEnergy(setKEnergyCmd->GetNewDoubleValue(newValue));}
if( command == setMomentumCmd) if( command == setMomentumCmd)

View File

@ -49,6 +49,7 @@ musrRootOutput::musrRootOutput() {
ProcessIDMapping["Decay"]=13; ProcessIDMapping["Decay"]=13;
ProcessIDMapping["conv"]=14; ProcessIDMapping["conv"]=14;
ProcessIDMapping["compt"]=15; ProcessIDMapping["compt"]=15;
ProcessIDMapping["phot"]=16;
ProcessIDMapping["initialParticle"]=100; ProcessIDMapping["initialParticle"]=100;
} }