Event Generation Gloria Corti CERN LHCb Software Tutorial Updated on 13 July 2007 Gauss Tutorial.

32
Event Generation Gloria Corti CERN LHCb Software Tutorial Updated on 13 July 2007 Gauss Tutorial

Transcript of Event Generation Gloria Corti CERN LHCb Software Tutorial Updated on 13 July 2007 Gauss Tutorial.

Event Generation

Gloria CortiCERN

LHCb Software Tutorial

Updated on 13 July 2007

Gauss Tutorial

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 2

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

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 3

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

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 4

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

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 5

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 !

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

Commented !

Uncomment forwriting out onlygenerator event

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 6

Init

Monitor

Stand alone Event Generation

Event Generationprimary event generatorspecialized decay packagepile-up generation

Detector Simulationgeometry of the detector (LHCb Geant4)tracking through materials (Geant4)hit creation and MC truth information (Geant4 LHCb)

Geant4

GiGa

Cn

v

Cn

v

Cnv

JobOpts

Exchange model HepMC

MCParticleMCVertex

MCHits

POOL

LHCb Event model

Geometry

HepMC

POOL

Pythia,EvtGen

JobOpts

Interface

Monitor

Initialize

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 7

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)

Ph

ysic

s E

ven

ts

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 8

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

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 9

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)

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 10

IProductionToolgenerateEvent( HepMC

)setStable()save/loadPartonEvent()turnOn/OffHadronization()

Abstract Interface

Concrete Implementations PythiaProductionInterface to Pythia with possibility to interact with Pythia common blocks via job options.

HerwigProduction

SHERPAProduction

BcVegPyProduction

ProductionTool

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 11

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" };

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 12

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 b

decays – from –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

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 13

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/, 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.

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 14

ISampleGenerationToolgenerate()

Abstract Interface

Concrete Implementations

ExternalGeneratorContain useful functions when interfacing with an external production generator (handling of B**, parity trick, …)

MinimumBias Inclusive Signal Other

SignalPlainSignalForcedFragmentatio

nSignalRepeatedHadronizati

on

Sample Generation

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 15

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

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 16

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

ToolSvc.EvtGenDecay.DecayFile = "$DECFILESROOT/dkfiles/DECAY-DC06.DEC";

ToolSvc.EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/Bs_Jpsiphi,mm.dec";

13144000.opts

Generator.opts

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 17

Options and dkfile for Minimum Bias

// Event Type:30000000//// ASCII Decay Descriptor: pp => ?

Generation.EventType = 30000000;Generation.SampleGenerationTool = "MinimumBias";Generation.MinimumBias.ProductionTool = "PythiaProduction";ToolSvc.EvtGenDecay.UserDecayFile =

"$DECFILESROOT/dkfiles/minbias.dec";

30000000.opts

## EventType: 30000000# Descriptor: pp => ?# NickName: minbias# Production: Pythia# Physics:#End

minbias.dec

Empty EvtGen directive: no special decay

used by EvtTypeSvc and MCDecayFinder

used by Book-keeping

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 18

Main algorithm: Generation

1. Initialize all tools

2. Generate an event:

1. Compute the number of interactions per event, N

2. Generate an event with N interactions

3. Repeat until this event is accepted

3. Decay all hadrons in event

4. Smear the vertex

5. Store in event data store

6. Print counters

IPileUpTool

MinimumBias

Generate interactions (N times)

IDecayTool

ISmearingVertexTool

IProductionTool

Obtain the beam parameters for this event.

Generate an event (use the internal function of the generator used)

IBeamTool

Generation algorithm for Mimimum Bias

Fixed luminosity of 2 × 1032 cm2/s (default) and 5 × 1032 cm2/s.

Colliding beams with horizontal crossing angle 285 mradBeam spot size:

x,y=70 m

z=50 mm

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 19

# 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

Options for Signal Event

// 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";

)()(/ KKJBs In analysis session used:

13144000.opts

Bs_Jpsiphi,mm.dec

used by Book-keeping

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 20

Main algorithm: Generation

1. Initialize all tools

2. Generate an event:

1. Compute the number of interactions per event, N

2. Generate an event with N interactions

3. Repeat until this event is accepted

3. Decay all hadrons in event

4. Smear the vertex

5. Apply cut on whole event

6. Store in event data store

7. Print counters

IPileUpTool

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.

IDecayTool

ISmearingVertexTool

IProductionTool

Obtain the beam parameters for this event.

Generate an event (use the internal function of the generator used)

IBeamTool

IDecayTool

IGenCutTool

IDecayTool

Generation algorithm for Signal Events

Repeated hadronization used for B0, B+, Bs and b.Forced fragmentation for Bc

Plain Pythia for J/ D, Ds, …

available:• 400 mrad cut on the B direction (default)• direction of the decay products of the B

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 21

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 EvtGen also 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

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 22

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

b Lambda_b0sig anti-Lambda_b0sig

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 23

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 → 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 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 →

ISGW2 : semi-leptonic, … Their explanation is available from the EvtGen manual

available from the Gauss web page: Gauss → EvtGen → pdf of manual

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 24

Example decay file

# Decay file for BS0 -> PSI(-> MU+ MU-) PHI(-> K+ K-)# Can define parameters to be usedDefine Hp 0.159 . . .# Define aliases for J/psi and phi decaysAlias MyJ/psi J/psiAlias MyPhi phi# Define charged conjugatesChargeConj MyJ/psi MyJ/psiChargeConj MyPhi MyPhi# Define decay of B0sig aliasDecay 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-particleDecay anti-B_s0sig1.000 MyJ/psi MyPhi SVV_HELAMP Hm pHm Hz pHz Hp pHp;Enddecay# Define the decay of the products. . .End

)()(/ KKJBs

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 25

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

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 26

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.RunNumber = 3477;Gauss.FirstEventNumber = 1001;

Gauss.opts

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 27

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; // mmParticleGun.xVertexMax = 0.0; // mmParticleGun.yVertexMin = 0.0; // mmParticleGun.yVertexMax = 0.0; // mmParticleGun.zVertexMin = 0.0; // mmParticleGun.zVertexMax = 0.0; // mmParticleGun.MomentumMin = 1.0; // GeVParticleGun.MomentumMax = 100.0; // GeVParticleGun.ThetMin = 0.015; // radParticleGun.ThetMax = 0.300; // radParticleGun.PhiMin = 0.0; // radParticleGun.PhiMax = 6.28; // radParticleGun.PdgCodes = {-211, 211}; // PDG code of list of particles to be // generated

Example in Gauss: ParticleGun.opts

Momentum

Theta

Phi

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 28

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

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 ) {

#include “Event/HepMCEvent.h”LHCb convention

LHCb convention

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 29

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

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 30

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

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 31

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, b

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)

Software Tutorial - Gauss - Last update: 10 October 2007

Event Generation - Page 32

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