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