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 (when prompted, you can use the default session 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. For instance, here's an overlap report for ZDCtoFP420 and RP_220_Right_Station volumes:

 = Overlap ov00005: CMSE/ZDCtoFP4200x7fe4ed735880 overlapping CMSE/RP_220_Right_Station0x7fe4ed89a840 ovlp=50.5
 - first volume: ZDCtoFP420 at position:
matrix  - tr=1  rot=0  refl=0  scl=0
  1.000000    0.000000    0.000000    Tx =   0.000000
  0.000000    1.000000    0.000000    Ty =   0.000000
  0.000000    0.000000    1.000000    Tz = 27000.000000
*** Shape ZDCtoFP420: TGeoTube ***
    Rmin =     0.00000
    Rmax =   100.00000
    dz   = 12000.00000
 Bounding box:
*** Shape ZDCtoFP420: TGeoBBox ***
    dX =   100.00000
    dY =   100.00000
    dZ = 12000.00000
    origin: x=    0.00000 y=    0.00000 z=    0.00000
 - second volume: RP_220_Right_Station at position:
matrix  - tr=1  rot=0  refl=0  scl=0
  1.000000    0.000000    0.000000    Tx =   0.000000
  0.000000    1.000000    0.000000    Ty =   0.000000
  0.000000    0.000000    1.000000    Tz = 21731.400000
*** Shape RP_220_Right_Station: TGeoTube ***
    Rmin =     0.00000
    Rmax =    49.50000
    dz   =   329.40000
 Bounding box:
*** Shape RP_220_Right_Station: TGeoBBox ***
    dX =    49.50000
    dY =    49.50000
    dZ =   329.40000
    origin: x=    0.00000 y=    0.00000 z=    0.00000

-- MaciejTomaszKocot - 2017-09-12

Edit | Attach | Watch | Print version | History: r7 | r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r3 - 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