Get interaction of a secondary particle

in the uploaded nohup.out, fSectrackID is always 0
but then you compare step->GetTrack()->GetTrackID() == fSectrackID, probably GetTrackID is never 0?

Hello @weller, I tried to do these prints:

  1. Printing all e+ produced by gamma->e+e- in the regenerator
for(size_t lp1=0;lp1<(*fSecondary).size(); lp1++){
     secondaryParticleName =  (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();  // name of the secondary
     process = (*fSecondary)[lp1]-> GetCreatorProcess()-> GetProcessName();   // process creating it
     fSectrackID = (*fSecondary)[lp1]->GetTrackID(); //track id
     fSsecparID = (*fSecondary)[lp1]->GetParentID();   //parent id
     volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName(); // volume where secondary was generated 
     if (process=="conv" && secondaryParticleName =="e+"){	 
    G4cerr << G4endl;
     G4cerr << "Event n°: " << lp1 << G4endl;
     G4cerr << "secondaryParticleName: " << (*fSecondary)[lp1]->GetDefinition() -> GetParticleName() << G4endl;
     G4cerr << "process: " << (*fSecondary)[lp1]-> GetCreatorProcess()-> GetProcessName() << G4endl;
     //G4cerr << "fSectrackID: " << (*fSecondary)[lp1]->GetTrackID() << G4endl;
     //G4cerr << "fSsecparID: " << (*fSecondary)[lp1]->GetParentID() << G4endl;
     G4cerr << "volumeName: " << (*fSecondary)[lp1] -> GetVolume() -> GetName() << G4endl;
     G4cerr << G4endl;
 
 }

and I get several particles…

    1. Printing all e+ produced by gamma->e+e- in the regenerator and outgoing it
for(size_t lp1=0;lp1<(*fSecondary).size(); lp1++){
     secondaryParticleName =  (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();  // name of the secondary
     process = (*fSecondary)[lp1]-> GetCreatorProcess()-> GetProcessName();   // process creating it
     fSectrackID = (*fSecondary)[lp1]->GetTrackID(); //track id
     fSsecparID = (*fSecondary)[lp1]->GetParentID();   //parent id
     volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName(); // volume where secondary was generated 
     if (process=="conv" && secondaryParticleName =="e+"){
     	if(NextVol && ThisVol->GetName()=="Regenerator" && NextVol->GetName()=="World"){
		 
	 
    G4cerr << G4endl;
     G4cerr << "Event n°: " << lp1 << G4endl;
     G4cerr << "secondaryParticleName: " << (*fSecondary)[lp1]->GetDefinition() -> GetParticleName() << G4endl;
     G4cerr << "process: " << (*fSecondary)[lp1]-> GetCreatorProcess()-> GetProcessName() << G4endl;
     //G4cerr << "fSectrackID: " << (*fSecondary)[lp1]->GetTrackID() << G4endl;
     //G4cerr << "fSsecparID: " << (*fSecondary)[lp1]->GetParentID() << G4endl;
     G4cerr << "volumeName: " << (*fSecondary)[lp1] -> GetVolume() -> GetName() << G4endl;
     G4cerr << G4endl;
 }
 }

but I don’t get any particle…

it looks like that all positrons outgoing the regenerator are produced by other process (i.e. eBrem)…

but it’s strange…because in the project there is the idea to regenerate e+ from gamma conversion…

in your nohup.out, the very last entry:

G4WT1 > Event n°: 1
G4WT1 > secondaryParticleName: e+
G4WT1 > process: conv
G4WT1 > fSectrackID: 0
G4WT1 > fSsecparID: 588
G4WT1 > volumeName: Regenerator

is that what you are looking for?

Yesh I’m looking for the
process =="conv" && volumeName=="Regenerator"

but

  1. Simulating 10000 events (instead, in the file that I uploaded I simulated only 100 events)
  2. I didn’t set selection on fSecparID and fSectrackID…

Correct me if I’m wrong, but isn’t eBrem (Bremsstrahlung) a process where a gamma gets created (by decelleration of a charged particle)?

So maybe only the last process a positron/electron went through before leaving the volume under consideration is eBrem, but the positron could have originally been created via conv?
Probably it is highly unlikely for a conv process to happen very close to the surface (ratio of volume close to and far from the surface?), that’s why you did not encounter at least one of them in your limited number of events…

Hello @weller

Yes, when an Electron/positron moves near atomic nuclei, it can emits photons.

Obviously, it’s possible that a photon produces a positron then it emits photon so I get it as an “eBream”…but how can I know if it was produce by a photon or, for example, by positron of primary beam??

Currently both the beam and secondary particles producded in the targets can reich the regeneraror…
So I can’t know if the parent of the eBream is a photon or other particle…I tried to add a magnetic field in order to deflect charged particles (i.e. to have only photons reaching the regenerator), but even if I don’t get errors, the simulation doesn’t run Add a magnetic field - #4 by faca87