Logo ROOT  
Reference Guide
pythia_display.C File Reference

Detailed Description

Demo showing H -> ZZ -> 4 mu generated by Pythia.

Requires libPythia6.

void pythia_display()
TString dir = gSystem->UnixPathName(__FILE__);
gROOT->LoadMacro(dir +"MultiView.C+");
#ifndef G__WIN32 // libPythia6 is a static library on Windoze
if (gSystem->Load("libPythia6") < 0)
"Could not load 'libPythia6', make sure it is available!");
gROOT->ProcessLine("#define __RUN_PYTHIA_DISPLAY__ 1");
gROOT->ProcessLine("#include \"pythia_display.C\"");
gROOT->ProcessLine("#undef __RUN_PYTHIA_DISPLAY__");
// Constants.
const Double_t kR_min = 240;
const Double_t kR_max = 250;
const Double_t kZ_d = 300;
// Solenoid field along z, in Tesla.
const Double_t kMagField = 4;
// Color for Higgs, Zs and muons
const Color_t kColors[3] = { kRed, kGreen, kYellow };
// Global variables.
#include "TPythia6.h"
#include "TGeoTube.h"
#include "TMCParticle.h"
TPythia6 *g_pythia = 0;
// Implemented in MultiView.C
class MultiView;
MultiView* gMultiView = 0;
TEveTrackList *gTrackList = 0;
// Forward decalarations of CINT functions.
void pythia_next_event();
void pythia_make_gui();
// Main - pythia_display()
void run_pythia_display()
if (g_pythia != 0)
Warning("pythia_display()", "Already initialized.");
// Create an instance of the Pythia event generator ...
g_pythia = new TPythia6;
TPythia6& P = * g_pythia;
P.SetMSEL(0); // full user controll;
P.SetMSUB(102, 1); // g + g -> H0
//P.SetMSUB(123, 1); // f + f' -> f + f' + H0
//P.SetMSUB(124, 1); // f + f' -> f" + f"' + H0
P.SetPMAS(6, 1, 175); // mass of TOP
P.SetPMAS(25, 1, 180); // mass of Higgs
P.SetCKIN(1, 170.0); // range of allowed mass
P.SetCKIN(2, 190.0);
P.SetMSTP(61, 0); // switch off ISR
P.SetMSTP(71, 0); // switch off FSR
P.SetMSTP(81, 0); // switch off multiple interactions
P.SetMSTP(111, 0); // Switch off fragmentation
// Force h0 -> ZZ
for (Int_t i = 210; i <= 288; ++i)
P.SetMDME(i, 1, 0);
P.SetMDME(225, 1, 1);
// Force Z -> mumu
for (Int_t i = 174; i <= 189; ++i)
P.SetMDME(i, 1, 0);
P.SetMDME(184, 1, 1);
P.Initialize("cms", "p", "p", 14000);
// Create views and containers.
TEveElementList *fake_geom = new TEveElementList("Geometry");
b = new TEveGeoShape("Barell 1");
b->SetShape(new TGeoTube(kR_min, kR_max, kZ_d));
b = new TEveGeoShape("Barell 2");
b->SetShape(new TGeoTube(2*kR_min, 2*kR_max, 2*kZ_d));
gMultiView = new MultiView;
gTrackList = new TEveTrackList("Pythia Tracks");
TEveTrackPropagator* trkProp = gTrackList->GetPropagator();
// Next event
void pythia_next_event()
TPythia6& P = * g_pythia;
int nh = P.GetMSTU(72);
// printf("N = %d, Nhard = %d :: NumSec = %d, separators (%d,%d,%d,%d)\n",
// P.GetN(), nh, P.GetMSTU(70), P.GetMSTU(71), P.GetMSTU(72), P.GetMSTU(73), P.GetMSTU(74));
// 2->2 hard postfrag final
TEveTrackPropagator *trkProp = gTrackList->GetPropagator();
TClonesArray &MC = * (TClonesArray*) P.GetListOfParticles();
for (Int_t i = 0; i < 7; ++i)
TMCParticle& p = (TMCParticle&)*MC[nh+i];
TParticle pb(p.GetKF(), p.GetKS(), 0, 0,
p.GetFirstChild()-nh-1, p.GetLastChild()-nh-1,
p.GetPx(), p.GetPy(), p.GetPz(), p.GetEnergy(),
p.GetVx(), p.GetVy(), p.GetVz(), p.GetTime());
TEveTrack* track = new TEveTrack(&pb, i, trkProp);
track->SetName(Form("%s [%d]", pb.GetName(), i));
if (i == 0)
else if (i <= 2)
printf("%d - %d %d %d %d %d %d\n", i,
p.GetKF(), p.GetKS(), 0, 0,
p.GetFirstChild()-nh-1, p.GetLastChild()-nh-1);
printf("%d - %f %f %f %f\n", i,
p.GetPx(), p.GetPy(), p.GetPz(), p.GetEnergy(),
printf("%d - %f %f %f %f\n", i,
p.GetVx(), p.GetVy(), p.GetVz(), p.GetTime());
// GUI stuff
class EvNavHandler
void Fwd()
void Bck()
void pythia_make_gui()
// Create minimal GUI for event navigation.
TEveBrowser* browser = gEve->GetBrowser();
TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
frmMain->SetWindowName("XX GUI");
TString icondir( Form("%s/icons/", gSystem->Getenv("ROOTSYS")) );
EvNavHandler *fh = new EvNavHandler;
b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif"));
b->SetToolTipText("Go to previous event - not supported.");
b->Connect("Clicked()", "EvNavHandler", fh, "Bck()");
b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoForward.gif"));
b->SetToolTipText("Generate new event.");
b->Connect("Clicked()", "EvNavHandler", fh, "Fwd()");
browser->SetTabTitle("Event Control", 0);
#define b(i)
Definition: RSha256.hxx:100
int Int_t
Definition: RtypesCore.h:45
const Bool_t kFALSE
Definition: RtypesCore.h:92
double Double_t
Definition: RtypesCore.h:59
short Color_t
Definition: RtypesCore.h:83
const Bool_t kTRUE
Definition: RtypesCore.h:91
@ kPink
Definition: Rtypes.h:67
@ kRed
Definition: Rtypes.h:66
@ kGreen
Definition: Rtypes.h:66
@ kCyan
Definition: Rtypes.h:66
@ kYellow
Definition: Rtypes.h:66
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition: TError.cxx:187
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition: TError.cxx:231
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
#define gClient
Definition: TGClient.h:166
@ kDeepCleanup
Definition: TGFrame.h:50
#define gROOT
Definition: TROOT.h:406
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
An array of clone (identical) objects.
Definition: TClonesArray.h:29
Specialization of TRootBrowser for Eve.
Definition: TEveBrowser.h:130
A list of TEveElements.
Definition: TEveElement.h:433
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:36
virtual void AddElement(TEveElement *el)
Add el to the list of children.
virtual void DestroyElements()
Destroy all children of this element.
Wrapper for TGeoShape with absolute positioning and color attributes allowing display of extracted TG...
Definition: TEveGeoShape.h:24
virtual void SetLineColor(Color_t col)
Set the line color.
Definition: TEveLine.h:48
void AddElement(TEveElement *element, TEveElement *parent=0)
Add an element.
void AddGlobalElement(TEveElement *element, TEveElement *parent=0)
Add a global element, i.e.
TEveBrowser * GetBrowser() const
Definition: TEveManager.h:137
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition: TEveManager.h:168
TEveEventManager * GetCurrentEvent() const
Definition: TEveManager.h:149
A list of tracks supporting change of common attributes and selection based on track parameters.
Definition: TEveTrack.h:140
virtual void SetMarkerStyle(Style_t s)
Set marker style for the list and the elements.
Definition: TEveTrack.cxx:897
virtual void SetMarkerColor(Color_t c)
Set marker color for the list and the elements.
Definition: TEveTrack.cxx:929
void MakeTracks(Bool_t recurse=kTRUE)
Regenerate the visual representations of tracks.
Definition: TEveTrack.cxx:635
virtual void SetMainColor(Color_t c)
Set main (line) color for the list and the elements.
Definition: TEveTrack.cxx:801
TEveTrackPropagator * GetPropagator()
Definition: TEveTrack.h:175
virtual void SetMarkerSize(Size_t s)
Set marker size for the list and the elements.
Definition: TEveTrack.cxx:961
Holding structure for a number of track rendering parameters.
void SetMaxR(Double_t x)
Set maximum radius and rebuild tracks.
void SetMaxZ(Double_t x)
Set maximum z and rebuild tracks.
void SetMagField(Double_t bX, Double_t bY, Double_t bZ)
Set constant magnetic field and rebuild tracks.
Visual representation of a track.
Definition: TEveTrack.h:33
void SetAttLineAttMarker(TEveTrackList *tl)
Set line and marker attributes from TEveTrackList.
Definition: TEveTrack.cxx:318
virtual void SetStdTitle()
Set standard track title based on most data-member values.
Definition: TEveTrack.cxx:264
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1102
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1057
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1149
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:590
virtual void MapWindow()
map window
Definition: TGFrame.h:228
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1749
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
Definition: TGTab.cxx:509
Cylindrical tube class.
Definition: TGeoTube.h:18
This class serves as a data storage for description of one particle.
Definition: TMCParticle.h:20
Float_t GetPx() const
Definition: TMCParticle.h:80
Int_t GetKS() const
Definition: TMCParticle.h:74
Float_t GetVx() const
Definition: TMCParticle.h:86
Float_t GetPy() const
Definition: TMCParticle.h:81
Int_t GetLastChild() const
Definition: TMCParticle.h:78
Float_t GetTime() const
Definition: TMCParticle.h:89
Int_t GetKF() const
Definition: TMCParticle.h:75
Float_t GetPz() const
Definition: TMCParticle.h:82
Float_t GetVz() const
Definition: TMCParticle.h:88
Float_t GetEnergy() const
Definition: TMCParticle.h:83
Float_t GetVy() const
Definition: TMCParticle.h:87
Int_t GetFirstChild() const
Definition: TMCParticle.h:77
Description of the dynamic properties of a particle.
Definition: TParticle.h:26
virtual void SetName(const char *name)
Change (i.e.
TPythia is an interface class to F77 version of Pythia 6.2
Definition: TPythia6.h:84
void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1) override
Start embedding external frame in the tab "pos" and tab element "subpos".
void SetTabTitle(const char *title, Int_t pos=kRight, Int_t subpos=-1)
Set text "title" of Tab "subpos" in TGTab "pos".
void StopEmbedding(const char *name=nullptr) override
Definition: TRootBrowser.h:151
TGTab * GetTabRight() const
Definition: TRootBrowser.h:140
Basic string class.
Definition: TString.h:136
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
virtual const char * Getenv(const char *env)
Get environment variable.
Definition: TSystem.cxx:1661
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1853
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition: TSystem.cxx:1061
const Double_t kR_max
Definition: calorimeters.C:18
const Double_t kZ_d
Definition: calorimeters.C:19
const Double_t kR_min
Definition: calorimeters.C:17
static double P[]
Matevz Tadel

Definition in file pythia_display.C.