from geant 3 to virtual monte carlo: approach and experience

21
From Geant 3 to Virtual Monte Carlo: Approach and From Geant 3 to Virtual Monte Carlo: Approach and Experience Experience M. Potekhin, J.Lauret, Y.Fisyak, V. Perevoztchikov M. Potekhin, J.Lauret, Y.Fisyak, V. Perevoztchikov for the STAR Collaboration for the STAR Collaboration September 29, 2004 September 29, 2004

Upload: olaf

Post on 12-Jan-2016

23 views

Category:

Documents


1 download

DESCRIPTION

From Geant 3 to Virtual Monte Carlo: Approach and Experience. M. Potekhin, J.Lauret, Y.Fisyak, V. Perevoztchikov for the STAR Collaboration September 29, 2004. Overview. The current STAR MC simulation software: features and platform [ Why are we interested in moving towards VMC ? [ - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: From Geant 3 to Virtual Monte Carlo: Approach and Experience

From Geant 3 to Virtual Monte Carlo: Approach and ExperienceFrom Geant 3 to Virtual Monte Carlo: Approach and Experience

M. Potekhin, J.Lauret, Y.Fisyak, V. PerevoztchikovM. Potekhin, J.Lauret, Y.Fisyak, V. Perevoztchikovfor the STAR Collaborationfor the STAR Collaboration

September 29, 2004September 29, 2004

Page 2: From Geant 3 to Virtual Monte Carlo: Approach and Experience

OverviewOverview

The current STAR MC simulation software: features and platform The current STAR MC simulation software: features and platform

Why are we interested in moving towards VMC ? Why are we interested in moving towards VMC ?

Should we consider alternative geometry models? Should we consider alternative geometry models?

Infrastructure components that need to be built Infrastructure components that need to be built

Current status of the Star VMC and Detector Description project Current status of the Star VMC and Detector Description project

Page 3: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Features of the Existing Features of the Existing STAR Simulation SoftwareSTAR Simulation Software

The current STAR simulation software provides the following tools for The current STAR simulation software provides the following tools for the user/developer:the user/developer:

– Detector (geometry) description languageDetector (geometry) description language

– Hit structure declaration (part of the above)Hit structure declaration (part of the above)

– User-prescribed volume enumeration (important for analysis)User-prescribed volume enumeration (important for analysis)

– Comprehensive I/O systemComprehensive I/O system

– Logic for treatment of secondary particles (and the mechanism of saving Logic for treatment of secondary particles (and the mechanism of saving “interesting” particles for analysis)“interesting” particles for analysis)

– Persistent documentation system (self-documenting Zebra banks)Persistent documentation system (self-documenting Zebra banks)

Page 4: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Why is STAR interested in a new simulation Why is STAR interested in a new simulation platform?platform?

Software MaintenanceSoftware Maintenance

Software IntegrationSoftware Integration

Geant 3 to 4 to *?* MigrationGeant 3 to 4 to *?* Migration

More specifically, we’ll talk about VMCMore specifically, we’ll talk about VMC

Page 5: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Our interest the VMCOur interest the VMC

Maintenance of the existing software is not trivial and requires product-specific Maintenance of the existing software is not trivial and requires product-specific expertise. The VMC is a hedge against our simulation framework becoming expertise. The VMC is a hedge against our simulation framework becoming obsolete in terms of user expertise and platform change. obsolete in terms of user expertise and platform change.

We want to increase the transparency to the users, in part due to benefits of We want to increase the transparency to the users, in part due to benefits of OO programming and the more familiar language platform (C++ vs Fortran).OO programming and the more familiar language platform (C++ vs Fortran).

The VMC can be seen as a bridge between Geant 3 and 4, and future MC The VMC can be seen as a bridge between Geant 3 and 4, and future MC platformsplatforms

It has the potential to become a long term MC solution for STAR, with a stable It has the potential to become a long term MC solution for STAR, with a stable API, and a geometry description system that facilitates the ongoing detector API, and a geometry description system that facilitates the ongoing detector development and upgradesdevelopment and upgrades

It is a step to make the STAR software more robust by implementing a unified It is a step to make the STAR software more robust by implementing a unified geometry description, i.e. establishing ageometry description, i.e. establishing a CONSISTENT CONSISTENT geometry model in geometry model in simulation and reconstructionsimulation and reconstruction

There are other aspects of integration of the simulation and reconstruction, e.g. There are other aspects of integration of the simulation and reconstruction, e.g. data formats etcdata formats etc

Page 6: From Geant 3 to Virtual Monte Carlo: Approach and Experience

The Root Geometry component and its possible role in VMCThe Root Geometry component and its possible role in VMC

the Root Geometry (“TGeo”) is a broad term used to describe a set of geometry related the Root Geometry (“TGeo”) is a broad term used to describe a set of geometry related ROOT classesROOT classes

feature-rich and allows one to build complex geometriesfeature-rich and allows one to build complex geometries

suitable for building a Geant-like application such as VMCsuitable for building a Geant-like application such as VMC

can be used in event displays and potentially offers sophisticated graphic functionality can be used in event displays and potentially offers sophisticated graphic functionality (confer recent Qt work by V.Fine)(confer recent Qt work by V.Fine)

can be considered “platform neutral” as it is not really tied to any particular application can be considered “platform neutral” as it is not really tied to any particular application such as Geant, and can be productively used to navigate geometry in STAR such as Geant, and can be productively used to navigate geometry in STAR reconstructionreconstruction

can provide a consistent geometry interface with reconstructioncan provide a consistent geometry interface with reconstruction

more flexible, and portable, geometry description: geometry persistent in ROOT files, XML more flexible, and portable, geometry description: geometry persistent in ROOT files, XML (future development), possible CAD systems interface, various TGeo based interfaces, (future development), possible CAD systems interface, various TGeo based interfaces, and event displaysand event displays

an attractive component to have in any future simulation frameworkan attractive component to have in any future simulation framework

Offers a performance gain?Offers a performance gain?

Page 7: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Infrastructure IssuesInfrastructure Issues

We want to preserve the following functionality of the existing We want to preserve the following functionality of the existing softwaresoftware

– Tools for the Detector DescriptionTools for the Detector Description

– Hit structure declaration (part of the above)Hit structure declaration (part of the above)

– User-prescribed volume enumeration (important for analysis)User-prescribed volume enumeration (important for analysis)

– Comprehensive I/O systemComprehensive I/O system

– Logic for treatment of secondary particles (and the mechanism of saving Logic for treatment of secondary particles (and the mechanism of saving “interesting” particles for analysis)“interesting” particles for analysis)

Page 8: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Infrastructure IssuesInfrastructure Issues

Hit structure declarationHit structure declaration

– Example from the existing STAR system:Example from the existing STAR system:

HITS ESCI Birk:0:(0,10)HITS ESCI Birk:0:(0,10) HITS CSDA type=4:2: eta:0.1:(0,1) etsp:h_phi2:(0,sh_phi2) Eloss:0:(0,1)HITS CSDA type=4:2: eta:0.1:(0,1) etsp:h_phi2:(0,sh_phi2) Eloss:0:(0,1)

HITS FSEC X:.0003:S Y:.0003: Z:.0003: cx:10: cy:10: cz:10:,HITS FSEC X:.0003:S Y:.0003: Z:.0003: cx:10: cy:10: cz:10:,

Ptot:18:(0,100) Sleng:.1:(0,500),Ptot:18:(0,100) Sleng:.1:(0,500),

ToF:16:(0,1.e-6) LGAM:16:(-2,2), ToF:16:(0,1.e-6) LGAM:16:(-2,2),

Step:11:(0,10) Elos:21:(0,.01) Step:11:(0,10) Elos:21:(0,.01)

– A choice of pre-defined variables to be included in the hit structure, A choice of pre-defined variables to be included in the hit structure, suitable for a lot of taskssuitable for a lot of tasks

– Advantage: reusability of software created for various detector Advantage: reusability of software created for various detector subsystems, added user transparencysubsystems, added user transparency

Page 9: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Infrastructure IssuesInfrastructure Issues

Volume navigation and Volume navigation and enumeration:enumeration:

In analysis, it is often necessary to In analysis, it is often necessary to follow a convention in assigning IDs follow a convention in assigning IDs to volumes. Difference subsystems to volumes. Difference subsystems may have different rules attached to may have different rules attached to them. This is “engineer’s numbering them. This is “engineer’s numbering vs GEANT numbering”.vs GEANT numbering”.

This is not standardized and This is not standardized and needs to be developed in a VMC needs to be developed in a VMC implementation. implementation.

Page 10: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Detector DescriptionDetector Description

Detector Description is the method by which the detector geometry Detector Description is the method by which the detector geometry model, and properties of it constituents, are defined by the user. It can model, and properties of it constituents, are defined by the user. It can be a piece of Fortran code, a CAD system file, a piece C++ code, a XML be a piece of Fortran code, a CAD system file, a piece C++ code, a XML file etc.file etc.

Now the Detector Description component should be viewed in a broader Now the Detector Description component should be viewed in a broader context of the VMC, as one of its componentscontext of the VMC, as one of its components

Page 11: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Detector DescriptionDetector Description

Detector Description is an important component of the simulation software Detector Description is an important component of the simulation software infrastructure, for the following reasons:infrastructure, for the following reasons:

– a robust DD system helps the detector development and upgrade process.a robust DD system helps the detector development and upgrade process.– having tools that facilitate the geometry development and testing is requisite in a having tools that facilitate the geometry development and testing is requisite in a

running experiment like STAR, where there are few resources immediately availablerunning experiment like STAR, where there are few resources immediately available– having it in place early during the transition process allows one to have the geometry having it in place early during the transition process allows one to have the geometry

ready by the time of the proposed transitionready by the time of the proposed transition

Future Detector Description in STAR - we could use one (or all) of the following… Future Detector Description in STAR - we could use one (or all) of the following… What is best?What is best?

C++ code with a proper API to interface the databaseC++ code with a proper API to interface the databaseXML-based solutionXML-based solution

We will try of course to find a uniform solution (XML -based detector description We will try of course to find a uniform solution (XML -based detector description being of particular interest)being of particular interest)

There are reasons why automated Zebra-to-Root conversion isn’t suited for the There are reasons why automated Zebra-to-Root conversion isn’t suited for the task (parameters are numbers, hit definitions not translated etc)task (parameters are numbers, hit definitions not translated etc)

Page 12: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Detector DescriptionDetector Description

Why XML versus algorithmic languages?Why XML versus algorithmic languages?– experience in the STAR experiment shows that having a structured, experience in the STAR experiment shows that having a structured,

declaration-based description of geometry helps a great deal in creation and declaration-based description of geometry helps a great deal in creation and maintenance of the geometry code. Extending this approach to a new maintenance of the geometry code. Extending this approach to a new platform, supported by the industry, seems to be a logical step forward.platform, supported by the industry, seems to be a logical step forward.

– always a possibility to use XML as an exchange formatalways a possibility to use XML as an exchange format

Functionality of a XML-based solution should includeFunctionality of a XML-based solution should include– constantsconstants

– arithmetic expressionsarithmetic expressions

– iterators (expressing symmetry in the system)iterators (expressing symmetry in the system)

– arrays of parametersarrays of parameters

– export of pure XML for visualizationexport of pure XML for visualization

– database interfacedatabase interface

Page 13: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Detector DescriptionDetector Description

Open issues in Detector Description:Open issues in Detector Description:

Have to make a choice of a particular language (schema), such as GDMLHave to make a choice of a particular language (schema), such as GDML

None of the existing parsers is useable right away in the TGeo context, so None of the existing parsers is useable right away in the TGeo context, so effectively this needs to be implemented almost from scratcheffectively this needs to be implemented almost from scratch

Separation of geometrical structure and the Separation of geometrical structure and the data componentdata component: current lack of a : current lack of a standard database interface in the existing implementations (will probably have standard database interface in the existing implementations (will probably have to do it ourselves and/or establish a joint project with interested parties)to do it ourselves and/or establish a joint project with interested parties)

Geant 3 and 4 geometry implementation differencesGeant 3 and 4 geometry implementation differences

Page 14: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Current status of the STAR VMC projectCurrent status of the STAR VMC project

Parameters of the STAR VMC effort:Parameters of the STAR VMC effort:– as lightweight application as possible, due to limited resourcesas lightweight application as possible, due to limited resources– experiment-independent, to better design and leave the door open for experiment-independent, to better design and leave the door open for

collaboration with other groupscollaboration with other groups– focus on the end result, thus necessitating the development of the focus on the end result, thus necessitating the development of the

infrastructure as detailed aboveinfrastructure as detailed above

Accomplished steps:Accomplished steps:– Developed core classes for the VMC implementation in STARDeveloped core classes for the VMC implementation in STAR– Test application createdTest application created– validation of the ROOT geometry manager in the VMC context validation of the ROOT geometry manager in the VMC context

(V.Perevoztchikov)(V.Perevoztchikov)– the TGeant3 library restructured (V.Perevoztchikov)the TGeant3 library restructured (V.Perevoztchikov)

Page 15: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Current status of the STAR VMC projectCurrent status of the STAR VMC project

Core classes:Core classes:

– StarConfigurationStarConfiguration– StarDetectorConstructionStarDetectorConstruction– StarGeneratorStarGenerator– StarHitStarHit– StarMaterialStarMaterial– StarMCApplicationStarMCApplication– StarMCDisplayStarMCDisplay– StarMCEventStarMCEvent– StarMediumStarMedium– StarModuleStarModule– StarParticleStarParticle– StarRndmStarRndm– StarRotationStarRotation– StarStackStarStack– StarVertexStarVertex– StarVolumeStarVolume

Additional classes: detector specificAdditional classes: detector specific

Page 16: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Current status of the STAR VMC projectCurrent status of the STAR VMC project

Example of VMC event class design:Example of VMC event class design:

Page 17: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Current status of the STAR VMC projectCurrent status of the STAR VMC project

Saving tracks of interest:Saving tracks of interest:

– done in StarStack::PushTrack method.done in StarStack::PushTrack method.

– mechanisms of interest defined by the user, can include decays, mechanisms of interest defined by the user, can include decays, particle types, or even volumes (work in progress)particle types, or even volumes (work in progress)

Geometry:Geometry:

– a portion of the detector used, and currently coded in C++ (Root TGeo a portion of the detector used, and currently coded in C++ (Root TGeo classes), as a stop-gap measure until we find a better solutionclasses), as a stop-gap measure until we find a better solution

Interface with other components of the STAR softwareInterface with other components of the STAR software

– pending implementation of the infrastructure elements such as volume pending implementation of the infrastructure elements such as volume numbering and hit declarationnumbering and hit declaration

Page 18: From Geant 3 to Virtual Monte Carlo: Approach and Experience

The STAR VMCThe STAR VMC Test applicationTest application

driven from a CINT driven from a CINT macro in the ROOT macro in the ROOT environmentenvironment

at the current at the current stage, geometry of stage, geometry of the detector coded the detector coded in C++, pending in C++, pending the development of the development of the Detector the Detector DescriptionDescription

StarMCApplication* appl = new StarMCApplication* appl = new StarMCApplication("StarMCApplication", "STAR VMC");StarMCApplication("StarMCApplication", "STAR VMC");

StarTpc* tpc = new StarTpc(); StarTpc* tpc = new StarTpc(); StarEcal* ecal = new StarEcal();StarEcal* ecal = new StarEcal();appl->AddModule(tpc); appl->AddModule(tpc); appl->AddModule(ecal);appl->AddModule(ecal);

TGeant3* geant3 = new TGeant3("TGeant3"); TGeant3* geant3 = new TGeant3("TGeant3"); geant3->SetDRAY(1);geant3->SetDRAY(1);geant3->SetHADR(1);geant3->SetHADR(1);geant3->SetLOSS(1);geant3->SetLOSS(1);geant3->SetMULS(1);geant3->SetMULS(1);appl->InitMC();appl->InitMC();appl->InitDisplay();appl->InitDisplay();appl->SetFinishEventCB(StMcEventInterface::FinishEventCB);appl->SetFinishEventCB(StMcEventInterface::FinishEventCB);

appl->SetInterest("Decay");appl->SetInterest("Decay");appl->SetInterest("Compton scattering");appl->SetInterest("Compton scattering");appl->SetInterest("Positron annihilation");appl->SetInterest("Positron annihilation");appl->SetInterest("Photoelectric effect");appl->SetInterest("Photoelectric effect");appl->SetInterest("Bremstrahlung");appl->SetInterest("Bremstrahlung");appl->trig();appl->trig();

Page 19: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Current status of the STAR VMC projectCurrent status of the STAR VMC project

validation of the ROOT geometry manager in the VMC context validation of the ROOT geometry manager in the VMC context (V.Perevoztchikov)(V.Perevoztchikov)

– the the g2root g2root utility was used to generate a Root (TGeo) representation of utility was used to generate a Root (TGeo) representation of the a realistic STAR geometry, based on the actual Geant model.the a realistic STAR geometry, based on the actual Geant model.

– same geometry was studied using the standard STAR simulation toolsame geometry was studied using the standard STAR simulation tool

– an identical set of tracks was used in both applicationsan identical set of tracks was used in both applications

– observables: observables: distributions of track lengths in different volumesdistributions of track lengths in different volumes

integrated track lengthsintegrated track lengths

– results:results:a few bugs found in the original STAR geometry descriptiona few bugs found in the original STAR geometry description

minor differences (identified and understood) in the operation of respective minor differences (identified and understood) in the operation of respective geometry managersgeometry managers

No “show stopper” problem with the TGeo geometry manager found so farNo “show stopper” problem with the TGeo geometry manager found so far

– performance: TGeo somewhat slower (performance: TGeo somewhat slower (caveat: non-optimized code)caveat: non-optimized code)

Page 20: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Current status of the STAR VMC projectCurrent status of the STAR VMC project

Restructuring of the TGeant3 library:Restructuring of the TGeant3 library:

– the “official” TGeant3 library comes with a particular (modified) version the “official” TGeant3 library comes with a particular (modified) version of Geant 3.21 code and is linked to it. This adversely affects of Geant 3.21 code and is linked to it. This adversely affects interoperability with other software components that may have interoperability with other software components that may have dependency on Geant 3.21dependency on Geant 3.21

– same applies to a few other componentssame applies to a few other components

– we have successfully separated the TGeant3 and other components we have successfully separated the TGeant3 and other components that can now be loaded as dynamic librariesthat can now be loaded as dynamic libraries

Does it make sense to make that official?Does it make sense to make that official?

Page 21: From Geant 3 to Virtual Monte Carlo: Approach and Experience

Current status of the STAR VMC projectCurrent status of the STAR VMC project

Areas of interest and collaboration with other groups and experiments:Areas of interest and collaboration with other groups and experiments:

– the XML (GDML?) parserthe XML (GDML?) parser

– enhancements to TGeant3enhancements to TGeant3

– elements of infrastructure useful in any context: hits, enumeration, etcelements of infrastructure useful in any context: hits, enumeration, etc