Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:14

0001 class Plots{
0002 
0003   public:
0004   Plots();
0005 
0006   void Legend(TString histoname1,TString histoname2,TString histoname3,TString histoname4,TString histoname5,TString histoname6, TH1F *histo1,TH1F *histo2,TH1F *histo3,TH1F *histo4,TH1F *histo5,TH1F *histo6);  
0007 
0008   float convert(float num);
0009 
0010 };
0011 
0012 void Plots::Plots()
0013 {
0014 
0015 gROOT->Reset();
0016 gROOT->Clear();
0017 
0018 gStyle->SetNdivisions(10);
0019 gStyle->SetCanvasBorderMode(0); 
0020 gStyle->SetPadBorderMode(1);
0021 gStyle->SetOptTitle(1);
0022 gStyle->SetStatFont(42);
0023 gStyle->SetCanvasColor(10);
0024 gStyle->SetPadColor(0);
0025 gStyle->SetTitleFont(62,"xy");
0026 gStyle->SetLabelFont(62,"xy");
0027 gStyle->SetTitleFontSize(0.05);
0028 gStyle->SetTitleSize(0.039,"xy");
0029 gStyle->SetLabelSize(0.046,"xy");
0030 // gStyle->SetTitleFillColor(0);
0031 gStyle->SetHistFillStyle(1001);
0032 gStyle->SetHistFillColor(0);
0033 gStyle->SetHistLineStyle(1);
0034 gStyle->SetHistLineWidth(2);
0035 gStyle->SetHistLineColor(2);
0036 gStyle->SetTitleXOffset(1.15);
0037 gStyle->SetTitleYOffset(1.3);
0038 gStyle->SetOptStat(1110);
0039 gStyle->SetOptStat(kFALSE);
0040 // gStyle->SetOptFit(0111);
0041 gStyle->SetStatH(0.1); 
0042 gStyle->SetOptFit(1011);
0043 
0044 TCanvas *c1 = new TCanvas("c1","c1",129,17,926,703);
0045 c1->SetBorderSize(2);
0046 c1->SetFrameFillColor(0);
0047 c1->SetLogy(0);
0048 c1->cd(); 
0049 
0050 TFile *f[6];
0051 TTree *MyTree[6];
0052 
0053 f[0]= new TFile("../../Z/MisalignmentIdeal.root");  
0054 MyTree[0]=Tracks;
0055 
0056 f[1]=new TFile("../../SurveyLAS/zmumu/Misalignment_SurveyLASOnlyScenario_refitter_zmumu.root");
0057 MyTree[1]=Tracks;
0058 
0059 f[2]=new TFile("Misalignment_SurveyLASOnlyScenario_refitter_zmumuSurveyLASCosmics.root");
0060 MyTree[2]=Tracks;
0061 
0062 f[3]=new TFile("../../Z/Misalignment10.root");
0063 MyTree[3]=Tracks;
0064 
0065 f[4]=new TFile("../../Z/Misalignment100.root");
0066 MyTree[4]=Tracks;
0067 
0068 f[5]=new TFile("../../Z/Misalignment_NOAPE_2.root");
0069 //f[5]=new TFile("../../SurveyLAS/zmumu65To100/Misalignment_SurveyLASOnlyScenario_refitter_zmumu_NOAPE.root");
0070 MyTree[5]=Tracks;
0071 
0072 ////&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0073 
0074 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0075 /// EFFICIENCIES VS ETA ALIGNED
0076 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0077 hframe = new TH2F("hframe","m_{Z}",100,70.,110.,32,0.,0.075);
0078 hframe->SetXTitle("m_{Z} [GeV/c^{2}]");
0079 hframe->SetYTitle("N. ev. / 0.4");
0080 hframe->Draw();
0081 
0082 char histoname[128];
0083 char name[128];
0084 TH1F *mZmu[6];
0085 
0086 //Double_t lorentzianPeak(Double_t *x, Double_t *par) {
0087 //  return (0.5*par[0]*par[1]/TMath::Pi()) /
0088 //    TMath::Max( 1.e-10,(x[0]-par[2])*(x[0]-par[2]) + .25*par[1]*par[1]);
0089 //}
0090 
0091 //TF1 *fitFcn = new TF1("fitFcn",lorentzianPeak,70,110,3);
0092 //fitFcn->SetParameters(100,3,90);
0093 //fitFcn->SetParNames("Ftop","Fwidth","Fmass");
0094 //fitFcn->SetLineWidth(2);
0095 
0096 for(int i=0; i<6; i++){
0097   sprintf(name,"mZmu[%d]",i);
0098   mZmu[i] = new TH1F(name,name,100,70.,110.);
0099   sprintf(histoname,"mZmu[%d]",i);
0100   MyTree[i]->Project(histoname,"recmzmu","eff==1 && recmzmu>0.");
0101 
0102   cout << "Entries " << mZmu[i]->GetEntries() <<endl;
0103   mZmu[i]->Scale(1/mZmu[i]->GetEntries());
0104   mZmu[i]->SetTitle("Z->#mu#mu mass from Z->#mu#mu");    
0105   mZmu[i]->SetXTitle(" GeV/c2");
0106   mZmu[i]->SetYTitle("arb. units");
0107   
0108   mZmu[i]->SetLineColor(i+2);
0109   // mZmu[i]->SetLineStyle(i+1);
0110   // mZmu[i]->SetLineWidth(i+2);
0111   if (i==0) {
0112     //    mZmu[i]->Fit("fitFcn","0","",70,110);
0113     //const Int_t kNotDraw = 1<<9; 
0114     //mZmu[i]->GetFunction("fitFcn")->ResetBit(kNotDraw);
0115     mZmu[i]->Draw("same");
0116   }
0117   else { 
0118     //mZmu[i]->Fit("fitFcn","0","",70,110);
0119     //const Int_t kNotDraw = 1<<9; 
0120     //mZmu[i]->GetFunction("fitFcn")->ResetBit(kNotDraw);
0121     mZmu[i]->Draw("same");
0122   }
0123   //  c1->WaitPrimitive();
0124   c1->Update();
0125 }
0126 
0127 Legend("mZmu[0]","mZmu[1]","mZmu[2]","mZmu[3]","mZmu[4]","mZmu[5]",mZmu[0],mZmu[1],mZmu[2],mZmu[3],mZmu[4],mZmu[5]);
0128 
0129 c1->SaveAs("mZ_mu.gif");
0130 c1->SaveAs("mZ_mu.eps");
0131 gROOT->Reset();
0132 gROOT->Clear();
0133 
0134 delete c1;
0135 
0136 }
0137 
0138 void Plots::Legend(TString histoname1,TString histoname2,TString histoname3,TString histoname4, TString histoname5, TString histoname6, TH1F *histo1, TH1F *histo2, TH1F *histo3,TH1F *histo4,TH1F *histo5,TH1F *histo6)
0139 {
0140 
0141 TLegend *leg = new TLegend(0.3,0.74.,0.995,0.995);
0142 leg->SetTextAlign(32);
0143 leg->SetTextColor(1);
0144 leg->SetTextSize(0.033);
0145 leg->SetFillColor(0);
0146 
0147 char  label[128];
0148 
0149 sprintf(label,"perfect; mean=%1.4f, RMS=%1.4f",(histo1->GetMean()),histo1->GetRMS());
0150 leg->AddEntry(histoname1, label, "l");
0151 sprintf(label,"SurveyLAS; mean=%1.4f, RMS=%1.4f",(histo2->GetMean()),histo2->GetRMS());
0152 leg->AddEntry(histoname2, label, "l");
0153 sprintf(label,"SurveyLASCosmics; mean=%1.4f, RMS=%1.4f",(histo3->GetMean()),histo3->GetRMS());
0154 leg->AddEntry(histoname3, label, "l");
0155 sprintf(label,"10 pb^{-1};  mean=%1.4f, RMS=%1.4f",(histo4->GetMean()),histo4->GetRMS());
0156 leg->AddEntry(histoname4, label, "l");
0157 sprintf(label,"100 pb^{-1};  mean=%1.4f, RMS=%1.4f",(histo5->GetMean()),histo5->GetRMS());
0158 leg->AddEntry(histoname5, label, "l");
0159 sprintf(label,"10 pb^{-1}; APE not used; mean=%1.4f, RMS=%1.4f",(histo6->GetMean()),histo6->GetRMS());
0160 leg->AddEntry(histoname6, label, "l");
0161 
0162 leg->Draw();
0163 
0164 }
0165 
0166 float Plots::convert(float num){
0167   int mean1 = num;
0168   float res = num - mean1;
0169   int res2 = res*1000;
0170   float res3 = res2*0.001;
0171   float mean2 = mean1 + res3;
0172                                                                                                                   
0173   float res4 = res - res3;
0174   int res5 = res4*10000;
0175                                                                                                                   
0176   if(res5>5)
0177     mean2 = mean2 + 0.001;
0178                                                                                                                   
0179   return mean2;
0180 }
0181