Message: Classification of new track: How to stop killing tracks? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Classification of new track: How to stop killing tracks? 

Forum: Event and Track Management
Date: 23 Feb, 2017
From: Patrick Asenov <Patrick Asenov>

Greetings, colleagues, comrades and friends!

I've been trying to implement the G4ClassificationOfNewTrack inside my StackingAction.cc. However, whenever I try to visualize the trajectories of secondary particles using OGL, I am not able to see any of them. I believe that this is due to the fact that I delete all the new tracks immediately with the command

return fKill;

while not storing them in any stack.

But what should be returned instead of fKill??? fUrgent, fWaiting, fPostpone?? They all end up in the same warning message: Segmentation fault (core dumped).

Do you have any suggestions? I would be thankful if I were given a helping hand.

Here's my code:

G4ClassificationOfNewTrack
StackingAction::ClassifyNewTrack(const G4Track* track)
{
  //keep primary particle
  if (track->GetParentID() == 0) return fUrgent;

  //energy spectrum of secondaries
  //
  energy = track->GetKineticEnergy();
  charged = (track->GetDefinition()->GetPDGCharge() != 0.);
  G4VPhysicalVolume* volume = track->GetVolume();

  //kinetic energy of secondaries calculation
  if (volume == fDetectorconstruction->GetDet1()) {
    G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();

    if (charged) {
     fRunaction->AddChargedSecondary1(energy);
     analysisManager->FillH1(7,energy);
    } else {
     fRunaction->AddNeutralSecondary1(energy);
     analysisManager->FillH1(9,energy);
    }

    fEventaction->AddSecondary1(energy);
  }

  if (volume == fDetectorconstruction->GetDet2()) {
    G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();

    if (charged) {
     fRunaction->AddChargedSecondary2(energy);
     analysisManager->FillH1(8,energy);
    } else {
     fRunaction->AddNeutralSecondary2(energy);
     analysisManager->FillH1(10,energy);
    }

    fEventaction->AddSecondary2(energy);
  }

  return fKill; // This might be the source of all trouble!!
}

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Feedback: Re: Classification of new track: How to stop killing tracks?   (Gumplinger Peter - 23 Feb, 2017)
(_ Ok: Re: Classification of new track: How to stop killing tracks?   (Patrick Asenov - 24 Feb, 2017)
 Add Message Add Message
to: "Classification of new track: How to stop killing tracks?"

 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 ]