6 #define HISTNAME "ptSpectra"
10 void PlotPythia(
const char *fileName=
"pythia.root")
24 printf(
"\nUsage: root LoadPythia.C PlotPythia.C(fileName=\"pythia.root\")\n");
27 printf(
"\n To create \"pythia.root\" input file run first");
28 printf(
"\n > root LoadPythia.C P2ATest.C\n");
33 TObject *nextObject = 0;
35 Int_t size = readEvents.TotalKeys();
36 printf(
" The total number of the events: %d\n",size);
43 ptSpectra =
new TH1D(HISTNAME,
"p_{#perp} spectrum for #pi^{+}",
45 ptSpectra->SetXTitle(
"p_{#perp}");
46 ptSpectra->SetYTitle(
"dN/dp_{#perp}");
47 printf(
" -- > Loop over all events, read them in to memory one by one < -- \n");
49 for( readEvents = 0; int(readEvents) < size; readEvents.SkipObjects() ){
50 nextObject = *readEvents;
51 printf(
" %d bytes of the object \"%s\" of class \"%s\" written with TKey \"%s\" has been read from file\n"
52 ,readEvents.GetObjlen()
53 ,nextObject->GetName()
54 ,nextObject->IsA()->GetName()
55 ,(
const char *)readEvents
59 if (particles) particles->Draw(Form(
"sqrt(pow(momentum[0],2)+pow(momentum[1],2))>>+%s", HISTNAME),
60 Form(
"pdg_id==%d", PDGNUMBER) );
66 ptSpectra->SetDirectory(0);
68 ptSpectra->Scale(3 / 100. / ptSpectra->Integral());
69 ptSpectra->Fit(
"expo",
"QO+",
"", .25, 1.75);
70 TF1* func = ptSpectra->GetFunction(
"expo");
71 func->SetParNames(
"A",
"- 1 / T");