|Message: Re: adding new units to example B1||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
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:||Outline Depth:||Add message:|