91#define FILENAME   "pythia.root" 
   92#define TREENAME   "tree" 
   93#define BRANCHNAME "particles" 
   94#define HISTNAME   "ptSpectra" 
  107int makeEventSample(
Int_t nEvents)
 
  121    Error(
"makeEventSample", 
"Couldn;t open file %s", FILENAME);
 
  131  tree->Branch(BRANCHNAME, &particles);
 
  134  for (
Int_t i = 0; i < nEvents; i++) {
 
  137      cout << 
"Event # " << i << endl;
 
  154  TH1D* hist = 
new TH1D(HISTNAME, 
"p_{#perp}  spectrum for  #pi^{+}",
 
  159  sprintf(expression,
"sqrt(pow(%s.fPx,2)+pow(%s.fPy,2))>>%s",
 
  160          BRANCHNAME, BRANCHNAME, HISTNAME);
 
  162  sprintf(selection,
"%s.fKF==%d", BRANCHNAME, PDGNUMBER);
 
  163  tree->Draw(expression,selection);
 
  168  hist->
Fit(
"expo", 
"QO+", 
"", .25, 1.75);
 
  187    Error(
"showEventSample", 
"Couldn;t open file %s", FILENAME);
 
  194    Error(
"showEventSample", 
"couldn't get TTree %s", TREENAME);
 
  204    Error(
"showEventSample", 
"couldn't get TH1D %s", HISTNAME);
 
  216  sprintf(expression,
"T #approx %5.1f", -1000 / func->
GetParameter(1));
 
  225void pythiaExample(
Int_t n=1000) {
 
  231int main(
int argc, 
char** argv)
 
  237    n = strtol(argv[1], NULL, 0);
 
  241    retVal = makeEventSample(
n);
 
  243    retVal = showEventSample();
 
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
 
R__EXTERN TStyle * gStyle
 
R__EXTERN TSystem * gSystem
 
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
 
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
 
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
 
An array of clone (identical) objects.
 
virtual void SetParNames(const char *name0="p0", const char *name1="p1", const char *name2="p2", const char *name3="p3", const char *name4="p4", const char *name5="p5", const char *name6="p6", const char *name7="p7", const char *name8="p8", const char *name9="p9", const char *name10="p10")
Set up to 10 parameter names.
 
virtual Double_t GetParameter(Int_t ipar) const
 
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
 
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
 
virtual TObjArray * GetListOfParticles() const
 
1-D histogram with a double per channel (see TH1 documentation)}
 
virtual void SetXTitle(const char *title)
 
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
Fit histogram with function fname.
 
void Draw(Option_t *option="") override
Draw this histogram with options.
 
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
 
virtual TF1 * GetFunction(const char *name) const
Return pointer to function with name.
 
virtual void SetYTitle(const char *title)
 
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
 
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
 
To draw Mathematical Formula.
 
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
 
void SetLogy(Int_t value=1) override
Set Lin/Log scale for Y.
 
TPythia is an interface class to F77 version of Pythia 6.2
 
void Initialize(const char *frame, const char *beam, const char *target, float win)
Calls PyInit with the same parameters after performing some checking, sets correct title.
 
void GenerateEvent()
generate event and copy the information from /HEPEVT/ to fPrimaries
 
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
 
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
 
A TTree represents a columnar dataset.