Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plotbg.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plotbg.C
1 void plotbg()
2 {
3 gStyle->SetOptStat(0);
4 TH1F* hmass4 = new TH1F("hmass4","",60,5.,11.);
5 TH1F* hmass23 = new TH1F("hmass23","",60,5.,11.);
6 TH1F* hmass56 = new TH1F("hmass56","",60,5.,11.);
7 
8 float mass,type,pt,eta,rap,pt1,pt2,eta1,eta2,bimp;
9 float chisq1,chisq2,dca2d1,dca2d2,e3x31,e3x32,p1,p2;
10 float nmvtx1,nmvtx2,ntpc1,ntpc2;
11 
12 TChain* ntp1 = new TChain("ntp1");
13 ntp1->Add("test.root");
14 
15 cout << "number of entries = " << ntp1->GetEntries() << endl;
16 
17 ntp1->SetBranchAddress("type",&type);
18 ntp1->SetBranchAddress("mass",&mass);
19 ntp1->SetBranchAddress("pt",&pt);
20 ntp1->SetBranchAddress("eta",&eta);
21 ntp1->SetBranchAddress("rap",&rap);
22 ntp1->SetBranchAddress("p1",&p1);
23 ntp1->SetBranchAddress("p2",&p2);
24 ntp1->SetBranchAddress("pt1",&pt1);
25 ntp1->SetBranchAddress("pt2",&pt2);
26 ntp1->SetBranchAddress("chisq1",&chisq1);
27 ntp1->SetBranchAddress("dca2d1",&dca2d1);
28 ntp1->SetBranchAddress("chisq2",&chisq2);
29 ntp1->SetBranchAddress("dca2d2",&dca2d2);
30 ntp1->SetBranchAddress("nmvtx1",&nmvtx1);
31 ntp1->SetBranchAddress("nmvtx2",&nmvtx2);
32 ntp1->SetBranchAddress("ntpc1",&ntpc1);
33 ntp1->SetBranchAddress("ntpc2",&ntpc2);
34 ntp1->SetBranchAddress("e3x31",&e3x31);
35 ntp1->SetBranchAddress("e3x32",&e3x32);
36 
37 cout << "start loop..." << endl;
38  for(int j=0; j<ntp1->GetEntries(); j++) {
39  ntp1->GetEvent(j);
40  if(p1==0. || p2==0.) continue;
41  if(e3x31/p1<0.7 || e3x32/p2<0.7) continue;
42  if(nmvtx1<2 || nmvtx2<2) continue;
43  if(ntpc1<20 || ntpc2<20) continue;
44  if(chisq1>10 || chisq2>10) continue;
45  if(type==5 || type==6) { hmass56->Fill(mass); }
46  if(type==2 || type==3) { hmass23->Fill(mass); }
47  if(ntpc1<26 || ntpc2<26) continue;
48  if(chisq1>3 || chisq2>3) continue;
49  if(type==4) { hmass4->Fill(mass); }
50  }
51 
52 //hmass56->Divide(hmass23);
53 
54 hmass4->Draw();
55 
56 }