Remove G4ParticleDefinition dependance.
This commit is contained in:
parent
dbf68bfae2
commit
cd724f2691
@ -4,18 +4,19 @@
|
||||
cp G4ChordFinder.cc $G4INSTALL/source/geometry/magneticfield/src/
|
||||
cp G4ChordFinder.hh $G4INSTALL/source/geometry/magneticfield/include/
|
||||
|
||||
cp G4El_EqRhs.cc $G4INSTALL/source/geometry/magneticfield/src/
|
||||
cp G4El_EqRhs.hh $G4INSTALL/source/geometry/magneticfield/include/
|
||||
|
||||
cp G4El_MagEqRhs.cc $G4INSTALL/source/geometry/magneticfield/src/
|
||||
cp G4El_MagEqRhs.hh $G4INSTALL/source/geometry/magneticfield/include/
|
||||
|
||||
cp G4El_UsualEqRhs.cc $G4INSTALL/source/geometry/magneticfield/src/
|
||||
cp G4El_UsualEqRhs.hh $G4INSTALL/source/geometry/magneticfield/include/
|
||||
cp G4FieldManager.cc $G4INSTALL/source/geometry/magneticfield/src/
|
||||
cp G4FieldManager.hh $G4INSTALL/source/geometry/magneticfield/include/
|
||||
cp G4FieldManager.icc $G4INSTALL/source/geometry/magneticfield/include/
|
||||
|
||||
|
||||
cp G4El_EqRhs.cc $G4INSTALL/source/geometry/magneticfield/src/
|
||||
cp G4El_EqRhs.hh $G4INSTALL/source/geometry/magneticfield/include/
|
||||
|
||||
cp G4El_UsualEqRhs.cc $G4INSTALL/source/geometry/magneticfield/src/
|
||||
cp G4El_UsualEqRhs.hh $G4INSTALL/source/geometry/magneticfield/include/
|
||||
|
||||
|
||||
|
||||
cp G4MultipleScattering52.cc $G4INSTALL/source/processes/electromagnetic/standard/src/
|
||||
|
||||
cp G4VDecayChannel.cc $G4INSTALL/source/particles/management/src/
|
||||
@ -27,9 +28,6 @@ cp G4MuonDecayChannelWithSpin.hh $G4INSTALL/source/particles/management/inclu
|
||||
|
||||
cp G4Muonium.cc $G4INSTALL/source/particles/leptons/src/
|
||||
cp G4Muonium.hh $G4INSTALL/source/particles/leptons/include/
|
||||
cp G4ParticleDefinition.cc $G4INSTALL/source/particles/management/src/
|
||||
cp G4ParticleDefinition.hh $G4INSTALL/source/particles/management/include/
|
||||
cp G4ParticleDefinition.icc $G4INSTALL/source/particles/management/include/
|
||||
|
||||
|
||||
cd $G4INSTALL/source/geometry/magneticfield/
|
||||
|
@ -69,7 +69,7 @@
|
||||
#include "G4ForceCondition.hh"
|
||||
#include "G4ParticleChangeForTransport.hh"
|
||||
#include "LEMuSRParticleChangeForSR.hh"
|
||||
|
||||
#include "G4EventManager.hh"
|
||||
|
||||
/*!
|
||||
* This class is a public class of the G4VRestProcess class,
|
||||
@ -114,15 +114,20 @@ public:
|
||||
G4double
|
||||
//! The magnetic field vector at the point[4] position.
|
||||
B[3],
|
||||
//! The spin rotation angle computed in the RotateSpin method
|
||||
rotation_angle;
|
||||
//! The rotation frequency
|
||||
fqz,
|
||||
//! The spin rotation angle computed in the RotateSpin method
|
||||
rotation_angle;
|
||||
|
||||
G4double
|
||||
//! The initial time.
|
||||
itime,
|
||||
//! The final time.
|
||||
ftime,
|
||||
//! The time variation.
|
||||
deltatime;
|
||||
//! The final time.
|
||||
ftime,
|
||||
//! The time variation.
|
||||
deltatime;
|
||||
|
||||
|
||||
G4ThreeVector SpinDirection;
|
||||
|
||||
//! The particle change object which stores all the proposed modification of the particle's state.
|
||||
@ -134,7 +139,12 @@ public:
|
||||
|
||||
|
||||
void RotateSpin(const G4Step&, G4ThreeVector, G4double);
|
||||
|
||||
//! Returns the precession frequency according to the particle:
|
||||
/*!
|
||||
*- For muons and all other particles \f$ \gamma= 8.5062e+7*rad/(s*kGauss)\f$
|
||||
*- For muonium \f$ \gamma=*rad/(s*kGauss) \f$
|
||||
*/
|
||||
G4double GetGyromagneticRatio();
|
||||
|
||||
inline G4double GetMeanLifeTime(const G4Track&, G4ForceCondition* condition)
|
||||
{
|
||||
|
@ -22,18 +22,6 @@
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*The LEMuSRCryoHit class defines the Hit object for the Sample Plate. A hit is an elementary
|
||||
*component for the sensitive detection. As soon as particle enters in the specified
|
||||
*volume, a hit object is created and will store any parameter the user wants to
|
||||
*consider.
|
||||
*The hit can then be plotted, printed or registered in a hit collection for further histogramming.
|
||||
*
|
||||
*However, it is not necessary to use hits objects since histograms can be filled
|
||||
*directly from the sensitive detector classes (cf. LEMuSRCryoSD.cc).
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LEMuSRCryoHit_h
|
||||
#define LEMuSRCryoHit_h 1
|
||||
@ -45,6 +33,18 @@
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
|
||||
/**
|
||||
*The LEMuSRCryoHit class defines the Hit object for the Sample Plate. A hit is an elementary
|
||||
*component for the sensitive detection. As soon as particle enters in the specified
|
||||
*volume, a hit object is created and will store any parameter the user wants to
|
||||
*consider.
|
||||
*The hit can then be plotted, printed or registered in a hit collection for further histogramming.
|
||||
*
|
||||
*However, it is not necessary to use hits objects since histograms can be filled
|
||||
*directly from the sensitive detector classes (cf. LEMuSRCryoSD.cc).
|
||||
*
|
||||
*/
|
||||
class LEMuSRCryoHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
|
@ -23,23 +23,6 @@
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*The sensitive detector classes are the most important to simulate the data acquisition.
|
||||
*The sensitive detector object is attached to the detector in LEMuSRDetectorConstruction.
|
||||
*
|
||||
*During the particle transportation, geant4 will check if the volume where the particle
|
||||
*travels is a sensitive detector (cf. G4Transportation). If this is the case, the method
|
||||
*ProcessHits will be executed.
|
||||
*
|
||||
*In the geant4 standard, the ProcessHit method would create a hit object, fill it with
|
||||
*desired parameters and send it to the corresponding hits collection for histogramming.
|
||||
*
|
||||
*This implementationof the \lemu simulation uses Root for histogramming, and therefore the hit object are not used.
|
||||
*Instead of filling a collection, we directly fill a Root tree with all the data we want.
|
||||
*A new hit structutre has been implemented according to Root format.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LEMuSRCryoSD_h
|
||||
#define LEMuSRCryoSD_h 1
|
||||
|
||||
@ -67,6 +50,23 @@ class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
class G4TouchableHistory;
|
||||
|
||||
|
||||
/**
|
||||
*The sensitive detector classes are the most important to simulate the data acquisition.
|
||||
*The sensitive detector object is attached to the detector in LEMuSRDetectorConstruction.
|
||||
*
|
||||
*During the particle transportation, geant4 will check if the volume where the particle
|
||||
*travels is a sensitive detector (cf. G4Transportation). If this is the case, the method
|
||||
*ProcessHits will be executed.
|
||||
*
|
||||
*In the geant4 standard, the ProcessHit method would create a hit object, fill it with
|
||||
*desired parameters and send it to the corresponding hits collection for histogramming.
|
||||
*
|
||||
*This implementationof the \lemu simulation uses Root for histogramming, and therefore the hit object are not used.
|
||||
*Instead of filling a collection, we directly fill a Root tree with all the data we want.
|
||||
*A new hit structutre has been implemented according to Root format.
|
||||
*/
|
||||
|
||||
class LEMuSRCryoSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
|
@ -20,25 +20,6 @@
|
||||
// DETECTOR CONSTRUCTION.HH
|
||||
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
|
||||
|
||||
/*! In this class the detector geometry is defined according to the following hierarchy:
|
||||
* - Solid Volume
|
||||
* -# The solid shape of the detector element. For example tube, sphere, box etc.
|
||||
* -# It can be defined as a boolean combination of solids.
|
||||
* - Logical Volume
|
||||
* -# The solid volume plus a material, a color, and all other specific parameters.
|
||||
* -# One can define different kind of attributes: visualization attributes, step size limitation, minimal kinetic enery to pursue the tracking of a particle etc. They are called UserAttributes or UserLimits. For more precision please refer to the G4UserLimits class.
|
||||
* -# The sensitive detection is also set in the logical volume: the user should first define a sensitive detector, and then assign it to the logical volume (cf. source code of LEMuSRDetectorConstruction.cc)
|
||||
* - Physical Volume
|
||||
* -# The logical volume and its position inside a mother logical volume.
|
||||
* -# One can also define space transformations (rotation, translation etc.) to position the physical volume in the mother volume.
|
||||
* -# Only the World volume does not need to be given a mother volume.
|
||||
* .
|
||||
* The main method is the virtual method Construct.
|
||||
* For clarity and compilation reasons the implementation code has been shared in the following files:
|
||||
* -# LEMuSRDetectorConstruction.cc
|
||||
* -# LEMuSRMaterials.cc where the materials table is built as well as the different attribute
|
||||
* -# LEMuSRdummydets.cc, which build the dummy detectors. This file should be removed in the future since we notice that the introduction of dummy detectors could influence the results.
|
||||
*/
|
||||
#ifndef LEMuSRDetectorConstruction_H
|
||||
#define LEMuSRDetectorConstruction_H 1
|
||||
|
||||
@ -88,6 +69,25 @@ class G4VPhysicalVolume;
|
||||
class G4Material;
|
||||
|
||||
|
||||
/*! In this class the detector geometry is defined according to the following hierarchy:
|
||||
* - Solid Volume
|
||||
* -# The solid shape of the detector element. For example tube, sphere, box etc.
|
||||
* -# It can be defined as a boolean combination of solids.
|
||||
* - Logical Volume
|
||||
* -# The solid volume plus a material, a color, and all other specific parameters.
|
||||
* -# One can define different kind of attributes: visualization attributes, step size limitation, minimal kinetic enery to pursue the tracking of a particle etc. They are called UserAttributes or UserLimits. For more precision please refer to the G4UserLimits class.
|
||||
* -# The sensitive detection is also set in the logical volume: the user should first define a sensitive detector, and then assign it to the logical volume (cf. source code of LEMuSRDetectorConstruction.cc)
|
||||
* - Physical Volume
|
||||
* -# The logical volume and its position inside a mother logical volume.
|
||||
* -# One can also define space transformations (rotation, translation etc.) to position the physical volume in the mother volume.
|
||||
* -# Only the World volume does not need to be given a mother volume.
|
||||
* .
|
||||
* The main method is the virtual method Construct.
|
||||
* For clarity and compilation reasons the implementation code has been shared in the following files:
|
||||
* -# LEMuSRDetectorConstruction.cc
|
||||
* -# LEMuSRMaterials.cc where the materials table is built as well as the different attribute
|
||||
* -# LEMuSRdummydets.cc, which build the dummy detectors. This file should be removed in the future since we notice that the introduction of dummy detectors could influence the results.
|
||||
*/
|
||||
class LEMuSRDetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
|
||||
|
@ -21,21 +21,7 @@
|
||||
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
|
||||
|
||||
|
||||
/**
|
||||
* The LEMuSRDetectorMessenger class defines the terminal's commands to operate changes in the detector geometry. The following settings can be personalized:
|
||||
* -# MCP/Sample cryostat geometry
|
||||
* -# Electric Fields on/off
|
||||
* -# Magnetic Fields on/off
|
||||
* -# Sample cryostat grid
|
||||
* -# Sample cryostat guards
|
||||
* -# Electric potentials
|
||||
* -# Carbon foil thickness
|
||||
* -# Maximal step size in field regions
|
||||
* -# Sample holder material
|
||||
* -# Views of the detector
|
||||
* .
|
||||
* Many more can be implemented at will by the user.
|
||||
*/
|
||||
|
||||
#ifndef LEMuSRDetectorMessenger_h
|
||||
#define LEMuSRDetectorMessenger_h 1
|
||||
|
||||
@ -72,6 +58,21 @@ class G4UIcmdWithAString;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class LEMuSRDetectorConstruction; //modif
|
||||
|
||||
/**
|
||||
* The LEMuSRDetectorMessenger class defines the terminal's commands to operate changes in the detector geometry. The following settings can be personalized:
|
||||
* -# MCP/Sample cryostat geometry
|
||||
* -# Electric Fields on/off
|
||||
* -# Magnetic Fields on/off
|
||||
* -# Sample cryostat grid
|
||||
* -# Sample cryostat guards
|
||||
* -# Electric potentials
|
||||
* -# Carbon foil thickness
|
||||
* -# Maximal step size in field regions
|
||||
* -# Sample holder material
|
||||
* -# Views of the detector
|
||||
* .
|
||||
* Many more can be implemented at will by the user.
|
||||
*/
|
||||
class LEMuSRDetectorMessenger : public G4UImessenger {
|
||||
public:
|
||||
//! Constructor.
|
||||
|
@ -19,22 +19,7 @@
|
||||
// &
|
||||
// Electric Field MIX
|
||||
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
|
||||
/**
|
||||
* In order to build complex electric fields, the following class has been built.
|
||||
* It allows the superposition of many electric fields recurrently.
|
||||
*
|
||||
* The main reason for this is that the field manager attached to a given volume do not handle such a
|
||||
* superposition. In the case of the sample chamber, this is a big problem because we have to handle
|
||||
* the fields of the ring anode and of the sample cryostat.
|
||||
*
|
||||
* The electric field in the sample region (gate valve chamber + mcp2 chamber) is then the
|
||||
* superposition of the following electric fields:
|
||||
* -# left side of the ring anode
|
||||
* -# right side of the ring anode
|
||||
* -# sample cryostat
|
||||
* .
|
||||
* On the same principle was built the class LEMuSRElMagField.
|
||||
*/
|
||||
|
||||
#ifndef LEMUSRELECTRICFIELDMIX_H
|
||||
#define LEMUSRELECTRICFIELDMIX_H 1
|
||||
|
||||
@ -54,6 +39,23 @@
|
||||
|
||||
#include "LEMuSRElectricField.hh"
|
||||
|
||||
|
||||
/**
|
||||
* In order to build complex electric fields, the following class has been built.
|
||||
* It allows the superposition of many electric fields recurrently.
|
||||
*
|
||||
* The main reason for this is that the field manager attached to a given volume do not handle such a
|
||||
* superposition. In the case of the sample chamber, this is a big problem because we have to handle
|
||||
* the fields of the ring anode and of the sample cryostat.
|
||||
*
|
||||
* The electric field in the sample region (gate valve chamber + mcp2 chamber) is then the
|
||||
* superposition of the following electric fields:
|
||||
* -# left side of the ring anode
|
||||
* -# right side of the ring anode
|
||||
* -# sample cryostat
|
||||
* .
|
||||
* On the same principle was built the class LEMuSRElMagField.
|
||||
*/
|
||||
class LEMuSRElFieldMix : public G4ElectricField
|
||||
{
|
||||
public:
|
||||
|
@ -20,24 +20,6 @@
|
||||
// ElectroMagnetic Field
|
||||
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
|
||||
|
||||
/**
|
||||
* In order to build complex electromagnetic fields, the following class has been built.
|
||||
* It allows the superposition of an electric field and a magnetic field.
|
||||
*
|
||||
* The main reason for this is that the field manager attached to a given volume do not handle such a
|
||||
* superposition. In the case of the sample chamber, this is a big problem because we have to handle
|
||||
* the electric fields of the ring anode and of the sample cryostat as well as the magnetic field over the sample.
|
||||
*
|
||||
* The electromagnetic field in the sample region (gate valve chamber + mcp2 chamber) is then the
|
||||
* superposition of the following fields:
|
||||
* -# electric field for left side of the ring anode
|
||||
* -# electric field for right side of the ring anode
|
||||
* -# electric field for sample cryostat
|
||||
* -# magnetic field for sample region
|
||||
* .
|
||||
* On the same principle was built the class LEMuSRElFieldMix
|
||||
*/
|
||||
|
||||
#ifndef LEMUSRELECTRICMAGFIELD_H
|
||||
#define LEMUSRELECTRICMAGFIELD_H 1
|
||||
|
||||
@ -58,6 +40,26 @@
|
||||
|
||||
#include "LEMuSRElectricField.hh"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* In order to build complex electromagnetic fields, the following class has been built.
|
||||
* It allows the superposition of an electric field and a magnetic field.
|
||||
*
|
||||
* The main reason for this is that the field manager attached to a given volume do not handle such a
|
||||
* superposition. In the case of the sample chamber, this is a big problem because we have to handle
|
||||
* the electric fields of the ring anode and of the sample cryostat as well as the magnetic field over the sample.
|
||||
*
|
||||
* The electromagnetic field in the sample region (gate valve chamber + mcp2 chamber) is then the
|
||||
* superposition of the following fields:
|
||||
* -# electric field for left side of the ring anode
|
||||
* -# electric field for right side of the ring anode
|
||||
* -# electric field for sample cryostat
|
||||
* -# magnetic field for sample region
|
||||
* .
|
||||
* On the same principle was built the class LEMuSRElFieldMix
|
||||
*/
|
||||
|
||||
class LEMuSRElMagField : public G4MagneticField
|
||||
{
|
||||
public:
|
||||
|
@ -20,12 +20,6 @@
|
||||
// ElectroMagnetic Spin Equation
|
||||
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
|
||||
|
||||
/**
|
||||
* This class defines the motion equation to use to calculate the evolution of a
|
||||
* particle in an electromagnetic field. The derivatives vector is calculated for
|
||||
* the electric field, and for the magnetic field, taking into account the spin precession
|
||||
* and the time evolution.
|
||||
*/
|
||||
|
||||
#ifndef LEMuSRELMAG_SPIN_EQRHS
|
||||
#define LEMuSRELMAG_SPIN_EQRHS 1
|
||||
@ -46,6 +40,12 @@
|
||||
class G4MagneticField;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the motion equation to use to calculate the evolution of a
|
||||
* particle in an electromagnetic field. The derivatives vector is calculated for
|
||||
* the electric field, and for the magnetic field, taking into account the spin precession
|
||||
* and the time evolution.
|
||||
*/
|
||||
class LEMuSRElMag_SpinEqRhs : public G4Mag_EqRhs
|
||||
{
|
||||
public: // with description
|
||||
@ -66,6 +66,14 @@ class LEMuSRElMag_SpinEqRhs : public G4Mag_EqRhs
|
||||
// Given the value of the electromagnetic field B, this function
|
||||
// calculates the value of the derivative dydx.
|
||||
|
||||
|
||||
//! 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 GetGyromagneticRatio();
|
||||
|
||||
private:
|
||||
|
||||
G4double omegac;
|
||||
|
@ -20,6 +20,24 @@
|
||||
// Electric Field
|
||||
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
|
||||
|
||||
|
||||
#ifndef LEMUSRELECTRICFIELD_H
|
||||
#define LEMUSRELECTRICFIELD_H 1
|
||||
|
||||
#include"G4ElectricField.hh"
|
||||
#include"G4ElectroMagneticField.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include <iomanip.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include "CLHEP/Matrix/Vector.h"
|
||||
#include "CLHEP/Matrix/Matrix.h"
|
||||
|
||||
|
||||
/**
|
||||
* The goal of the LEMuSRElectricField class is to read field maps generated by
|
||||
* COMSOL Multiphysics.
|
||||
@ -51,24 +69,6 @@
|
||||
* lens, the anode and the sample.
|
||||
*/
|
||||
|
||||
#ifndef LEMUSRELECTRICFIELD_H
|
||||
#define LEMUSRELECTRICFIELD_H 1
|
||||
|
||||
#include"G4ElectricField.hh"
|
||||
#include"G4ElectroMagneticField.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include <iomanip.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include "CLHEP/Matrix/Vector.h"
|
||||
#include "CLHEP/Matrix/Matrix.h"
|
||||
|
||||
|
||||
|
||||
class LEMuSRElectricField : public G4ElectricField
|
||||
{
|
||||
public:
|
||||
|
@ -19,11 +19,7 @@
|
||||
// &
|
||||
// EVENT ACTION.HH
|
||||
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
|
||||
/*!
|
||||
* The role of the event action is to take special actions at the beginning or at the end of each event. It can be used for histogramming, plotting trajectories, or any other useful actions.
|
||||
*
|
||||
* It can be used to initialized the hits collections for the sensitive detection. In \lemu simulation, we finally did not really use the event action.
|
||||
*/
|
||||
|
||||
#ifndef LEMuSREventAction_h
|
||||
#define LEMuSREventAction_h 1
|
||||
|
||||
@ -46,7 +42,11 @@
|
||||
class G4EventManager;
|
||||
class G4Event;
|
||||
|
||||
|
||||
/*!
|
||||
* The role of the event action is to take special actions at the beginning or at the end of each event. It can be used for histogramming, plotting trajectories, or any other useful actions.
|
||||
*
|
||||
* It can be used to initialized the hits collections for the sensitive detection. In \lemu simulation, we finally did not really use the event action.
|
||||
*/
|
||||
class LEMuSREventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
|
@ -43,12 +43,17 @@
|
||||
#include "G4Types.hh"
|
||||
#include "G4Mag_EqRhs.hh"
|
||||
#include "G4SteppingManager.hh" // Include from 'tracking'
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4TrackingManager.hh" // Include from 'tracking'
|
||||
#include "LEMuSRTrackingAction.hh"
|
||||
#include "LEMuSRSteppingAction.hh"
|
||||
|
||||
class G4MagneticField;
|
||||
|
||||
/**
|
||||
* This class defines the motion equation to use to calculate the evolution of a
|
||||
* particle in a magnetic field. The derivatives vector is calculated for
|
||||
* the magnetic field, taking into account the spin precession
|
||||
* and the time evolution.
|
||||
*/
|
||||
class LEMuSRMag_SpinEqRhs : public G4Mag_EqRhs
|
||||
{
|
||||
public: // with description
|
||||
@ -69,6 +74,11 @@ class LEMuSRMag_SpinEqRhs : public G4Mag_EqRhs
|
||||
const G4double B[3],
|
||||
G4double dydx[] ) const;
|
||||
|
||||
//! 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 GetGyromagneticRatio();
|
||||
private:
|
||||
|
||||
G4double omegac;
|
||||
@ -80,8 +90,7 @@ class LEMuSRMag_SpinEqRhs : public G4Mag_EqRhs
|
||||
G4double beta;
|
||||
G4double m_mass;
|
||||
|
||||
LEMuSRTrackingAction* theTrackingAction;
|
||||
G4double oldomegac; //to remove
|
||||
G4double oldomegac; //to remove
|
||||
};
|
||||
|
||||
#endif /* LEMuSRMAG_SPIN_EQRHS */
|
||||
|
@ -194,26 +194,10 @@ void LEMuSRAtRestSpinRotation::RotateSpin( const G4Step& aStep, G4ThreeVector B,
|
||||
<< "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;
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user