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:
@@ -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!"<<G4endl;
|
||||
}
|
||||
} while( ((x*x+y*y)>(rMaxAllowed*rMaxAllowed))||(z>zMaxAllowed)||(z<zMinAllowed) );
|
||||
// The generated muon has to stay
|
||||
// within some well defined region,
|
||||
// e.g. within the beampipe
|
||||
} while(
|
||||
((x*x+y*y)>(rMaxAllowed*rMaxAllowed))||(z>zMaxAllowed)||(z<zMinAllowed) ||
|
||||
(((x-x0)*(x-x0)+(y-y0)*(y-y0))>(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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -49,6 +49,7 @@ musrRootOutput::musrRootOutput() {
|
||||
ProcessIDMapping["Decay"]=13;
|
||||
ProcessIDMapping["conv"]=14;
|
||||
ProcessIDMapping["compt"]=15;
|
||||
ProcessIDMapping["phot"]=16;
|
||||
ProcessIDMapping["initialParticle"]=100;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user