void Compare_DPM_FTF_MC(){ gStyle->SetOptStat(0); gStyle->SetLabelSize(0.045,"xyz"); gStyle->SetTitleYSize(0.04); gStyle->SetTitleXSize(0.04); TString resname= "DPM_vs_FTF"; TString resname_pdf = resname+".pdf"; TString resname_pdf_o = resname_pdf+"("; TString resname_pdf_c = resname_pdf+")"; Long64_t nentries = 2e7; //Long64_t nentries = 2e3; // virtual Long64_t Project(const char* hname, const char* varexp, const char* selection = "", Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0) double th_lim=150; TString cond = "Particles.Theta()<0.150 && Npart>0"; // double th_lim=TMath::Pi(); // TString cond = "Particles.Theta()<2*TMath::Pi()"; TFile * finDPM = new TFile("DPM_inel_15GeV.root","READ"); TTree *treeDPM = (TTree *)finDPM->Get("data"); TH1 *nmultDPM = new TH1I("nmultDPM",";trks/ev",20,0,20); treeDPM->Project("nmultDPM","Npart","","",nentries); TH1 *thMCdpm = new TH1D("thMCdpm",";#theta_{MC}, rad",3e3,0,th_lim); int nDPM = treeDPM->Project("thMCdpm","1e3*Particles.Theta()",cond.Data(),"",nentries); cout<<"nDPM = "<Project("phMCdpm","Particles.Phi()",cond.Data(),"",nentries); TH1 *momMCdpm = new TH1D("momMCdpm","; Pz_{MC}, GeV/c",3e3,0,20); int ndpm = treeDPM->Project("momMCdpm","Particles.fPz",cond.Data(),"",nentries);// mom in GeV TFile * finFTF = new TFile("FTF_inel_15GeV_2.root","READ"); TTree *treeFTF = (TTree *)finFTF->Get("data"); TH1 *nmultFTF = new TH1I("nmultFTF",";trks/ev",20,0,20); treeFTF->Project("nmultFTF","Npart","","",nentries); TH1 *thMCftf = new TH1D("thMCftf",";#theta_{MC}, rad",3e3,0,th_lim); int nFTF = treeFTF->Project("thMCftf","1e3*Particles.Theta()",cond.Data(),"",nentries); cout<<"nFTF = "<Project("phMCftf","Particles.Phi()",cond.Data(),"",nentries); TH1 *momMCftf = new TH1D("momMCftf","; Pz_{MC}, GeV/c",3e3,0,20); treeFTF->Project("momMCftf","Particles.fPz",cond.Data(),"",nentries);// mom in MeV source of long time??? // TFile * finFTF = new TFile("FTF_inel_15GeV.root","READ"); // TTree *treeFTF = (TTree *)finFTF->Get("data"); TLegend *leg = new TLegend(0.81,0.85,0.93,0.95); leg->SetFillColor(0); leg->SetName("leg"); TCanvas c1; //c1.SetLogy(); nmultDPM->SetLineColor(1); nmultDPM->SetLineWidth(2.5); nmultFTF->SetLineColor(2); nmultFTF->SetLineWidth(2.5); nmultFTF->Draw(); nmultDPM->Draw("same"); leg->AddEntry(nmultFTF,"FTF","l"); leg->AddEntry(nmultDPM,"DPM","l"); leg->Draw(); c1.Print(resname_pdf_o); c1.Clear(); TH1D *nmultnorm = (TH1D*)nmultDPM->Clone("nmultnorm"); TH1D *nmultnue = (TH1D*)nmultFTF->Clone("nmultnue"); nmultnue->Add(nmultnorm,-1); nmultnue->Divide(nmultnue,nmultnorm,100,1); nmultnue->GetYaxis()->SetTitle("(FTF-DPM)/DPM, %"); // nmultnue->SetMaximum(50.); // nmultnue->SetMinimum(-50.); nmultnue->Draw(); c1.Print(resname_pdf_o); c1.Clear(); thMCdpm->SetLineColor(1); thMCdpm->SetLineWidth(2.5); thMCftf->SetLineColor(2); thMCftf->SetLineWidth(2.5); thMCdpm->SetMinimum(0); // thMCftf->SetMaximum(2e4); thMCdpm->Draw(); thMCftf->Draw("same"); leg->Draw(); c1.Print(resname_pdf_o); c1.Clear(); TH1D *thMCnorm = (TH1D*)thMCdpm->Clone("thMCnorm"); TH1D *thMCnue = (TH1D*)thMCftf->Clone("thMCnue"); thMCnue->Add(thMCnorm,-1); thMCnue->Divide(thMCnue,thMCnorm,100,1); thMCnue->GetYaxis()->SetTitle("(FTF-DPM)/DPM, %"); thMCnue->Draw(); // thMCnue->SetMinimum(-50); // thMCnue->SetMaximum(50); c1.Print(resname_pdf_o); c1.Clear(); phMCdpm->SetLineColor(1); phMCdpm->SetLineWidth(2.5); phMCftf->SetLineColor(2); phMCftf->SetLineWidth(2.5); phMCdpm->SetMinimum(0); phMCdpm->Draw(); phMCftf->Draw("same"); leg->Draw(); c1.Print(resname_pdf_o); c1.Clear(); TH1D *phMCnorm = (TH1D*)phMCdpm->Clone("phMCnorm"); TH1D *phMCnue = (TH1D*)phMCftf->Clone("phMCnue"); phMCnue->Add(phMCnorm,-1); phMCnue->Divide(phMCnue,phMCnorm,100,1); phMCnue->GetYaxis()->SetTitle("(FTF-DPM)/DPM, %"); phMCnue->Draw(); phMCnue->SetMinimum(-10); phMCnue->SetMaximum(10); c1.Print(resname_pdf_o); c1.Clear(); momMCdpm->SetLineColor(1); momMCdpm->SetLineWidth(2.5); momMCftf->SetLineColor(2); momMCftf->SetLineWidth(2.5); momMCdpm->SetMinimum(0); momMCdpm->Draw(); momMCftf->Draw("same"); leg->Draw(); c1.Print(resname_pdf_o); c1.Clear(); TH1D *momMCnorm = (TH1D*)momMCdpm->Clone("momMCnorm"); TH1D *momMCnue = (TH1D*)momMCftf->Clone("momMCnue"); momMCnue->Add(momMCnorm,-1); momMCnue->Divide(momMCnue,momMCnorm,100,1); momMCnue->GetYaxis()->SetTitle("(FTF-DPM)/DPM, %"); momMCnue->Draw(); momMCnue->SetMinimum(-100); momMCnue->SetMaximum(500); c1.Print(resname_pdf_c); TString out = resname+".root"; TFile *f = new TFile(out,"RECREATE"); momMCnue->Write(); momMCdpm->Write(); momMCftf->Write(); phMCnue->Write(); phMCdpm->Write(); phMCftf->Write(); thMCnue->Write(); thMCdpm->Write(); thMCftf->Write(); nmultnue->Write(); nmultDPM->Write(); nmultFTF->Write(); leg->Write(); f->Write(); f->Close(); }