120 likes | 134 Views
Mantis a framework and toolkit for Geant4 simulation in CMS. M. Stavrianakou CERN Geant4 Workshop 02.10.2002. COBRA Mantis OSCAR. COBRA is the CMS “framework”; it implements the CMS OO architecture Mantis is the COBRA interface to Geant4 Mantis as a subsystem of COBRA is
E N D
Mantisa framework and toolkit for Geant4 simulation in CMS M. Stavrianakou CERN Geant4 Workshop 02.10.2002
COBRA Mantis OSCAR • COBRA is the CMS “framework”; it implements the CMS OO architecture • Mantis is the COBRA interface to Geant4 • Mantis as a subsystem of COBRA is • a toolkit for building or interfacing to detector geometries and sensitive volumes, generators, physics, magnetic fields, actions etc • a framework for Geant4 simulation applications (interactive or batch) • relies on COBRA infrastructure and services for core application steering and control, persistency, histogramming etc • provides run and event management • provides interfaces for loading the specific libraries for geometry, magnetic field, generators, physics, tuning and monitoring actions • OSCAR is the CMS Geant4 simulation based on Mantis ———————————————————————————————————————————————— Mantis is also: • a human able to see the future: from the Greek word for seer, prophet • a rather nasty insect • a very cute and timid shrimp M. Stavrianakou, CMS/CERN
Mantis functionality Application Steering • Mantis application (G4Application) is a COBRA SimApplication; it relies on COBRA for the application main • Most if not all configurable/tunable aspects of the application (including persistency) are driven by COBRA “simple configurables” (kind of “datacard”mechanism) • Persistency, metadata management, histogramming services etc are available transparently via the underlying COBRA infrastructure • G4Application instantiates and launches • an event source factory based on a COBRA abstract event “reader”of simulated events • a run manager and handles generator, magnetic field and visualisation selection and instantiation • powerful key COBRA features (lazy instantiation, action on demand, etc) and patterns (factories, dispatchers-observers etc) are used extensively (but are probably not yet exploited to their full potential) M. Stavrianakou, CMS/CERN
Mantis functionality Run and Event Management Run and event management are implemented in order to work around (what we may consider) restrictive Geant4 mechanisms and facilitate synergy with COBRA • Run Manager (inherits from G4RunManager) takes over control for: • geometry initialization • UserInitialization of a G4VUserDetectorConstruction bypassed • generator initialization and Monte Carlo event conversion to G4Event • G4VUserPrimaryGeneratorAction bypassed • physics initialization • UserInitialization of a G4VUserPhysicsList bypassed • Event • is a COBRA SimEvent • analogous to its Geant3 counterpart • manages Monte-Carlo truth • raw event/particles from generator and G4 simulated tracks and vertices • does not directly depend on Geant4, butneeds EventAction and Tracking Action to retrieve G4 simulated tracks and vertices M. Stavrianakou, CMS/CERN
Mantis functionality Geometry and Magnetic Field • Geometry: uses the CMS Detector Description Database (DDD) • Setup selection • full CMS, partial, test beam etc driven by configuration (XML) • Geometry building • automated conversion from DDD to Geant4 solids, materials, volumes • User limits • step and track length, production, tracking and time cuts: • automatic conversion and assignment from DDD to Geant4work in progress • no code modification, no recompilation, loadable on demand • Magnetic Field: uses the COBRA infrastructure and several COBRA-provided types of field, allowing • selection (Uniform, 2D map, 3D map) • interface to G4 with • choice of integrator • tuning options • loadable on demand M. Stavrianakou, CMS/CERN
Mantis functionality Sensitive Detectors and Hits • Sensitive detectors: creation and assignment to geometrical (logical) volumes • any number of instances of a given sensitive detector, assignable to any type and number of logical volumes • loadable on demand • Hits: COBRA hits and hit collections that handle • creation • using Geant4 ProcessStep • formatting • persistency • hit modelling, numbering scheme, readout choice by CMS detector group experts (OSCAR-side) • hits directly digitizable and usable by the CMS OO reconstruction program ORCA M. Stavrianakou, CMS/CERN
Mantis functionality Generators • infrastructure based on COBRA mechanisms and the COBRA GeneratorInterface • to produce a CMS RawHepEvent • converted and passed to Geant4 using the G4HEPEvtInterface • HepMC/HepPDT have been evaluated • will be used following evolution in context of on-going RTAGs • preference/recommendation for physical decoupling from CLHEP • to allow selection and configuration at the application steering level • implementations • configurable particle gun with choice of vertex generator • CMS HepEvt ntuple • CMS text file with choice of vertex generator • Pythia6 on-the-fly • loadable on demand M. Stavrianakou, CMS/CERN
Mantis functionality Physics and User Actions Physics Lists and Cuts infrastructure for • building a concrete physics list • list selection configuration • active categories of processes • general, electromagnetic, hadronic, ion … • selection of production (range) cuts: default, from file • currently using cuts per material User Actions infrastructure for • tuning • monitoring • quantities of interest (Begin/End Of Run/Event, Step, Pre/Post Track) “dispatched” to potential “observers” using COBRA dispatcher- observer pattern • at present foresee only one CMS “stacking action” possibly emulating level 1 trigger • any number of (combinations of) observers may be present • no need for central “action management” M. Stavrianakou, CMS/CERN
Mantis: the framework and its dependencies The core: G4Application M. Stavrianakou, CMS/CERN
Mantis as a toolkit CMS Geometry example CMS Sensitive Detector and Hits example M. Stavrianakou, CMS/CERN
Mantis as a toolkit CMS Production Physics List User Action Example M. Stavrianakou, CMS/CERN
A few last points • Mantis has been inspired by and developed in the context of COBRA • it has also been inspired by and reused ideas from Goofy (ATLAS) and has profited from the pre-existing OSCAR implementation • Interactivity is largely addressed by IGUANA • Mantis relies on basic G4 services/messengers; future versions may exploit emerging G4/Python facilities • Mantis amounts to ~5K lines of code developed by ~1 FTE in ~3 months • Realistic beta-testing by the CMS b/t – Tracker is in progress • vital feedback is contributing to improvements • There are outstanding requirements as well as currently unforeseen ones • Thanks to the underlying COBRA architecture, implementation of most new requirements is straightforward • Several requirements to Geant4 have emerged during the Mantis development • these we sometimes address as Geant4 shortcomings or restrictive mechanisms but this should not be taken as criticism in any negative sense; given the scope and magnitude of LHC experiment simulations, requirement evolution is inevitable • Mantis and the underlying COBRA infrastructure are not CMS-specific M. Stavrianakou, CMS/CERN