10
C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

Embed Size (px)

Citation preview

Page 1: C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

C++ / G4MICE Course

Session 5

Materials in G4MICEUnits in G4MICE

Visualisation in G4MICEG4MICE Modelling

Page 2: C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

Materials in G4MICE

• The MiceMaterials class is used by the modelling code (and can be accessed by user code as required) to hold information about all of the materials that can be used in a G4MICE model.

• It currently includes all of the NIST material database plus some additional materials for MICE and MANX.

• Other materials can be added on request if they are needed.

2

Page 3: C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

Material Properties

• If an application is built including GEANT4, then the G4Material object can be retrieved from the corresponding MiceMaterial object.

• If not, then you can still get all of the material proprties (density, temperature, pressure, X0, etc) from the MiceMaterial class.

• >> look at doxygen page for MiceMaterial

3

Page 4: C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

Units in G4MICE

• CLHEP provides a set of definitions that are self-consistent to allow the use of units correctly in our code (SystemOfUnits).

• If you always use the units when defining variables and when using them, there should be no problems that are often associated with one person using cm and another using mm, inches, metres, etc...

4

Page 5: C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

Units Example

• double length = 100 * mm;• double width = 1 * cm;• double height = 2.5 * m;• double area = width * height;• double volume = length * width * height;• std::cout << “Area = “ << area / km2 << “

square kilometres” << std::endl;• std::cout << “Volume = “ << volume / mm3 <<

“ cubic millimetres” << std::endl;5

Page 6: C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

G4MICE – Units Extension

• The MiceUnits class takes the CLHEP units and adds the ability to read in units from our various text files (data cards and MiceModules).

• This means that there is no reason to ever give a parameter without a unit if it has a unit.

• >> look at data cards and MiceModules files again.

6

Page 7: C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

Visualisation in G4MICE

• There are currently two different options to perform visualisation in G4MICE.

• The first is the EventDisplay application, which generates a HepRep format file.

• The second is to run the Simulation Application in the interactive mode and use the GEANT4 interactive commands to perform the visualisation.

7

Page 8: C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

Event Display Application

• The EventDisplay application will generate one heprep file per event.

• If there is a file with hits, points, tracks, etc, it will visualise those as well.

• If numEvts is equal to 0, it will only generate one file, containing just the geometry.

• >> try cards.vis1 and cards.vis2

8

Page 9: C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

Simulation Visualisation• Run the Simulation in interactive mode:• ${MICESRC}/Applications/Simulation/Simulation

cards.sim 1• When it gives a prompt, enter the following:

– /vis/scene/create– /vis/sceneHandler/create VRML2FILE– /vis/viewer/create – /vis/scene/endOfEventAction accumulate– /vis/scene/endOfRunAction accumulate– /tracking/storeTrajectory 1– /run/beamOn 100– exit

9

Page 10: C++ / G4MICE Course Session 5 Materials in G4MICE Units in G4MICE Visualisation in G4MICE G4MICE Modelling

G4MICE Modelling

• Exercise for this session:– Dream up a simple arrangement of boxes,

cylinders and tubes, perhaps based on a real experiment, but not necessarily so.

– Create the necessary files in the Modules and Configurations areas (in both cases, but them in the Tests directory).

– Visualise the configuration and experiment with the material and colour properties.

10