Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
pythia_display.C File Reference

Detailed Description

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

Requires libPythia6.

#ifndef __RUN_PYTHIA_DISPLAY__
{
dir.ReplaceAll("pythia_display.C", "");
dir.ReplaceAll("/./", "/");
gROOT->LoadMacro(dir + "MultiView.C+");
#ifndef R__WIN32 // libPythia6 is a static library on Windoze
if (gSystem->Load("libPythia6") < 0) {
Error("pythia_display()", "Could not load 'libPythia6', make sure it is available!");
return;
}
#endif
gSystem->Load("libEGPythia6");
gROOT->ProcessLine("#define __RUN_PYTHIA_DISPLAY__ 1");
gROOT->ProcessLine("#include \"pythia_display.C\"");
gROOT->ProcessLine("run_pythia_display()");
gROOT->ProcessLine("#undef __RUN_PYTHIA_DISPLAY__");
}
#else
//==============================================================================
// 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 "TEveTrack.h"
#include "TEveElement.h"
#include "TEveGeoShape.h"
#include "TPythia6.h"
#include "TGeoTube.h"
#include "TMCParticle.h"
// Implemented in MultiView.C
class MultiView;
//==============================================================================
// Forward decalarations of CINT functions.
//------------------------------------------------------------------------------
//==============================================================================
// Main - pythia_display()
//------------------------------------------------------------------------------
{
if (g_pythia != 0) {
Warning("pythia_display()", "Already initialized.");
return;
}
//========================================================================
//========================================================================
// Create an instance of the Pythia event generator ...
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.
//========================================================================
b = new TEveGeoShape("Barell 1");
b->SetShape(new TGeoTube(kR_min, kR_max, kZ_d));
b->SetMainColor(kCyan);
b->SetMainTransparency(80);
fake_geom->AddElement(b);
b = new TEveGeoShape("Barell 2");
b->SetShape(new TGeoTube(2 * kR_min, 2 * kR_max, 2 * kZ_d));
b->SetMainColor(kPink - 3);
b->SetMainTransparency(80);
fake_geom->AddElement(b);
gMultiView->ImportGeomRPhi(fake_geom);
gMultiView->ImportGeomRhoZ(fake_geom);
gTrackList = new TEveTrackList("Pythia Tracks");
gTrackList->SetMainColor(kYellow);
gTrackList->SetMarkerColor(kRed);
gTrackList->SetMarkerStyle(4);
gTrackList->SetMarkerSize(0.5);
TEveTrackPropagator *trkProp = gTrackList->GetPropagator();
trkProp->SetMagField(kMagField);
trkProp->SetMaxR(2 * kR_max);
trkProp->SetMaxZ(2 * kZ_d);
//========================================================================
//========================================================================
}
//==============================================================================
// Next event
//------------------------------------------------------------------------------
{
gTrackList->DestroyElements();
P.GenerateEvent();
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());
track->SetName(Form("%s [%d]", pb.GetName(), i));
track->SetStdTitle();
track->SetAttLineAttMarker(gTrackList);
if (i == 0)
track->SetLineColor(kColors[0]);
else if (i <= 2)
track->SetLineColor(kColors[1]);
gTrackList->AddElement(track);
/*
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());
*/
}
gTrackList->MakeTracks();
TEveElement *top = static_cast<TEveElement *>(gEve->GetCurrentEvent());
gMultiView->DestroyEventRPhi();
gMultiView->ImportEventRPhi(top);
gMultiView->DestroyEventRhoZ();
gMultiView->ImportEventRhoZ(top);
}
//==============================================================================
// GUI stuff
//------------------------------------------------------------------------------
class EvNavHandler {
public:
void Fwd() { pythia_next_event(); }
void Bck() {}
};
//______________________________________________________________________________
{
// Create minimal GUI for event navigation.
browser->StartEmbedding(TRootBrowser::kLeft);
TGMainFrame *frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
frmMain->SetWindowName("XX GUI");
frmMain->SetCleanup(kDeepCleanup);
{
TString icondir(Form("%s/icons/", gSystem->Getenv("ROOTSYS")));
b = new TGPictureButton(hf, gClient->GetPicture(icondir + "GoBack.gif"));
b->SetEnabled(kFALSE);
b->SetToolTipText("Go to previous event - not supported.");
hf->AddFrame(b);
b->Connect("Clicked()", "EvNavHandler", fh, "Bck()");
b = new TGPictureButton(hf, gClient->GetPicture(icondir + "GoForward.gif"));
b->SetToolTipText("Generate new event.");
hf->AddFrame(b);
b->Connect("Clicked()", "EvNavHandler", fh, "Fwd()");
}
frmMain->AddFrame(hf);
frmMain->MapSubwindows();
frmMain->Resize();
frmMain->MapWindow();
browser->StopEmbedding();
browser->SetTabTitle("Event Control", 0);
}
#endif
#define b(i)
Definition RSha256.hxx:100
int Int_t
Definition RtypesCore.h:45
short Color_t
Definition RtypesCore.h:85
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
@ 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
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:229
R__EXTERN TEveManager * gEve
#define gClient
Definition TGClient.h:157
@ kDeepCleanup
Definition TGFrame.h:42
winID h TVirtualViewer3D TVirtualGLPainter p
#define gROOT
Definition TROOT.h:406
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
R__EXTERN TSystem * gSystem
Definition TSystem.h:561
An array of clone (identical) objects.
Specialization of TRootBrowser for Eve.
A list of TEveElements.
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
Wrapper for TGeoShape with absolute positioning and color attributes allowing display of extracted TG...
void AddElement(TEveElement *element, TEveElement *parent=nullptr)
Add an element.
void AddGlobalElement(TEveElement *element, TEveElement *parent=nullptr)
Add a global element, i.e.
TEveBrowser * GetBrowser() const
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)
TEveEventManager * GetCurrentEvent() const
A list of tracks supporting change of common attributes and selection based on track parameters.
Definition TEveTrack.h:140
Holding structure for a number of track rendering parameters.
Visual representation of a track.
Definition TEveTrack.h:33
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:397
Yield an action as soon as it is clicked.
Definition TGButton.h:228
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:558
Cylindrical tube class.
Definition TGeoTube.h:17
Description of the dynamic properties of a particle.
Definition TParticle.h:26
TGTab * GetTabRight() const
Basic string class.
Definition TString.h:139
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:704
virtual const char * Getenv(const char *env)
Get environment variable.
Definition TSystem.cxx:1665
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition TSystem.cxx:1857
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1063
const Double_t kR_max
const Double_t kZ_d
const Double_t kR_min
Author
Matevz Tadel

Definition in file pythia_display.C.