Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
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. | |||||||
TroubleshootingIf you don't have that already, then install your own version of ROOT, so that you can customise it. | ||||||||
Line: 164 to 167 | ||||||||
| ||||||||
Added: | ||||||||
> > |
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Geometry validation | ||||||||
Line: 32 to 32 | ||||||||
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: | ||||||||
< < | ||||||||
For example, if we have changed EcalEndcap_zmin from 165.70cm to 164.70cm between the two models, we get | ||||||||
Added: | ||||||||
> > | ||||||||
[protopop@ppelx test]$ ./stressGeometry clicd ... | ||||||||
Line: 161 to 163 | ||||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
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 |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
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: | ||||||||
< < |
| |||||||
> > |
| |||||||
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
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())); |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
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
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.
TroubleshootingIf 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. | |||||||
| ||||||||
Added: | ||||||||
> > |
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Geometry validation | ||||||||
Line: 32 to 32 | ||||||||
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}, // clicdthen recompile make stressGeometryand run stressGeometry clicdThis will generate a reference file called clicd_ref_1.root and put it in $ROOTSYS/test/files . | |||||||
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
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:
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 : 31To visualise the overlaps/extrusions, navigate in the ROOT TBrowser to world → Illegal overlaps and you will be able to see something like this:
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 ...
| ||||||||
Added: | ||||||||
> > |
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
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 ... | |||||||
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
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. | |||||||
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > |
Geometry validationOnce 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 validationFirst 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 overlapsShooting particles with Geant4/SLICOne can shoot particles using SLIC MC, and save output to a slcio file, then useanajob 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 1Run SLIC, loading the geometry and running this macro: slic -g geometry.lcdd -m particleGun.macThis will create a file named outfile.slcio . Now run:
anajob outfile.slcioto see hit counts, or dumpevent outfile.slcio 1or use dumpHits.py (attached, modify at will) to print various hit parameters.
Stress tests
|