The New ROOT Geometry Package RTAG MC CERN

  • Slides: 35
Download presentation
The New ROOT Geometry Package RTAG MC CERN 8 August René Brun, Andrei &

The New ROOT Geometry Package RTAG MC CERN 8 August René Brun, Andrei & Mihaela Gheata CERN ftp: //root. cern. ch/rootgeom. ppt ROOT Geometry Package. L 1

Simulation tools Geant 3 created in 1981 Still used by the majority of experiments

Simulation tools Geant 3 created in 1981 Still used by the majority of experiments Fluka Geant 4 A huge investment Slow penetration in experiments State of the art for hadronics and neutron physics R. Brun RTAG MC ROOT Geometry Package 2

Detector Geometry (way 1) Simulation program Geant 4 -based C++ classes XML files R.

Detector Geometry (way 1) Simulation program Geant 4 -based C++ classes XML files R. Brun RTAG MC Geant 4 geometry My. SQL ROOT Geometry Package Visualisation Reconstruction program 3

The Virtual Monte. Carlo This strategy facilitates DAQ migration or comparisons Online For example

The Virtual Monte. Carlo This strategy facilitates DAQ migration or comparisons Online For example Ali. Root in Alice with a common input and a common output Geant 3 Kinematics Geometry Geant 4 Fluka TVirtual. MC Geant 3. tar. gz includes an upgraded Geant 3 with a C++ interface Hits, Digits Geant 4_mc. tar. gz includes the TVirtual. MC <-->Geant 4 interface classes R. Brun RTAG MC ROOT Geometry Package 4

Virtual MC example (with G 3) { // Load basic libraries g. System->Load("lib. Physics");

Virtual MC example (with G 3) { // Load basic libraries g. System->Load("lib. Physics"); g. System->Load("lib. MC"); g. System->Load("$(MCINSTALL)/lib/Linux-g++/libexample 01"); // Load Geant 3 libraries // … skipped // MC application Ex 01 MCApplication* appl = new Ex 01 MCApplication("Example 01", "The example 01 MC application"); appl->Init. MC("g 3 Config. C"); appl->Run. MC(1); } void Config() { cout << "Create geant 3" << endl; new TGeant 3("C++ Interface to Geant 3"); } R. Brun RTAG MC ROOT Geometry Package g 3 Config. C 5

Virtual MC example (with G 4) { // Load basic libraries g. System->Load("lib. Physics");

Virtual MC example (with G 4) { // Load basic libraries g. System->Load("lib. Physics"); g. System->Load("lib. MC"); g. System->Load("$(MCINSTALL)/lib/Linux-g++/libexample 01"); // Load Geant 4 libraries // … skipped // MC application Ex 01 MCApplication* appl = new Ex 01 MCApplication("Example 01", "The example 01 MC application"); appl->Init. MC("g 4 Config. C"); appl->Run. MC(1); } void Config() { g 4 Config. C // Run. Configuration for Geant 4 TG 4 Run. Configuration* run. Configuration = new TG 4 Run. Configuration(); // TGeant 4 new TGeant 4("TGeant 4", "The Geant 4 Monte Carlo", run. Configuration); } R. Brun RTAG MC ROOT Geometry Package 6

Modelling Detector Geometry (way 2) Visualisation Interactivity Where am I? Distance to boundary Closest

Modelling Detector Geometry (way 2) Visualisation Interactivity Where am I? Distance to boundary Closest boundary C++ classes My. SQL Persistency Geometry package Visualisation R. Brun RTAG MC ROOT Geometry Package Simulation program Geant 3 -based Geant 4 -based Fluka-based Reconstruction program 7

The new ROOT Geometry package n n n n Was the request Nr 1

The new ROOT Geometry package n n n n Was the request Nr 1 at ROOT FNAL workshop in June 2001 The package is being developed in collaboration with Alice (Andrei & Mihaela Gheata) Alpha release in July faster than Geant 3 Import from Geant 3 (eg 4 LHC detectors) Interfaces to Geant 3, 4, Fluka in view Demos on request R. Brun RTAG MC ROOT Geometry Package 8

The TGeo classes in html http: //root. cern. ch/root/htmldoc/Class. Index. html R. Brun RTAG

The TGeo classes in html http: //root. cern. ch/root/htmldoc/Class. Index. html R. Brun RTAG MC ROOT Geometry Package 9

TGeo. Manager R. Brun RTAG MC ROOT Geometry Package 10

TGeo. Manager R. Brun RTAG MC ROOT Geometry Package 10

TGeo. Shape R. Brun RTAG MC ROOT Geometry Package 11

TGeo. Shape R. Brun RTAG MC ROOT Geometry Package 11

TGeo. Volume R. Brun RTAG MC ROOT Geometry Package 12

TGeo. Volume R. Brun RTAG MC ROOT Geometry Package 12

TGeo. Node R. Brun RTAG MC ROOT Geometry Package 13

TGeo. Node R. Brun RTAG MC ROOT Geometry Package 13

Example R. Brun RTAG MC ROOT Geometry Package 14

Example R. Brun RTAG MC ROOT Geometry Package 14

The ROOT “detector” example R. Brun RTAG MC ROOT Geometry Package 15

The ROOT “detector” example R. Brun RTAG MC ROOT Geometry Package 15

Shooting random points R. Brun RTAG MC ROOT Geometry Package 16

Shooting random points R. Brun RTAG MC ROOT Geometry Package 16

Shooting random rays R. Brun RTAG MC ROOT Geometry Package 17

Shooting random rays R. Brun RTAG MC ROOT Geometry Package 17

Automatic conversion from Geant 3 Zebra memory Data structure JVOLUM JMATE, etc Root >.

Automatic conversion from Geant 3 Zebra memory Data structure JVOLUM JMATE, etc Root >. x mygeom. C Mygeom. c void gexam 1() {TGeo. Material *mat; TGeo. Mixture *mix; TGeo. Manager *gexam 1 = new TGeo. Manager("gexam 1", "gexam 1. C"); //------List of Materials and Mixtures-------mat = new TGeo. Material("mat 9", "ALUMINIUM", 26. 98, 13, 2. 7); mix = new TGeo. Mixture("mix 10", "IRON(COMPOUND)", 3); mix->Define. Element(0, 55. 847, 26, 0. 703964); mix->Define. Element(1, 58. 71, 28, 0. 9900000 E-01); mix->Define. Element(2, 51. 998, 24, 0. 197); mat = new TGeo. Material("mat 11", "COPPER", 63. 54, 29, 8. 96); Geant > RZ/File 21 mygeom on Zebra RZ mygeom R. Brun RTAG MC g 2 root mygeom. C ROOT Geometry Package 18

Example : gexam 1 void gexam 1() { TGeo. Material *mat; TGeo. Mixture *mix;

Example : gexam 1 void gexam 1() { TGeo. Material *mat; TGeo. Mixture *mix; //------List of Volumes-------TGeo. Volume *ECAL ; ECAL = gexam 1 -> Make. Tube("ECAL", "mat 15", 0, 5. 898013, 12. 35774); LEAK = gexam 1 ->Make. Tube("LEAK", "mat 15", 0, 5. 898013, 0. 5617155); LATR = gexam 1 ->Make. Tube("LATR", "mat 15", 5. 617156, 5. 813, 11. 23); BLOC = gexam 1 ->Make. Tube("BLOC", "mix 21", 0, 5. 617156, 11. 23431); TGeo. Manager *gexam 1; gexam 1 = new TGeo. Manager("gexam 1", "gexam 1. C"); //------List of Materials and Mixtures-------mat = new TGeo. Material("mat 9", "ALUMINIUM", 26. 98, 13, 2. 7); mix = new TGeo. Mixture("mix 10", "IRON(COMPOUND)", 3); mix->Define. Element(0, 55. 847, 26, 0. 703964); mix->Define. Element(1, 58. 71, 28, 0. 9900000 E-01); mix->Define. Element(2, 51. 998, 24, 0. 197); mat = new TGeo. Material("mat 11", "COPPER", 63. 54, 29, 8. 96); mat = new TGeo. Material("mat 13", "LEAD", 207. 19, 82, 11. 35); mat = new TGeo. Material("mat 14", "URANIUM", 238. 03, 92, 18. 95); mat = new TGeo. Material("mat 15", "AIR", 14. 61, 7. 3, 0. 1205 E-02); mat = new TGeo. Material("mat 16", "VACUUM", 0, 0, 0); mix = new TGeo. Mixture("mix 21", "BGO(COMPOUND)", 3); mix->Define. Element(0, 208. 98, 83, 0. 6710563); mix->Define. Element(1, 72. 59, 32, 0. 1748205); mix->Define. Element(2, 15. 999, 8, 0. 1541233); mix = new TGeo. Mixture("mix 22", "LEAD GLASS", 6); mix->Define. Element(0, 207. 19, 82, 0. 65994); mix->Define. Element(1, 39. 102, 19, 0. 7990000 E-02); mix->Define. Element(2, 28. 088, 14, 0. 126676); mix->Define. Element(3, 22. 99, 11, 0. 4007300 E-02); mix->Define. Element(4, 15. 999, 8, 0. 199281); //------List of Nodes-------gexam 1 ->Set. Top. Volume(ECAL); ECAL->Add. Node(LEAK, 1, new TGeo. Translation(0, 0, -11. 79603)); ECAL->Add. Node(LEAK, 2, new TGeo. Translation(0, 0, 11. 79603)); ECAL->Add. Node(LATR, 1, g. Geo. Identity); ECAL->Add. Node(BLOC, 1, g. Geo. Identity); TGeo. Volume *RTUB = BLOC->Divide("RTUB", 1, 20, 0, 0. 2808578); TGeo. Volume *RING = RTUB->Divide("RING", 3, 20, -11. 31, 1. 131); gexam 1 ->Close. Geometry(); } mix->Define. Element(5, 74. 922, 33, 0. 2004850 E-02); R. Brun RTAG MC ROOT Geometry Package gexam 1. C code generated automatically by g 2 root 19

Brahms 2649 nodes R. Brun RTAG MC ROOT Geometry Package 20

Brahms 2649 nodes R. Brun RTAG MC ROOT Geometry Package 20

CMS 1. 3 million nodes R. Brun RTAG MC ROOT Geometry Package 21

CMS 1. 3 million nodes R. Brun RTAG MC ROOT Geometry Package 21

Atlas R. Brun RTAG MC 29 million nodes ROOT Geometry Package 22

Atlas R. Brun RTAG MC 29 million nodes ROOT Geometry Package 22

Atlas R. Brun RTAG MC ROOT Geometry Package 23

Atlas R. Brun RTAG MC ROOT Geometry Package 23

Atlas R. Brun RTAG MC ROOT Geometry Package 24

Atlas R. Brun RTAG MC ROOT Geometry Package 24

Alice R. Brun RTAG MC ROOT Geometry Package 25

Alice R. Brun RTAG MC ROOT Geometry Package 25

Alice R. Brun RTAG MC 3 million nodes ROOT Geometry Package 26

Alice R. Brun RTAG MC 3 million nodes ROOT Geometry Package 26

TGeo performance vs Geant 3 Number nodes Gexam 1 425 Gexam 3 86 Gexam

TGeo performance vs Geant 3 Number nodes Gexam 1 425 Gexam 3 86 Gexam 4 12781 Brahms 2649 Tesla 15370 CDF 24422 Minos_near 30988 BTe. VEcal 52 BTe. V 295310 CMSEcal 251713 CMS 1166310 LHCb 1533488 Alice 3080198 Atlas 29046966 R. Brun RTAG MC gtmedi physics 3. 08 2. 87 2. 51 5. 82 6. 56 14. 81 30. 93 1. 57 45. 27 5. 60 33. 57 7. 98 11. 50 8. 90 Root Geant 3/ gtmedi physics Root random 1. 84 1. 67 6. 60 2. 15 1. 33 3. 47 2. 20 1. 14 12. 09 3. 04 1. 91 4. 17 5. 58 1. 17 12. 95 4. 31 3. 43 20. 94 20. 99 1. 47 21. 57 1. 08 1. 45 1. 78 25. 88 1. 75 197. 06 1. 81 3. 09 5. 69 8. 76 3. 83 39. 09 6. 75 1. 18 12. 58 8. 63 1. 33 11. 45 9. 94 0. 89 32. 48 ROOT Geometry Package Root Geant 3/ random Root 4. 39 1. 50 2. 50 1. 38 11. 18 1. 08 1. 93 2. 16 7. 15 1. 81 5. 85 3. 57 13. 70 1. 57 0. 73 2. 43 26. 83 7. 34 1. 74 3. 27 24. 98 1. 56 2. 89 4. 35 7. 28 1. 57 23. 39 1. 38 27

Bte. V R. Brun RTAG MC ROOT Geometry Package 28

Bte. V R. Brun RTAG MC ROOT Geometry Package 28

Validation Procedure Use one million points generated by Geant 3. Compare G 3 path

Validation Procedure Use one million points generated by Geant 3. Compare G 3 path vs TGeo found path (pictures for a CDF event) R. Brun RTAG MC ROOT Geometry Package 29

Validation Procedure n Using points generated by Geant 3 applications n n n grecord.

Validation Procedure n Using points generated by Geant 3 applications n n n grecord. f --> mygeom, mygeom. hbook Play-back these points in Geant 3 using only the Geant 3 geometry package. Compute g 3 path, snext, safety in myresults. hbook h 2 root myresults. hbook myresults. root Same operation with TGeo classes. Compare g 3 path with tgeopath, same for snext, safety Some discrepancies with Geant 3 (see next) R. Brun RTAG MC ROOT Geometry Package 30

Validation Procedure Differences Geant 3 TGeo n n n Due to precision problems in

Validation Procedure Differences Geant 3 TGeo n n n Due to precision problems in Geant 3, points recorded at the volume boundaries may be found on the other side by TGeo. When volumes declared MANY in Geant 3 overlap and have sub-volumes also MANY, Geant 3 is not always reporting the right answer. In general it does not matter, sometimes it does. In this exercise, we also found original errors in the detector description, eg wrong parameters. R. Brun RTAG MC ROOT Geometry Package 31

Status of the implementation test of gtnext • • Visualization - best tool for

Status of the implementation test of gtnext • • Visualization - best tool for checking the algorithms The "width" of the boundaries due to floating point limitations was determined for some shapes This diffusion effect is crucial for fixing stepping actions in order to trigger expected inside/ouside response of the modeler The diffusion was defined as the distance between extrapolated point from step and closest point that changes this in/out response. R. Brun RTAG MC ROOT Geometry Package 32

Status of the implementation n n Geant 3 geometries - almost fully mapped (still

Status of the implementation n n Geant 3 geometries - almost fully mapped (still not supporting multiple positioning for volumes having shapes with negative parameters which then are divided - quite seldom topology) "Where am I ? " - fully implemented n Tested on a dozen of geometries, including all 4 LHC experiments n Performance w. r. t GEANT 3 - OK. The average gain factor ~1. 52. 0 , increasing for flat-like geometries n Consistency vs. GEANT 3 response reasonable : still few % differences, but fully understood n Still scope for increasing speed, specially for cylindrical symmetries, where the current voxelization algorithm is not efficient enough. R. Brun RTAG MC ROOT Geometry Package 33

Status of the implementation gtnext n n "Which is the next crossed boundary ?

Status of the implementation gtnext n n "Which is the next crossed boundary ? " - about 80% implemented, still a couple of weeks to work on it. Algorithms per shape improved w. r. t G 3 for some shapes New functionalities added : normals to surfaces at crossing points, accurate distance to closest node, direction vector to closest point Features for stepping added : flags for entering and exiting R. Brun RTAG MC ROOT Geometry Package 34

Summary n n n The new Geometry Package looks very promising. We have been

Summary n n n The new Geometry Package looks very promising. We have been able to model all existing large detectors. Performance is better than Geant 3. We are planing to interface it via TVirtual. MC to Geant 3, Geant 4 and Fluka. Alpha release with ROOT version 3. 03/07 R. Brun RTAG MC ROOT Geometry Package 35