// macro for analys bkg particles PDG id and drawing results // in cool histogram // author: a.karavdina // date: 07 January 2014 #include "TString.h" #include "TFile.h" #include "TTree.h" #include "TBranch.h" #include "TChain.h" #include "TClonesArray.h" #include "/panda/pandaroot/lmd/LmdQA/PndLmdTrackQ.h" #include "TPie.h" #include "TLegend.h" #include "TH1.h" #include using namespace std; void MCvarBKG(TString path="/panda/myResults/DPMoutputDec2013/FTF/NoDipole/mom_15/"){ // // color table: barp = 2, pi- = 8, e- = 4, e+ = 43, pi+ = 7, K- = 11, mu- = 3, p = 6, mu+ = 38, K+ = 9 /// read for phi,theta,mom ----------------------------------------------------------------------------------- TString filename1 = path+"/TOT_Lumi_BkgSig_el_inel.root"; TFile *fin1 = new TFile(filename1,"READ"); TTree *tbkg1 = (TTree *)fin1->Get("tBkg"); //Bkg data // TTree *tsig = (TTree *)fin1->Get("tBkg"); //Bkg data /// end read for phi,theta,mom ----------------------------------------------------------------------------------- // // /// fill & draw hists with theta -------------------------------------------------------------------------------------------- // TH1 *hthmc_pimn = new TH1D("hthmc_pimn",";#theta_{MC}, mrad ;N",2e3,0,1000); //15 GeV/c // TH1 *hthmc_antip = new TH1D("hthmc_antip",";#theta_{MC}, mrad ;N",2e3,0,1000); //15 GeV/c // TH1 *hthmc_pipl = new TH1D("hthmc_pipl",";#theta_{MC}, mrad ;N",2e3,0,1000); //15 GeV/c // tbkg1->Project("hthmc_pimn","thmc","id==-211 && issecond<0"); // tbkg1->Project("hthmc_antip","thmc","id==-2212 && issecond<0"); // tbkg1->Project("hthmc_pipl","thmc","id==211 && issecond<0"); // // tbkg1->Project("hthmc_pimn","thmc","id==-211 && issecond<0 && abs(15.0-prec)/15.0<5e-4"); // // tbkg1->Project("hthmc_antip","thmc","id==-2212 && issecond<0 && abs(15.0-prec)/15.0<5e-4"); // hthmc_antip->SetFillColor(2); // hthmc_antip->SetLineColor(2); // hthmc_antip->SetLineWidth(2); // hthmc_antip->SetFillStyle(3003); // hthmc_pimn->SetFillColor(8); // hthmc_pimn->SetLineColor(32); // hthmc_pimn->SetLineWidth(2); // hthmc_pimn->SetFillStyle(3351); // hthmc_pipl->SetFillColor(7); // hthmc_pipl->SetLineColor(38); // hthmc_pipl->SetFillStyle(3315); // hthmc_pimn->Draw(); // hthmc_antip->Draw("same"); // hthmc_pipl->Draw("same"); // TLegend *leg = new TLegend(0.8,0.65,0.95,0.95); // leg->SetTextSize(0.08); // leg->SetFillColor(0); // leg->AddEntry("hthmc_pimn"," #pi^{-}","f"); // leg->AddEntry("hthmc_antip"," #bar{p}","f"); // leg->AddEntry("hthmc_pipl","#pi^{+}","f"); // leg->Draw(); // // hthmc_pipl->Draw("same"); // // /// end fill & draw hists with theta -------------------------------------------------------------------------------------------- // // // /// fill & draw hists with phi -------------------------------------------------------------------------------------------- // TH1 *hphmc_pimn = new TH1D("hphmc_pimn",";#phi_{MC}, rad ;N",2e2,-3.15,3.15); //15 GeV/c // TH1 *hphmc_antip = new TH1D("hphmc_antip",";#phi_{MC}, rad ;N",2e2,-3.15,3.15); //15 GeV/c // // TH1 *hphmc_pipl = new TH1D("hphmc_pipl",";#phi_{MC}, rad ;N",2e2,-3.15,3.15); //15 GeV/c // // tbkg1->Project("hphmc_pimn","phmc","id==-211 && issecond<0"); // // tbkg1->Project("hphmc_antip","phmc","id==-2212 && issecond<0"); // tbkg1->Project("hphmc_pimn","phmc","id==-211 && issecond<0 && abs(15.0-prec)/15.0<5e-4"); // tbkg1->Project("hphmc_antip","phmc","id==-2212 && issecond<0 && abs(15.0-prec)/15.0<5e-4"); // hphmc_antip->SetFillColor(2); // hphmc_antip->SetLineColor(2); // hphmc_antip->SetLineWidth(2); // hphmc_antip->SetFillStyle(3003); // hphmc_pimn->SetFillColor(8); // hphmc_pimn->SetLineColor(32); // hphmc_pimn->SetFillStyle(3351); // hphmc_pimn->SetLineWidth(2); // // hphmc_pipl->SetFillColor(7); // // hphmc_pipl->SetLineColor(38); // // hphmc_pipl->SetFillStyle(3315); // hphmc_antip->Draw(); // hphmc_pimn->Draw("same"); // // hphmc_pipl->Draw("same"); // //TLegend *leg = new TLegend(0.85,0.65,0.95,0.95); // TLegend *leg = new TLegend(0.8,0.65,0.95,0.95); // leg->SetTextSize(0.08); // leg->SetFillColor(0); // leg->AddEntry("hphmc_pimn"," #pi^{-}","f"); // leg->AddEntry("hphmc_antip"," #bar{p}","f"); // // leg->AddEntry("hphmc_pipl"," #pi^{+}","f"); // leg->Draw(); // // // /// end fill & draw hists with phi -------------------------------------------------------------------------------------------- // /// fill & draw hists with mom -------------------------------------------------------------------------------------------- // TH1 *hpmc_pimn = new TH1D("hpmc_pimn",";P_{MC}, GeV/c ;N",2e2,0,16); //15 GeV/c // TH1 *hpmc_antip = new TH1D("hpmc_antip",";P_{MC}, GeV/c ;N",2e2,0,16); //15 GeV/c // TH1 *hpmc_pipl = new TH1D("hpmc_pipl",";P_{MC}, GeV/c ;N",2e2,0,16); //15 GeV/c // // TH1 *hpmc_pimn = new TH1D("hpmc_pimn",";P_{MC}, GeV/c ;N",2e2,0,2.5); //1.5 GeV/c // // TH1 *hpmc_antip = new TH1D("hpmc_antip",";P_{MC}, GeV/c ;N",2e2,0,2.5); //1.5 GeV/c // tbkg1->Project("hpmc_pimn","pmc","id==-211 && issecond<0"); // tbkg1->Project("hpmc_pipl","pmc","id==211 && issecond<0"); // tbkg1->Project("hpmc_antip","pmc","id==-2212 && issecond<0"); // // tbkg1->Project("hpmc_pimn","pmc","id==-211 && issecond<0 && abs(15.0-prec)/15.0<5e-4"); // // tbkg1->Project("hpmc_antip","pmc","id==-2212 && issecond<0 && abs(15.0-prec)/15.0<5e-4"); // hpmc_antip->SetFillColor(2); // hpmc_antip->SetLineColor(2); // hpmc_antip->SetLineWidth(2); // hpmc_antip->SetFillStyle(3003); // hpmc_pimn->SetFillColor(8); // hpmc_pimn->SetLineColor(32); // hpmc_pimn->SetLineWidth(2); // hpmc_pimn->SetFillStyle(3351); // hpmc_pipl->SetFillColor(7); // hpmc_pipl->SetLineColor(38); // hpmc_pipl->SetFillStyle(3315); // hpmc_pimn->Draw(); // hpmc_antip->Draw("same"); // hpmc_pipl->Draw("same"); // // hpmc_pipl->Draw("same"); // TLegend *leg = new TLegend(0.8,0.65,0.95,0.95); // leg->SetTextSize(0.08); // leg->SetFillColor(0); // leg->AddEntry("hpmc_pimn"," #pi^{-}","f"); // leg->AddEntry("hpmc_antip"," #bar{p}","f"); // leg->AddEntry("hpmc_pipl","#pi^{+}","f"); // leg->Draw(); // /// end fill & draw hists with mom -------------------------------------------------------------------------------------------- // /// fill & draw hists with time of flight -------------------------------------------------------------------------------------------- TH1 *htmc_pimn = new TH1I("htmc_pimn",";ToF, ns ;N",90,0,90); //1.5 GeV/c TH1 *htmc_pipl = new TH1I("htmc_pipl",";ToF, ns ;N",90,0,90); //1.5 GeV/c TH1 *htmc_antip = new TH1I("htmc_antip",";ToF, ns ;N",90,0,90); //1.5 GeV/c tbkg1->Project("htmc_pimn","trktime","id==-211 && issecond<0"); tbkg1->Project("htmc_pipl","trktime","id==211 && issecond<0"); tbkg1->Project("htmc_antip","trktime","id==-2212 && issecond<0"); htmc_antip->SetFillColor(2); htmc_antip->SetLineColor(2); htmc_antip->SetLineWidth(2); htmc_antip->SetFillStyle(3003); htmc_pimn->SetFillColor(8); htmc_pimn->SetLineColor(32); htmc_pimn->SetLineWidth(2); htmc_pimn->SetFillStyle(3351); htmc_pipl->SetFillColor(7); htmc_pipl->SetLineColor(38); htmc_pipl->SetFillStyle(3315); htmc_pimn->Draw(); htmc_antip->Draw("same"); htmc_pipl->Draw("same"); TLegend *leg = new TLegend(0.8,0.65,0.95,0.95); leg->SetTextSize(0.08); leg->SetFillColor(0); leg->AddEntry("htmc_pimn"," #pi^{-}","f"); leg->AddEntry("htmc_antip"," #bar{p}","f"); leg->AddEntry("htmc_pipl"," #pi^{+}","f"); leg->Draw(); // /// end fill & draw hists with with time of flight -------------------------------------------------------------------------------------------- // /// read, fill & draw hists with multiplisities -------------------------------------------------------------------------------------------- // TString filename1 = path+"/TOT_Lumi_TrksQA_el_inel.root"; // TFile *fin1 = new TFile(filename1,"READ"); // TTree *tbkg1 = (TTree *)fin1->Get("cbmsim"); //Bkg data // TH1 *hmultmc_pimn = new TH1I("hmultmc_pimn",";N_{trks} ;N_{events}",20,0,20); //15 GeV/c // TH1 *hmultmc_pipl = new TH1I("hmultmc_pipl",";N_{trks} ;N_{events}",20,0,20); //15 GeV/c // TH1 *hmultmc_antip = new TH1I("hmultmc_antip",";N_{trks} ;N_{events}",20,0,20); //15 GeV/c // tbkg1->Project("hmultmc_pimn","LMDTrackQ.fnumEvparticles","LMDTrackQ.fSecondary<0 && LMDTrackQ.fTrkRecStatus==0 && LMDTrackQ.fsumID!=4424 && LMDTrackQ.fPDGcode==-211"); // tbkg1->Project("hmultmc_pipl","LMDTrackQ.fnumEvparticles","LMDTrackQ.fSecondary<0 && LMDTrackQ.fTrkRecStatus==0 && LMDTrackQ.fsumID!=4424 && LMDTrackQ.fPDGcode==211"); // tbkg1->Project("hmultmc_antip","LMDTrackQ.fnumEvparticles","LMDTrackQ.fSecondary<0 && LMDTrackQ.fTrkRecStatus==0 && LMDTrackQ.fsumID!=4424 && LMDTrackQ.fPDGcode==-2212"); // hmultmc_antip->SetFillColor(2); // hmultmc_antip->SetLineColor(2); // hmultmc_antip->SetFillStyle(3003); // hmultmc_pimn->SetFillColor(8); // hmultmc_pimn->SetLineColor(32); // hmultmc_pimn->SetFillStyle(3351); // hmultmc_pipl->SetFillColor(7); // hmultmc_pipl->SetLineColor(38); // hmultmc_pipl->SetFillStyle(3315); // hmultmc_antip->Draw(); // hmultmc_pimn->Draw("same"); // hmultmc_pipl->Draw("same"); // TLegend *leg = new TLegend(0.85,0.65,0.95,0.95); // leg->SetTextSize(0.08); // leg->SetFillColor(0); // leg->AddEntry("hmultmc_antip","#bar{p}","f"); // leg->AddEntry("hmultmc_pimn","#pi^{-}","f"); // leg->AddEntry("hmultmc_pipl","#pi^{+}","f"); // leg->Draw(); // /// end read, fill & draw hists with multiplisities -------------------------------------------------------------------------------------------- // /// read, fill & draw hists with mc true for channel 4535 -------------------------------------------------------------------------------------------- // TString filename1 = path+"/TOT_Lumi_TrksQA_el_inel.root"; // TFile *fin1 = new TFile(filename1,"READ"); // TTree *tbkg1 = (TTree *)fin1->Get("cbmsim"); //Bkg data // TH1 *hphmc_antip = new TH1I("hphmc_antip",";#phi_{MC}, rad ;N",2e2,-3.15,3.15); //15 GeV/c // TH1 *hphmc_antip_rec = new TH1I("hphmc_antip_rec",";#phi_{MC}, rad ;N",2e2,-3.15,3.15); //15 GeV/c // tbkg1->Project("hphmc_antip","LMDTrackQ.fPhimc","LMDTrackQ.fsumID==4535 && LMDTrackQ.fPDGcode==-2212","",5000000); // tbkg1->Project("hphmc_antip_rec","LMDTrackQ.fPhimc","LMDTrackQ.fsumID==4535 && LMDTrackQ.fPDGcode==-2212 && LMDTrackQ.fTrkRecStatus==0"); // hphmc_antip->SetFillColor(2); // hphmc_antip->SetLineColor(2); // hphmc_antip->SetFillStyle(3003); // // hphmc_antip->Scale(); // hphmc_antip->Draw(); // hphmc_antip_rec->SetFillColor(2); // hphmc_antip_rec->SetLineColor(2); // // hphmc_antip_rec->SetFillStyle(3003); // // hphmc_antip_rec->Scale(10.); // hphmc_antip_rec->Draw("same"); // // hphmc_antip_rec->Draw(); // TLegend *leg = new TLegend(0.85,0.65,0.95,0.95); // leg->SetTextSize(0.08); // leg->SetFillColor(0); // leg->AddEntry("hphmc_antip","#bar{p}, sumID = 4535, ALL","f"); // leg->AddEntry("hphmc_antip_rec","#bar{p}, sumID = 4535, REC","f"); // // leg->AddEntry("hmultmc_pimn","#pi^{-}","f"); // // leg->AddEntry("hmultmc_pipl","#pi^{+}","f"); // leg->Draw(); // /// end read, fill & draw hists with multiplisities -------------------------------------------------------------------------------------------- }