Hello! Thanks to everyone i can reach this point but i need again your help. In calorimeterSD, in processhit I wrote this:
G4StepPoint* posStep = step->GetPostStepPoint();
G4int counter = 0;
G4TrackVector* secTracks = G4TrackingManager->GimmeSecondaries();
if (posStep->GetStepStatus()==fGeomBoundary){
if(secTracks) {
size_t nmbSecTracks = (*secTracks).size();
for(size_t i = 0; i < nmbSecTracks; i++) {
if((*secTracks)[i] ->GetDefinition() = G4Electron::Definition())
counter++;
G4cout<<"particles passing through"<<counter<<G4endl;
}
}
}
I have to count the number of electron produced by a muon in a layer of copper and passing through the boundary between the absorber and the gap. I tried to introduce an HitCollection but i don’t know how to do it properly so i made a loop over all the secondaries but i would like a more efficient way.
P.s. i started from the B4c example.
P.P.s. it gives me an error GimmeSecondaries() because of the brackets an again I don’t know why.