Message: Draw tracks only for particles resulting in hits? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Draw tracks only for particles resulting in hits? 

Forum: Event and Track Management
Date: 30 Aug, 2018
From: Alan Horst <Alan Horst>

I know there are methods to filter tracks, and also ways to draw hits, but I'm trying to find a way to conditionally draw only the tracks that result in hits.

I have a variable that is updated every event that will give a 0 or 1 if the event results in a hit, but I'm not sure this can be correctly used in PostUserTrackingAction.

    G4HCofThisEvent* hitsCollections = 0;
    hitsCollections = anEvent->GetHCofThisEvent();

    LYSimPMTHitsCollection* hits = 0;
    if ( hitsCollections )
    {
        hits = static_cast<LYSimPMTHitsCollection*> ( hitsCollections->GetHC(hitCollID) );
    }
    else
    {
        G4cerr << "hitsCollection not found" << G4endl;
        return;
    }
    G4double nHits = hits->entries();

Preferably, I would want to use nHits as a conditional when drawing tracks.

Any ideas?

 Add Message Add Message
to: "Draw tracks only for particles resulting in hits?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]