160 likes | 166 Views
StdHepC++ is a natural object-oriented implementation of a C++ standard Monte Carlo generator interface. It provides a standardized Fortran Monte Carlo output, interfaces with simulation packages, and has key classes for particles, collisions, events, and runs.
E N D
StdHepC++ L. Garren Presented by M. Fischler Fermi National Accelerator Laboratory USA http://www-pat.fnal.gov/stdhep/c++
What is StdHep? • From event generators • Lund, Pythia, Isajet, Herwig, … • Produce events in some form • StdHep • To simulation packages • Consume events in some form • Geant3, MCFast, … • Packages can conform to StdHep formats directly, but StdHep also has interfaces to package formats
What Does StdHep Do? • Standardized Fortran Monte Carlo output • HEPEVT common block • PDG particle numbering scheme • C++ requires a similar standard • Analysis moving to C++ • C++ Monte Carlo generators • Events and particles are natural C++ objects • StdHepC++ • Initial interface much like HEPEVT common block • Translation routines • Major rewrite under way
5 Key Classes in StdHepC++ • All classes are in StdHep namespace • StdHep::ParticleData • StdHep::Particle • StdHep::Collision • StdHep::Event • StdHep::Run
Run is logically a sequence of • Event is a set of • Collision has a specially structured container of • Particle has methods to refer to common • ParticleData may come from standard reference or be application specific
StdHep::Particle • Volatile particle information • Particle ID • status code • color • generated mass • helicity • momentum (CLHEP LorentzVector) • creation vertex (CLHEP LorentzVector) • decay vertex (CLHEP LorentzVector)
(volatile Particle information continued) • mother • secondmother • index to the first daughter • index to the last daughter • Method to access appropriate StdHep::ParticleData • Mother and daughter entries deliberately designed to be compatible with HEPEVT common block • Ideally, information about the particle tree should (will) be decoupled from the Particle class
StdHep::Collision • A Collision is a single beam interaction • collision number • input I/O stream for bookkeeping purposes • number of Particles in the collision • vector of pointers to Particles • method to get Particle • Conceptually, Collision is a special sort of container of Particles
StdHep::Event • Each beam crossing may have several interactions. Therefore an Event is a collection of Collisions. • event number • number of Collisions • vector of pointers to Collisions • method to get Collision • method to get Particle • Conceptually, Event is special sort of container of Collisions
StdHep::Run • Collects event-independent informationLogically refers to a sequence of Events • number of Events to generate • number of Events generated • number of Events written to I/O • nominal center-of-mass energy • cross section • random number seeds • I/O methods
Taking Advantage of C++ and O-O • The classes described (particularly Particle) have some data which ought to be decoupled StdHep::Particle mother secondmother index to the first daughter index to the last daughter • These implement a type of aggregation, with special relationship properties • The C++ std library defines semantics for containers - stick with those semantics!
A Collision is a DAG <Particle> • Directed Acyclic Graph of Particles • templated class, works as a std::container • but augmented with parent/child relations • a parent may have any number of children • a child may have more than one parent • each parent or child (Particle) is a node on the graph • Acyclic: • there is at most one relation between two nodes • there cannot be a closed directed cycle
The DAG class • Looks and feels like other container classes • iterators; same sorts of loop constructs; … • Also embodies parent/child relationships • Removes parent/child information from Particle • Provides natural methods for traversing the particle tree in various ways • Including the concept of two isomorphic graphs of different types of objects • Allows for disconnected nodes
How DAG Will be Used class Particle {…}; class Collision : public DAG <Particle> { /* plus any not-per-particle data and methods */ }; • DAG has methods to insert/delete a Particle, assign parent/child, and provide iterators • dereferencing a DAG::iterator gives you a Particle • Nodelist<Particle> • ordered list of some iterators associated with a DAG • provides clean std syntax for loops over daughters, etc.
Some examples of DAG methods • Constructors • empty • relations induce from another DAG • fill from Nodelist in some other DAG • itp = dag.insert(p); • itp = dag.insertChild(p, itm); • Nodelist<T>-returning methods: • Nodelist<Particle> children (itp) • Nodelist<Particle> parents (itp)
Conclusion • There is a strong need for C++ standard Monte Carlo generator interface. • StdHepC++ is a natural object-oriented implementation of such an interface. • At present we have working examples which integrate StdHepC++ with the Fortran versions of Herwig, Pythia, Isajet. • On the other side, StdHepC++ provides event blocks readable by MCFast and Geant3, and will have an interface to Geant4.