Record some unstable particles in output without making detector interaction/decay

Dear experts,
Is there a way to record unstable particles without them making any interaction/decay.
In other words, I have a pp collision generator sample from which I shoot only stable particles using a particle gun - by setting its momentum and vertex from the file. I would like to record a few b quarks from this file, in addition, to be able to keep a track of it for later use.
Thanks,
Tamasi

Hello, Can someone help me in this regard?
I read a set of particles from a root file which contains details of pp collisions. Only the stable particles are shot using a particle gun into the detector simulation by setting their momentum and vertex information. However, I am using HH->4b physics channel and would like to keep a track of the b quarks after simulation and reconstruction.

Is there a way these unstable particles (the 4 b quarks, maybe also the higgs’s) can be added to the trajectory container somehow to be filled in the simulation output in the user defined G4VEvent.cpp class?

I do the following to shoot stable particles:
G4Event anEvent;
G4ParticleTable
particleTable = G4ParticleTable::GetParticleTable();
G4ParticleGun *particleGun = new G4ParticleGun(n_particle);
I start by looping over all particles from a pp collision:

  1. Check if the particles are stable; if not continue
  2. G4ParticleDefinition* sparticle;
    sparticle = particleTable->FindParticle(pid);
    particleGun->SetParticleDefinition(sparticle);
    particleGun->SetParticlePosition(G4ThreeVector(vx, vy, vy));
    particleGun->SetParticleMomentum(G4ThreeVector(px, py, py));
    particleGun->GeneratePrimaryVertex(anEvent);
  3. After this the user RunAction class is called…

Any hints of how I could do this would be of great help.
Thanks,
Tamasi