330 likes | 562 Views
LHCb Software Tutorial Updated on 13 July 2007. Event Generation. Gloria Corti CERN. Gauss Tutorial. Outline. Overview of Event generation Purpose: reminder Elements of generation structure and various tasks: accelerator conditions, production of pp collisions, decays
E N D
LHCb Software Tutorial Updated on 13 July 2007 Event Generation Gloria Corti CERN Gauss Tutorial
Outline • Overview of Event generation • Purpose: reminder • Elements of generation • structure and various tasks: accelerator conditions, production of pp collisions, decays • External libraries • Event types • hints for generating a new signal sample and controlling decay • Generator studies and high statistic samples • random number seeds, asking for a production • Output Data • HepMC
Purpose: a reminder • For Generator phase of Gauss • generation of proton-proton collisions • decay of particles with special attention to those of b-hadrons • Data produced can be studied directly or in further processing • GenCollisions (Global generator event information) • HepMCEvents (Generator event with particles and vertices) • Output (.sim ) can be processed by Gauss simulation phase if produced alone, if in a complete Gauss job Boole will not use the generator information but will “propagate it” to Brunel DaVinci
Event Generator Phase as stand-alone Gauss job • Gauss normally run in a single job with all phases • Detector physics simulation is quite time consuming • Require production system resources for reasonable statistic • No more than few hundred (500) events can be produced in a single job • Generator phase can be run by itself to do studies at Generator level • Faster → reasonable statistics can be produced for signal samples by anyone • Very useful when introducing generator features or looking at at production mechanisms or decay channels for the first time • Must do it BEFORE introducing a new decay channel in a Gauss release and asking the Production Team for events to be produced with Gauss → Boole → Brunel chain • You will run generator stand-alone jobs in this following practical section
Job Options – Gauss.opts Generator Stand alone //----------------------------------------------------------------- // Phases to be executed: //----------------------------------------------------------------- ApplicationMgr.TopAlg += { "GaudiSequencer/Generator" }; // ApplicationMgr.TopAlg += { “GaudiSequencer/Simulation” }; //----------------------------------------------------------------- // Generator Phase //----------------------------------------------------------------- #include "$GAUSSOPTS/Generator.opts“ Generator.MeasureTime = true; // When running Generator stand-alone uncomment the following // to write on tape only Generator objects #include "$GAUSSOPTS/GenStandAlone.opts“ //----------------------------------------------------------------- // Simulation Phase //----------------------------------------------------------------- // #include "$GAUSSOPTS/Simulation.opts" // Simulation.MeasureTime = true; Commented ! Uncomment for writing out only generator event Commented ! • A generator stand-alone Gauss job can be run with Gauss.opts or v200601.opts – the geometry is irrelevant ! • ../slc3_ia32_gcc323/Gauss.exe $GAUSSOPTS/Gauss.opts
EventGeneration JobOpts LHCb Event model primary event generator specialized decay package pile-up generation Interface HepMC MCParticle MCVertex MCHits Pythia, EvtGen … POOL Stand alone Event Generation Monitor JobOpts Init Exchange model GiGa Geant4 Initialize HepMC Monitor Cnv Cnv Cnv POOL Geometry Detector Simulation geometry of the detector (LHCb Geant4) tracking through materials (Geant4) hit creation and MC truth information (Geant4 LHCb)
Event Generator Phase • Necessary to generate events for different purposes • feasibilities of some physics analysis in LHCb • understand detector performance and evaluate changes in detector design • test beam analysis • LHCb real data physics analysis • Need different type of “events” • Single pp-collisions and bunch crossing at different luminosities (pile-up) • Minimum bias • Generic beauty (and charm) events • “Signal” events: b-mesons family in many decay modes but also b-hadrons, open charm, heavy quarkonia, Higgs, Z0, etc. etc. etc. • Particle guns (calibration, test beams, single beam in IP8) Physics Events
Elements of generation of physics events • Generation algorithm uses tools, i.e. small pieces of code realizing small and specific actions of the generation sequence: • PileUpTool – Generation of number of pile-up events • SampleGenerationTool – generate a given sample of events (minimum bias, inclusive, signal, …) • ProductionTool – Generation of one p-p interaction • BeamTool – Generation of beam parameters (3 momentum) • DecayTool – Decay of unstable particles, • CutTool – Cut at generator level, • FullGenEventCutTool – Cut on full event properties, • VertexSmearingTool – Smearing of primary vertex. Generator.Members = { "Generation" }; Generator.opts
Generator Tools • Each tool has a generic interface and a specific implementation: this allows to use different methods to realize each action. For example, generation of p-p interactions can be done with Pythia or HERWIG, without changing anything else. • New in DC06 versions – easier to add a new generator engine or cuts for specific samples • A large amount of code is common when using Pythia or Herwig and then do not have to be rewritten. • New ideas (for generator level cuts, …) can be inserted quickly in Gauss since it is just a matter of adding a small piece of code and do not require to change the whole software. • Details on the web: • http://lhcb-comp.web.cern.ch/lhcb-comp/Simulation/generators.htm (Gauss → Generators)
ProductionTool IProductionTool Abstract Interface generateEvent( HepMC ) setStable() save/loadPartonEvent() turnOn/OffHadronization() Concrete Implementations PythiaProduction Interface to Pythia with possibility to interact with Pythia common blocks via job options. HerwigProduction BcVegPyProduction SHERPAProduction
External libraries • The functionality in the tools is implemented by external libraries available in the physics community • controllable via property of the tools • Default engines used in Gauss v25r12 • Pythia generates pp interactions up to hadronization and some decays (main-stream generator) • LHAPDF generate the parton distributions inside the colliding protons • called by Pythia • EvtGen generate the decay and evolution of all particles • B hadrons, generic and user/signal tables • delegate to Pythia when decay not present in decay table (called internally) • Photos implements QED radiative corrections • used for all kind of decays • called by EvtGen Generation.MinimumBias.PythiaProduction.Commands = { "pysub msel 1" };
External libraries used in Gauss v24r7 • Most external libraries for generator phase out of the box from GENSER 1.4.1 (LCG application area Generator Services) • Pythia 6.325.2 • PHOTOS 2.15.2 • LHAPDF 4.2 (use CTEQ6L) • HERWIG 6.510.2 (and JIMMY 4.2.2) • available for validation and development • HepMC 1.26 • uses CLHEP, • two libraries: one for Event classes, the other interfaces to HepEVT for IO to FORTRAN generator libraries • Specialized libraries maintained by LHCb • EvtGen • modified by P.Robbe for hadron machine with additional models including for Lb decays • from a–00–11–07, D.Lange & A.Rys for Babar • BcVegPy 2.0 – special Bc generator • for validation and development • from C.H.Chang, J.X.Wang, X.G.Wu, Comp.Phys.Comm. 174 (2006) 241 • HiddenValley – special Z’ v-quarks generator • for special productions • from M. Strassler, hep-ph/0707160 • MC@NLO – build with LbHerwig • modified by K.Harrison to fit with LHCb software requirements Documentation on the web by authors from Gauss doxygen but look first on how it is controllable and interfaced to Gauss
Event types and Generator methods • Minimum Bias: • Keep all events generated by Pythia. • Inclusive: • Keep events generated by Pythia with at least one b-(or c)hadron in 400 mrad w/r to the z axis. • If all of these hadrons have pz < 0, flip the whole interaction • Signal: • Keep events generated by Pythia containing one B+ or one B- (or one B0/anti-B0, J/y, Ds+/Ds-, …) in 400 mrad. • If there are several candidates, choose randomly one. • If it has pz<0, flip the whole interaction. • To speed up generation, if the interaction contains a b quark, repeat the hadronization process of Pythia until the interaction contains the B+/B-. • Decay the signal candidate according to a forced channel with EvtGen. • Decay B** and B mixing with EvtGen • Special(Higgs, top, W, Z, …): • Keep all events generated by Pythia with special settings and passing specific generator level cuts (pT(lepton) > 4 GeV, …) • Decay Higgs, top, W, Z, … with Pythia, all other particles with EvtGen • No pile-up for this mode.
Sample Generation ISampleGenerationTool Abstract Interface generate() ExternalGenerator Concrete Implementations Contain useful functions when interfacing with an external production generator (handling of B**, parity trick, …) MinimumBias Inclusive Signal Other SignalForcedFragmentation SignalPlain SignalRepeatedHadronization
Options for event types • Options for event type chosen at production time, included after all other options • example in Gauss.opts • Options files have name GSDCTNXU.opts • GSDCTNXU is LHCb Event type code, used in data and in Book-keeping to identify samples • Each digit has a meaning explained in Note LHCb-2005-034 Minimum Bias: #include $DECFILESROOT/options/30000000.opts Inclusive b: #include $DECFILESROOT/options/10000000.opts Bs->J/Psi(mum)Phi(KK) #include $DECFILESROOT/options/13144000.opts
DecFile package • Contains all validated and released EventType options • released independently from Gauss • allow production of new event types with an already released Gauss and corresponding EvtGen decay files (dkfiles) for signals and to be used in addition to generic one containing all decays • When building the package a tool automatically builds job options necessary for a given EVTTYPE given specified keywords for production, cuts to be applied and special options to include Generator.opts ToolSvc.EvtGenDecay.DecayFile = "$DECFILESROOT/dkfiles/DECAY-DC06.DEC"; 13144000.opts ToolSvc.EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/Bs_Jpsiphi,mm.dec";
Options and dkfile for Minimum Bias # # EventType: 30000000 # Descriptor: pp => ? # NickName: minbias # Production: Pythia # Physics: # End minbias.dec used by Book-keeping used by EvtTypeSvc and MCDecayFinder Empty EvtGen directive: no special decay 30000000.opts // Event Type:30000000 // // ASCII Decay Descriptor: pp => ? Generation.EventType = 30000000; Generation.SampleGenerationTool = "MinimumBias"; Generation.MinimumBias.ProductionTool = "PythiaProduction"; ToolSvc.EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/minbias.dec";
Generation algorithm for Mimimum Bias • Main algorithm: Generation • Initialize all tools • Generate an event: • Compute the number of interactions per event, N • Generate an event with N interactions • Repeat until this event is accepted • Decay all hadrons in event • Smear the vertex • Store in event data store • Print counters Fixed luminosity of 2 × 1032 cm2/s (default) and 5 × 1032 cm2/s. IPileUpTool MinimumBias Generate interactions (N times) IProductionTool Obtain the beam parameters for this event. Generate an event (use the internal function of the generator used) IBeamTool Colliding beams with horizontal crossing angle 285 mrad IDecayTool ISmearingVertexTool Beam spot size: sx,y=70 mm sz=50 mm
Options for Signal Event Bs_Jpsiphi,mm.dec # This is the decay file for the decay BS0 -> PSI(-> MU+ MU-)PHI(-> K+ K-) # EventType: 13144000 # Descriptor: [B_s0 -> (J/psi(1S) -> mu+ mu- {,gamma} {,gamma}) (phi(1020) -> K+ K-)]cc # NickName: Bs_Jpsiphi,mm # Physics: Includes radiative mode, No CP violation # # Tested: Yes # By: Gerhard Raven # Date: 29 Mar 2004 used by Book-keeping In analysis session used: 13144000.opts // Event Type:13144000 // // ASCII Decay Descriptor: [B_s0 -> (J/psi(1S) -> mu+ mu- {,gamma} {,gamma}) (phi(1020) -> K+ K-)]cc Generation.EventType = 13144000; Generation.SampleGenerationTool = "SignalRepeatedHadronization"; Generation.SignalRepeatedHadronization.ProductionTool = "PythiaProduction"; Generation.SignalRepeatedHadronization.SignalPIDList = {531,-531}; ToolSvc.EvtGenDecay.UserDecayFile = "$GAUSSOPTS/Bs_Jpsiphi,mm.dec";
Generation algorithm for Signal Events IProductionTool Obtain the beam parameters for this event. Generate an event (use the internal function of the generator used) IPileUpTool • Main algorithm: Generation • Initialize all tools • Generate an event: • Compute the number of interactions per event, N • Generate an event with N interactions • Repeat until this event is accepted • Decay all hadrons in event • Smear the vertex • Apply cut on whole event • Store in event data store • Print counters SignalReapeatedHadronization Generate interactions (N times). If the interaction contains a b (or bbar) quark, save the parton event and re-run only the hadronization. Decay excited particles heavier than the signal particle. Check if the interaction contains the signal Apply generator level cuts to all particles of interest. If all remaining particles have pz<0, invert the interaction. Force the signal particle to decay to the correct decay mode. IBeamTool • available: • 400 mrad cut on the B direction (default) • direction of the decay products of the B IDecayTool IGenCutTool IDecayTool Repeated hadronization used for B0, B+, Bs and Lb. Forced fragmentation for Bc Plain Pythia for J/yD, Ds, … IDecayTool ISmearingVertexTool
Decays and EvtGen • Package developed by BABAR (David Lange and Anders Ryd) for B decays generation, written in C++. • Takes as input: • evt.pdl: particles properties (name, mass, width, charge, spin, lifetime) • In LHCb created on the fly from ParticleTable.txt • DECAY(-DC06).DEC: decay table for generic decays • we use the latest BABAR table with updated Branching Ratio • User .dec file : decay table for signal decays • Dedicated syntax to describe how to perform decays in .dec files • EvtGenalso uses PYTHIA to generate some decay modes. • Ensure both use the same particle properties (masses, lifetimes,…) via Gaudi ParticleProperty Service • EvtGen is contained in a tool,EvtGenDecay, that can be called at various stages of the Generation
EvtGen Decay Files (1) • Aliases for signal B hadrons are defined by default. they can be found in DECAY(-DC06).DEC • The user decay file sets the decay table for these aliases. • Additional aliases can be defined B-hadron Alias Charge conjugate B0 B0sig anti-B0sig B+ B+sig B-sig B0s B_s0sig anti-B_s0sig B+c B_c+sig B_c-sig Lb Lambda_b0sig anti-Lambda_b0sig
EvtGen Decay Files (2) • A lot of decay models are available. The most common ones are: • PHSP : phase space • SVS : (pseudo)scalar to vector (pseudo)scalar • VSS : vector to scalar scalar • for example for f→KK • SVV_HELAMP |H+| argH+ |H0| argH0 |H-| argH- : scalar to vector vector with amplitude given by helicity amplitude arguments • for example for Bs →J/Psi f where the values are: |H+| = 0.159 argH+ = 1.563 |H0| = 0.775 argH0 = 0.0 |H-| = 0.612 argH- = 2.712 • VLL : vector to lepton lepton • PHOTOS_VLL : vector to lepton lepton with Photos radiative corrections • for example for J/Psi →mm • ISGW2 : semi-leptonic, … • Their explanation is available from the EvtGen manual • available from the Gauss web page: Gauss → EvtGen → pdf of manual
# Decay file for BS0 -> PSI(-> MU+ MU-) PHI(-> K+ K-) # Can define parameters to be used Define Hp 0.159 . . . # Define aliases for J/psi and phi decays Alias MyJ/psi J/psi Alias MyPhi phi # Define charged conjugates ChargeConj MyJ/psi MyJ/psi ChargeConj MyPhi MyPhi # Define decay of B0sig alias Decay B_s0sig # BR Decay_products Decay_model (parameters) 1.000 MyJ/psi MyPhi SVV_HELAMP Hp pHp Hz pHz Hm pHm; Enddecay # Define the charge conjugate decay mode for anti-particle Decay anti-B_s0sig 1.000 MyJ/psi MyPhi SVV_HELAMP Hm pHm Hz pHz Hp pHp; Enddecay # Define the decay of the products . . . End Example decay file
High statistic samples - requests • Once an Event type has been chosen .OR. setup up and a big production through the whole chain of GaussBooleBrunel is necessary • Send a request to your Physics Working Group and the Physics Coordinator, Olivier Schneider, with cc to Patrick Robbe and me • specify Gauss version to use and if decay file is new provide it • It will be ensure all necessary code is released (including options!) and request is forwarded to Production Team
Indipendent samples • To generate independent samples and to ensure reproducibility of the events set random number sequence for each event • Use the same random number generator in whole of Gauss (from Gaudi framework) • The random number sequence is set in initialization of each phase • Three Random numbers are setup via Run and FirstEvent Number and their combination: change either one! • Event and Run number set in Generator phase and retrieved in Simulation • Random number seeds is also stored in Headers • Two separate headers: GenHeader (event type) & MCHeader (event time) Gauss.opts Gauss.RunNumber = 3477; Gauss.FirstEventNumber = 1001;
Type of events: Particle Guns • Used for special studies • Gaudi Algorihtm that can be controlled given particles in ranges of momentum, angle and origin vertex Generator.Members -= { "Generation", "GaudiSequencer/GenMonitor" }; Generator.Members += { "ParticleGun", "GaudiSequencer/GenMonitor" }; // Particle Gun's options // Note that internally the ParticleGun expect the units to be as specified on // the side (this is because of consistency with the generator format HepMC) ParticleGun.xVertexMin = 0.0; // mm ParticleGun.xVertexMax = 0.0; // mm ParticleGun.yVertexMin = 0.0; // mm ParticleGun.yVertexMax = 0.0; // mm ParticleGun.zVertexMin = 0.0; // mm ParticleGun.zVertexMax = 0.0; // mm ParticleGun.MomentumMin = 1.0; // GeV ParticleGun.MomentumMax = 100.0; // GeV ParticleGun.ThetMin = 0.015; // rad ParticleGun.ThetMax = 0.300; // rad ParticleGun.PhiMin = 0.0; // rad ParticleGun.PhiMax = 6.28; // rad ParticleGun.PdgCodes = {-211, 211}; // PDG code of list of particles to be // generated Example in Gauss: ParticleGun.opts Momentum Theta Phi
Generator Event data • Event data resides in Event Store • Tree - similar to file system • Identification by path ”/Event/Gen/HepMCEvents” • Objects or Containers of objects • Data access in GaudiAlgorithm: • iteration like any STL-vector: • Don’t FORGET the header file of the data class LHCb convention const HepMCEvents* events = get<HepMCEvents>(HepMCEventLocation::Default); for( HepMCEvents::const_iterator iEv = events->begin(); iEv != events->end(); ++iEv ) { for( HepMC::GenEvent::particle_const_iterator iP = (*iEv)->pGenEvt()->particles_begin(); iP != (*iEv)->pGenEvt()->particles_end(); ++iP ) { LHCb convention #include “Event/HepMCEvent.h”
Generator Events • HepMC used for generator event • External library supported by LCG • Some C++ generator provides interface • Provide access to Pythia, Herwig data (HepEvt wrapper provided) • Generators communicate via HepMC in LHCb • PythiaEvtGen • Very well suited to generator structure HepMC::GenEvent (process) from which access to HepMC::GenVertex(ices) HepMC::GenVertex and HepMC::GenParticle holding incoming particle/end vertex, production vertex/outgoing particle relationship
Generator Events • HepMCEvent(s) • LHCb wrapper class to provide general LHCb data object functionality • Access in Transient Event, Persistency • Link to HepMC::GenEvent as a whole from other LHCb event data classes (SmartRef) • One for each pile-up event • GenCollisions • Information about each pile-up interaction • Mandelstam and Bjorken variables • process type • reference to HepMCEvent • GenHeader • General information of generation • luminosity, event type, event and run number • Fast access to pile-ups: reference to GenCollisions
Generator – Counters and Monitors • In the Gauss log files, counters computed during the generation are printed to be able to compute efficiencies and cross sections: • Pythia cross-sections, • Number of c and b events, • Fractions of B, B*, B** • Fractions of B0, B+, Bs, Lb • Efficiencies of generator level cuts • A tool is being put in place to automatically extract quantities from log files (F. Ranjard, M. Barbera Asin) • Basic monitoring histograms are filled in production • They can also be run also a posteriori on the HepMCEvents and a detailed n-tuple is also available (set up in MonitorInDetail.opts)
Exercises • You will get familiar with running Gauss in generator stand-alone, how to generate independent samples and how the configuration for different event types are set • Guidelines for the exercises on the web • from the tutorial agenda • Packages used: • Sim/Gauss v25r12 – Mandatory • Tutorial/Simulation v2r0 – Optional • exercises/README.txt + exerciseN.txt • solutions/exerciseN/ • Advanced exercises also available