Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:46

0001 void Plot_mass() {
0002 
0003   gStyle->SetOptStat ("111111");
0004   gStyle->SetOptFit (1);
0005   
0006   TFile * A = new TFile ("./1_testYJM_SM_f4r4.root");
0007   A->cd();
0008   TH1F * Mu = dynamic_cast<TH1F*> (A->Get("hRecBestZ_Mass_fine")); 
0009   TH1F * MuZ = dynamic_cast<TH1F*> (A->Get("hRecBestZ_Mass")); 
0010   TH1F * Mup = dynamic_cast<TH1F*> (A->Get("Mass_fine_P"));
0011   TH1F * MuZp = dynamic_cast<TH1F*> (A->Get("Mass_P"));
0012   TProfile * UL_pt = dynamic_cast<TProfile*> (A->Get("hLikeVSMu_LikelihoodVSPt_prof"));
0013   TProfile * UL_phi = dynamic_cast<TProfile*> (A->Get("hLikeVSMu_LikelihoodVSPhi_prof"));
0014   TProfile * UL_eta = dynamic_cast<TProfile*> (A->Get("hLikeVSMu_LikelihoodVSEta_prof"));
0015   TProfile * UR_pt = dynamic_cast<TProfile*> (A->Get("hResVSMu_ResolutionVSPt_prof"));
0016   TProfile * UR_phi = dynamic_cast<TProfile*> (A->Get("hResVSMu_ResolutionVSPhi_prof"));
0017   TProfile * UR_eta = dynamic_cast<TProfile*> (A->Get("hResVSMu_ResolutionVSEta_prof"));
0018 
0019   TFile * B = new TFile ("./4_testYJM_SM_f4r4.root");
0020   B->cd();
0021   TH1F * Mc = dynamic_cast<TH1F*> (B->Get("hRecBestZ_Mass_fine")); 
0022   TH1F * McZ = dynamic_cast<TH1F*> (B->Get("hRecBestZ_Mass")); 
0023   TH1F * Mcp = dynamic_cast<TH1F*> (B->Get("Mass_fine_P"));
0024   TH1F * McZp = dynamic_cast<TH1F*> (B->Get("Mass_P"));
0025   TProfile * CL_pt = dynamic_cast<TProfile*> (B->Get("hLikeVSMu_LikelihoodVSPt_prof"));
0026   TProfile * CL_phi = dynamic_cast<TProfile*> (B->Get("hLikeVSMu_LikelihoodVSPhi_prof"));
0027   TProfile * CL_eta = dynamic_cast<TProfile*> (B->Get("hLikeVSMu_LikelihoodVSEta_prof"));
0028   TProfile * CR_pt = dynamic_cast<TProfile*> (B->Get("hResVSMu_ResolutionVSPt_prof"));
0029   TProfile * CR_phi = dynamic_cast<TProfile*> (B->Get("hResVSMu_ResolutionVSPhi_prof"));
0030   TProfile * CR_eta = dynamic_cast<TProfile*> (B->Get("hResVSMu_ResolutionVSEta_prof"));
0031 
0032   double ResHalfWidth[6] = {20., 0.5, 0.5, 0.5, 0.2, 0.2};
0033   double ResMass[6] = {90.986, 10.3552, 10.0233, 9.4603, 3.68609, 3.0969};
0034 
0035   TCanvas * Allres = new TCanvas ("Allres", "All resonances", 600, 600);
0036   Allres->Divide (2,3);
0037   
0038   for (int ires=0; ires<6; ires++) {
0039     Allres->cd(ires+1);
0040     if (ires==0) {
0041       McZ->SetAxisRange(ResMass[ires]-ResHalfWidth[ires], ResMass[ires]+ResHalfWidth[ires]);
0042       McZ->SetLineColor(kRed);
0043       McZp->SetNormFactor(Mc->Integral());
0044       McZp->SetAxisRange(ResMass[ires]-ResHalfWidth[ires], ResMass[ires]+ResHalfWidth[ires]);
0045       McZp->SetLineColor(kBlue);
0046       McZ->SetMarkerColor(kRed);
0047       McZ->DrawCopy("PE");
0048       McZp->DrawCopy("SAMEHISTO");
0049     } else {
0050       Mc->SetAxisRange(ResMass[ires]-ResHalfWidth[ires], ResMass[ires]+ResHalfWidth[ires]);
0051       Mc->SetLineColor(kRed);
0052       Mc->SetMarkerColor(kRed);
0053       Mcp->SetNormFactor(Mc->Integral());
0054       Mcp->SetAxisRange(ResMass[ires]-ResHalfWidth[ires], ResMass[ires]+ResHalfWidth[ires]);
0055       Mcp->SetLineColor(kBlue);
0056       Mc->DrawCopy("PE");
0057       Mcp->DrawCopy("SAMEHISTO");
0058     }
0059   }
0060   Allres->Print("Plot_mass_fitYJM_SM_f4r4.ps");
0061 
0062   TCanvas * Allres2 = new TCanvas ("Allres2", "All resonances", 600, 600);
0063   Allres2->Divide (2,3);
0064   
0065   for (int ires=0; ires<6; ires++) {
0066     Allres2->cd(ires+1);
0067     if (ires==0) {
0068       MuZ->SetAxisRange(ResMass[ires]-ResHalfWidth[ires], ResMass[ires]+ResHalfWidth[ires]);
0069       MuZ->SetLineColor(kBlack);
0070       MuZ->SetMarkerColor(kBlack);
0071       MuZp->SetNormFactor(Mu->Integral());
0072       MuZp->SetAxisRange(ResMass[ires]-ResHalfWidth[ires], ResMass[ires]+ResHalfWidth[ires]);
0073       MuZp->SetLineColor(kBlue);
0074       MuZ->DrawCopy("PE");
0075       MuZp->DrawCopy("SAMEHISTO");
0076     } else {
0077       Mu->SetAxisRange(ResMass[ires]-ResHalfWidth[ires], ResMass[ires]+ResHalfWidth[ires]);
0078       Mu->SetLineColor(kBlack);
0079       Mu->SetMarkerColor(kBlack);
0080       Mup->SetNormFactor(Mu->Integral());
0081       Mup->SetAxisRange(ResMass[ires]-ResHalfWidth[ires], ResMass[ires]+ResHalfWidth[ires]);
0082       Mup->SetLineColor(kBlue);
0083       Mu->DrawCopy("PE");
0084       Mup->DrawCopy("SAMEHISTO");
0085     }
0086   }
0087   Allres2->Print("Plot_mass_bef_fitYJM_SM_f4r4.ps");
0088 
0089 
0090   TCanvas * LR = new TCanvas ("LR", "Likelihood and resolution before and after corrections", 600, 600 );
0091   LR->Divide (2,3);
0092 
0093   LR->cd (1);
0094   UL_pt->SetMinimum(-8);
0095   UL_pt->SetMaximum(-4);
0096   UL_pt->Draw("");
0097   CL_pt->SetLineColor(kRed);
0098   CL_pt->Draw("SAME");
0099   LR->cd (2);
0100   UR_pt->SetMaximum(0.15);
0101   UR_pt->Draw("");
0102   CR_pt->SetLineColor(kRed);
0103   CR_pt->Draw("SAME");
0104   LR->cd (3);
0105   UL_eta->SetMinimum(-8);
0106   UL_eta->SetMaximum(-4);
0107   UL_eta->Draw("");
0108   CL_eta->SetLineColor(kRed);
0109   CL_eta->Draw("SAME");
0110   LR->cd (4);
0111   UR_eta->SetMaximum(0.15);
0112   UR_eta->Draw("");
0113   CR_eta->SetLineColor(kRed);
0114   CR_eta->Draw("SAME");
0115   LR->cd (5);
0116   UL_phi->SetMinimum(-8);
0117   UL_phi->SetMaximum(-4);
0118   UL_phi->Draw("");
0119   CL_phi->SetLineColor(kRed);
0120   CL_phi->Draw("SAME");
0121   LR->cd (6);
0122   UR_phi->SetMaximum(0.15);
0123   UR_phi->Draw("");
0124   CR_phi->SetLineColor(kRed);
0125   CR_phi->Draw("SAME");
0126   LR->Print("Plot_mass_Lik_ResYJM_SM_f4r4.ps");
0127 
0128 
0129   TCanvas * G = new TCanvas ("G", "Mass before and after corrections", 600, 600 );
0130   G->Divide (3,3);
0131 
0132   G->cd (1);
0133   Mu->SetAxisRange (2.8, 3.4);
0134   Mu->SetLineColor (kBlue);
0135   Mc->SetLineColor (kRed);
0136   
0137   Mu->DrawCopy ("HISTO");
0138   Mc->DrawCopy ("SAME");
0139 
0140   G->cd (2);
0141   Mu->SetAxisRange (9., 10.);
0142   Mc->SetAxisRange (9., 10.);
0143   Mu->DrawCopy ("HISTO");
0144   Mc->DrawCopy ("SAME"); 
0145 
0146   G->cd (3);
0147   MuZ->SetAxisRange (70., 110.);
0148   McZ->SetAxisRange (70., 110.);
0149 
0150   MuZ->DrawCopy ("HISTO");
0151   McZ->DrawCopy ("SAME"); 
0152 
0153   G->cd (4);
0154   Mu->SetAxisRange (2.8, 3.4);
0155   Mu->Fit ("gaus", "", "", 3., 3.2);
0156   Mu->DrawCopy();
0157   G->cd (7);
0158   Mc->SetAxisRange (2.8, 3.4);
0159   Mc->Fit ("gaus", "", "", 3., 3.2);
0160   Mc->DrawCopy();
0161   G->cd (5);
0162   Mu->SetAxisRange (9., 10.);
0163   Mu->Fit ("gaus", "", "", 9., 10.);
0164   Mu->DrawCopy();
0165   G->cd (8);
0166   Mc->SetAxisRange (9., 10.);
0167   Mc->Fit ("gaus", "", "", 9., 10..);
0168   Mc->DrawCopy();
0169   G->cd (6);
0170   MuZ->SetAxisRange (70., 110.);
0171   MuZ->Fit ("gaus", "", "", 70., 110.);
0172   MuZ->DrawCopy();
0173   G->cd (9);
0174   McZ->SetAxisRange (70., 110.);
0175   McZ->Fit ("gaus", "", "", 70., 110.);
0176   McZ->DrawCopy();
0177   G->Print("Plot_mass_Resonances_YJM_SM_f4r4.ps");
0178  
0179   TCanvas * Spectrum = new TCanvas ("Spectrum", "Mass before and after corrections", 600, 600 );
0180   //Spectrum->Divide(1,2);
0181   Spectrum->cd(1);
0182   MuZ->SetAxisRange(1.,15.);
0183   McZ->SetAxisRange(1.,15.);
0184   McZ->SetLineColor(kRed);
0185   McZ->DrawCopy("HISTO");
0186   Spectrum->cd(2);
0187   MuZ->SetLineColor(kBlack);
0188   MuZ->DrawCopy("SAMEHISTO");
0189   Spectrum->Print("Spectrum_YJM_SM_f4r4.ps");
0190 
0191 }