当前位置: 首页>>代码示例>>C++>>正文


C++ TLegend::SetFillStyle方法代码示例

本文整理汇总了C++中TLegend::SetFillStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ TLegend::SetFillStyle方法的具体用法?C++ TLegend::SetFillStyle怎么用?C++ TLegend::SetFillStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TLegend的用法示例。


在下文中一共展示了TLegend::SetFillStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: paraPull_alpha_MUONS_MS_2TeV_2Lep_plots_All


//.........这里部分代码省略.........
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
    };
    Double_t _fey1026[35] = {
        0,
        0,
        0.6078027,
        1.092912,
        1.104476,
        0.9336719,
        0.9913968,
        0.9144366,
        0.7275085,
        0.9893613,
        0.987145,
        0.9819155,
        0.9938071,
        0.9978833,
        0.9917251,
        0.9510144,
        0.9928258,
        0.9931704,
        0.9925399,
        1.005278,
        0.9933467,
        0.9908674,
        0.9932531,
        0.9930728,
        0.9918603,
        1.137459,
        0.9911371,
        0.9865638,
        0.9931418,
        0.9930512,
        0.9596104,
        0.9909946,
        0.753126,
        0.9864575,
        0.77864
    };
    TGraphErrors *gre = new TGraphErrors(35,_fx1026,_fy1026,_fex1026,_fey1026);
    gre->SetName("");
    gre->SetTitle("");
    gre->SetFillColor(1);
    gre->SetMarkerStyle(20);
    gre->SetMarkerSize(1.2);

    TH1F *Graph_Graph1026 = new TH1F("Graph_Graph1026","",100,0,35.75);
    Graph_Graph1026->SetMinimum(-1.756302);
    Graph_Graph1026->SetMaximum(2.096664);
    Graph_Graph1026->SetDirectory(0);
    Graph_Graph1026->SetStats(0);

    ci = TColor::GetColor("#000099");
    Graph_Graph1026->SetLineColor(ci);
    Graph_Graph1026->GetXaxis()->SetLabelFont(42);
    Graph_Graph1026->GetXaxis()->SetLabelSize(0.035);
    Graph_Graph1026->GetXaxis()->SetTitleSize(0.035);
    Graph_Graph1026->GetXaxis()->SetTitleFont(42);
    Graph_Graph1026->GetYaxis()->SetLabelFont(42);
    Graph_Graph1026->GetYaxis()->SetLabelSize(0.035);
    Graph_Graph1026->GetYaxis()->SetTitleSize(0.035);
    Graph_Graph1026->GetYaxis()->SetTitleFont(42);
    Graph_Graph1026->GetZaxis()->SetLabelFont(42);
    Graph_Graph1026->GetZaxis()->SetLabelSize(0.035);
    Graph_Graph1026->GetZaxis()->SetTitleSize(0.035);
    Graph_Graph1026->GetZaxis()->SetTitleFont(42);
    gre->SetHistogram(Graph_Graph1026);

    gre->Draw("p");

    TLegend *leg = new TLegend(0.1,0.4,0.4,0.95,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextFont(72);
    leg->SetTextSize(0.015);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(0);
    leg->Draw();

    TPaveText *pt = new TPaveText(0.3599799,0.9341608,0.6400201,0.995,"blNDC");
    pt->SetName("title");
    pt->SetBorderSize(0);
    pt->SetFillColor(0);
    pt->SetFillStyle(0);
    pt->SetTextFont(42);
    TText *AText = pt->AddText("alpha_MUONS_MS");
    pt->Draw();
    c1->Modified();
    c1->cd();
    c1->SetSelected(c1);
}
开发者ID:AlexanderMorton,项目名称:NP_Prun,代码行数:101,代码来源:paraPull_alpha_MUONS_MS_2TeV_2Lep_plots_All.C

示例2: Fit_electron_purity


//.........这里部分代码省略.........

      
      
      g1->SetParameter(0,total_3->GetParameter(0));
      g1->SetParameter(1,total_3->GetParameter(1));
      g1->SetParameter(2,total_3->GetParameter(2));
      
      g2->SetParameter(0,total_3->GetParameter(3));
      g2->SetParameter(1,total_3->GetParameter(4));
      g2->SetParameter(2,total_3->GetParameter(5));
      
      g4->SetParameter(0,total_3->GetParameter(6));
      g4->SetParameter(1,total_3->GetParameter(7));
      g4->SetParameter(2,total_3->GetParameter(8));

      // g4->SetParameter(0,total_3->GetParameter(9));
      // g4->SetParameter(1,total_3->GetParameter(10));
      // g4->SetParameter(2,total_3->GetParameter(11));
      
       
      g1->Draw("same");
      g2->Draw("same");
      //  g3->Draw("same");
      g4->Draw("same");
      
      
      TLegend *legend = new TLegend(0.15,0.65,0.35,0.8);
      legend->AddEntry(g1,"#pi ","lp");
      legend->AddEntry(g2,"p+k ","lp");
      //     legend->AddEntry(g3,"kaon","lp");
      legend->AddEntry(g4,"e","lp");

      legend->SetBorderSize(0);
      legend->SetFillStyle(0);
      legend->SetTextSize(0.055);
      legend ->SetTextFont(62);       
      legend->Draw("same");

      c2->SaveAs("purity_fit_c2.pdf");
      c3->SaveAs("purity_fit_c3.pdf");
      
      //continue;


            
      Double_t mPurity=g4->Integral(-1,3)/total_3->Integral(-1,3);
      purity_MB->SetBinContent(ipt+1,mPurity);
          

      mh1Electron_Constant->SetBinContent(ipt+1,total_3->GetParameter(6));
      mh1Electron_Constant->SetBinError(ipt+1,total_3->GetParError(6));
      
      mh1Electron_Mean->SetBinContent(ipt+1,total_3->GetParameter(7));
      mh1Electron_Mean->SetBinError(ipt+1,total_3->GetParError(7));
      
      mh1Electron_Sigma->SetBinContent(ipt+1,total_3->GetParameter(8));
      mh1Electron_Sigma->SetBinError(ipt+1,total_3->GetParError(8));

      
      
      
      Double_t mPurity_temp_oneSigma= Fit_purity(nsigmaE_inclusive[ipt],ipt,electron_Mean->GetBinError(ipt+1),electron_Sigma->GetBinError(ipt+1),total_3,g1,g2,g3,g4,1,1); 
      Double_t mPurity_temp_twoSigma= Fit_purity(nsigmaE_inclusive[ipt],ipt,electron_Mean->GetBinError(ipt+1),electron_Sigma->GetBinError(ipt+1),total_3,g1,g2,g3,g4,2,1); 
      Double_t mPurity_temp_threeSigma= Fit_purity(nsigmaE_inclusive[ipt],ipt,electron_Mean->GetBinError(ipt+1),electron_Sigma->GetBinError(ipt+1),total_3,g1,g2,g3,g4,3,1);

      
开发者ID:XiaozhiBai,项目名称:Run12,代码行数:65,代码来源:purity_MB_highpT.C

示例3: drawplot_eff_eta

void drawplot_eff_eta()
{

  // gROOT->ProcessLine(".L effFunctions.C");

  TCanvas* cEff = new TCanvas("cEff","cEff",700,450);
  cEff->SetGridx(1);
  cEff->SetGridy(1);

  TTree *gt = getTree(filesDir + "gem_csc_delta_pt40_pad4.root");

  //ht = draw_geff(gt, "Eff. for a SimTrack to have an associated LCT;SimTrack |#eta|;Eff.", "h_odd", "(100,1.54,2.2)", "TMath::Abs(eta)", "", ok_lct1 || ok_lct2, "P", kRed);
  //hh = draw_geff(gt, "Eff. for a SimTrack to have an associated LCT;SimTrack |#eta|;Eff.", "h_odd", "(100,1.54,2.2)", "TMath::Abs(eta)", "", ok_sh1 || ok_sh2, "P same", kViolet);
  h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh1, ok_lct1, "P", kRed);
  h2 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh2, ok_lct2, "P same");
  eff_base->GetYaxis()->SetRangeUser(0.6,1.05);
  TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->AddEntry(h1, "odd chambers","l");
  leg->AddEntry(h2, "even chambers","l");
  leg->Draw();
  TLatex *  tex = new TLatex(0.17, 0.16,"No Pile-Up");
  tex->SetNDC();
  tex->Draw();
  cEff->Print(plotDir + "lct_eff_for_Trk_vsTrkEta_pt40" + ext);


  h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT and GEM Pad;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh1, ok_lct1 && ok_pad1, "P", kRed);
  h2 = draw_geff(gt, "Eff. for a SimTrack to have an associated ME1/b LCT and GEM Pad;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", ok_sh2, ok_lct2 && ok_pad2, "P same");
  eff_base->GetYaxis()->SetRangeUser(0.6,1.05);
  TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->AddEntry(h1, "odd chambers","l");
  leg->AddEntry(h2, "even chambers","l");
  leg->Draw();
  TLatex *  tex = new TLatex(0.17, 0.16,"No Pile-Up");
  tex->SetNDC();
  tex->Draw();
  cEff->Print(plotDir + "gem_pad_and_lct_eff_for_Trk_vsTrkEta_pt40" + ext);

  return;

  h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated GEM Pad;SimTrack |#eta|;Eff.", "h_odd", "(70,1.54,2.2)", "TMath::Abs(eta)", "", ok_pad1 || ok_pad2, "P", kViolet);
  eff_base->GetYaxis()->SetRangeUser(0.6,1.05);
  TLatex *  tex = new TLatex(0.17, 0.16,"No Pile-Up");
  tex->SetNDC();
  tex->Draw();
  cEff->Print(plotDir + "gem_pad0_eff_for_Trk_vsTrkEta_pt40" + ext);




  TTree *gt15 = getTree(filesDir + "gem_csc_delta_pt15_pad4.root");
  h1 = draw_geff(gt15, "Eff. for a SimTrack to have an associated LCT;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_lct1 || ok_lct2, "P", kViolet+2);
  cEff->Print(plotDir + "lct_eff_for_Trk_vsTrkEta_pt15" + ext);


  ho = draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_lct_odd)", ok_lct1, ok_pad1, "P", kRed);
  he = draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta_lct_even)", ok_lct2, ok_pad2, "P same");
  TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->AddEntry(he, "\"Close\" chambers","l");
  leg->AddEntry(ho, "\"Far\" chambers","l");
  leg->Draw();
  cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsLCTEta_pt40" + ext);

  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1, ok_pad1, "P", kRed);
  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2, ok_pad2, "P same");
  leg->Draw();
  cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsTrkEta_pt40" + ext);

  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_lct_odd)", ok_lct1, ok_pad1_overlap, "P", kRed);
  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;LCT |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta_lct_even)", ok_lct2, ok_pad2_overlap, "P same");
  leg->Draw();
  cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsLCTEta_pt40_overlap" + ext);

  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1, ok_pad1_overlap, "P", kRed);
  draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;SimTrack |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2, ok_pad2_overlap, "P same");
  leg->Draw();
  cEff->Print(plotDir + "gem_pad_eff_for_LCT_vsTrkEta_pt40_overlap" + ext);

  //draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;z SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct1 && Ep, ok_pad1_overlap, "P", kRed);
  //draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;z SimTrack |#eta|;Eff.", "h_evn", "(140,1.5,2.2)", "TMath::Abs(eta)", ok_lct2 && Ep, ok_pad2_overlap, "P same");
  //draw_geff(gt, "Eff. for track with LCT to have GEM pad in chamber;z SimTrack |#eta|;Eff.", "h_odd", "(140,1.5,2.2)", "TMath::Abs(eta_gemsh_odd)", ok_gsh1, ok_gdg1, "P", kRed);
  h1 = draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_pad1 || ok_pad2, "P", kViolet);
  h2 = draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_2pad1 || ok_2pad2, "P same", kViolet-6);
  TLegend *leg = new TLegend(0.42,0.23,.96,0.4, NULL, "brNDC");
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  leg->AddEntry(h1, "at least one pad","l");
  leg->AddEntry(he, "two pads in two GEMs","l");
  leg->Draw();
  cEff->Print(plotDir + "gem_pad_eff_for_Trk_vsTrkEta_pt40" + ext);

  return;
  draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_gsh1 || ok_gsh2, "P", kViolet);
  draw_geff(gt, "Eff. for a SimTrack to have an associated GEM pad;SimTrack |#eta|;Eff.", "h_odd", "(140,1.54,2.2)", "TMath::Abs(eta)", "", ok_g2sh1 || ok_g2sh2 , "P", kOrange);
//.........这里部分代码省略.........
开发者ID:khotilov,项目名称:GEMCode,代码行数:101,代码来源:drawplot_eff.C

示例4: plot2

void plot2(){

  typedef std::map<double, ROOT::Math::XYZTVector , User::moreStruct>::iterator CImap;

  TFile* file   = new TFile("../vbfTree.root","READ");

  TCanvas *c1 = new TCanvas("c1Mass","",5,30,650,600);
  c1->SetGrid(0,0);
  c1->SetFillStyle(4000);
  c1->SetFillColor(10);
  c1->SetTicky();
  c1->SetObjectStat(0);
  c1->SetLogy(1);


  TLegend* leg = new TLegend(0.55,0.45,0.85,0.75,NULL,"brNDC");
  leg->SetFillStyle(0);
  leg->SetBorderSize(0);
  leg->SetFillColor(10);
  leg->SetTextSize(0.04);
  leg->SetHeader("#splitline{POWHEG+PYTHIA qqH(115)#rightarrow#tau#tau}{jets matched to tag partons}");

  TTree* currentTree = (TTree*)file->Get("vbfJetAnalyzer/tree");
  int nEntries = currentTree->GetEntries() ;

  TH2F* h2  = new TH2F("h2","; #Delta#eta_{j1,j2}; min_{i=1,2}#Delta#eta_{ji,j3} ", 80,0,8,40,0,8);
  
  std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >* jets;
  std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >* tagjets;
  currentTree->SetBranchAddress("jetsP4",   &jets);
  currentTree->SetBranchAddress("tagjetsP4",&tagjets);


  for (int n = 0; n < nEntries ; n++) {

    currentTree->GetEntry(n);

    std::map<double, ROOT::Math::XYZTVector , User::moreStruct> sortedTagJets;
    for(unsigned int i = 0; i < tagjets->size(); i++){
      sortedTagJets.insert( make_pair( (*tagjets)[i].Et(),(*tagjets)[i] )  ) ;
    }
    std::map<double, ROOT::Math::XYZTVector , User::moreStruct> sortedJets;
    for(unsigned int i = 0; i < jets->size(); i++){
      sortedJets.insert( make_pair( (*jets)[i].Et(),(*jets)[i] )  ) ;
    }

    if(tagjets->size()<3) continue;

    int counter = 0;
    float eta1,eta2,eta3;

    for(CImap it = sortedTagJets.begin(); 
	it!=sortedTagJets.end(); it++){
      if(counter==0) eta1 = (it->second).Eta();
      if(counter==1) eta2 = (it->second).Eta();
      if(counter==2) eta3 = (it->second).Eta();
      counter++;
    }

    float deta12 = abs(eta1-eta2);
    float detai3 = std::min( abs(eta1-eta3),
			     abs(eta2-eta3)  );
    h2->Fill(deta12,detai3);
   
  }

  h2->Draw("COLZ");


  leg->Draw();


}
开发者ID:aknayak,项目名称:LLRAnalysis,代码行数:73,代码来源:vbfPlotMacro.C

示例5: makePlots


//.........这里部分代码省略.........
  style[0] = 21;
  color[0] = 2;
  size[0]  = 0.7;
  
  //For dataset No2
  style[1] = 20;
  color[1] = 4;
  size[1]  = 0.8;
  
  //For dataset No3
  style[2] = 22;
  color[2] = 38;
  size[2]  = 0.8;

  TCanvas * c1 = new TCanvas( cname.Data(), "Oscillation probabilities", 184,60,861,263); 
  c1->cd();
  gPad->SetGridx();
  gPad->SetGridy();
  gPad->SetLogx();

  float ymin = 0.0;
  float ymax = 0.5;
  float xmin = 0.9e9;
  float xmax = 1.0e10;

  TLegend * leg = new TLegend(0.14,0.58,0.35,0.85);
    
  leg->SetBorderSize(0);
  leg->SetTextSize(0.1);
  leg->SetLineColor(1);
  leg->SetLineStyle(1);
  leg->SetLineWidth(1);
  leg->SetFillColor(0);
  leg->SetFillStyle(1001);
  leg->SetTextFont(62);
  leg->SetTextSize(0.085);

  ndataset = allgraphs->GetSize(); //Get the ndatasets from the size of the List

  // Loop now over the List using the index k
  
  for(int k=0; k < ndataset; ++k) {
    
    if( k == 0 ) {
      //this is our first graph and it is special (to define axis min,max)
      ((TGraph*)allgraphs->At(k))->SetMinimum(ymin);
      ((TGraph*)allgraphs->At(k))->SetMaximum(ymax);
      ((TGraph*)allgraphs->At(k))->Draw("AP");
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetLimits(xmin, xmax);
      //set the color options
      ((TGraph*)allgraphs->At(k))->SetMarkerStyle( style[k] );
      ((TGraph*)allgraphs->At(k))->SetMarkerSize( size[k] );
      ((TGraph*)allgraphs->At(k))->SetMarkerColor( color[k] );
      ((TGraph*)allgraphs->At(k))->SetLineColor( color[k] );
      ((TGraph*)allgraphs->At(k))->SetFillColor( 10 );
      ((TGraph*)allgraphs->At(k))->GetYaxis()->SetNdivisions(505);
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetTitle("E [eV]");
      ((TGraph*)allgraphs->At(k))->GetYaxis()->SetTitle("P_{#mue}");

      ((TGraph*)allgraphs->At(k))->GetYaxis()->CenterTitle(true); 
      ((TGraph*)allgraphs->At(k))->GetXaxis()->CenterTitle(true); 
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetLabelOffset(0.007);
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetLabelSize(0.08);
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetTitleSize(0.07);
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetTitleOffset(0.9);
      ((TGraph*)allgraphs->At(k))->GetXaxis()->SetLabelFont(42);
开发者ID:andres0sorio,项目名称:GRBsWork,代码行数:67,代码来源:make_plots_earthAB.C

示例6: fit_chi2


//.........这里部分代码省略.........
  background_pos->Sumw2();
  scale = 1.0/(Double_t)background_pos->Integral(0,1000); 
  cout << "scale for background template = " << scale << endl;
  background_pos->Scale(scale);



  TMinuit *gMinuit = new TMinuit(1);  //initialize TMinuit with a maximum of 5 (1param??) params
  gMinuit->SetFCN(fcn); // sets function to minimize: fcn is Chi2 with errors on templates

  Double_t arglist[10];
  Int_t ierflg = 0; // status flag, it is 0 when ereything goes fine

  // -- sets error
  arglist[0] = 1;
  gMinuit->mnexcm("SET ERR", arglist ,1,ierflg);


  Double_t vstart = 0.5;
  Double_t step = 0.001;
  gMinuit->mnparm(0, "fsig", vstart, step, 0,1,ierflg);



  // Now ready for minimization step
  arglist[0] = 1000;
  arglist[1] = 0.01;
  gMinuit->mnexcm("MIGRAD", arglist ,2,ierflg);

  Double_t fsig=0;
  Double_t fsigerr=0;
  Double_t chi2 = 0;


  if ( ierflg == 0 ) 
    {

      // Print results
      Double_t amin,edm,errdef;
      Int_t nvpar,nparx,icstat;
      gMinuit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
      gMinuit->mnprin(3,amin);
      chi2 = gMinuit->fAmin;
      gMinuit->GetParameter(0, fsig, fsigerr);  
      cout << "Fsig = " << fsig << " +- " << fsigerr << endl;

      TCanvas* c1 = new TCanvas("c1","",500,500);

      data->Draw();
      TH1D* signal_display = (TH1D*)signal_pos->Clone();
      signal_display->SetName("signal_display");
      signal_display->Scale(fsig/signal_display->Integral(0,1000));
      signal_display->SetFillStyle(3001);
      signal_display->Draw("histsame");

      TH1D* background_display = (TH1D*)background_pos->Clone();
      background_display->SetName("background_display");
      background_display->Scale((1-fsig)/background_display->Integral(0,1000));
      background_display->SetFillStyle(3001);
      background_display->Draw("histsame");

      fit_result->Draw("histesame");

      char result[300];
      sprintf(result,"fsig = %.3lf #pm %.3lf",fsig,fsigerr);
      sigFrac = fsig;
      sigFrac_err = fsigerr;

      TLegend* leg = new TLegend(0.2,0.6,0.4,0.9);
      leg->SetHeader(result);
      leg->SetFillColor(0);
      leg->SetFillStyle(0);
      leg->SetTextSize(0.045);
      leg->SetBorderSize(0);
      leg->AddEntry(data,"data");
      leg->AddEntry(fit_result,"fit");
      leg->AddEntry(signal_display,"signal template");
      leg->AddEntry(background_display,"background template");
      leg->Draw("same");

      std::string outputFile = prefix + ".eps";
      c1->Print(outputFile.data());

      outputFile = prefix + ".gif";
      c1->Print(outputFile.data());

      outputFile = prefix + ".C";
      c1->Print(outputFile.data());
    }
    
  else{
    cout << "Fit failed!\n";
    sigFrac = 0;
    sigFrac_err = 0;
  }

  
  return;

}
开发者ID:ramankhurana,项目名称:usercode,代码行数:101,代码来源:fit_chi2.C

示例7: METJets


//.........这里部分代码省略.........
   METJets15->SetBinError(10,1.677165e-05);
   METJets15->SetEntries(17);

   ci = TColor::GetColor("#0000ff");
   METJets15->SetFillColor(ci);

   ci = TColor::GetColor("#0000ff");
   METJets15->SetLineColor(ci);

   ci = TColor::GetColor("#0000ff");
   METJets15->SetMarkerColor(ci);
   METJets15->SetMarkerStyle(21);
   METJets15->GetXaxis()->SetTitle("METJets");
   METJets15->GetXaxis()->SetLabelFont(42);
   METJets15->GetXaxis()->SetLabelSize(0.035);
   METJets15->GetXaxis()->SetTitleSize(0.035);
   METJets15->GetXaxis()->SetTitleFont(42);
   METJets15->GetYaxis()->SetTitle("Events/pb");
   METJets15->GetYaxis()->SetLabelFont(42);
   METJets15->GetYaxis()->SetLabelSize(0.035);
   METJets15->GetYaxis()->SetTitleSize(0.035);
   METJets15->GetYaxis()->SetTitleFont(42);
   METJets15->GetZaxis()->SetLabelFont(42);
   METJets15->GetZaxis()->SetLabelSize(0.035);
   METJets15->GetZaxis()->SetTitleSize(0.035);
   METJets15->GetZaxis()->SetTitleFont(42);
   METJets->Add(METJets,"");
   METJets->Draw("nostack");
   
   TPaveText *pt = new TPaveText(0.3872701,0.94,0.6127299,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("METJets");
   pt->Draw();
   
   TLegend *leg = new TLegend(0.54023,0.639881,0.938218,0.924107,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextSize(0.034965);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("METJets","METJets_QCD","lp");

   ci = TColor::GetColor("#00cc00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);

   ci = TColor::GetColor("#00cc00");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(22);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("METJets","METJets_WJetsToLNu","lp");

   ci = TColor::GetColor("#00ffff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);

   ci = TColor::GetColor("#00ffff");
开发者ID:delgadoandrea,项目名称:CMSSW_7_4_6_patch6,代码行数:67,代码来源:METJets.C

示例8: LCTX_2016B_June22all_sameYrange

void LCTX_2016B_June22all_sameYrange()
{
//=========Macro generated from canvas: LCTX/LCTX
//=========  (Fri Aug  5 08:12:16 2016) by ROOT version6.06/01
   TCanvas *LCTX = new TCanvas("LCTX", "LCTX",0,0,500,500);
   gStyle->SetOptStat(0);
   LCTX->SetHighLightColor(2);
   LCTX->Range(-125,-2.848556,125,2.626708);
   LCTX->SetFillColor(0);
   LCTX->SetBorderMode(0);
   LCTX->SetBorderSize(2);
   LCTX->SetLogy();
   LCTX->SetFrameBorderMode(0);
   LCTX->SetFrameBorderMode(0);
   
   TH1D *LCTX_1__43 = new TH1D("LCTX_1__43","LCTX",100,-100,100);
   LCTX_1__43->SetBinContent(0,384.5084);
   LCTX_1__43->SetBinContent(39,0.0007169384);
   LCTX_1__43->SetBinContent(41,0.01003714);
   LCTX_1__43->SetBinContent(42,0.01720652);
   LCTX_1__43->SetBinContent(43,0.05018569);
   LCTX_1__43->SetBinContent(44,0.5054416);
   LCTX_1__43->SetBinContent(45,1.948639);
   LCTX_1__43->SetBinContent(46,4.235672);
   LCTX_1__43->SetBinContent(47,8.363803);
   LCTX_1__43->SetBinContent(48,11.57712);
   LCTX_1__43->SetBinContent(49,11.51905);
   LCTX_1__43->SetBinContent(50,12.02879);
   LCTX_1__43->SetBinContent(51,12.01876);
   LCTX_1__43->SetBinContent(52,11.53984);
   LCTX_1__43->SetBinContent(53,11.428);
   LCTX_1__43->SetBinContent(54,8.141552);
   LCTX_1__43->SetBinContent(55,4.112359);
   LCTX_1__43->SetBinContent(56,1.841815);
   LCTX_1__43->SetBinContent(57,0.4932536);
   LCTX_1__43->SetBinContent(58,0.06810915);
   LCTX_1__43->SetBinContent(59,0.04803487);
   LCTX_1__43->SetBinContent(60,0.02365897);
   LCTX_1__43->SetBinContent(61,0.01935734);
   LCTX_1__43->SetBinContent(62,0.002867754);
   LCTX_1__43->SetBinContent(63,0.002867754);
   LCTX_1__43->SetBinContent(64,0.0007169384);
   LCTX_1__43->SetBinContent(65,0.0007169384);
   LCTX_1__43->SetBinContent(66,0.0007169384);
   LCTX_1__43->SetBinContent(67,0.0007169384);
   LCTX_1__43->SetMinimum(0.005);
   LCTX_1__43->SetMaximum(120);
   LCTX_1__43->SetEntries(675802);
   LCTX_1__43->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff00ff");
   LCTX_1__43->SetLineColor(ci);

   ci = TColor::GetColor("#ff00ff");
   LCTX_1__43->SetMarkerColor(ci);
   LCTX_1__43->GetXaxis()->SetTitle("cm");
   LCTX_1__43->GetYaxis()->SetTitle("scaled number of entries");
   LCTX_1__43->Draw("H");
   
   TLegend *leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("LCTX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("LCTX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("LCTX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("LCTX_4","ME2: mean:-0.1cm;RMS:23.2cm","l");

//.........这里部分代码省略.........
开发者ID:senka,项目名称:CSC_eff_808,代码行数:101,代码来源:LCTX_2016B_June22all_sameYrange.C

示例9: DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_dimuon_m_fake


//.........这里部分代码省略.........
   h_dimuon_m_fake_0117->SetBinError(58,0.0001507811);
   h_dimuon_m_fake_0117->SetBinError(59,0.0001467105);
   h_dimuon_m_fake_0117->SetBinError(60,0.0001341949);
   h_dimuon_m_fake_0117->SetBinError(61,0.000130655);
   h_dimuon_m_fake_0117->SetBinError(62,0.000120385);
   h_dimuon_m_fake_0117->SetBinError(63,0.0001170952);
   h_dimuon_m_fake_0117->SetBinError(64,0.0001077119);
   h_dimuon_m_fake_0117->SetBinError(65,0.0001023182);
   h_dimuon_m_fake_0117->SetBinError(66,0.0001026993);
   h_dimuon_m_fake_0117->SetBinError(67,9.035633e-05);
   h_dimuon_m_fake_0117->SetBinError(68,8.88303e-05);
   h_dimuon_m_fake_0117->SetBinError(69,8.546853e-05);
   h_dimuon_m_fake_0117->SetBinError(70,7.04348e-05);
   h_dimuon_m_fake_0117->SetBinError(71,6.760493e-05);
   h_dimuon_m_fake_0117->SetBinError(72,6.059676e-05);
   h_dimuon_m_fake_0117->SetBinError(73,6.312269e-05);
   h_dimuon_m_fake_0117->SetBinError(74,5.659686e-05);
   h_dimuon_m_fake_0117->SetBinError(75,5.303367e-05);
   h_dimuon_m_fake_0117->SetBinError(76,4.506995e-05);
   h_dimuon_m_fake_0117->SetBinError(77,4.800776e-05);
   h_dimuon_m_fake_0117->SetBinError(78,4.284838e-05);
   h_dimuon_m_fake_0117->SetBinError(79,3.750047e-05);
   h_dimuon_m_fake_0117->SetBinError(80,3.535578e-05);
   h_dimuon_m_fake_0117->SetBinError(81,3.30723e-05);
   h_dimuon_m_fake_0117->SetBinError(82,2.576973e-05);
   h_dimuon_m_fake_0117->SetBinError(83,2.724346e-05);
   h_dimuon_m_fake_0117->SetBinError(84,1.976448e-05);
   h_dimuon_m_fake_0117->SetBinError(85,1.767789e-05);
   h_dimuon_m_fake_0117->SetBinError(86,1.976448e-05);
   h_dimuon_m_fake_0117->SetBinError(87,1.082545e-05);
   h_dimuon_m_fake_0117->SetBinError(88,1.082545e-05);
   h_dimuon_m_fake_0117->SetBinError(89,6.250078e-06);
   h_dimuon_m_fake_0117->SetBinError(90,1.082545e-05);
   h_dimuon_m_fake_0117->SetBinError(92,8.838945e-06);
   h_dimuon_m_fake_0117->SetBinError(96,6.250078e-06);
   h_dimuon_m_fake_0117->SetEntries(159998);
   h_dimuon_m_fake_0117->SetDirectory(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff0000");
   h_dimuon_m_fake_0117->SetLineColor(ci);
   h_dimuon_m_fake_0117->SetLineWidth(2);
   h_dimuon_m_fake_0117->SetMarkerStyle(20);
   h_dimuon_m_fake_0117->GetXaxis()->SetLabelFont(42);
   h_dimuon_m_fake_0117->GetXaxis()->SetLabelOffset(0.007);
   h_dimuon_m_fake_0117->GetXaxis()->SetTitleSize(0.06);
   h_dimuon_m_fake_0117->GetXaxis()->SetTitleOffset(0.95);
   h_dimuon_m_fake_0117->GetXaxis()->SetTitleFont(42);
   h_dimuon_m_fake_0117->GetYaxis()->SetLabelFont(42);
   h_dimuon_m_fake_0117->GetYaxis()->SetLabelOffset(0.007);
   h_dimuon_m_fake_0117->GetYaxis()->SetTitleSize(0.06);
   h_dimuon_m_fake_0117->GetYaxis()->SetTitleOffset(1.3);
   h_dimuon_m_fake_0117->GetYaxis()->SetTitleFont(42);
   h_dimuon_m_fake_0117->GetZaxis()->SetLabelFont(42);
   h_dimuon_m_fake_0117->GetZaxis()->SetLabelOffset(0.007);
   h_dimuon_m_fake_0117->GetZaxis()->SetTitleSize(0.06);
   h_dimuon_m_fake_0117->GetZaxis()->SetTitleFont(42);
   h_dimuon_m_fake_0117->Draw("SAMEHIST");
   
   TLegend *leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 10 mm}}","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.17,0.935,0.97,1,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextAlign(22);
   leg->SetTextSize(0.045);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","CMS Simulation (LHE) 14 TeV","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   cnv->Modified();
   cnv->cd();
   cnv->SetSelected(cnv);
}
开发者ID:tahuang1991,项目名称:MuJetAnalysis,代码行数:101,代码来源:DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_dimuon_m_fake.C

示例10: plotVariable

void plotVariable(string variable = "Elec_Fbrem",
		  const TString& category = "TauNoGammas",
		  const TString& xAxisTitle = "Fbrem",
		  const TString& yAxisTitle = "a.u.",
		  float xMin = -0.2, 
		  float xMax = 1,
		  int nBins = 100, 
		  int numPVMin = 0, 
		  int numPVMax = 50,
		  float PtMin = 10, 
		  float PtMax = 60,
		  const TString& Region = "Endcap"
		   )
{
   string discriminator = "";
//   string discriminator = "-AntiEMed";

  float AbsEtaMin = 0; 
  float AbsEtaMax = 3.0;
  if(Region == "Barrel"){
    AbsEtaMin = 0; 
    AbsEtaMax = 1.479;
  }
  if(Region == "Endcap"){
    AbsEtaMin = 1.479; 
    AbsEtaMax = 3.0;
  }
  TCanvas *c1 = new TCanvas("c1","",5,30,650,600);
  c1->SetGrid(0,0);
  c1->SetFillStyle(4000);
  c1->SetFillColor(10);
  c1->SetTicky();
  c1->SetObjectStat(0);

  gStyle->SetOptStat(0);
  gStyle->SetTitleFillColor(0);
  gStyle->SetCanvasBorderMode(0);
  gStyle->SetCanvasColor(0);
  gStyle->SetPadBorderMode(0);
  gStyle->SetPadColor(0);
  gStyle->SetTitleFillColor(0);
  gStyle->SetTitleBorderSize(0);
  gStyle->SetTitleH(0.07);
  gStyle->SetTitleFontSize(0.1);
  gStyle->SetTitleStyle(0);
  gStyle->SetTitleOffset(1.3,"y");

  TLegend* leg = new TLegend(0.6,0.75,0.8,0.88,NULL,"brNDC");
  leg->SetFillStyle(0);
  leg->SetBorderSize(0);
  leg->SetFillColor(10);
  leg->SetTextSize(0.03);
  //leg->SetHeader("#splitline{CMS Preliminary}{ #sqrt{s}=7 TeV}");

//   std::string inputFileName = "/data_CMS/cms/ivo/AntiEMVA/Trees/AntiEMVA_Fall11DYJetsToLL-iter4.root";
//   std::string inputFileName = "/data_CMS/cms/ivo/AntiEMVA/Trees/Trees_ForV4/AntiEMVA_AntiEMVATrees-DYJetsToLL-madgraph-PUS6.root";
  std::string inputFileName = "/data_CMS/cms/ivo/AntiEMVA/Trees/Trees_ForV4/AntiEMVA_V4.root";
  TFile* inputFile = new TFile (inputFileName.data(),"READ");
  if(inputFile->IsZombie()){
    cout << "No such file!" << endl;
    return;
  }
  TTree* inputTree = (TTree*)inputFile->Get("AntiEMVAAnalyzer2/tree");
//   TTree* inputTree = (TTree*)inputFile->Get("AntiEMVAAnalyzer/tree");
  std::vector<TH1*> histograms;

  std::vector<std::string> matchings ; 
  matchings.push_back("GenHadMatch");
  matchings.push_back("GenEleMatch");

  for ( std::vector<std::string>::const_iterator matching = matchings.begin();
	matching  != matchings.end(); ++matching ) {


    TCut PUSelection(Form("NumPV>%i && NumPV<%i",numPVMin,numPVMax));
    TCut ElecPtSelection (Form("Elec_Pt>%0f && Elec_Pt<%0f",PtMin,PtMax));
    TCut TauPtSelection (Form("Tau_Pt>%0f && Tau_Pt<%0f",PtMin,PtMax));
    TCut ElecAbsEtaSelection (Form("Elec_AbsEta>%0f && Elec_AbsEta<%0f",AbsEtaMin,AbsEtaMax));
    TCut TauAbsEtaSelection = "";
    if(Region == "Barrel"){
      TauAbsEtaSelection = "Tau_Eta>-1.479 && Tau_Eta<1.479";
    }
    if(Region == "Endcap"){
      TauAbsEtaSelection = "(Tau_Eta>1.479 && Tau_Eta<3.0) || (Tau_Eta>-3.0 && Tau_Eta<-1.479)";
    }
    //   TCut TauAbsEtaSelection (Form("Tau_AbsEta>%0f && Tau_AbsEta<%0f",AbsEtaMin,AbsEtaMax));
    TCut ElecMatchSelection (Form("Elec_%s == 1",matching->data()));
    //   TCut ElecMatchSelection (Form("Elec_PFTauMatch && Elec_%s",matching->data()));
    TCut TauMatchSelection (Form("Tau_%s",matching->data()));
    TCut CategorySelection = "";
    if(discriminator == ""){
      if (category == "NoEleMatch") CategorySelection = "Tau_GsfEleMatch<0.5"; 
      if (category == "woG") CategorySelection = "Tau_NumGammaCands<0.5"; 
      if (category == "wGwoGSF") CategorySelection = "Tau_NumGammaCands>0.5 && Tau_HasGsf<0.5";
      if (category == "wGwGSFwoPFMVA")CategorySelection = "Tau_NumGammaCands>0.5 && Tau_HasGsf>0.5 && Elec_PFMvaOutput<-0.1";
      if (category == "wGwGSFwPFMVA")CategorySelection = "Tau_NumGammaCands>0.5 && Tau_HasGsf>0.5 && Elec_PFMvaOutput>-0.1";
    }

    if(discriminator == "-AntiEMed"){
      if (category == "NoEleMatch") CategorySelection = "Tau_GsfEleMatch<0.5"; 
//.........这里部分代码省略.........
开发者ID:inaranjo,项目名称:ElectronsStudies,代码行数:101,代码来源:plotVariablesAntiEMVACVS.C

示例11: forPaper_approval_2


//.........这里部分代码省略.........
  h[3] = (TH1F*)(fmc3->Get(var3.data()));

  if(var1=="h_jety")
    {
      double value = h[3]->GetBinContent(12);
      value *= 0.9;
      h[3]->SetBinContent(12,value);
    }


  TH1D* hscale[NHISTOS];

  int COLOR[NHISTOS]={1,4,2,kOrange-1};
  int MARKERSTYLE[NHISTOS]={8,24,21,29};
  int MARKERSIZE[NHISTOS]={1,0,0,0};
  int LINESTYLE[NHISTOS]={1,1,2,6};
  int FILLSTYLE[NHISTOS]={1,3345,3436,1};

  for(int i=0; i < NHISTOS; i++){

    hscale[i]   =(TH1D*) h[0]->Clone(Form("hscale%02i",i));
    hscale[i]   ->SetYTitle(Form("Ratio to %s",mcName3.data()));
    hscale[i]   ->SetXTitle(xtitle.data());
    hscale[i]   ->GetXaxis()->SetDecimals();
    hscale[i]   ->GetYaxis()->SetDecimals();

    hscale[i]->SetLineColor(COLOR[i]);
    hscale[i]->SetLineWidth(LINEWIDTH);
    hscale[i]->SetLineStyle(1);
    hscale[i]->SetMarkerColor(COLOR[i]);
    hscale[i]->SetMarkerStyle(MARKERSTYLE[i]);
    hscale[i]->SetMarkerSize(MARKERSIZE[i]);
    hscale[i]->SetFillColor(COLOR[i]);
    hscale[i]->SetFillStyle(FILLSTYLE[i]);

    hscale[i]->SetTitle("");
    hscale[i]->SetMaximum(ymax);
    hscale[i]->SetMinimum(ymin);

    hscale[i]->SetTitleOffset(1.2,"X");
    hscale[i]->SetTitleOffset(1.2,"Y");

    h[i]->SetTitle("");
    h[i]->SetLineStyle(LINESTYLE[i]);
    h[i]->GetXaxis()->SetDecimals();
    h[i]->GetYaxis()->SetDecimals();
    h[i]->SetMarkerSize(1);
    h[i]->SetLineColor(COLOR[i]);
    h[i]->SetLineWidth(LINEWIDTH);
    h[i]->SetMarkerColor(COLOR[i]);
    h[i]->SetMarkerStyle(MARKERSTYLE[i]);
    h[i]->SetTitleOffset(1.2,"Y");

  }
  h[0]->SetLineWidth(1);
  hscale[0]->SetLineWidth(1);

  // if normalizing to the same area, set the scale 

  int binLo = -1;
  int binHi = -1;
  int nbins = h[0]->GetNbinsX();
  binLo = 1;
  binHi = nbins;

  double scaleFactor[NHISTOS]={1};
开发者ID:ramankhurana,项目名称:usercode,代码行数:67,代码来源:forPaper_PAS.C

示例12: myPlot


//.........这里部分代码省略.........

  h_data->Reset();
  h_data->Add(h_data0);
  h_data->Add(h_data1);

  TH1D* h_DY = (TH1D*)h_DY100->Clone("h_DY");

  h_DY->Reset();
  h_DY->Add(h_DY100, scaleDY100);
  h_DY->Add(h_DY200, scaleDY200);
  h_DY->Add(h_DY400, scaleDY400);
  h_DY->Add(h_DY600, scaleDY600);
  h_DY->SetFillColor(kOrange-3);
  h_DY->SetLineColor(kBlack);

  h_TTbar->Scale(scaleTTbar);
  h_TTbar->SetFillColor(kGreen);
  h_TTbar->SetLineColor(kBlack);

  h_WW->Scale(scaleWW);
  h_WW->SetFillColor(kYellow);
  h_WW->SetLineColor(kBlack);

  h_WZ->Scale(scaleWZ);
  h_WZ->SetFillColor(kCyan);
  h_WZ->SetLineColor(kBlack);

  h_ZZ->Scale(scaleZZ);
  h_ZZ->SetFillColor(kPink);
  h_ZZ->SetLineColor(kBlack);

  h_bkg->Reset();
  h_bkg->Add(h_DY);
  h_bkg->Add(h_TTbar);
  h_bkg->Add(h_WW);
  h_bkg->Add(h_WZ);
  h_bkg->Add(h_ZZ);

  THStack *h_stack = new THStack("h_stack", "");

  h_stack->Add(h_DY);
  h_stack->Add(h_TTbar);
  h_stack->Add(h_WW);
  h_stack->Add(h_WZ);
  h_stack->Add(h_ZZ);

  h_data->SetLineColor(kBlack);
  h_data->SetMarkerStyle(8);
  h_data->SetMarkerSize(1.5);
  h_data->GetYaxis()->SetTitleOffset(1.3);
  h_data->GetXaxis()->SetTitle("");
  h_data->GetXaxis()->SetLabelOffset(999);
  h_data->GetXaxis()->SetLabelSize(0);

  if( h_data->GetMaximum() < h_stack->GetMaximum() ){
  
    h_stack->Draw("histe");
    h_stack->GetHistogram()->GetYaxis()->SetTitle("Event Numbers");
    h_stack->GetHistogram()->GetYaxis()->SetTitleSize(h_data->GetYaxis()->GetTitleSize());
    h_stack->GetHistogram()->GetYaxis()->SetLabelSize(h_data->GetYaxis()->GetLabelSize());
    h_stack->GetHistogram()->GetYaxis()->SetTitleOffset(1.3);
    h_stack->GetHistogram()->GetXaxis()->SetTickLength(0);
    h_stack->GetHistogram()->GetXaxis()->SetLabelOffset(999);
    h_data->Draw("elsame");
  
  }
    
  else{

    h_data->GetYaxis()->SetTitle("Event Numbers");
    h_data->Draw("el");
    h_stack->Draw("histesame");
    h_data->Draw("elsame");

  }
  
  TLegend *leg = new TLegend(0.73, 0.60, 0.90, 0.87);
  
  leg->SetBorderSize(0);
  leg->SetFillColor(0);
  leg->SetFillStyle(0);
  leg->SetTextSize(0.04);
    
  leg->AddEntry(h_DY, "DY+Jets", "f");
  leg->AddEntry(h_TTbar, "t#bar{t}", "f");
  leg->AddEntry(h_WW, "WW", "f");
  leg->AddEntry(h_WZ, "WZ", "f");
  leg->AddEntry(h_ZZ, "ZZ", "f");
  leg->AddEntry(h_data, "Data", "lp");
  leg->Draw();

  TLatex *lar = new TLatex();

  lar->SetNDC(kTRUE);
  lar->SetTextSize(0.04);
  lar->SetLineWidth(5);
  lar->DrawLatex(0.14, 0.94, "CMS preliminary 2015");
  lar->DrawLatex(0.63, 0.94, "L = 2.08 fb^{-1} at #sqrt{s} = 13 TeV");

}
开发者ID:wvieri,项目名称:new_git,代码行数:101,代码来源:dataMCplots.C

示例13: DisttoEdge_2016B_June22all_sameYrange_fullIntegral_10k9k

void DisttoEdge_2016B_June22all_sameYrange_fullIntegral_10k9k()
{
//=========Macro generated from canvas: DisttoEdge/DisttoEdge
//=========  (Fri Aug  5 09:22:37 2016) by ROOT version6.06/01
   TCanvas *DisttoEdge = new TCanvas("DisttoEdge", "DisttoEdge",0,0,500,500);
   gStyle->SetOptStat(0);
   DisttoEdge->SetHighLightColor(2);
   DisttoEdge->Range(-67.5,-2.848556,7.500001,2.626708);
   DisttoEdge->SetFillColor(0);
   DisttoEdge->SetBorderMode(0);
   DisttoEdge->SetBorderSize(2);
   DisttoEdge->SetLogy();
   DisttoEdge->SetFrameBorderMode(0);
   DisttoEdge->SetFrameBorderMode(0);
   
   TH1D *DisttoEdge_1__7 = new TH1D("DisttoEdge_1__7","DisttoEdge",100,-60,0);
   DisttoEdge_1__7->SetBinContent(64,0.0001479723);
   DisttoEdge_1__7->SetBinContent(65,0.008582395);
   DisttoEdge_1__7->SetBinContent(66,0.01701682);
   DisttoEdge_1__7->SetBinContent(67,0.02944649);
   DisttoEdge_1__7->SetBinContent(68,0.04394778);
   DisttoEdge_1__7->SetBinContent(69,0.05164234);
   DisttoEdge_1__7->SetBinContent(70,0.07191455);
   DisttoEdge_1__7->SetBinContent(71,0.08730368);
   DisttoEdge_1__7->SetBinContent(72,0.1127549);
   DisttoEdge_1__7->SetBinContent(73,0.1222251);
   DisttoEdge_1__7->SetBinContent(74,0.1408697);
   DisttoEdge_1__7->SetBinContent(75,0.1652851);
   DisttoEdge_1__7->SetBinContent(76,0.2007985);
   DisttoEdge_1__7->SetBinContent(77,0.4424373);
   DisttoEdge_1__7->SetBinContent(78,1.415503);
   DisttoEdge_1__7->SetBinContent(79,3.061252);
   DisttoEdge_1__7->SetBinContent(80,4.839287);
   DisttoEdge_1__7->SetBinContent(81,6.813978);
   DisttoEdge_1__7->SetBinContent(82,8.689379);
   DisttoEdge_1__7->SetBinContent(83,9.021873);
   DisttoEdge_1__7->SetBinContent(84,8.897133);
   DisttoEdge_1__7->SetBinContent(85,8.654606);
   DisttoEdge_1__7->SetBinContent(86,8.316933);
   DisttoEdge_1__7->SetBinContent(87,7.941675);
   DisttoEdge_1__7->SetBinContent(88,7.634189);
   DisttoEdge_1__7->SetBinContent(89,7.148396);
   DisttoEdge_1__7->SetBinContent(90,6.559022);
   DisttoEdge_1__7->SetBinContent(91,5.935762);
   DisttoEdge_1__7->SetBinContent(92,3.576639);
   DisttoEdge_1__7->SetMinimum(0.005);
   DisttoEdge_1__7->SetMaximum(120);
   DisttoEdge_1__7->SetEntries(675802);
   DisttoEdge_1__7->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff00ff");
   DisttoEdge_1__7->SetLineColor(ci);

   ci = TColor::GetColor("#ff00ff");
   DisttoEdge_1__7->SetMarkerColor(ci);
   DisttoEdge_1__7->GetXaxis()->SetTitle("cm");
   DisttoEdge_1__7->GetYaxis()->SetTitle("scaled number of entries");
   DisttoEdge_1__7->Draw("H");
   
   TLegend *leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("DisttoEdge_1","ME11A: mean:-9.2cm;RMS:2.3cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("DisttoEdge_2","ME11B: mean:-12.0cm;RMS:3.8cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("DisttoEdge_3","ME12+13: mean:-18.9cm;RMS:8.0cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("DisttoEdge_4","ME2: mean:-22.5cm;RMS:10.2cm","l");

//.........这里部分代码省略.........
开发者ID:senka,项目名称:CSC_eff_808,代码行数:101,代码来源:DisttoEdge_2016B_June22all_sameYrange_fullIntegral_10k9k.C

示例14: Unfold2


//.........这里部分代码省略.........
	  }	       
	  delete hTmp[j];
	  delete hTmp2[j];
	}
      cPbPb->cd(i+1);
    }

    uhist[i]->hMeas->SetMarkerStyle(20);
    uhist[i]->hMeas->SetMarkerColor(1);
    uhist[i]->hReco->SetMarkerStyle(24);
    uhist[i]->hReco->SetMarkerColor(2);
    uhist[i]->hReco->SetLineColor(2);
    uhist[i]->hReco->SetName(Form("hReco_cent%d",i));
    uhist[i]->hReco->Draw("");    
    makeHistTitle(uhist[i]->hReco,"","Jet p_{T} (GeV/c)","dN_{jets} / dp_{T}");
    uhist[i]->hReco->GetYaxis()->SetTitleOffset(1.3);
    uhist[i]->hReco->GetXaxis()->SetTitleOffset(1.2);
    uhist[i]->hGen->SetLineWidth(1);
    uhist[i]->hGen->SetLineColor(1);
    if(isMC)uhist[i]->hGen->Draw("hist same");
    uhist[i]->hReco->Draw("same");    
    uhist[i]->hRecoBinByBin->SetMarkerStyle(28);
    uhist[i]->hRecoBinByBin->SetMarkerColor(4);
    uhist[i]->hRecoBinByBin->SetLineColor(4);
    uhist[i]->hRecoBinByBin->Draw("same");    
    uhist[i]->hReco->SetAxisRange(60,300);
    TH1F *hReproduced = (TH1F*)myUnfolding.hReproduced->Clone(Form("hReproduced_cent%d",i));
    hReproduced->SetMarkerColor(4);
    hReproduced->SetMarkerStyle(24);
    uhist[i]->hMeas->Draw("same");    
		
    TLegend *leg = new TLegend(0.5,0.5,0.9,0.9);
    leg->SetBorderSize(0);
    leg->SetFillStyle(0);
    leg->AddEntry(uhist[i]->hMeas,"Measured","pl");
    leg->AddEntry(uhist[i]->hReco,"Bayesian unfolded","pl");
    leg->AddEntry(uhist[i]->hRecoBinByBin,"Bin-by-bin unfolded","pl");
    if(isMC)leg->AddEntry(uhist[i]->hGen,"Generator level truth","l");
    leg->Draw();
  }	     
  
  cPbPb->Update();

 // ======================= Unfolding closure in MC =========================================================
  TCanvas * cRatio = new TCanvas("cRatio","Ratio",1200,600);
    TH1F * hReco[nbins_cent+1];
    TH1F * hRecoBinByBin[nbins_cent+1];
    TH1F * hMeas[nbins_cent+1];
    TH1F * hGen[nbins_cent+1];
    TLegend *leg[nbins_cent+1];
  TLine *line = new TLine(60,1,250,1);
	line->SetLineStyle(2);
	line->SetLineWidth(2);
 
    for (int i=0;i<=nbins_cent;i++) {
        hReco[i]          = (TH1F*)uhist[i]->hReco->Clone(Form("hReco_Cen%d", i));
        hRecoBinByBin[i]          = (TH1F*)uhist[i]->hRecoBinByBin->Clone(Form("hRecoBinByBin_Cen%d", i));
        hMeas[i]          = (TH1F*)uhist[i]->hMeas->Clone(Form("hMeas_Cen%d", i));
        if(isMC) hGen[i]          = (TH1F*)uhist[i]->hGen->Clone(Form("hGen_Cen%d", i));
    }
    
  if(isMC){
    cRatio->Divide(2,1);
      for (int i=0;i<=nbins_cent;i++) {
          
          hMeas[i]->Divide(hGen[i]);
开发者ID:maoyx,项目名称:MITBackup2014July,代码行数:67,代码来源:Unfold2.C

示例15: SegtoLCTXY_2015all_sameYrange_fullIntegral


//.........这里部分代码省略.........
   SegtoLCTXY_1__85->SetBinContent(93,0.003192954);
   SegtoLCTXY_1__85->SetBinContent(94,0.001330398);
   SegtoLCTXY_1__85->SetBinContent(95,0.002394716);
   SegtoLCTXY_1__85->SetBinContent(96,0.0007982386);
   SegtoLCTXY_1__85->SetBinContent(97,0.002394716);
   SegtoLCTXY_1__85->SetBinContent(98,0.003192954);
   SegtoLCTXY_1__85->SetBinContent(99,0.002128636);
   SegtoLCTXY_1__85->SetBinContent(100,0.001064318);
   SegtoLCTXY_1__85->SetBinContent(101,2.265268);
   SegtoLCTXY_1__85->SetMinimum(0.02);
   SegtoLCTXY_1__85->SetMaximum(50);
   SegtoLCTXY_1__85->SetEntries(768682);
   SegtoLCTXY_1__85->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff00ff");
   SegtoLCTXY_1__85->SetLineColor(ci);

   ci = TColor::GetColor("#ff00ff");
   SegtoLCTXY_1__85->SetMarkerColor(ci);
   SegtoLCTXY_1__85->GetXaxis()->SetTitle("cm");
   SegtoLCTXY_1__85->GetYaxis()->SetTitle("scaled number of entries");
   SegtoLCTXY_1__85->Draw("H");
   
   TLegend *leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.8cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
开发者ID:senka,项目名称:CSC_eff_808,代码行数:67,代码来源:SegtoLCTXY_2015all_sameYrange_fullIntegral.C


注:本文中的TLegend::SetFillStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。