diff --git a/doc/musrSim.pdf b/doc/musrSim.pdf index e40e799..5feb581 100644 Binary files a/doc/musrSim.pdf and b/doc/musrSim.pdf differ diff --git a/doc/musrSim.tex b/doc/musrSim.tex index 3cd72f2..6a8e5ba 100644 --- a/doc/musrSim.tex +++ b/doc/musrSim.tex @@ -506,6 +506,24 @@ Three special volumes ``Target, M0, M1 and M2''. 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. +\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}}\\ Set the mean kinetic energy of the initial particles (muons).\\ (Ignored by the TURTLE input). diff --git a/include/musrPrimaryGeneratorAction.hh b/include/musrPrimaryGeneratorAction.hh index 757b32e..026d6a0 100644 --- a/include/musrPrimaryGeneratorAction.hh +++ b/include/musrPrimaryGeneratorAction.hh @@ -52,6 +52,9 @@ class musrPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 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 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 SetMuonTimeSigma(G4double val) {tSigma=val;} //P.B. 13 May 2009 void SetKEnergy(G4double val); @@ -98,7 +101,10 @@ class musrPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction static G4String thePrimaryParticleName ; 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 xangle0, yangle0, xangleSigma, yangleSigma, pitch; G4bool UnpolarisedMuonBeam, TransversalyUnpolarisedMuonBeam; diff --git a/include/musrPrimaryGeneratorMessenger.hh b/include/musrPrimaryGeneratorMessenger.hh index c69f88a..aa1d1c2 100644 --- a/include/musrPrimaryGeneratorMessenger.hh +++ b/include/musrPrimaryGeneratorMessenger.hh @@ -51,8 +51,11 @@ class musrPrimaryGeneratorMessenger: public G4UImessenger G4UIcmdWith3VectorAndUnit* setvertexCmd; G4UIcmdWith3VectorAndUnit* setvertexSigmaCmd; G4UIcmdWith3VectorAndUnit* setvertexBoundaryCmd; - G4UIcmdWithADoubleAndUnit* setStarttimeCmd; //P.B. 13 May 2009 - G4UIcmdWithADoubleAndUnit* setStarttimeSigmaCmd; //P.B. 13 May 2009 + G4UIcmdWithADoubleAndUnit* setvertexRelativeRCmd; + 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* setMomentumCmd; G4UIcmdWithADoubleAndUnit* setMomentumSmearingCmd; diff --git a/src/musrPrimaryGeneratorAction.cc b/src/musrPrimaryGeneratorAction.cc index b659c1e..5119c7b 100644 --- a/src/musrPrimaryGeneratorAction.cc +++ b/src/musrPrimaryGeneratorAction.cc @@ -59,6 +59,9 @@ musrPrimaryGeneratorAction::musrPrimaryGeneratorAction( :musrDetector(musrDC), x0(0), y0(0), z0(-10*cm), xSigma(0), ySigma(0), zSigma(0), rMaxAllowed(1e10*mm), zMinAllowed(-1e10*mm), zMaxAllowed(1e10*mm), 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), xangle0(0), yangle0(0), xangleSigma(0), yangleSigma(0), pitch(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 - // rMaxAllowed ... maximal radius, within which the muon can be generated - // x0, y0, z0 ... central point around which the muons are generated + // rMaxAllowed ... maximal radius, within which the muon can be 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 - // x, y, z ... actual initial position of the generated muon + // x, y, z ... actual initial position of the generated muon G4int checkNrOfCounts=0; numberOfGeneratedEvents++; @@ -220,10 +226,11 @@ void musrPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) if (checkNrOfCounts>1000) { G4cout<<"musrPrimaryGeneratorAction::GeneratePrimaries: Too strict requirements on the r or z position!"<(rMaxAllowed*rMaxAllowed))||(z>zMaxAllowed)||(z(rMaxAllowed*rMaxAllowed))||(z>zMaxAllowed)||(z(relativeRMaxAllowed*relativeRMaxAllowed))|| + (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 checkNrOfCounts=0; diff --git a/src/musrPrimaryGeneratorMessenger.cc b/src/musrPrimaryGeneratorMessenger.cc index b5223eb..882197a 100644 --- a/src/musrPrimaryGeneratorMessenger.cc +++ b/src/musrPrimaryGeneratorMessenger.cc @@ -54,6 +54,12 @@ musrPrimaryGeneratorMessenger::musrPrimaryGeneratorMessenger(musrPrimaryGenerato setvertexBoundaryCmd->SetParameterName("mes_rMaxAllowed","mes_zMinAllowed","mes_zMaxAllowed",true,true); 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->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 @@ -64,6 +70,16 @@ musrPrimaryGeneratorMessenger::musrPrimaryGeneratorMessenger(musrPrimaryGenerato setStarttimeSigmaCmd->SetParameterName("mes_tSigma",true); //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->SetGuidance(" Set kinetic energy of the generated muons (with unit)"); setKEnergyCmd->SetParameterName("mes_E0",true); @@ -161,8 +177,11 @@ musrPrimaryGeneratorMessenger::~musrPrimaryGeneratorMessenger() delete setvertexCmd; delete setvertexSigmaCmd; delete setvertexBoundaryCmd; + delete setvertexRelativeRCmd; delete setStarttimeCmd; //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 setMomentumCmd; delete setMomentumSmearingCmd; @@ -187,15 +206,21 @@ void musrPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String n if( command == setPrimaryParticleCmd) { musrAction->SetPrimaryParticule(newValue); } if( command == setvertexCmd) - { musrAction->Setvertex(setvertexCmd->GetNew3VectorValue(newValue));} + { musrAction->Setvertex(setvertexCmd->GetNew3VectorValue(newValue));} if( command == setvertexSigmaCmd) - { musrAction->SetvertexSigma(setvertexSigmaCmd->GetNew3VectorValue(newValue));} + { musrAction->SetvertexSigma(setvertexSigmaCmd->GetNew3VectorValue(newValue));} 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 { musrAction->SetMuonTime(setStarttimeCmd->GetNewDoubleValue(newValue));} //P.B. 13 May 2009 if( command == setStarttimeSigmaCmd) //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) { musrAction->SetKEnergy(setKEnergyCmd->GetNewDoubleValue(newValue));} if( command == setMomentumCmd) diff --git a/src/musrRootOutput.cc b/src/musrRootOutput.cc index 30b862b..4c51647 100644 --- a/src/musrRootOutput.cc +++ b/src/musrRootOutput.cc @@ -49,6 +49,7 @@ musrRootOutput::musrRootOutput() { ProcessIDMapping["Decay"]=13; ProcessIDMapping["conv"]=14; ProcessIDMapping["compt"]=15; + ProcessIDMapping["phot"]=16; ProcessIDMapping["initialParticle"]=100; }