Message: Tracking Secondary Optical Photons Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Tracking Secondary Optical Photons 

Forum: Event and Track Management
Date: 08 Oct, 2013
From: Madax <Madax>

I want to track all secondary optical photons generated in the Physical Volume retained by GetNaI.

-------------

But, I am not able to get any count in the counter1. While, my stackingaction class shows secondary optical photons in millions been generated. I have tried to remove volume conditions as well to simply check counter being incremented. But, no change.

Please tell me if you know where I am going wrong.

-----

Code in the SteppingAction Class:::

----

void Example1SteppingAction::UserSteppingAction(const G4Step* step)
{
    // get volume of the current step
    static G4VPhysicalVolume* volume;
    // check if we are in scoring volume
    if(0 == fVolumes.count(volume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume())) { return; }

    const std::vector<const G4Track*>* secondaries = step->GetSecondaryInCurrentStep();
    for(unsigned int i=0; i<secondaries->size(); ++i)
    {
        if (secondaries->at(i)->GetDynamicParticle()->GetParticleDefinition() == G4OpticalPhoton::OpticalPhotonDefinition())
        {
            secondaries_to_track.insert(secondaries->at(i));            
        }
    }

    G4cout<<"Check 1"<<G4endl;

    if (secondaries_to_track.count(step->GetTrack())!=0 &&
            volume == detector->GetNaI())
    {

        counter1 +=1;
        G4cout<<"Counted Sec Opti Photon" << counter1<<G4endl;
    }

   if (secondaries_to_track.count(step->GetTrack())!=0 &&
            fVolumes.count(step->GetTrack()->GetTouchable()->GetVolume()) > 0)
    {

        counter1 +=1;
        G4cout<<"Counted Sec Opti Photons all" << counter1<<G4endl;
    }

----------------

 Add Message Add Message
to: "Tracking Secondary Optical Photons"

 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 ]