void compare() { gROOT->ProcessLine(".L lhcbStyle.C"); TCanvas *c1= new TCanvas("c1", "c1", 800,600); TChain *ch_S21= new TChain(); TChain *ch_S21_unique= new TChain(); TChain *ch_S20_unique= new TChain(); ch_S21->Add("/storage4/ntuples/lhcb/KstarMuMu/data_reduced/Run1/Kstarmumu_Data_Run1.root/Reduced"); ch_S21_unique->Add("NEW.root/NEW"); ch_S20_unique->Add("OLD.root/OLD"); TString cutnew= "B0_M>5370 && B0_M<5700 && Kstar_M>795.9 && Kstar_M < 995.9 && K_TRACK_GhostProb<0.4 && Pi_TRACK_GhostProb<0.4 && mu_plus_TRACK_GhostProb<0.4 && mu_minus_TRACK_GhostProb<0.4 && (!((B0_ID>0)&&(B0_swapMass>3626)&&(B0_swapMass<3746)&&(Pi_PIDmu>5||Pi_isMuon==1))&&!((B0_ID<0)&&(B0_swapMass>3626)&&(B0_swapMass<3746)&&(Pi_PIDmu>5||Pi_isMuon==1))&&!((B0_ID>0)&&(B0_kmuswapMass>3626)&&(B0_kmuswapMass<3746)&&(K_PIDmu>5||K_isMuon==1)))" ; TString fiducial_new="q2>0.1 && q2<19. && !( J_psi_M>3626 && J_psi_M <3746.) && !( J_psi_M>3037 && J_psi_M <3157. )"; TString cut = cutnew + "&&"+fiducial_new; vector<TString> variables={"B0_M", "Kstar_M", "J_psi_M", "B0_DiraAngle", "B0_ENDVERTEX_CHI2", "B0_IP_OWNPV", "B0_IPCHI2_OWNPV", "B0_P", "B0_PT", "K_IPCHI2_OWNPV", "K_P", "K_PT", "K_PIDmu", "K_PIDK", "K_PIDp", "Pi_IPCHI2_OWNPV", "Pi_P", "Pi_PT", "Pi_PIDmu", "Pi_PIDK", "Pi_PIDp", "mu_plus_IPCHI2_OWNPV", "mu_plus_P", "mu_plus_PT", "mu_plus_PIDmu", "mu_plus_PIDK", "mu_plus_PIDp", "mu_minus_IPCHI2_OWNPV", "mu_minus_P", "mu_minus_PT", "mu_minus_PIDmu", "mu_minus_PIDK", "mu_minus_PIDp" }; vector<TString> range={ "(100,5060,6000)", "(100,795.9, 995.9)","(100,100,4000)", "(100,0,0.014)", "(100,0,30)", "(100,0,0.12)", "(100,0., 16.)", "(100,10000, 300000)", "(100,100, 30000)", "(100,0,200)", "(100,1000, 150000)", "(100,100, 5000)", "(100,-15,15)", "(100,-5,80)", "(100,-40,50)", "(100,0,200)", "(100,1000, 150000)", "(100,100, 5000)", "(100,-15,15)", "(100,-80,20)", "(100,-80,20)", "(100,0,200)", "(100,1000, 150000)", "(100,100, 5000)", "(100,-3,15)", "(100,-80,15)", "(100,-100,20)", "(100,0,200)","(100,1000, 150000)", "(100,100, 5000)", "(100,-3,15)", "(100,-80,15)", "(100,-100,20)"}; if(variables.size() != range.size()) { cout<<"Wrong number of arguments!"<< variables.size()<<" "<< range.size()<<endl; } for(int i=0;i< variables.size(); i++) { ch_S21->Draw(variables[i]+">>"+variables[i]+range[i], cut); ch_S21_unique->Draw(variables[i]+">>"+variables[i]+"1"+range[i]); ch_S20_unique->Draw(variables[i]+">>"+variables[i]+"2"+range[i]); TH1D* hist= (TH1D*)gROOT->FindObject(variables[i]); TH1D* hist1= (TH1D*)gROOT->FindObject(variables[i] +"1"); TH1D* hist2= (TH1D*)gROOT->FindObject(variables[i]+"2"); hist->SetFillColor(0); hist1->SetFillColor(0); hist2->SetFillColor(0); hist->SetLineColor(kRed); hist1->SetLineColor(kBlue+2); hist2->SetLineColor(kGreen+2); hist->GetXaxis()->SetTitle(variables[i]); hist1->GetXaxis()->SetTitle(variables[i]); hist2->GetXaxis()->SetTitle(variables[i]); hist->SetMaximum(hist->GetMaximum()*1.5); hist1->SetMaximum(hist1->GetMaximum()*1.5); hist2->SetMaximum(hist2->GetMaximum()*1.5); hist->DrawNormalized(); hist1->DrawNormalized("SAME"); hist2->DrawNormalized("SAME"); //if(i==0) // { TLegend *leg= new TLegend(0.6, 0.8, 0.9, 0.9); leg->AddEntry(hist, "S21", "f"); leg->AddEntry(hist1, "Unique in S21" ,"f"); leg->AddEntry(hist2, "Unique in S20" ,"f"); leg->Draw(); // } c1->SaveAs(variables[i]+".pdf"); } }