Message: Re: adding new units to example B1 Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: adding new units to example B1 

Forum: Documentation and Examples
Re: Question adding new units to example B1 (Tim Meehan)
Date: 19 Jul, 2017
From: michel maire <michel maire>

On Tue, 18 Jul 2017 16:35:29 GMT, Tim Meehan wrote:
> Im running Geant4-10.3.1 on a Mac, and I wanted to see if I could add a
> unit to example B1. It seems like the examples that I could find added
> the units in the constructor of a subclass of G4UserRunAction ... but it
> doesn't seem like there is a preferred location mentioned anywhere.
> 
> I wanted to define a new material using the
> G4NistManager::ConstructNewGasMaterial method, and the gauge that the
> experiment is using reads out in "Torr", so I wanted to add "Torr" as a
> unit.
> 
> I made sure to include all of the proper headers (or at least the
> compiler stopped complaining about missing things). I didn't bother
> adding the material yet, I just wanted to see if my application would
> print out something in my new unit - so in the constructor for
> B1DetectorConstruction I put:
> 
> new G4UnitDefinition("torr", "Torr", "Pressure", atmosphere/760.);
> 
> In B1DetectorConstruction::Construct(), I put a line:
> 
> G4cout << "1 pascal in Torr: " << pascal / torr << G4endl;
> 
> However, the compiler doesn't recognize torr as a unit, I thinks that I
> have misspelled "for" :(
> 
> Any ideas?
> 

 There are two levels.

 1- The units defined in external/CLHEP/SystemOfUnits.h
      These units can be used everywhere in your application, via the header G4SystemOfUnits.hh

 2- The units registered in G4UnitsTable (in global/management)
      These units have a chance to be selected on output by the function G4BestUnit(...)

 As it is, your Torr belong to the second family (as the other units introduced in B1RunAction).
 To be used everywhere in your application, the numerical value of Torr must be defined in some global statement. 

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

1 Ok: Re: adding new units to example B1   (Tim Meehan - 19 Jul, 2017)
 Add Message Add Message
to: "Re: adding new units to example B1"

 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 ]