Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:13:28

0001 void plotbg()
0002 {
0003 gStyle->SetOptStat(0);
0004 TH1F* hmass4 = new TH1F("hmass4","",60,5.,11.);
0005 TH1F* hmass23 = new TH1F("hmass23","",60,5.,11.);
0006 TH1F* hmass56 = new TH1F("hmass56","",60,5.,11.);
0007 
0008 float mass,type,pt,eta,rap,pt1,pt2,eta1,eta2,bimp;
0009 float chisq1,chisq2,dca2d1,dca2d2,e3x31,e3x32,p1,p2;
0010 float nmvtx1,nmvtx2,ntpc1,ntpc2;
0011 
0012 TChain* ntp1 =  new TChain("ntp1");
0013 ntp1->Add("test.root");
0014 
0015 cout << "number of entries = " << ntp1->GetEntries() << endl;
0016 
0017 ntp1->SetBranchAddress("type",&type);
0018 ntp1->SetBranchAddress("mass",&mass);
0019 ntp1->SetBranchAddress("pt",&pt);
0020 ntp1->SetBranchAddress("eta",&eta);
0021 ntp1->SetBranchAddress("rap",&rap);
0022 ntp1->SetBranchAddress("p1",&p1);
0023 ntp1->SetBranchAddress("p2",&p2);
0024 ntp1->SetBranchAddress("pt1",&pt1);
0025 ntp1->SetBranchAddress("pt2",&pt2);
0026 ntp1->SetBranchAddress("chisq1",&chisq1);
0027 ntp1->SetBranchAddress("dca2d1",&dca2d1);
0028 ntp1->SetBranchAddress("chisq2",&chisq2);
0029 ntp1->SetBranchAddress("dca2d2",&dca2d2);
0030 ntp1->SetBranchAddress("nmvtx1",&nmvtx1);
0031 ntp1->SetBranchAddress("nmvtx2",&nmvtx2);
0032 ntp1->SetBranchAddress("ntpc1",&ntpc1);
0033 ntp1->SetBranchAddress("ntpc2",&ntpc2);
0034 ntp1->SetBranchAddress("e3x31",&e3x31);
0035 ntp1->SetBranchAddress("e3x32",&e3x32);
0036 
0037 cout << "start loop..." << endl;
0038  for(int j=0; j<ntp1->GetEntries(); j++) {
0039    ntp1->GetEvent(j);
0040    if(p1==0. || p2==0.) continue;
0041    if(e3x31/p1<0.7 || e3x32/p2<0.7) continue;
0042    if(nmvtx1<2 || nmvtx2<2) continue;
0043    if(ntpc1<20 || ntpc2<20) continue;
0044    if(chisq1>10 || chisq2>10) continue;
0045    if(type==5 || type==6) { hmass56->Fill(mass); }
0046    if(type==2 || type==3) { hmass23->Fill(mass); }
0047    if(ntpc1<26 || ntpc2<26) continue;
0048    if(chisq1>3 || chisq2>3) continue;
0049    if(type==4) { hmass4->Fill(mass); }
0050  }
0051 
0052 //hmass56->Divide(hmass23);
0053 
0054 hmass4->Draw();
0055 
0056 }