|Message: int-conversion with unit||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)|
Hi, I discovered a strange thing in Gean4 concerning units: First I wanted to have an integer-number of the radius of an orb in order to put this into the filename (with sprintf). I solved this in a better way (posting 98): G4UIcommand::ConvertToString((radius/cm)*2./2.54)
The thing I descovered is, that there seems to be something strange with the units:
In DetectorConstruction: inchFactor = 2.54*cm; radius = 6.*inchFactor/2.;
In RunAction I get this radius with a Get-funktion, then I try : G4cout << "=============================================================" <<G4endl; G4cout << "Int-ausgabe der kugelgröße : "<< G4endl; G4double zahl1,zahl2; zahl1=(7.62)*2./2.54; zahl2=(radius/cm)*2./2.54; G4cout <<"Radius of sphere(cm): "<< radius/cm<<G4endl; G4cout <<"Radius=7.62 of sphere(cm) as Integer with zahl1: "<< G4int(zahl1) <<G4endl; G4cout << "Radius=radius/cm of sphere(cm) as Integer with zahl2: "<<G4int(zahl2)<<G4endl; G4cout << "Radius of sphere(cm) as Integer: "<<G4int((radius/cm)*2./2.54) <<G4endl; G4cout <<"Radius of sphere(cm) as double: "<<(radius/cm)*2./2.54<< G4endl; G4cout << "=============================================================" <<G4endl;
I get the following output: ============================================================= Int-ausgabe der kugelgröße :
Radius of sphere(cm): 7.62
Radius=7.62 of sphere(cm) as Integer with zahl1: 6
Radius=radius/cm of sphere(cm) as Integer with zahl2: 5
Radius of sphere(cm) as Integer: 5
Radius of sphere(cm) as double: 6
Why is there this 5?????? I saw the same thing with energies(only at lower energies:<keV) Has it got something to do with the unit?????
I hope this only concerns the converting to int. Greetings, Sylvia
|Inline Depth:||Outline Depth:||Add message:|