Remove G4ParticleDefinition dependance.
This commit is contained in:
@@ -193,27 +193,11 @@ void LEMuSRAtRestSpinRotation::RotateSpin( const G4Step& aStep, G4ThreeVector B,
|
||||
G4cout<< "AT REST::: PARAMETERS\n"
|
||||
<< "Magnetic Field Norm : " << G4BestUnit(Bnorm,"Magnetic flux density") <<"\n";
|
||||
#endif
|
||||
|
||||
G4double omega,q,a,fqz;
|
||||
G4double gamma;
|
||||
q= aStep.GetTrack()->GetDefinition()->GetPDGCharge();
|
||||
a= 1.165922e-3;
|
||||
fqz = 8.5062e+7*rad/(s*kilogauss);
|
||||
|
||||
gamma = aStep.GetTrack()->GetDefinition()->GetGyromagneticRatio()*rad;
|
||||
|
||||
// G4cout<< fqz*(s*tesla)<<G4endl;
|
||||
// G4cout<< gamma*(s*tesla)<<G4endl;
|
||||
|
||||
|
||||
|
||||
#ifdef G4SRVERBOSE
|
||||
G4cout<< "AT REST::: PARAMETERS\n"
|
||||
<< "Charge : " << q <<"\n";
|
||||
#endif
|
||||
|
||||
// omega= - (fqz)*(1.+a) * Bnorm;
|
||||
omega= - (gamma) * Bnorm;
|
||||
//! Gyromagnetic Ratio
|
||||
G4double gamma = GetGyromagneticRatio();
|
||||
//! Compute precession frequency
|
||||
G4double omega= - (gamma) * Bnorm;
|
||||
|
||||
#ifdef G4SRVERBOSE
|
||||
G4cout<< "AT REST::: PARAMETERS\n"
|
||||
@@ -251,3 +235,45 @@ void LEMuSRAtRestSpinRotation::RotateSpin( const G4Step& aStep, G4ThreeVector B,
|
||||
polar = newspin;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! Return the gyromagnetic ratio
|
||||
/*!
|
||||
* This method call the event manager to get the tracking manager and then the current track in order to get the particle name. According to the name of the particle it returns the gyromagnetic ratio.
|
||||
*/
|
||||
G4double LEMuSRAtRestSpinRotation::GetGyromagneticRatio()
|
||||
{
|
||||
//! Get the event manager
|
||||
G4EventManager* evtMgr = G4EventManager::GetEventManager();
|
||||
|
||||
//! Get the track from the tracking manager
|
||||
G4Track* theTrack = evtMgr->GetTrackingManager()->GetTrack();
|
||||
|
||||
//! Get the particle name
|
||||
G4String particle = theTrack->GetDefinition()->GetParticleName();
|
||||
|
||||
/*! Arbitrary initialisation of \f$ \gamma \f$ as muons plus
|
||||
* gyromagnetic ratio
|
||||
*/
|
||||
G4double gamma = 8.5062e+7*rad/(s*kilogauss);
|
||||
|
||||
//! Set gamma according to the particle. One can add other particles at will.
|
||||
|
||||
if(particle== "Mu")
|
||||
{
|
||||
gamma= gamma = 0.5*((1.*eplus)/(0.1056584*GeV/(c_light*c_light))-(1.*eplus)/(0.51099906*MeV/(c_light*c_light)));
|
||||
}
|
||||
|
||||
else if (particle == "mu+")
|
||||
{
|
||||
gamma= 8.5062e+7*rad/(s*kilogauss);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
gamma= 8.5062e+7*rad/(s*kilogauss);
|
||||
}
|
||||
|
||||
return gamma;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
#include "G4ElectricField.hh"
|
||||
#include "G4ElectroMagneticField.hh"
|
||||
#include "G4EqMagElectricField.hh"
|
||||
#include "G4El_MagEqRhs.hh"
|
||||
#include "LEMuSRCryoField.hh"
|
||||
#include "LEMuSRMag_SpinEqRhs.hh"
|
||||
#include "LEMuSRElMag_SpinEqRhs.hh"
|
||||
@@ -541,9 +540,9 @@ void LEMuSRDetectorConstruction:: lemuCRYO()
|
||||
// sample MAGNETIC field
|
||||
sampleField = new LEMuSRRNDMAGField(G4ThreeVector(0.,0.,100*gauss),1.);
|
||||
|
||||
G4Mag_SpinEqRhs *Mag_SpinEqRhs;
|
||||
LEMuSRMag_SpinEqRhs *Mag_SpinEqRhs;
|
||||
G4MagIntegratorStepper *pStepper;
|
||||
Mag_SpinEqRhs = new G4Mag_SpinEqRhs(sampleField);
|
||||
Mag_SpinEqRhs = new LEMuSRMag_SpinEqRhs(sampleField);
|
||||
pStepper = new G4ClassicalRK4( Mag_SpinEqRhs,12 );
|
||||
|
||||
G4ChordFinder* pChordFinder = new G4ChordFinder(sampleField,1.e-5* mm, pStepper );
|
||||
@@ -1173,11 +1172,11 @@ void LEMuSRDetectorConstruction::buildAnodeField()
|
||||
#ifdef LEMU_TRANSVERSE_FIELD
|
||||
mcField = new LEMuSRMagneticField(G4ThreeVector(0.,B*gauss,0.));
|
||||
G4cout<<"Transverse Field Applied: (0 G, " <<B <<"G, 0 G) \n"<<G4endl;
|
||||
//sleep(3); // wait 3 seconds
|
||||
// sleep(3); // wait 3 seconds
|
||||
#else
|
||||
mcField = new LEMuSRMagneticField(G4ThreeVector(0.,0.,B*gauss));
|
||||
G4cout<<"Longtudinal Field Applied: (0 G, 0 G, " <<B <<"G) \n"<<G4endl;
|
||||
//sleep(3); // wait 3 seconds
|
||||
// sleep(3); // wait 3 seconds
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1242,11 +1241,11 @@ void LEMuSRDetectorConstruction::buildAnodeField()
|
||||
#ifdef LEMU_TRANSVERSE_FIELD
|
||||
mcField = new LEMuSRMagneticField(G4ThreeVector(0.,B*gauss,0.));
|
||||
G4cout<<"Longitudinal Field Applied: (0 G, " <<B <<"G, 0 G) \n"<<G4endl;
|
||||
//sleep(3); // wait 3 seconds
|
||||
// sleep(3); // wait 3 seconds
|
||||
#else
|
||||
mcField = new LEMuSRMagneticField(G4ThreeVector(0.,0.,B*gauss));
|
||||
G4cout<<"Transverse Field Applied: (0 G, 0 G, " <<B <<"G) \n"<<G4endl;
|
||||
//sleep(3); // wait 3 seconds
|
||||
// sleep(3); // wait 3 seconds
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1410,6 +1409,6 @@ void LEMuSRDetectorConstruction::PrintStatus()
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout<<"Fied Maps Directory is not defined!!!"<<endl;//sleep(10);
|
||||
G4cout<<"Fied Maps Directory is not defined!!!"<<endl;// sleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,9 +48,7 @@ void LEMuSRElMag_SpinEqRhs::SetChargeMomentumMass(G4double particleCharge, // in
|
||||
*/
|
||||
|
||||
// Get the gyromagnetic ratio via the event manager
|
||||
G4EventManager* evtMgr = G4EventManager::GetEventManager();
|
||||
G4Track* theTrack = evtMgr->GetTrackingManager()->GetTrack();
|
||||
G4double gratio= theTrack->GetDefinition()->GetGyromagneticRatio();
|
||||
G4double gratio= GetGyromagneticRatio();
|
||||
// G4cout <<"g ratio [MHz]/[T]"<<gratio<<G4endl;
|
||||
|
||||
omegac =gratio;// 0.105658387*GeV/mass * 2.837374841e-3*(rad/cm/kilogauss);
|
||||
@@ -146,3 +144,39 @@ void LEMuSRElMag_SpinEqRhs::EvaluateRhsGivenB( const G4double y[],
|
||||
}
|
||||
|
||||
|
||||
|
||||
G4double LEMuSRElMag_SpinEqRhs::GetGyromagneticRatio()
|
||||
{
|
||||
//! Get the event manager
|
||||
G4EventManager* evtMgr = G4EventManager::GetEventManager();
|
||||
|
||||
//! Get the track from the tracking manager
|
||||
G4Track* theTrack = evtMgr->GetTrackingManager()->GetTrack();
|
||||
|
||||
//! Get the particle name
|
||||
G4String particle = theTrack->GetDefinition()->GetParticleName();
|
||||
|
||||
/*! Arbitrary initialisation of \f$ \gamma \f$ as muons plus
|
||||
* gyromagnetic ratio
|
||||
*/
|
||||
G4double gamma = 8.5062e+7*rad/(s*kilogauss);
|
||||
|
||||
//! Set gamma according to the particle. One can add other particles at will.
|
||||
|
||||
if(particle== "Mu")
|
||||
{
|
||||
gamma= gamma = 0.5*((1.*eplus)/(0.1056584*GeV/(c_light*c_light))-(1.*eplus)/(0.51099906*MeV/(c_light*c_light)));
|
||||
}
|
||||
|
||||
else if (particle == "mu+")
|
||||
{
|
||||
gamma= 8.5062e+7*rad/(s*kilogauss);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
gamma= 8.5062e+7*rad/(s*kilogauss);
|
||||
}
|
||||
|
||||
return gamma;
|
||||
}
|
||||
|
||||
@@ -60,9 +60,7 @@ LEMuSRMag_SpinEqRhs::SetChargeMomentumMass(G4double particleCharge, // in e+ uni
|
||||
// To set fCof_val
|
||||
G4Mag_EqRhs::SetChargeMomentumMass(particleCharge, MomentumXc, mass);
|
||||
|
||||
theTrackingAction= LEMuSRTrackingAction::GetInstance();
|
||||
|
||||
G4double gratio=theTrackingAction->GyroMagRatio;
|
||||
G4double gratio=GetGyromagneticRatio();
|
||||
//G4cout <<"g ratio [MHz]/[T]"<<gratio<<G4endl;
|
||||
|
||||
omegac =gratio;// 0.105658387*GeV/mass * 2.837374841e-3*(rad/cm/kilogauss);
|
||||
@@ -147,3 +145,40 @@ LEMuSRMag_SpinEqRhs::EvaluateRhsGivenB( const G4double y[],
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
G4double LEMuSRMag_SpinEqRhs::GetGyromagneticRatio()
|
||||
{
|
||||
//! Get the event manager
|
||||
G4EventManager* evtMgr = G4EventManager::GetEventManager();
|
||||
|
||||
//! Get the track from the tracking manager
|
||||
G4Track* theTrack = evtMgr->GetTrackingManager()->GetTrack();
|
||||
|
||||
//! Get the particle name
|
||||
G4String particle = theTrack->GetDefinition()->GetParticleName();
|
||||
|
||||
/*! Arbitrary initialisation of \f$ \gamma \f$ as muons plus
|
||||
* gyromagnetic ratio
|
||||
*/
|
||||
G4double gamma = 8.5062e+7*rad/(s*kilogauss);
|
||||
|
||||
//! Set gamma according to the particle. One can add other particles at will.
|
||||
|
||||
if(particle== "Mu")
|
||||
{
|
||||
gamma= gamma = 0.5*((1.*eplus)/(0.1056584*GeV/(c_light*c_light))-(1.*eplus)/(0.51099906*MeV/(c_light*c_light)));
|
||||
}
|
||||
|
||||
else if (particle == "mu+")
|
||||
{
|
||||
gamma= 8.5062e+7*rad/(s*kilogauss);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
gamma= 8.5062e+7*rad/(s*kilogauss);
|
||||
}
|
||||
|
||||
return gamma;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
#include "G4ios.hh"
|
||||
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "LEMuSRDetectorConstruction.hh"
|
||||
|
||||
// ROOT
|
||||
#include "TROOT.h"
|
||||
#include "TApplication.h"
|
||||
@@ -51,10 +54,22 @@ LEMuSRRunAction::~LEMuSRRunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
/*! Initializes the user interface manager.*/
|
||||
|
||||
//! Actions to take before the run.
|
||||
/*!
|
||||
* -# Initializes the user interface manager.
|
||||
* -# Initialize the visualization
|
||||
*/
|
||||
void LEMuSRRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
/* G4cout<<"WILL REBUILD THE DETECTOR"<<G4endl;
|
||||
UI->ApplyCommand("/Detector/View total");
|
||||
G4VPhysicalVolume* newDetector = LEMuSRDetectorConstruction::GetInstance()->Construct();
|
||||
|
||||
*/
|
||||
|
||||
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
@@ -64,13 +79,6 @@ void LEMuSRRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
UI->ApplyCommand("/vis/scene/notifyHandlers");
|
||||
}
|
||||
|
||||
//! BUILD THE DETECTOR IN TOTAL GEOMETRY
|
||||
// G4cout<<"WILL REBUILD THE DETECTOR"<<G4endl;
|
||||
// UI->ApplyCommand("/Detector/View total");
|
||||
|
||||
// G4VPhysicalVolume* newDetector = LEMuSRDetectorConstruction::GetInstance()->Construct();
|
||||
// G4RunManager::GetRunManager()->DefineWorldVolume(newDetector);
|
||||
// G4cout<<"DETECTOR BUILT."<<G4endl;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user