Message: Re: fill velocity in root file? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: fill velocity in root file? 

Forum: Analysis
Re: Question fill velocity in root file? (Summit)
Date: 04 Apr, 2013
From: michel maire <michel maire>

On Sat, 30 Mar 2013 14:10:13 GMT, Summit wrote:
> Hello,
> 
> To calculate the velocity of the charged particle with depth, I modified
> TrackingAction.cc in example TestEm7 (Geant4.9.5) as:
> 
> void TrackingAction::PostUserTrackingAction(const G4Track* track)
> {
>   // extract Projected Range of primary particle
>   if (track->GetTrackID() == 1) {
>     G4double x = track->GetPosition().x() + 0.5*detector->GetAbsorSizeX();
>     G4double vel = track->GetVelocity();
> 
>      if(vel>0.0){
>      G4cout<<vel/(m/s)<<" m/sec  at  "<< x/mm <<" mm\n";
>      histoManager->FillHisto(3, x, vel/(m/s));
>         }
> 
>     if(x > 0.0) runAction->AddProjRange(x);
> 
>   }  
> }
> 
> In this case, G4cout prints the velocity of the order of 10^8, while
> root file results only 10^6. Can anyone suggest me something to sort out
> this problem.
> 
 I tried to reproduce the problem with your code above.
 Macro :
 #
 /testem/det/setMat Water
 /testem/det/setSizeX  10 cm
 /testem/det/setSizeYZ 10 cm
 #
 /run/initialize
 #
 /gun/particle proton
 /gun/energy 200 MeV
 #
 /analysis/setFileName testem7
 /analysis/h1/set 3 100 100 120 mm
 #
 /run/beamOn 10

 The result is:
 ---> Begin of Event: 0
 1.52869e+08 m/sec  at  110 mm
 1.52203e+08 m/sec  at  110 mm
 1.5202e+08 m/sec  at  110 mm
 1.52665e+08 m/sec  at  110 mm
 1.52098e+08 m/sec  at  110 mm
 1.51974e+08 m/sec  at  110 mm
 1.51994e+08 m/sec  at  110 mm
 1.52375e+08 m/sec  at  110 mm
 1.52574e+08 m/sec  at  110 mm
 1.51654e+08 m/sec  at  110 mm

 and the histo 3 in attachement:
 weight is of the order of 150 10^6 = 1.5 10^8

   Attachment:
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2013/04/04/10.33-22016-velocity.gif

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

1 Question: Re: fill velocity in root file?   (Summit - 04 Apr, 2013)
(_ None: Re: fill velocity in root file?   (michel maire - 06 Apr, 2013)
 Add Message Add Message
to: "Re: fill velocity in root file?"

 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 ]