FairRoot/PandaRoot
Functions
macro/examples/fastsim/ana_example.C File Reference

Go to the source code of this file.

Functions

int ana_example (TString fname, int nevts=0)
 

Function Documentation

int ana_example ( TString  fname,
int  nevts = 0 
)

Definition at line 1 of file macro/examples/fastsim/ana_example.C.

References c1, ctime, Double_t, eta, gam, i, printf(), rtime, and timer.

2 {
3  TStopwatch timer;
4  timer.Start();
5 
6  gSystem->Load("libEGPythia6"); // needed for TDatabasePDG
7  gSystem->Load("libRho");
8 
9  // the PndEventReader takes care about file/event handling
10  PndEventReader evr(fname);
11 
12  // to attach more files: evr.Add(fname2);evr.Add(fname3); ...
13 
14  TH1F *metac=new TH1F("metac","m(eta_c)",100,2.6,3.3);
15 
16  // the candidates lists we need
17  TCandList gam, pi0, eta, etac;
18 
19  // some mass selectors
20  TPidMassSelector *etaMassSel=new TPidMassSelector("eta",0.534,0.03);
21  TPidMassSelector *pi0MassSel=new TPidMassSelector("pi0",0.130,0.03);
22 
23  if (nevts==0) nevts=evr.GetEntries();
24  int i=0,j;
25 
26  // *************
27  // this is the loop through the events ... as simple as this...
28  // ****************
29  while (evr.GetEvent() && i++<nevts)
30  {
31  // ask the event reader to fill the gamma candidates lists
32  evr.FillList(gam,"Neutral");
33 
34  // do the combinatorics and selection
35  pi0.Combine(gam,gam);
36  pi0.Select(pi0MassSel);
37 
38  eta.Combine(gam,gam);
39  eta.Select(etaMassSel);
40 
41  // Combine now works with up to 5 lists
42  // double counting and overlap when using the same list
43  // more the once is handled properly
44  etac.Combine(eta, pi0, pi0);
45 
46  // fill a histogram
47  for (j=0;j<etac.GetLength();++j) metac->Fill(etac[j].M());
48  }
49 
50  // ... and plot it
51  TCanvas *c1=new TCanvas("c1","c1",500,500);
52  c1->cd(); metac->Draw();
53 
54  // now take the time...
55  timer.Stop();
56  Double_t rtime = timer.RealTime();
57  Double_t ctime = timer.CpuTime();
58 
59  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
60  return 0;
61 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Int_t i
Definition: run_full.C:25
Double_t
TStopwatch timer
Definition: hit_dirc.C:51
c1
Definition: plot_dirc.C:35
CandList gam
Double_t ctime
Definition: hit_dirc.C:114
TParticlePDG * eta
Double_t rtime
Definition: hit_dirc.C:113