Failed to simulate an X-Ray tube

Hi all:
I am trying to simulate an X-Ray tube, the target of the tube is made of Ag. An SDD detector is placed outside the Be window of the X-ray tube.I use 10000 50keV electrons hit the Ag target, but the energy spectrum of the tube is not right.
The simple model is as follow.

The physicList is listed in the bellow.

void PhysicsList::ConstructParticle()
{
    ConstructBosons();
    ConstructLeptons();
    ConstructBarions();
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....

void PhysicsList::ConstructBosons()
{
    // gamma
    G4Gamma::GammaDefinition();

    // optical photon
    G4OpticalPhoton::OpticalPhotonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....

void PhysicsList::ConstructLeptons()
{
    // leptons
    G4Electron::ElectronDefinition();
    G4Positron::PositronDefinition();
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....

void PhysicsList::ConstructBarions()
{
    //  barions
    G4Proton::ProtonDefinition();
    G4AntiProton::AntiProtonDefinition();
    G4GenericIon::GenericIonDefinition();
}
void PhysicsList::ConstructProcess()
{
    AddTransportation();
    ConstructEM();
  //  ConstructGeneral();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....


//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....

void PhysicsList::ConstructEM()
{

    G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();

    // ****************************************************************
    // Identical to G4EmStandardPhysics but added G4StepLimiter process
    // ****************************************************************


    auto particleIterator = GetParticleIterator();
    particleIterator->reset();

    while ((*particleIterator)()) {

        G4ParticleDefinition* particle = particleIterator->value();

        G4String particleName = particle->GetParticleName();

        if (particleName == "gamma") {

            ph->RegisterProcess(new G4PhotoElectricEffect(), particle);
            ph->RegisterProcess(new G4ComptonScattering(), particle);
            ph->RegisterProcess(new G4GammaConversion(), particle);
            ph->RegisterProcess(new G4RayleighScattering(), particle);
           // ph->RegisterProcess(new G4GeneralGammaProcess(), particle);

        }
        else if (particleName == "e-") {

            ph->RegisterProcess(new G4eMultipleScattering(), particle);
            ph->RegisterProcess(new G4eIonisation(), particle);
            ph->RegisterProcess(new G4eBremsstrahlung(), particle);

        }
        else if (particleName == "e+") {

            ph->RegisterProcess(new G4eMultipleScattering(), particle);
            ph->RegisterProcess(new G4eIonisation(), particle);
            ph->RegisterProcess(new G4eBremsstrahlung(), particle);
            ph->RegisterProcess(new G4eplusAnnihilation(), particle);

        }
        else if (particleName == "mu+" ||
            particleName == "mu-") {

            G4MuMultipleScattering* msc = new G4MuMultipleScattering();
            msc->AddEmModel(0, new G4WentzelVIModel());

            ph->RegisterProcess(msc, particle);
            ph->RegisterProcess(new G4MuIonisation(), particle);
            ph->RegisterProcess(new G4MuBremsstrahlung(), particle);
            ph->RegisterProcess(new G4MuPairProduction(), particle);
            ph->RegisterProcess(new G4CoulombScattering(), particle);

        }
        else if (particleName == "alpha" ||
            particleName == "He3") {

            ph->RegisterProcess(new G4hMultipleScattering(), particle);
            ph->RegisterProcess(new G4ionIonisation(), particle);

        }
        else if (particleName == "GenericIon") {

            ph->RegisterProcess(new G4hMultipleScattering(), particle);
            ph->RegisterProcess(new G4ionIonisation(), particle);

        }
        else if (particleName == "proton") {
            ph->RegisterProcess(new G4hMultipleScattering(), particle);
            ph->RegisterProcess(new G4hIonisation(), particle);
            ph->RegisterProcess(new G4hBremsstrahlung(), particle);
            ph->RegisterProcess(new G4hPairProduction(), particle);
            ph->RegisterProcess(new G4StepLimiter(), particle);

        }
    }
    //===========================================================================//
    // la deséxcitation des atomes:: pour avoir les rayonnements caractéris-
    //                tiques dans le spectre des rayons x
    //===========================================================================//
    G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
    de->SetFluo(true);
    de->SetAuger(true);
    de->SetPIXE(true);
    G4LossTableManager::Instance()->SetAtomDeexcitation(de);
}

I run the simulation in the single thread mode.Am I doing this right?

auto* runManager = G4RunManagerFactory::CreateRunManager();
  G4int nThreads = 1;
  runManager->SetNumberOfThreads(nThreads);

The energy spectrum of the tube(energy deposited inside the detector) is as followed.

void XrayFluoSteppingAction::UserSteppingAction(const G4Step* aStep)
{
  if (aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == pTest)
  {
    
      particleName = aStep->GetTrack()->GetParticleDefinition()->GetParticleName();
          fEvent->AddEnergy(aStep->GetTotalEnergyDeposit());
 }
void XrayFluoEventAction::EndOfEventAction(const G4Event* evt)
{	
	auto analysisManager = G4AnalysisManager::Instance();
	if(energyD)
	analysisManager->FillH1(0, energyD / keV);
}

image

Sorry, the picture is not clear, I have reposted one.
image

Hi @BobLeeAbc,

As a starting point, it seems like the number of primary electrons you are running is far too low. Your x-ray spectrum has only 63 entries in it. With only 63 entries I don’t believe it is possible to tell whether the spectrum is correct or not.

Second: A question for you. My understanding is that an x-ray tube’s spectrum would be defined by the energy of the x-rays leaving the tube. But in your stepping action, you are scoring the energy deposited in some volume. Since photons/x-rays do not deposit energy directly, but through the creation of secondary photoelectrons and compton electrons, you are measuring the energy deposited by these secondary electrons. Is that your intention?

Best,

Joseph

1 Like

Hi Joseph,
Thanks for your replies. I will set a large number of primary electrons.

I am scoring the energy deposited in the SDD detector(made of Si), which is placed outside the Be window, and I am measuring the energy deposited by the x-rays leaving the tube, and their secondary electrons. I don’t know if I am right.

Best,

Lee

Hi Joseph,
I used 500000000 primary electrons to hit the Ag target, this is the energy spectrum from the detector (its thickness is 10mm). The picture seems a little strange.
image

Best,

Lee

Do you mean I just need measuring the energy deposited by these secondary electrons, not the photons/x-rays? I desperately need your help, thanks.

I just measured the energy deposited by these secondary electrons. I don’t know why there is the highest number of electrons with energy 2.929 keV.

Isn’t Auger electrons? Or some escape effect of x rays?

1 Like

Hi pandola,
You mean that the highest number of electrons with energy 2.929 keV is caused by some escape effect of x rays or Auger electrons? I don’t know if this spectrum is correct. I know the Ag Lβ X-ray energy is about 2.98 keV, but I think the number of Kα rays should be much higher than the Lβ rays. Maybe I’m doing something wrong

This the spectrum of X-rays emitted from Ag target:

1 Like

Thanks a lot! Could you tell me how you achieved it?

I’m almost desperate :sob: :sob:

This spectrum is obtained using G4EmStandardPhysics_option4, but this is not the energy deposition spectrum. I compute the energy fluence of X-rays passes through a volume detector.
What is the thickness of your target?

1 Like

Thanks a lot, the thickness of my target is 4 um. Could you tell me what is the energy fluence of X-rays passes through a volume detector?

I need help :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob: :sob:

top top top top :smiling_face: :smiling_face: :smiling_face: :smiling_face:

The thickness of 4 um is too small!

G4bool SensitiveDetector::ProcessHits(G4Step *aStep,
                                      G4TouchableHistory *)
{
  G4Track *track = aStep->GetTrack();

  track->SetTrackStatus(fStopAndKill);

  if (track->GetDynamicParticle()->GetDefinition()->GetParticleName() == "gamma")
  {
    G4double E = aStep->GetPreStepPoint()->GetKineticEnergy() / keV;
    G4double w = aStep->GetPreStepPoint()->GetWeight();
    // G4cout << E << "--------------->" << w << "\n";
    G4AnalysisManager *man = G4AnalysisManager::Instance();

    man->FillH1(0, E, w);
  }

I am using these lines in SD class to fill the histogram.

1 Like

Thank you very much for your suggestion, I will try it.

Hi,
I have done what you said and the energy spectrum is shown below. I changed the thickness of the silver target to 400 um.


Thanks.

Hi,
I got this spectrum according to your suggestion,thank you very much!