Message: How to Disregard Secondary Particles Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question How to Disregard Secondary Particles 

Forum: Event and Track Management
Date: 08 Oct, 2008
From: ozgur ates <ozgur ates>

Hi,

In my EventAction, I need to fill my Root Tree just by Primary Particle, not by secondary particles. I need to disregard them all. Could you guide me, here my codes as follows:

Thanks

....

void EventAction::EndOfEventAction(const G4Event* evt) {

  G4int event_id = evt->GetEventID();  

  if (event_id%1000 == 0) 
    G4cout <<"Event " << evt->GetEventID() << G4endl;

  G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
  if(HCE) {
    G4int CollSize=HCE->GetNumberOfCollections();
    G4int hci=0;

    for(G4int i=0;i<CollSize;i++){
      DetectorHitsCollection* hc;

      while(!(hc=static_cast<DetectorHitsCollection*>(HCE->GetHC(hci++))));
      G4int hc_nhits=hc->entries();

     if(hc->GetName().contains("Cathode")){
	for(G4int i=0;i<hc_nhits;i++){
 	  DetectorHit* hit=static_cast<DetectorHit*>(hc->GetHit(i));
	  det   = 1;
	  pdef  = hit->GetPDef();
	  pos   = hit->GetPos();
	  mom   = hit->GetMom();
	  time  = hit->GetTime();
	  edep  = hit->GetEdep();
	  id    = hit->GetID();
          theta = hit->GetTheta();
          phi   = hit->GetPhi();
	}

 anaManager->FillTree(det,pdef,pos,mom,theta,phi,time,edep,id);	

 }

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

1 None: Re: How to Disregard Secondary Particles   (ercan - 12 Dec, 2008)
 Add Message Add Message
to: "How to Disregard Secondary Particles"

 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 ]