Selector to generate Monte Carlo events with Pythia8.
#define ProofPythia_cxx
#include <TFormula.h>
ProofPythia::ProofPythia()
{
fHist = 0;
fPt = 0;
fEta = 0;
fPythia = 0;
fP = 0;
}
ProofPythia::~ProofPythia()
{
}
void ProofPythia::Begin(
TTree * )
{
Info(
"Begin",
"starting a simple exercise with process option: %s", option.
Data());
}
void ProofPythia::SlaveBegin(
TTree * )
{
fTot =
new TH1F(
"histo1",
"total multiplicity", 25, 0.5, 2500.5);
fHist =
new TH1F(
"histo2",
"charged multiplicity", 20, 0.5, 500.5);
fPt =
new TH1F(
"histo3",
"particles pT", 100, 0., 10);
fEta =
new TH1F(
"histo4",
"particles Eta", 100, -10., 10);
fTot->SetFillColor(
kBlue);
fHist->SetFillColor(
kRed);
fOutput->Add(fTot);
fOutput->Add(fHist);
fOutput->Add(fPt);
fOutput->Add(fEta);
fPythia->SetName("pythia8");
fPythia->ReadConfigFile("pythia8/main03.cmnd");
fPythia->Initialize( 2212, 2212, 14000.);
}
{
fPythia->GenerateEvent();
if (entry < 2)
fPythia->EventListing();
fPythia->ImportParticles(fP, "All");
Int_t nTot = fPythia->GetN();
fPythia->ImportParticles(fP, "All");
Int_t np = fP->GetEntriesFast();
for (
Int_t ip = 0; ip < np; ip++) {
if (ist != 1) continue;
if (charge == 0.) continue;
nCharged++;
if (
pt > 0.) fPt->Fill(
pt);
if ((eta > -10) && (eta < 10)) fEta->Fill(eta);
}
fHist->Fill(nCharged);
fTot->Fill(nTot);
}
void ProofPythia::SlaveTerminate()
{
}
void ProofPythia::Terminate()
{
if ((fTot =
dynamic_cast<TH1F *
>(fOutput->FindObject(
"histo1")))) {
fTot->Draw("h");
}
if ((fHist =
dynamic_cast<TH1F *
>(fOutput->FindObject(
"histo2")))) {
fHist->Draw("h");
}
if ((fPt =
dynamic_cast<TH1F *
>(fOutput->FindObject(
"histo3")))) {
fPt->Draw("h");
}
if ((fEta =
dynamic_cast<TH1F *
>(fOutput->FindObject(
"histo4")))) {
fEta->Draw("h");
}
}
Selector to generate Monte Carlo events with Pythia8.
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
An array of clone (identical) objects.
static TDatabasePDG * Instance()
static function
TParticlePDG * GetParticle(Int_t pdgCode) const
Get a pointer to the particle object according to the MC code number.
1-D histogram with a float per channel (see TH1 documentation)}
Description of the dynamic properties of a particle.
Int_t GetStatusCode() const
TPythia8 is an interface class to C++ version of Pythia 8.1 event generators, written by T....
const char * Data() const
A TTree represents a columnar dataset.