About SWAN

One of the ways to visualize the geometry is using SWAN and its ROOT notebooks. You can easily display an interactive preview of all the volumes, as well as access them programatically (e.g. to detect overlaps).

After logging in and starting a session (you can use the default parameters) you will see a list of files in your EOS directory:

GDML file visualization

We will also need a file describing the geometry - for this, we're going to use GDML format. It's basically an XML file that you can generate with your Python configuration file and cmsRun. Just find the place where g4SimHits properties are defined and add the following:

process.g4SimHits.FileNameGDML = cms.untracked.string('filename.gdml')

This way, the program will know you're expecting a GDML file to be generated. To keep the running time short, you can set the number of events to 1. When the program is finished, you should see filename.gdml in your current directory. Upload it to SWAN using EOS or your web browser.

Next, create a ROOT notebook:

... And paste the following, replacing filename.gdml with the path to your file:

topVolumep = gGeoManager->GetTopVolume();

You can then run it using the controls at the top of the page, or using the keyboard shortcut (Shift+Enter). A visualization of your geometry should appear. Some errors might appear, but as long as you can see the visualization, you don't have to be concerned about them.


  • Use left mouse button to rotate the view
  • …and right mouse button to move it
  • Scroll to zoom
  • Right click on any volume to show extra options (focus and hide are especially useful for navigating)
  • Full screen is available in the bottom left corner of the window (“enlarge geometry drawing”)

Overlaps detection

Overlaps are a very likely reason that some parts don’t appear in the visualization or it’s not possible to detect hits on them.

To check the geometry for overlaps, add the following after the previous piece of code:

ol = gGeoManager->GetListOfOverlaps();
for(int i=0;i<ol->GetEntries();++i) {

It will print a list of overlapping volumes and information about the parameters of their geometry.


-- MaciejTomaszKocot - 2017-09-12

Edit | Attach | Watch | Print version | History: r7 | r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 2017-09-14 - MaciejTomaszKocot
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback