Hello @dsawkey thank you…I tried to follow the example…but surely I did a mistake.
Firstly I want to explain you my goal.
In november 2021 it has been measured the radiation hitting a scintillator connected to an ArduSiPM. The beam (1GeV electron beam) entered and exit a steel vacuum chamber by two mylar chamber; In front of a third vacuum chamber forming an angle of 22.5 degree with the beam axis, there was the scintillator to measure the radiation outgoing the vacuum chamber. The counting rate measured by was 4.410^5 count/s.
I simulated the setup, and I estimated the counting rate of particles ENTERING the scintillator…it is 1.510^7 count/s…
This is the geant4 pictorial view (green=vacuum chamber, blue=mylar windows, grey=scintillator)
Obiviously in the 1.510^7 particles there are many of them that ArduSiPM can’t measure. For example, to be detected by the SiPM, photons entering in the scintillator must produce elctron-positron pairs and the latter must produce scintillation light. If I try to apply the E>1.2MeV to photons entering the scintillator (i.e. the threshold to produce electron-positron pair), the number of photons is reduced from 1.210^7 to 7.1*10^5)…
therefore, now I want to look by the simulation how many of the particles entering the scintillator produce scintillation light in it (i.e. can in principle be detected by the SiPM)
I wrote in the stepping action
if(NextVol && ThisVol->GetName()=="World" && NextVol->GetName()=="PlasticScintillator") {
int pdg = step->GetTrack()->GetParticleDefinition()->GetPDGEncoding();
analysisManager->FillNtupleDColumn(6,0, pdg);
double kinEnergy = step->GetTrack()->GetDynamicParticle()->GetKineticEnergy();
analysisManager->FillNtupleDColumn(6,1, kinEnergy);
double MomDirx = step->GetTrack()->GetMomentumDirection().x();
analysisManager->FillNtupleDColumn(6,2, MomDirx);
double MomDiry = step->GetTrack()->GetMomentumDirection().y();
analysisManager->FillNtupleDColumn(6,3, MomDiry);
double MomDirz = step->GetTrack()->GetMomentumDirection().z();
analysisManager->FillNtupleDColumn(6,4, MomDirz);
double Vertx = step->GetTrack()->GetVertexPosition().x();
analysisManager->FillNtupleDColumn(6,5, Vertx);
double Verty = step->GetTrack()->GetVertexPosition().y();
analysisManager->FillNtupleDColumn(6,6, Verty);
double Vertz = step->GetTrack()->GetVertexPosition().z();
analysisManager->FillNtupleDColumn(6,7, Vertz);
double Mom = step->GetTrack()->GetDynamicParticle()->GetTotalMomentum();
analysisManager->FillNtupleDColumn(6,8, Mom);
double Dirxsp = step->GetTrack()->GetPosition().x();
analysisManager->FillNtupleDColumn(6,9, Dirxsp);
double Dirysp = step->GetTrack()->GetPosition().y();
analysisManager->FillNtupleDColumn(6,10, Dirysp);
double Dirzsp = step->GetTrack()->GetPosition().z();
analysisManager->FillNtupleDColumn(6,11, Dirzsp);
double Momx = step->GetTrack()->GetDynamicParticle()->GetMomentum().x();
analysisManager->FillNtupleDColumn(6,12, Momx);
double Momy = step->GetTrack()->GetDynamicParticle()->GetMomentum().y();
analysisManager->FillNtupleDColumn(6,13, Momy);
double Momz = step->GetTrack()->GetDynamicParticle()->GetMomentum().z();
analysisManager->FillNtupleDColumn(6,14, Momz);
double xprime=atan((step->GetTrack()->GetDynamicParticle()->GetMomentum().x())/(step->GetTrack()->GetDynamicParticle()->GetMomentum().z()));
analysisManager->FillNtupleDColumn(6,15, xprime);
double yprime=atan((step->GetTrack()->GetDynamicParticle()->GetMomentum().y())/(step->GetTrack()->GetDynamicParticle()->GetMomentum().z()));
analysisManager->FillNtupleDColumn(6,16, yprime);
auto proc_man = step->GetTrack()->GetParticleDefinition()->GetProcessManager();
G4String proc_name = step->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName();
G4int n_scint = 0;
if(proc_name == "Scintillation"){
G4Scintillation* scint = new G4Scintillation("Scintillation");
n_scint = scint->GetNumPhotons();
analysisManager->FillNtupleDColumn(6,17, n_scint);
}
analysisManager->AddNtupleRow(6);
}
but you see…I get 0 scintillation photons (it was just to try, so I simulated only 10^6 primary electrons)
B1SteppingAction.cc (46.0 KB)