Difference: ValidateGeom (1 vs. 12)

Revision 122014-12-10 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Line: 154 to 154
  The statistics can be adjusted by changing Npoints = 10000; from its default.
Added:
>
>
And here's the optimised version of stressGeometry.cxx which I've been using lately. Easier to use in conjunction with this script: compare.sh.
 

Troubleshooting

If you don't have that already, then install your own version of ROOT, so that you can customise it.

Line: 164 to 167
 
META FILEATTACHMENT attachment="ECal1.png" attr="" comment="ECal visualised in geoDisplay" date="1403186454" name="ECal1.png" path="ECal1.png" size="18146" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="extrusion.png" attr="" comment="Extrusion detected by CheckOverlaps()" date="1403186506" name="extrusion.png" path="extrusion.png" size="32924" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="EcalEndcap_zmin_change.png" attr="h" comment="Small change in EcalEndcap_zmin" date="1403862015" name="EcalEndcap_zmin_change.png" path="EcalEndcap_zmin_change.png" size="26351" user="DanProtopopescu" version="3"
Added:
>
>
META FILEATTACHMENT attachment="stressGeometry.cxx" attr="" comment="Modified stressGeompetry.cxx source file" date="1418211848" name="stressGeometry.cxx" path="stressGeometry.cxx" size="23976" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="compare.sh" attr="" comment="Shell script to use in conjunction with stressGeometry" date="1418212382" name="compare.sh" path="compare.sh" size="640" user="DanProtopopescu" version="1"

Revision 112014-06-27 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Line: 32 to 32
  extrusion.png
Changed:
<
<
The offending subvolumes are highlighted in red. One can use:
>
>
The offending subvolumes are highlighted in red. Some other useful commands:
 
gGeoManager->cd(“/path/to/volume/”); // to check only a subvolume
Changed:
<
<
gGeoManager->GetPath(); // to see path
>
>
gGeoManager->GetPath(); // to see current path
 gGeoManager->getCurrentNode()->CheckOverlaps(0.01); gGeoManager->PrintOverlaps();
Line: 82 to 82
 

Stress tests

Changed:
<
<
There is a tool in TGeo that allows one to benchmark a given geometry. One could use this to compare for example two descriptions produced let's say via different frameworks, and spot if any errors occurred.
>
>
There is a TGeo tool for checking geometries. Although written for testing actual TGeo class implementations, one could use this to compare for example two descriptions produced let's say via different frameworks, and spot if any differences were introduced. A good description of how it actually works can be found in the header of the C++ source file
 
Changed:
<
<
Go to directory $ROOTSYS/test and edit stressGeometry.cxx to add a custom entry, in my case a diff shows these changes:
>
>
Go to directory $ROOTSYS/test and edit stressGeometry.cxx to add a custom entry. In my case a diff shows these changes:
 
[protopop@ppelx ECal]$ diff $ROOTSYS/test/stressGeometry.cxx.orig $ROOTSYS/test/stressGeometry.cxx
78c78
Line: 124 to 124
  and we put it in the same location as above (http://www.ppe.gla.ac.uk/~protopop/clic/clicd.root), e.g. cp ECal_new.root ~/web/clic/clicd.root
Deleted:
<
<
EcalEndcap_zmin_change.png
 For example, if we have changed EcalEndcap_zmin from 165.70cm to 164.70cm between the two models, we get
Added:
>
>
EcalEndcap_zmin_change.png
 
[protopop@ppelx test]$ ./stressGeometry clicd
...
Line: 161 to 163
 
META FILEATTACHMENT attachment="dumpHits.py.txt" attr="" comment="Script used to extract hit positions from slcio file" date="1403620030" name="dumpHits.py.txt" path="dumpHits.py.txt" size="1129" user="DanProtopopescu" version="2"
META FILEATTACHMENT attachment="ECal1.png" attr="" comment="ECal visualised in geoDisplay" date="1403186454" name="ECal1.png" path="ECal1.png" size="18146" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="extrusion.png" attr="" comment="Extrusion detected by CheckOverlaps()" date="1403186506" name="extrusion.png" path="extrusion.png" size="32924" user="DanProtopopescu" version="1"
Changed:
<
<
META FILEATTACHMENT attachment="EcalEndcap_zmin_change.png" attr="h" comment="Small change in EcalEndcap_zmin" date="1403515356" name="EcalEndcap_zmin_change.png" path="EcalEndcap_zmin_change.png" size="24158" user="DanProtopopescu" version="2"
>
>
META FILEATTACHMENT attachment="EcalEndcap_zmin_change.png" attr="h" comment="Small change in EcalEndcap_zmin" date="1403862015" name="EcalEndcap_zmin_change.png" path="EcalEndcap_zmin_change.png" size="26351" user="DanProtopopescu" version="3"

Revision 102014-06-26 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Line: 82 to 82
 

Stress tests

Added:
>
>
There is a tool in TGeo that allows one to benchmark a given geometry. One could use this to compare for example two descriptions produced let's say via different frameworks, and spot if any errors occurred.
 Go to directory $ROOTSYS/test and edit stressGeometry.cxx to add a custom entry, in my case a diff shows these changes:
[protopop@ppelx ECal]$ diff $ROOTSYS/test/stressGeometry.cxx.orig $ROOTSYS/test/stressGeometry.cxx

Revision 92014-06-24 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Line: 77 to 77
 
dumpevent outfile.slcio 1
Changed:
<
<
or use dumpHits.py (attached, modify at will) to print various hit parameters.
>
>
or use dumpHits.py (attached, modify at will) to print various hit parameters. For this to run, SLIC must be built with BUILD_ROOTDICT=ON.
 

Stress tests

Revision 82014-06-24 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Line: 156 to 156
  You might have to delete ROOT's local cache of the geometry file (clicd.root in the above example), or simply store it locally in order to make sure the newest version is loaded for comparison with the reference. Once created, the reference remains in $ROOTSYS/test/files/ and you will have to delete it to force the creation of a new one.
Changed:
<
<
META FILEATTACHMENT attachment="dumpHits.py.txt" attr="" comment="Script used to extract hit positions from slcio file" date="1402928692" name="dumpHits.py.txt" path="dumpHits.py.txt" size="1300" user="DanProtopopescu" version="1"
>
>
META FILEATTACHMENT attachment="dumpHits.py.txt" attr="" comment="Script used to extract hit positions from slcio file" date="1403620030" name="dumpHits.py.txt" path="dumpHits.py.txt" size="1129" user="DanProtopopescu" version="2"
 
META FILEATTACHMENT attachment="ECal1.png" attr="" comment="ECal visualised in geoDisplay" date="1403186454" name="ECal1.png" path="ECal1.png" size="18146" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="extrusion.png" attr="" comment="Extrusion detected by CheckOverlaps()" date="1403186506" name="extrusion.png" path="extrusion.png" size="32924" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="EcalEndcap_zmin_change.png" attr="h" comment="Small change in EcalEndcap_zmin" date="1403515356" name="EcalEndcap_zmin_change.png" path="EcalEndcap_zmin_change.png" size="24158" user="DanProtopopescu" version="2"

Revision 72014-06-24 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Line: 96 to 96
 150a153 > 0.4, //clicd
184a188
Changed:
<
<
> {750,750,1000}, // clicd
>
>
> {900,900,1400}, // clicd
 255a260,262 > if(i==4)
> TGeoManager::Import(Form("http://www.ppe.gla.ac.uk/~protopop/clic/%s", fname.Data()));

Revision 62014-06-23 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Changed:
<
<
Once the desired geometry is implemented in DD4hep, one need a way to compare it with the existing descriptions from Mokka or GeomConverter. This wiki describes several options for doing this. Lots of thanks to Andrei Gheață and Nikiforos Nikiforou for demonstrating how everything works.
>
>
Once the desired geometry is implemented in DD4hep, one need a way to compare it with the existing descriptions from Mokka or GeomConverter. This wiki describes several options for doing this. Lots of thanks to Andrei Gheață and Nikiforos Nikiforou for demonstrating how various tools work.
 
Line: 82 to 82
 

Stress tests

Changed:
<
<
If you don't have that already, then install your own version of ROOT, so that you can customise it. Then go to $ROOTSYS/test and edit stressGeometry.cxx to add a custom entry, in my case a diff shows these changes:
>
>
Go to directory $ROOTSYS/test and edit stressGeometry.cxx to add a custom entry, in my case a diff shows these changes:
 
[protopop@ppelx ECal]$ diff $ROOTSYS/test/stressGeometry.cxx.orig $ROOTSYS/test/stressGeometry.cxx
78c78
Line: 97 to 97
 > 0.4, //clicd
184a188 > {750,750,1000}, // clicd
Added:
>
>
255a260,262 > if(i==4)
> TGeoManager::Import(Form("http://www.ppe.gla.ac.uk/~protopop/clic/%s", fname.Data()));
> else
 
Changed:
<
<
then recompile
>
>
where the original geometry file clicd.root was created with gGeoManager->Export("clicd.root"); after importing it from another format, e.g. GDML (and removing for this example everything but the ECal).

We recompile

 
Added:
>
>
source /afs/phas.gla.ac.uk/data/ilc/software/ilcsoft/v01-17/init_ilcsoft.sh cd $ROOTSYS/test/
 make stressGeometry and run
Changed:
<
<
stressGeometry clicd
>
>
./stressGeometry clicd This will generate a file called clicd_ref_1.root and put it in $ROOTSYS/test/files. This is the reference that will be used for all our subsequent comparisons.

Now let's say we want to compare our newly implemented geometry with the original. We save our new geometry with

gGeoManager->Export("ECal_new.root");
and we put it in the same location as above (http://www.ppe.gla.ac.uk/~protopop/clic/clicd.root), e.g. cp ECal_new.root ~/web/clic/clicd.root

EcalEndcap_zmin_change.png For example, if we have changed EcalEndcap_zmin from 165.70cm to 164.70cm between the two models, we get

[protopop@ppelx test]$ ./stressGeometry clicd
...
Info in <TFile::OpenFromCache>: using local cache copy of http://root.cern.ch/files/clicd_ref_1.root [./files/clicd_ref_1.root]
Reference file http://root.cern.ch/files/clicd_ref_1.root found
 ==>Point 45 differs with diff = 35.4858, x=47.3349, y=4.26597, z=-370.913
    p.nbound=112, p.length=907.019, p.safe=129.087, p.rad=724.119
      nbound=116,   length=907.019,   safe=129.087,   rad=759.605
...
 ==>Point 1057 differs with diff = 63.411, x=-39.6917, y=-27.223, z=166.572
    p.nbound=75, p.length=795.659, p.safe=0.0221592, p.rad=574.564
      nbound=80,   length=795.659,   safe=0.0221592,   rad=637.975
******************************************************************************
*Tree    :TD        : TGeo stress diff                                       *
*Entries :      160 : Total =           10359 bytes  File  Size =       5420 *
*        :          : Tree compression factor =   1.00                       *
******************************************************************************
*Br    0 :p         : x/D:y/D:z/D:theta/D:phi/D:rad[4]/F                     *
*Entries :      160 : Total  Size=       9993 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*
*     stress clicd            found    80 bad points ............. failed
******************************************************************
 
Changed:
<
<
This will generate a reference file called clicd_ref_1.root and put it in $ROOTSYS/test/files.
>
>
The statistics can be adjusted by changing Npoints = 10000; from its default.

Troubleshooting

If you don't have that already, then install your own version of ROOT, so that you can customise it.

You might have to delete ROOT's local cache of the geometry file (clicd.root in the above example), or simply store it locally in order to make sure the newest version is loaded for comparison with the reference. Once created, the reference remains in $ROOTSYS/test/files/ and you will have to delete it to force the creation of a new one.

 
META FILEATTACHMENT attachment="dumpHits.py.txt" attr="" comment="Script used to extract hit positions from slcio file" date="1402928692" name="dumpHits.py.txt" path="dumpHits.py.txt" size="1300" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="ECal1.png" attr="" comment="ECal visualised in geoDisplay" date="1403186454" name="ECal1.png" path="ECal1.png" size="18146" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="extrusion.png" attr="" comment="Extrusion detected by CheckOverlaps()" date="1403186506" name="extrusion.png" path="extrusion.png" size="32924" user="DanProtopopescu" version="1"
Added:
>
>
META FILEATTACHMENT attachment="EcalEndcap_zmin_change.png" attr="h" comment="Small change in EcalEndcap_zmin" date="1403515356" name="EcalEndcap_zmin_change.png" path="EcalEndcap_zmin_change.png" size="24158" user="DanProtopopescu" version="2"

Revision 52014-06-19 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Line: 32 to 32
  extrusion.png
Changed:
<
<
The offending subvolumes are highlighted in red.
>
>
The offending subvolumes are highlighted in red. One can use:
gGeoManager->cd(“/path/to/volume/”); // to check only a subvolume
gGeoManager->GetPath();                    // to see path
gGeoManager->getCurrentNode()->CheckOverlaps(0.01);
gGeoManager->PrintOverlaps();
 

Shooting particles with Geant4/SLIC

Line: 77 to 82
 

Stress tests

Changed:
<
<
If you don't have that already, then install your own version of ROOT, so that you can customise it. Then go to $ROOTSYS/test and edit ...
>
>
If you don't have that already, then install your own version of ROOT, so that you can customise it. Then go to $ROOTSYS/test and edit stressGeometry.cxx to add a custom entry, in my case a diff shows these changes:
[protopop@ppelx ECal]$ diff $ROOTSYS/test/stressGeometry.cxx.orig $ROOTSYS/test/stressGeometry.cxx
78c78
< const Int_t NG = 33;
---
> const Int_t NG = 34;
82a83
>                         "clicd",
116a118
>               1, //clicd - added by protopop@cern.ch
150a153
>                               0.4,  //clicd
184a188
>                          {750,750,1000},    // clicd
then recompile
make stressGeometry
and run
stressGeometry clicd
This will generate a reference file called clicd_ref_1.root and put it in $ROOTSYS/test/files.
 
META FILEATTACHMENT attachment="dumpHits.py.txt" attr="" comment="Script used to extract hit positions from slcio file" date="1402928692" name="dumpHits.py.txt" path="dumpHits.py.txt" size="1300" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="ECal1.png" attr="" comment="ECal visualised in geoDisplay" date="1403186454" name="ECal1.png" path="ECal1.png" size="18146" user="DanProtopopescu" version="1"

Revision 42014-06-19 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Line: 13 to 13
 

Checking overlaps

Added:
>
>
Let's say we start with the examples/CLICSiD geometry and we remove everything except the ECal Barrel and EndCap components.

Running ./geoDisplay compact/ECal.xml as described here, we load this geometry in memory and display it using the TGeo class from ROOT:

ECal1.png

To check overlaps or extrusions, from ROOT prompt run

root [0]  gGeoManager->CheckOverlaps(0.01);
where the precision is given in cm. This will report any overlaps/extrusions:
...
Info in <TGeoNodeMatrix::CheckOverlaps>: Number of illegal overlaps/extrusions : 31
To visualise the overlaps/extrusions, navigate in the ROOT TBrowser to worldIllegal overlaps and you will be able to see something like this:

extrusion.png

The offending subvolumes are highlighted in red.

 

Shooting particles with Geant4/SLIC

Line: 59 to 80
 If you don't have that already, then install your own version of ROOT, so that you can customise it. Then go to $ROOTSYS/test and edit ...

META FILEATTACHMENT attachment="dumpHits.py.txt" attr="" comment="Script used to extract hit positions from slcio file" date="1402928692" name="dumpHits.py.txt" path="dumpHits.py.txt" size="1300" user="DanProtopopescu" version="1"
Added:
>
>
META FILEATTACHMENT attachment="ECal1.png" attr="" comment="ECal visualised in geoDisplay" date="1403186454" name="ECal1.png" path="ECal1.png" size="18146" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="extrusion.png" attr="" comment="Extrusion detected by CheckOverlaps()" date="1403186506" name="extrusion.png" path="extrusion.png" size="32924" user="DanProtopopescu" version="1"

Revision 32014-06-19 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Line: 56 to 56
 

Stress tests

Changed:
<
<
If you don't have that already, then install your own version of Root, so that you can customise it.
>
>
If you don't have that already, then install your own version of ROOT, so that you can customise it. Then go to $ROOTSYS/test and edit ...
 
META FILEATTACHMENT attachment="dumpHits.py.txt" attr="" comment="Script used to extract hit positions from slcio file" date="1402928692" name="dumpHits.py.txt" path="dumpHits.py.txt" size="1300" user="DanProtopopescu" version="1"

Revision 22014-06-19 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Geometry validation

Line: 56 to 56
 

Stress tests

Added:
>
>
If you don't have that already, then install your own version of Root, so that you can customise it.
 
META FILEATTACHMENT attachment="dumpHits.py.txt" attr="" comment="Script used to extract hit positions from slcio file" date="1402928692" name="dumpHits.py.txt" path="dumpHits.py.txt" size="1300" user="DanProtopopescu" version="1"

Revision 12014-06-16 - DanProtopopescu

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"

Geometry validation

Once the desired geometry is implemented in DD4hep, one need a way to compare it with the existing descriptions from Mokka or GeomConverter. This wiki describes several options for doing this. Lots of thanks to Andrei Gheață and Nikiforos Nikiforou for demonstrating how everything works.

Visual validation

First step is of course visual validation.To compare by eye an existing geometry with the newly implemented geometry in DD4hep, one should use the visualisation tools described in the VisuDet wiki.

Checking overlaps

Shooting particles with Geant4/SLIC

One can shoot particles using SLIC MC, and save output to a slcio file, then use anajob or dumpevent to compare hit positions.

To do this, setup ilcsoft to get access to SLIC and the LCIO libraries (for later processing of slcio files). Then create a file, e.g. particleGun.mac, containing something like this:

/run/initialize
/generator/select gps
/gps/pos/type Point
/gps/pos/centre 0. 0. 0.
/gps/ang/type iso
/gps/ang/mintheta 90 deg
/gps/ang/maxtheta 90 deg
/gps/ang/minphi 10 deg
/gps/ang/maxphi 10 deg
/gps/ene/type Mono
/gps/ene/mono 99.8944 GeV
/gps/ene/gradient 0
/gps/ene/intercept 1
/gps/particle mu-
/random/seed 123456789
/run/beamOn 1 

Run SLIC, loading the geometry and running this macro:

slic -g geometry.lcdd -m particleGun.mac

This will create a file named outfile.slcio. Now run:

anajob outfile.slcio
to see hit counts, or
dumpevent outfile.slcio 1
or use dumpHits.py (attached, modify at will) to print various hit parameters.

Stress tests

META FILEATTACHMENT attachment="dumpHits.py.txt" attr="" comment="Script used to extract hit positions from slcio file" date="1402928692" name="dumpHits.py.txt" path="dumpHits.py.txt" size="1300" user="DanProtopopescu" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback