Message: energy depostition of an individual track Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None energy depostition of an individual track 

Forum: Event and Track Management
Date: 02 Apr, 2008
From: Victor_Makarov <Victor_Makarov>

Hello. I would like to obtain e.d. per one track, but not per step or event. I thought it would be possible to use testem4 example policy with some modifications. In that example e.d. per step is sent and summed in EventAction and in the end of every event the summ is sent to histograms (e.d. per event)

This is the scheme that I used:

E.d. per step -----> it is sent and accumulated in TrackingAction ----> at the end of every track I send the summ to histo. Unfortnately, the sceme doesn't seem to work right. It seems that I make a mistake in sequence of making pointers. Here are the corresponding parts of my program:

-- part of main program ---

 runManager->SetUserAction(new PrimaryGeneratorAction);
  RunAction* RunAct     = new RunAction;
  EventAction* EvAct    = new EventAction(RunAct);  
TrackingAction* TrAct = new TrackingAction(RunAct);
  runManager->SetUserAction(new SteppingAction(TrAct));

  //Initialize G4 kernel

 --- part of stepping action ----

void SteppingAction::UserSteppingAction(const G4Step* aStep)
  G4String pname = aStep->GetTrack()->GetDefinition()->GetParticleName();
G4double EdepStep = 0;
  if(pname=="gamma")  EdepStep = aStep->GetTotalEnergyDeposit();
  if (EdepStep > 0.) trackingAction->addEdep(EdepStep);	 

-- part of ----

void TrackingAction::PostUserTrackingAction(const G4Track* aTrack)

--part of trackingaction.hh

class TrackingAction : public G4UserTrackingAction {

   ~TrackingAction() {};
     void addEdep(G4double Edep)     {TotalEnergyDeposit += Edep;};      
    G4double GetEnergyDeposit()     {return TotalEnergyDeposit;};    
    void PreUserTrackingAction(const G4Track*);
    void PostUserTrackingAction(const G4Track*);

    RunAction* Run;    
    G4double TotalEnergyDeposit;   


P.s: Also I can't understand how in line of EventAction of TestEm4 Run->GetHisto(0)->fill(TotalEnergyDeposit/MeV) we obtain TotalEnergyDeposit value because GetEnergyDeposit method was not used in Or is this method applied directly from EventAction.hh?

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

1 None: Re: energy depostition of an individual track   (michel maire - 02 Apr, 2008)
(_ None: Re: energy depostition of an individual track   (Victor_Makarov - 02 Apr, 2008)
 Add Message Add Message
to: "energy depostition of an individual track"

 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 ]