#include "TString.h" #include "TFile.h" #include "TNtuple.h" #include "TH2.h" using namespace std; void AnaTrkCutsAndSecondaries(TString path="/panda/pandaroot/macro/lmd/secondaries/beampipe_201303/BOX/"){ gStyle->SetOptStat("e"); TString finname = path+"/Lumi_Track_0_1_5GeV_Large_2_11mrad_secondariesFullLMD.root"; TFile * fin = new TFile(finname,"READ"); fin->ls(); TNtuple *ntgthetatgphiFit = (TNtuple*)fin->Get("htthetatphiTrkFit"); Long64_t nAll = ntgthetatgphiFit->GetEntries();//trk Long64_t nLeftTFitCut = ntgthetatgphiFit ->GetEntries("abs(tg_theta-0.0400)<=11 && abs(tg_phi)<=0.250"); fin->Close(); TString fin2name = path+"/Lumi_TCand_0_1_5GeV_Large_2_11mrad_secondariesFullLMD.root"; TFile * fin2 = new TFile(fin2name,"READ"); TNtuple *ntgthetatgphi2 = (TNtuple*)fin2->Get("htthetatphiTrk"); TNtuple *ntgthetatgphiC = (TNtuple*)fin2->Get("htthetatphiCells"); Long64_t nAll2 = ntgthetatgphi2->GetEntries();//trk-cand Long64_t nLeftTCandCut = ntgthetatgphi2 ->GetEntries("abs(tg_theta-0.0400)<=11 && abs(tg_phi)<=0.250"); Long64_t nAllC = ntgthetatgphiC->GetEntries(); Long64_t nLeftTCandCellsCut = ntgthetatgphiC ->GetEntries("abs(tg_theta-0.0400)<=11 && abs(tg_phi)<=0.250"); fin2->Close(); cout<<" --------- Summary ----------- "<Get("tRECMC"); Long64_t numSim = trecmcinfo->GetEntries(); Long64_t numSecondaries = trecmcinfo->GetEntries("trkstMC>0 && trkstREC<0 && abs(trkstMC)<1000"); Long64_t numRec = trecmcinfo->GetEntries("trkstREC>=0 && abs(trkstMC)<1000"); Long64_t numRecAfterCut = trecmcinfo->GetEntries("trkstREC>=0 && abs(trkstMC)<1000 && abs(thetarecLMD-0.040)<11 && abs(phirecLMD)<0.25"); Long64_t numRecGood = trecmcinfo->GetEntries("trkstREC==0 && trkstMC==0"); Long64_t numRecGoodAfterCut = trecmcinfo->GetEntries("trkstREC==0 && trkstMC==0 && abs(thetarecLMD-0.040)<11 && abs(phirecLMD)<0.25"); Long64_t numNotBP = trecmcinfo->GetEntries("trkstREC==-10"); Long64_t numSecondariesRec = trecmcinfo->GetEntries("trkstMC>0 && trkstREC>=0"); Long64_t numSecondariesRecAfterCut = trecmcinfo->GetEntries("trkstMC>0 && trkstREC>=0 && abs(thetarecLMD-0.040)< 11 && abs(phirecLMD)<0.25"); TH1D *hthetacut = new TH1D("hthetacut",";#theta_{REC}, mrad",1e2,0,1e2); trecmcinfo->Project("hthetacut","1e3*thetarec","trkstMC==0 && trkstREC>=0 && (abs(thetarecLMD-0.040)> 11 || abs(phirecLMD)>0.25)"); TCanvas c1; hthetacut->Draw(); TString outfile = path+"theta_good_trk_cut_1_5GeV.root"; c1.SaveAs(outfile); Long64_t numScattPrim = trecmcinfo->GetEntries("trkstMC==0 && zmc!=0"); Long64_t numScattPrimRec = trecmcinfo->GetEntries("trkstMC==0 && zmc!=0 && (trkstREC>-1 || trkstREC==-10)"); fin3->Close(); cout<<" numSim = "<