FairRoot/PandaRoot
Functions
run_ana_sttcombi.C File Reference

Go to the source code of this file.

Functions

void run_ana_sttcombi (TString fname="pid_sttcombi.root", int nevts=0)
 

Function Documentation

void run_ana_sttcombi ( TString  fname = "pid_sttcombi.root",
int  nevts = 0 
)

Definition at line 1 of file run_ana_sttcombi.C.

References c1, ctime, Double_t, i, Mass, p1, p2, printf(), rtime, and timer.

2 {
3  TStopwatch timer;
4  timer.Start();
5 
6  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
7 
8  TCanvas *c1=new TCanvas("c1","c1",600,600);
9 
10  // the PndEventReader takes care about file/event handling
11  PndEventReader evr(fname);
12 
13  // to attach more files: evr.Add(fname2);evr.Add(fname3); ...
14  TH1F *invmass=new TH1F("invmass","invariant mass",400,0.0,5.0);
15 
16  // the candidates lists we need
17  TCandList p1;
18  TCandList p2;
19  TCandList jpsi;
20 
21  if (nevts==0) nevts=evr.GetEntries();
22  cout << "nevts " << nevts << "\n";
23  int i=0,j=0, k=0, l=0;
24 
25  // *************
26  // this is the loop through the events ... as simple as this...
27  // ****************
28  while (evr.GetEvent() && i++<nevts)
29  {
30 
31 // evr.FillList(p1,"All");
32 // evr.FillList(p2,"All");
33  evr.FillList(p1,"Charged");
34  evr.FillList(p2,"Charged");
35 
36  cout << p1.GetLength() << " e+ candidates found" << "\n";
37  cout << p2.GetLength() << " e- candidates found" << "\n";
38 
39  for (j=0;j<p1.GetLength();++j) {
40  p1[j].SetMass(TRho::Instance()->GetPDG()->GetParticle(11)->Mass());
41  }
42  for (j=0;j<p2.GetLength();++j) {
43  p2[j].SetMass(TRho::Instance()->GetPDG()->GetParticle(11)->Mass());
44  }
45 
46  jpsi.Combine(p1,p2);
47 
48  cout << jpsi.GetLength() << " J/Psi candidates found" << "\n";
49 
50  for (l=0;l<jpsi.GetLength();++l) {
51  invmass->Fill(jpsi[l].M());
52  }
53  }
54 
55  // ... and plot it
56  c1->cd(); invmass->Draw();
57 
58  // now take the time...
59  timer.Stop();
60  Double_t rtime = timer.RealTime();
61  Double_t ctime = timer.CpuTime();
62  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
63 
64 }
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
Double_t ctime
Definition: hit_dirc.C:114
TPad * p2
Definition: hist-t7.C:117
TPad * p1
Definition: hist-t7.C:116
Double_t rtime
Definition: hit_dirc.C:113