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

None Re: energy depostition of an individual track 

Forum: Event and Track Management
Re: None energy depostition of an individual track (Victor_Makarov)
Date: 02 Apr, 2008
From: michel maire <michel maire>

User Victor_Makarov wrote:

>> 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;
>>  runManager->SetUserAction(RunAct);
>>  EventAction* EvAct    = new EventAction(RunAct);  
>>  runManager->SetUserAction(EvAct);
>> TrackingAction* TrAct = new TrackingAction(RunAct);

    I assume you did not forget : runManager->SetUserAction(TrAct);

>>   runManager->SetUserAction(new SteppingAction(TrAct));
>> 
>>   //Initialize G4 kernel
>>   runManager->Initialize();
>> 
>>  --- 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);  
>> }

  I assume the pointer 'trackingAction' is defined as a data member of your SteppingAction class,
  initialized in the constructor

>> 
>> -- part of trackingaction.cc ----
>> 
>> void TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
>> {
>> #ifdef G4ANALYSIS_USE
>>   Run->GetHisto(0)->fill(TotalEnergyDeposit/MeV);
>> #endif
>> }

  TotalEnergyDeposit is initialized in PreUserTrackingAction() ?

>> 
>> --part of trackingaction.hh
>> 
>> class TrackingAction : public G4UserTrackingAction {
>> 
>>   public:  
>>     TrackingAction(RunAction*);
>>    ~TrackingAction() {};
>>     void addEdep(G4double Edep)     {TotalEnergyDeposit += Edep;};      
>>     G4double GetEnergyDeposit()     {return TotalEnergyDeposit;};    
>>     void PreUserTrackingAction(const G4Track*);
>>     void PostUserTrackingAction(const G4Track*);
>> 
>>   private:
>>     RunAction* Run;    
>>     G4double TotalEnergyDeposit;   
>> };

    correct !

>> 
>> BIG THANKS IN ADVANCE!
>> 
>> 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
>> EventAction.cc Or is this method applied directly from EventAction.hh?

  It is filled with the method addEDep() in EventAction.hh, exactly like you do in TrackingAction.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   (Victor_Makarov - 02 Apr, 2008)
 Add Message Add Message
to: "Re: 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 ]