About SWAN

SWAN is an online application allowing to execute scripts (for example in ROOT, R or Python notebooks). You can use it to visualize geometry, displaying an interactive preview of all the volumes, as well as access them programmatically (e.g. to detect overlaps). You can find out more about SWAN here.

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 main EOS directory (e.g. /eos/user/m/makocot):

Please note that SWAN uses the /eos/user/... instance being mounted on LXPLUS by default, rather than /eos/totem/user/... .

GDML file visualization

We will also need a file describing the geometry - unfortunately, SWAN does not support the classic XML format. For this, we're going to use GDML. It's an XML-like geometry description format supported by Geant4. You can generate it with your Python configuration file and cmsRun. Just find the place where g4SimHits properties are defined and add the following:

Warning: To create a GDML file, you have to use configuration for simulation with Geant4 enabled. If you use reconstruction only, you will not see g4SimHits object at all!

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 (e.g. cp filename.gdml /eos/user/m/makocot) or your web browser as presented below:

Next, create a ROOT notebook:

... And paste the following, replacing filename.gdml with the path to your file. The path can be either absolute, or relative in regard to the location of the notebook you're currently using:

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.


  • 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 < r6 < r5 < r4 < r3 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r7 - 2017-09-19 - 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