FairRoot/PandaRoot
tutorials/analysis/ana_dsdsj.C
Go to the documentation of this file.
1 class TCandidate;
2 
3 int printRecursive(TCandidate *tc, int level=0);
4 
5 void ana_dsdsj(TString fname="dsds_10k.evt.root",int nevts=0)
6 {
7  gROOT->Reset();
8  TStopwatch timer;
9  timer.Start();
10 
11  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");rootlogon();
12 
13  TCanvas *c1=new TCanvas("c1","c1",900,600);
14  c1->Divide(3,2);
15 
16  // **** create and setup some histos for QA plots
17  //
18  TH1F *phimass = new TH1F("phimass","phi cands",100,0.95,1.1);
19  TH1F *pi0mass = new TH1F("pi0mass","pi0 cands",100,0.135-0.03,0.135+0.03);
20  TH1F *dsmass = new TH1F("dsmass","Ds cands",100,1.968-0.1,1.968+0.1);
21  TH1F *ds0mass = new TH1F("ds0mass","Ds0 cands",100,2.317-0.1,2.317+0.1);
22  TH1F *ppmass = new TH1F("ppmass","pbarp cands",100,4.306-0.1,4.306+0.1);
23 
24  TH1F *nmult=new TH1F("nmult","# neutrals",15,0,15);
25 
26  phimass->SetMinimum(0);
27  pi0mass->SetMinimum(0);
28  dsmass->SetMinimum(0);
29  ds0mass->SetMinimum(0);
30  ppmass->SetMinimum(0);
31 
32  // **** PndEventReader provides access to the data
33  //
34  PndEventReader evr(fname);
35 
36  if (nevts==0) nevts=evr.GetEntries();
37 
38  // **** create all the particle lists we'll need for rebuilding the decay tree
39  //
40  TCandList kp, km, pip, pim, gam;
41  TCandList phi, pi0, dsp, dsm, ds0p, ds0m, pp;
42 
43  // **** mass selectors for the resonances/composites
44  //
45  TPidMassSelector *phiMSel = new TPidMassSelector("phiSelector" , 1.0195 , 0.02);
46  TPidMassSelector *pi0MSel = new TPidMassSelector("pi0Selector" , 0.135 , 0.02);
47  TPidMassSelector *dsMSel = new TPidMassSelector("dsSelector" , 1.9685 , 0.04);
48 
49 
50  // **** loop over all _events_
51  //
52 
53  int i=0,j=0;
54 
55  while (evr.GetEvent() && i++<nevts)
56  {
57  if (0==i%100) cout <<"evt "<<i<<endl;
58 
59  evr.FillList(kp,"KaonVeryLoosePlus");
60  evr.FillList(km,"KaonVeryLooseMinus");
61  evr.FillList(pip,"PionVeryLoosePlus");
62  evr.FillList(pim,"PionVeryLooseMinus");
63  evr.FillList(gam,"Neutral");
64 
65  nmult->Fill(gam.GetLength());
66 
67  // **** now start combining all composits; inbetween plot masses
68  // before using the mass selectors
69  //
70 
71  // phi -> K+ K-
72  phi.Combine(kp, km);
73  for (j=0;j<phi.GetLength();++j) phimass->Fill(phi[j].M());
74  phi.Select(phiMSel);
75 
76  // Ds+ -> phi pi+, Ds- -> phi pi-
77  dsp.Combine(phi, pip);
78  dsm.Combine(phi, pim);
79  for (j=0;j<dsm.GetLength();++j) dsmass->Fill(dsm[j].M());
80  for (j=0;j<dsp.GetLength();++j) dsmass->Fill(dsp[j].M());
81  dsm.Select(dsMSel);
82  dsp.Select(dsMSel);
83 
84  // pi0 -> gamma gamma
85  pi0.Combine(gam,gam);
86  for (j=0;j<pi0.GetLength();++j) pi0mass->Fill(pi0[j].M());
87  pi0.Select(pi0MSel);
88 
89  // Ds0*+ -> Ds+ pi0, Ds0*- -> Ds- pi0
90  ds0p.Combine(dsp, pi0);
91  ds0m.Combine(dsm, pi0);
92  for (j=0;j<ds0p.GetLength();++j) ds0mass->Fill(ds0p[j].M());
93  for (j=0;j<ds0m.GetLength();++j) ds0mass->Fill(ds0m[j].M());
94 
95  // ppbar -> Ds+ Ds0*-
96  pp.Combine(dsp, ds0m);
97  // don't need Ds- Ds0*+; w/0 fitting would be double counting
98 
99  for (j=0;j<pp.GetLength();++j) ppmass->Fill(pp[j].M());
100 
101  }
102 
103  // **** plot all that stuff
104  //
105  c1->cd(1); phimass->Draw();
106  c1->cd(2); pi0mass->Draw();
107  c1->cd(3); dsmass->Draw();
108  c1->cd(4); ds0mass->Draw();
109  c1->cd(5); ppmass->Draw();
110  c1->cd(6); nmult->Draw();
111 
112  timer.Stop();
113  Double_t rtime = timer.RealTime();
114  Double_t ctime = timer.CpuTime();
115  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
116 }
117 
118 int printRecursive(TCandidate *tc, int level)
119 {
120 
121  int i=0;
122  int nd=tc->NDaughters();
123  if (nd==0) return;
124  cout <<tc->Uid()<<"("<<level<<") -> ";
125  for (i=0;i<nd;i++) cout<<tc->Daughter(i)->Uid()<<" ";
126  cout <<endl;
127  for (i=0;i<nd;i++) printRecursive(tc->Daughter(i),level+1);
128  if (level==0) cout <<endl;
129  return 0;
130 }
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
int printRecursive(TCandidate *tc, int level=0)
c1
Definition: plot_dirc.C:35
CandList gam
Double_t ctime
Definition: hit_dirc.C:114
Double_t rtime
Definition: hit_dirc.C:113
int ana_dsdsj(TString fname="dsds_10k.evt.root", int num=0)