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


C++ TH1F::SetLineStyle方法代码示例

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


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

示例1: SetSignalStyle

void SetSignalStyle(TH1F & ele, unsigned color) {
  ele.SetFillStyle(1001);
  ele.SetLineStyle(11);
  ele.SetFillColor(0);
  ele.SetLineColor(color);
  ele.SetLineWidth(2);
  return;
}
开发者ID:joaopela,项目名称:ICHiggsTauTau,代码行数:8,代码来源:SOBPlot.cpp

示例2: plot

TCanvas * plot (TH1F* histoDataIn, TString legendData, TH1F* histoSimulationIn, TString legendSimulation,
                TString & canvasName, Float_t maximum = 0.15, TString xAxisTitle = "#eta",
                TString yAxisTitle = "Number of Clusters", TString error = "", bool useLegend = true,
                TString text = "", Float_t textX = 0.7, Float_t textY = 0.4, Float_t rebin = 0 ) {

  TH1F * histoData = (TH1F*)histoDataIn->Clone();
  TH1F * histoSimulation = (TH1F*)histoSimulationIn->Clone();

  // histoData->Sumw2();
  histoData->Scale(1/(histoData->Integral()));
  histoSimulation->Scale(1/(histoSimulation->Integral()));

  // Create also the legend and add the histograms
  TLegend * legend = new TLegend( 0.55, 0.65, 0.76, 0.82 );
  legend->AddEntry( histoData, xAxisTitle );
  legend->AddEntry( histoSimulation, yAxisTitle, "F" );

  cout << "histoData = " << histoData << endl;
  cout << "histoSimulation = " << histoSimulation << endl;

  TCanvas * c = new TCanvas( canvasName, canvasName, 1000, 800 );
  c->Draw();

  histoSimulation->SetMaximum(maximum);

  histoSimulation->SetFillColor(kRed);
  // histoSimulation->SetLineWidth(0);
  histoSimulation->SetLineColor(kRed);
  histoSimulation->SetXTitle(xAxisTitle);
  histoSimulation->SetYTitle(yAxisTitle);
  histoSimulation->SetTitleOffset(1.6,"Y");
  histoSimulation->SetTitle();

  histoData->SetLineStyle(1);
  histoData->SetLineWidth(2.5);

  histoSimulation->Draw();
  histoData->Draw("same");

  legend->SetFillColor(kWhite);
  if (useLegend) legend->Draw("same");

  if ( text != "" ) {
    TPaveText * pt = new TPaveText(textX, textY, textX+0.2, textY+0.17, "NDC" ); // "NDC" option sets coords relative to pad dimensions
    pt->SetFillColor(0); // text is black on white
    pt->SetTextSize(0.08); 
    pt->SetBorderSize(0);
    pt->SetTextAlign(12);
    pt->AddText(text);
    pt->Draw("same");       //to draw your text object
  }

  return c;
};
开发者ID:Hosein47,项目名称:usercode,代码行数:54,代码来源:plot.C

示例3: performClosure

void performClosure(RooRealVar *mass, RooAbsPdf *pdf, RooDataSet *data, string closurename, double wmin=110., double wmax=130., double slow=110., double shigh=130., double step=0.002) {
  
  // plot to perform closure test
  cout << "Performing closure test..." << endl; 
  double nbins = (wmax-wmin)/step;
  TH1F *h = new TH1F("h","h",int(floor(nbins+0.5)),wmin,wmax);
  if (data){
    pdf->fillHistogram(h,RooArgList(*mass),data->sumEntries());
    h->Scale(2*h->GetNbinsX()/double(binning_));
  }
  else {
    pdf->fillHistogram(h,RooArgList(*mass));
  }
  int binLow = h->FindBin(slow);
  int binHigh = h->FindBin(shigh)-1;
  TH1F *copy = new TH1F("copy","c",binHigh-binLow,h->GetBinLowEdge(binLow),h->GetBinLowEdge(binHigh+1));
  for (int b=0; b<copy->GetNbinsX(); b++) copy->SetBinContent(b+1,h->GetBinContent(b+1+binLow));
  double areaCov = 100*h->Integral(binLow,binHigh)/h->Integral();
 
  // style
  h->SetLineColor(kBlue);
  h->SetLineWidth(3);
  h->SetLineStyle(7);
  copy->SetLineWidth(3);
  copy->SetFillColor(kGray);
  
  TCanvas *c = new TCanvas();
  if (data){
    RooPlot *plot = mass->frame(Bins(binning_),Range("higgsRange"));
    plot->addTH1(h,"hist");
    plot->addTH1(copy,"same f");
    if (data) data->plotOn(plot);
    pdf->plotOn(plot,Normalization(h->Integral(),RooAbsReal::NumEvent),NormRange("higgsRange"),Range("higgsRange"),LineWidth(1),LineColor(kRed),LineStyle(kDashed));
    plot->Draw();
    c->Print(closurename.c_str());
  }
  else {
    RooPlot *plot = mass->frame(Bins(binning_),Range("higgsRange"));
    h->Scale(plot->getFitRangeBinW()/h->GetBinWidth(1));
    copy->Scale(plot->getFitRangeBinW()/h->GetBinWidth(1));
    pdf->plotOn(plot,LineColor(kRed),LineWidth(3));
    plot->Draw();
    h->Draw("hist same");
    copy->Draw("same f");
    c->Print(closurename.c_str());
  }
  cout << "IntH: [" << h->GetBinLowEdge(binLow) << "-" << h->GetBinLowEdge(binHigh+1) << "] Area = " << areaCov << endl;
  delete c;
  delete copy;
  delete h;
}
开发者ID:h2gglobe,项目名称:UserCode,代码行数:51,代码来源:makeParametricSignalModelPlots.C

示例4: if

///
/// Make a plot out of a 1D histogram holding a 1-CL curve.
/// This is a fall back function that does no fancy stuff.
///
/// \param s The scanner to plot.
/// \param first Set this to true for the first plotted scanner.
///
void OneMinusClPlot::scan1dPlotSimple(MethodAbsScan* s, bool first, int CLsType)
{
	if ( arg->debug ){
		cout << "OneMinusClPlot::scan1dPlotSimple() : plotting ";
		cout << s->getName() << " (" << s->getMethodName() << ")" << endl;
	}
	m_mainCanvas->cd();

	TH1F *hCL = (TH1F*)s->getHCL()->Clone(getUniqueRootName());
	if (CLsType==1) hCL = (TH1F*)s->getHCLs()->Clone(getUniqueRootName());
  else if (CLsType==2) hCL = (TH1F*)s->getHCLsFreq()->Clone(getUniqueRootName());

	// get rid of nan and inf
	for ( int i=1; i<=hCL->GetNbinsX(); i++ ){
	if ( hCL->GetBinContent(i)!=hCL->GetBinContent(i)
				|| std::isinf(hCL->GetBinContent(i)) ) hCL->SetBinContent(i, 0.0);
	}

	int color = s->getLineColor();
	if(CLsType==1) color = color + 2 ;
	hCL->SetStats(0);
	hCL->SetLineColor(color);
	hCL->SetMarkerColor(color);
	hCL->SetLineWidth(2);
	hCL->SetLineStyle(s->getLineStyle());
	hCL->SetMarkerColor(color);
	hCL->SetMarkerStyle(8);
	hCL->SetMarkerSize(0.6);
	hCL->GetYaxis()->SetNdivisions(407, true);
	hCL->GetXaxis()->SetTitle(s->getScanVar1()->GetTitle());
	hCL->GetYaxis()->SetTitle("1-CL");
	hCL->GetXaxis()->SetLabelFont(font);
	hCL->GetYaxis()->SetLabelFont(font);
	hCL->GetXaxis()->SetTitleFont(font);
	hCL->GetYaxis()->SetTitleFont(font);
	hCL->GetXaxis()->SetTitleOffset(0.9);
	hCL->GetYaxis()->SetTitleOffset(0.85);
	hCL->GetXaxis()->SetLabelSize(labelsize);
	hCL->GetYaxis()->SetLabelSize(labelsize);
	hCL->GetXaxis()->SetTitleSize(titlesize);
	hCL->GetYaxis()->SetTitleSize(titlesize);
	if ( plotLegend && !arg->isQuickhack(22) ){
		if ( arg->plotlog ) hCL->GetYaxis()->SetRangeUser(1e-3,10);
		else                hCL->GetYaxis()->SetRangeUser(0.0,1.3);
	}
	else{
		if ( arg->plotlog ) hCL->GetYaxis()->SetRangeUser(1e-3,1);
		else                hCL->GetYaxis()->SetRangeUser(0.0,1.0);
	}
	hCL->Draw(first?"":"same");
}
开发者ID:gammacombo,项目名称:gammacombo,代码行数:58,代码来源:OneMinusClPlot.cpp

示例5: GetSigHist

TH1F * GetSigHist(TFile *f, const char * name, const char * tag, int color, int lstyle, TLegend * leg, const char * legtag){
   char full_name[200];

   sprintf(full_name, "%s_%s", name, tag);
   TH1F * h = (TH1F *)f->Get(full_name);

   h->SetFillStyle(0);
   h->SetFillColor(color);
   h->SetLineColor(color);   
   h->SetLineStyle(lstyle);   
   if (leg) { leg->AddEntry(h, legtag, "l"); }  

   return h;
}
开发者ID:dburns7,项目名称:Research,代码行数:14,代码来源:mkplots_13tev.C

示例6: DrawZero

/*--------------------------------------------------------------------*/
TH1F* DrawZero(TH1F *hist,Int_t nbins,Double_t lowedge,Double_t highedge)
/*--------------------------------------------------------------------*/
{ 

  TH1F *hzero = new TH1F(Form("hzero_%s",hist->GetName()),"hzero",nbins,lowedge,highedge);
  for (Int_t i=0;i<hzero->GetNbinsX();i++){
    hzero->SetBinContent(i,0.);
    hzero->SetBinError(i,0.);
  }
  hzero->SetLineWidth(2);
  hzero->SetLineStyle(9);
  hzero->SetLineColor(kRed);
  
  return hzero;
}
开发者ID:mmusich,项目名称:PVToolScripts,代码行数:16,代码来源:AutoFitResiduals_forApproval.C

示例7: Draw

void Draw()
{

   /*
   TLatex *t = new TLatex();
   t->SetTextSize(0.042);
   t->DrawLatex(1.5,0.80,"CMSSW_1_6_12, |#eta|< 1.3");
   t->DrawLatex(1.5,0.75,"no ZSP in HCAL");
   t->DrawLatex(1.5,0.70,"no SR in ECAL");
   */

  /*
   setTDRStyle(0,1);
   TCanvas* c0 = new TCanvas("X","Y",1);
   // data
   TFile* file = new TFile("DYDataA_29Feb.root");
   hnvtx0->GetXaxis()->SetTitle("N reco vertices");
   hnvtx0->GetYaxis()->SetTitle("");
   hnvtx0->SetLineStyle(1);
   hnvtx0->SetLineWidth(3);
   hnvtx0->SetMarkerStyle(24);
   hnvtx0->SetMarkerSize(1.0);
   hnvtx0->SetMaximum(200000.);
   hnvtx0->SetMinimum(0.5);
   hnvtx0->Draw("PE");
   TLegend *leg = new TLegend(0.35,0.75,0.9,0.85,NULL,"brNDC");
   leg->SetFillColor(10);
   leg->AddEntry(hnvtx0,"data: p_{T}^{#mu}> 20 GeV, |#eta|<2.4","P");
   // MC
   TFile* file = new TFile("DYMC18novPUW.root");
   hnvtx0->SetLineStyle(1);
   hnvtx0->SetLineWidth(3);
   hnvtx0->Draw("same");
   leg->AddEntry(hnvtx0,"MC, DY#rightarrowll","L");
   leg->Draw();
   c0->SaveAs("nvtx0.png");
  */

  // normalization
  //
  Double_t xsection=3048.;
  Double_t luminosity=5061;
  Double_t nmcevents=15000000.;
  Double_t datamcratio=2925.44;
  Double_t normalization=(xsection*luminosity)/(nmcevents*datamcratio);

  setTDRStyle(0,1);
  // data
  TFile* file = new TFile("DataAB.root");
  cout <<" ============= Data =============================" << endl;
  cout <<" ===> Zmumu = " << hZY->Integral() << endl;
  cout <<" ===> 2jets = " << hZY2J->Integral() << endl;
  cout <<" ===> y*    = " << hZY2JY->Integral() << endl;
  cout <<" ===> Mjj   = " << hZY2JYMjj->Integral() << endl;
  TCanvas* c1 = new TCanvas("X","Y",1);
  TH1F *hNjetsData = (TH1F*)hNjets->Clone();
  // MC events
  TFile* file = new TFile("DYMCAB.root");
  cout <<" ============= MC =============================" << endl;
  cout <<" ===> Zmumu = " << hZY->Integral()*normalization << endl;
  cout <<" ===> 2jets = " << hZY2J->Integral()*normalization << endl;
  cout <<" ===> y*    = " << hZY2JY->Integral()*normalization << endl;
  cout <<" ===> Mjj   = " << hZY2JYMjj->Integral()*normalization << endl;
  TH1F *hNjetsMC = (TH1F*)hNjets->Clone();
  TH1F *hNjetsRatio = (TH1F*)hNjets->Clone();
  TH1F *hNjetsRatio_JESUP = (TH1F*)hNjets->Clone();
  TH1F *hNjetsRatio_JESDN = (TH1F*)hNjets->Clone();
  //
  // MC events JESUP
  TFile* file = new TFile("DYMCAB_JESUP.root");
  TH1F *hNjetsMC_JESUP = (TH1F*)hNjets->Clone();
  // MC events JESDN
  TFile* file = new TFile("DYMCAB_JESDN.root");
  TH1F *hNjetsMC_JESDN = (TH1F*)hNjets->Clone();
  //
  hNjetsData->GetXaxis()->SetTitle("N jets");
  hNjetsData->GetYaxis()->SetTitle("N events");
  hNjetsData->SetMaximum(5000000.);
  hNjetsData->SetMinimum(100.);
  hNjetsData->SetLineStyle(1.);
  hNjetsData->SetLineWidth(2);
  hNjetsData->SetMarkerStyle(24);
  hNjetsData->SetMarkerSize(0.7);
  hNjetsData->Draw("PE");
  //  Double_t mcevents= hNjetsMC->Integral();
  //  Double_t dataevents=hNjetsData->Integral();
  //  Double_t expected=mcevents*normalization;
  hNjetsMC->Scale(normalization);
  hNjetsMC_JESUP->Scale(normalization);
  hNjetsMC_JESDN->Scale(normalization);
  hNjetsMC->SetLineStyle(1);
  hNjetsMC->SetLineWidth(2);
  hNjetsMC->Draw("same");

  TLegend *leg = new TLegend(0.5,0.8,0.9,0.9,NULL,"brNDC");
  leg->SetFillColor(10);
  leg->AddEntry(hNjetsData,"Data 2011, L=5.06 fb^{-1} ","P");
  leg->AddEntry(hNjetsMC,"Z+jets MC","L");
  leg->Draw();

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

示例8: makeGMSBPlot


//.........这里部分代码省略.........
  // cout << endl << endl;

  TGraph* g     = new TGraph(n,x,y);
  TGraph* gup   = new TGraph(n,x,yup);
  TGraph* gdn   = new TGraph(n,x,ydn);
  TGraph* gband = new TGraph(30,xband,yband);

  // UP:   248
  // DOWN: 148

  //TGraphErrors* g  = new TGraphErrors(n,x,y,xerr,yerr);

  TCanvas *c1 = new TCanvas("c1","",600,600);
  gPad->SetTopMargin(0.1);
  gPad->SetRightMargin(0.05);
  //gPad->SetGridx();
  //gPad->SetGridy();

  float ymin = 0;
  if( logplot ) ymin = 0.03;

  //TH2F* hdummy = new TH2F("hdummy","",100,130,300,100,ymin,3000);
  TH2F* hdummy = new TH2F("hdummy","",100,130,400,100,ymin,5);
  hdummy->Draw();

  c1->cd();
  if( logplot ) gPad->SetLogy();

  g->SetLineColor(2);
  g->SetLineWidth(3);
  g->SetFillColor(5);
  gup->SetLineColor(2);
  gdn->SetLineColor(2);
  gup->SetLineStyle(2);
  gdn->SetLineStyle(2);
  gband->SetFillColor(5);

  /*
  //2l2j observed
  gul->SetLineColor(6);
  gul->SetLineWidth(3);
  gul->SetLineStyle(4);

  //2l2j expected
  gulexp->SetLineColor(2);
  gulexp->SetLineWidth(3);
  gulexp->SetLineStyle(2);

  //4l observed
  gul2->SetLineWidth(3);
  gul2->SetLineStyle(4);
  gul2->SetLineColor(kGreen+2);

  //4l expected
  gul2exp->SetLineWidth(3);
  gul2exp->SetLineStyle(2);
  */

  //combined observed
  gulc->SetLineWidth(5);
  gulc->SetLineColor(1);

  //combined expected
  gulcexp->SetLineWidth(5);
  gulcexp->SetLineColor(4);
  gulcexp->SetLineStyle(2);
开发者ID:hooberman,项目名称:UserCode,代码行数:67,代码来源:makeGMSBPlot.C

示例9: plotSystFracs

void plotSystFracs(TList* HistList, TH1F* compT, std::string name){

  gROOT->SetBatch();
  system("mkdir -p plots/ada/systs");
  system("mkdir -p plots/grad/systs");

  std::string bdt;
  TString str = compT->GetName();
  if (str.Contains("ada")) bdt="ada";
  if (str.Contains("grad")) bdt="grad";

  int nHists=HistList->GetEntries();
  TH1F *comp = linearBin(compT);
  
  gROOT->SetStyle("Plain");
  gROOT->ForceStyle();
  gStyle->SetOptStat(0);
  TCanvas *canv = new TCanvas("","",700,700);
  
  TLegend *leg = new TLegend(0.6,0.6,0.88,0.88);
  leg->SetLineColor(0);
  leg->SetFillColor(0);
  
  TF1 *line = new TF1("line","0.0",0.,comp->GetBinLowEdge(comp->GetNbinsX()+1));
  line->SetLineColor(kBlack);
  TF1 *line1 = new TF1("line","10.0",0.,comp->GetBinLowEdge(comp->GetNbinsX()+1));
  line1->SetLineColor(kGray+2);
  line1->SetLineStyle(2);
  TF1 *line2 = new TF1("line","-10.0",0.,comp->GetBinLowEdge(comp->GetNbinsX()+1));
  line2->SetLineColor(kGray+2);
  line2->SetLineStyle(2);
  
  int colors[10] = {kBlue,kMagenta,kGreen,kCyan,kRed,kBlue+3,kOrange+1,kSpring-1,kMagenta+3,kGreen+3};
  int color=0;
  for (int i=0; i<nHists; i++){
    TH1F *systHist = linearBin((TH1F*)HistList->At(i));
    systHist->Add(comp,-1);
    systHist->Divide(comp);
    systHist->Scale(100.);
    std::string systStr = systHist->GetName();
    int ind = systStr.rfind("cat0");
    std::string systName = systStr.substr(ind+5,systStr.size());
    systHist->SetLineColor(colors[color]);
    systHist->SetTitle(Form("%s",name.c_str()));
    systHist->GetYaxis()->SetTitle("Difference over nominal %");
    systHist->GetYaxis()->SetTitleOffset(1.4);
    systHist->GetXaxis()->SetTitle("BDT output");
    systHist->GetYaxis()->SetRangeUser(-100.,250);
    if (int(systName.find("Up"))>0){
      systHist->SetLineStyle(1);
      systName = systName.substr(0,systName.rfind("Up"));
      leg->AddEntry(systHist,systName.c_str(),"l");
      color++;
    }
    else if (int(systName.find("Down"))>0){
      systHist->SetLineStyle(2);
      systName = systName.substr(0,systName.rfind("Down"));
    }
    if (i==0) systHist->DrawCopy("hist");
    else systHist->DrawCopy("same hist");
  }
  leg->Draw("same");
  line->Draw("same");
  line1->Draw("same");
  line2->Draw("same");
  canv->Print(("plots/"+bdt+"/systs/"+name+".png").c_str(),"png");
  
  delete canv;
  
  systCalls++;
  
}
开发者ID:kreczko,项目名称:HiggsAnalysisExample,代码行数:72,代码来源:BDTInterpolation.C

示例10: plotCutFlowNotStaggered


//.........这里部分代码省略.........
      TH1F* tmph1 =  (TH1F*)currentFile->Get( (cutList[m].first).c_str() );
      if(tmph1!=0){
	cutFlow.push_back( tmph1->GetBinContent(1) );
	//cout << tmph1->GetBinContent(1) << endl;
      }
    }

    TTree* currentTree = (TTree*)currentFile->Get("muTauStreamAnalyzer/tree");
    string h1Name = "h1_"+(fileList_[i].second).first;
    TH1F* h1 = new TH1F( h1Name.c_str() ,"", (int)(cutFlow.size()+3) ,0 , cutFlow.size()+3);

    if( ((fileList_[i].second).first).find("Zjets")!=string::npos ) {
      h1->SetLineColor(kRed);
      leg->AddEntry(h1,"MadGraph Z+jets","F");
    }
    if( ((fileList_[i].second).first).find("ttbar")!=string::npos ) {
      h1->SetLineColor(kBlue);
      leg->AddEntry(h1,"MadGraph t#bar{t}+jets","F");
    }
    if( ((fileList_[i].second).first).find("Wjets")!=string::npos ) {
      h1->SetLineColor(kGreen);
      leg->AddEntry(h1,"MadGraph W+jets","F");
    }
    if( ((fileList_[i].second).first).find("tW")!=string::npos ){
      h1->SetLineColor( 44 );
      leg->AddEntry(h1,"MadGraph single-top","F");
    }
    if( ((fileList_[i].second).first).find("QCD")!=string::npos ) {
      h1->SetLineColor(11);
      leg->AddEntry(h1,"Pythia QCD","F");
    }
    if( ((fileList_[i].second).first).find("qqH115")!=string::npos ) {
      h1->SetLineColor(kBlack);
      h1->SetLineStyle(kDashed);
      h1->SetLineWidth(3.0);
      signalScale = signalScale_;
      leg->AddEntry(h1,Form("VBF H(115)#rightarrow#tau#tau X %.0f",signalScale),"l");
    }
    if( ((fileList_[i].second).first).find("qqH135")!=string::npos ) {
      h1->SetLineColor(kBlack);
      h1->SetLineStyle(kDotted);
      h1->SetLineWidth(3.0);
      signalScale = signalScale_;
      leg->AddEntry(h1,Form("VBF H(135)#rightarrow#tau#tau X %.0f",signalScale),"l");
    }

    h1->SetBinContent(1,totalEvents);
    h1->GetXaxis()->SetBinLabel(1,"#sigma*BR*#int L");  
    for(int m = 0; m<cutFlow.size(); m++){
      h1->SetBinContent(m+2,cutFlow[m]);
      h1->GetXaxis()->SetBinLabel(m+2, (cutList[m].second).c_str() ); 
    }
    h1->GetXaxis()->SetBinLabel(cutFlow.size()+2,"VBF 1%");
    h1->GetXaxis()->SetBinLabel(cutFlow.size()+3,"CJV (15 GeV)");
   
    int nEntries = currentTree->GetEntries() ;    
    
    std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >* diTauSVfit3;
    std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >* jets;
    
    currentTree->SetBranchAddress("diTauSVfit3P4",&diTauSVfit3);
    currentTree->SetBranchAddress("jetsIDP4",&jets);
    
    for (int n = 0; n < nEntries ; n++) {
      
      currentTree->GetEntry(n);
开发者ID:aknayak,项目名称:LLRAnalysis,代码行数:67,代码来源:plotMacro_MuTauStream.C

示例11: compare_ATLAS_pp_fitBoth_TH1F


//.........这里部分代码省略.........
   hATLASppHist->SetBinContent(10,0.000735);
   hATLASppHist->SetBinError(10,8.981748e-05);
   hATLASppHist->SetBinContent(11,0.000114);
   hATLASppHist->SetBinError(11,1.442494e-05);
   hATLASppHist->SetBinContent(12,1.41e-05);
   hATLASppHist->SetBinError(12,1.98855e-06);
//    c1=new TCanvas();
// //   c1.cd();
//    hATLASppHist->Draw();
  // was grae
   for(int i=0; i<nfit; ++i){
     grae->Fit("fitppATLAS","","",FitStart,FitEnd); //fit function
   } 
   cout<<"now to fit hATLASppHist"<<endl;
   for(int ib=0; ib<nfit; ++ib){
     hATLASppHist->Fit("fitppATLASHist","IL","",FitStart,FitEnd); //fit function
   } 

   TCanvas *cATLAS_ppHist = new TCanvas("cATLAS_ppHist", "",0,0,1200,1000);
   cATLAS_ppHist->Range(-3.725291e-06,-5.878322,500,3.279288);
   cATLAS_ppHist->SetFillColor(0);
   cATLAS_ppHist->SetBorderMode(0);
   cATLAS_ppHist->SetBorderSize(2);
   cATLAS_ppHist->SetLogy();
   cATLAS_ppHist->SetFrameBorderMode(0);
   cATLAS_ppHist->SetFrameBorderMode(0);

//   grae->SetHistogram(hATLASpp);

   TLegend *leg = new TLegend(0.4,0.65,0.6,0.85,NULL,"BRNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.04);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(10);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("NULL","","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("hATLASppHist","ATLAS pp histogram","p");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(kGreen);
   entry->SetMarkerStyle(22);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("grae","ATLAS pp TGraphAsymErrors","p");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(33);
   entry->SetMarkerSize(1);
   
   leg->Draw();
   hATLASppHist->SetMarkerColor(kGreen);
   hATLASppHist->SetMarkerStyle(22);
   grae->SetMarkerStyle(21);
   grae->SetMarkerColor(1);
开发者ID:mtonjes,项目名称:usercode,代码行数:67,代码来源:compare_ATLAS_pp_fitBoth_TH1F.C

示例12: shapehist


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

    for (int i = 1; i <= nbins; i++) {
        if (hiszj->GetBinContent(i) == 0) hiszj->SetBinContent(i, 0.001);
        if (hisdi->GetBinContent(i) == 0) hisdi->SetBinContent(i, 0.001);
        if (histt->GetBinContent(i) == 0) histt->SetBinContent(i, 0.001);
        if (hisst->GetBinContent(i) == 0) hisst->SetBinContent(i, 0.001);
        if (hisqc->GetBinContent(i) == 0) hisqc->SetBinContent(i, 0.001);

        hiszj->SetBinError(i, 0.5*hiszj->GetBinContent(i));
        hisdi->SetBinError(i, 0.5*hisdi->GetBinContent(i));
        histt->SetBinError(i, 0.5*histt->GetBinContent(i));
        hisst->SetBinError(i, 0.5*hisst->GetBinContent(i));
        hisqc->SetBinError(i, 0.5*hisqc->GetBinContent(i));
    }


    std::cout << "data_obs  : " << hisdt->Integral() << std::endl;
    std::cout << "DM        : " << hisdm->Integral() << std::endl;
    std::cout << "Znunu     : " << hiszn->Integral() << std::endl;
    std::cout << "WJets     : " << hiswj->Integral() << std::endl;
    std::cout << "ZJets     : " << hiszj->Integral() << std::endl;
    std::cout << "Dibosons  : " << hisdi->Integral() << std::endl;
    std::cout << "ttbar     : " << histt->Integral() << std::endl;
    std::cout << "singletop : " << hisst->Integral() << std::endl;
    std::cout << "QCD       : " << hisqc->Integral() << std::endl;

    if (makeplot) {
    hiszj->Add(hisdi);
    hiszj->Add(histt);
    hiszj->Add(hisst);
    hiszj->Add(hisqc);

    hiswj->Add(hiszj);
    hiszn->Add(hiswj);
    hiszu->Add(hiswj);
    hiszd->Add(hiswj);

    hiszj->SetLineColor(kGreen+2);
    hiswj->SetLineColor(kRed);
    hiszn->SetLineColor(kBlue);
    hiszj->SetLineWidth(2);
    hiswj->SetLineWidth(2);
    hiszn->SetLineWidth(2);

    hiszu->SetMarkerSize(0);
    hiszu->SetMarkerColor(0);
    hiszu->SetLineColor(kOrange);
    hiszu->SetFillColor(kOrange);

    hiszd->SetMarkerSize(0);
    hiszd->SetMarkerColor(0);
    hiszd->SetLineColor(10);
    hiszd->SetFillColor(10);

    hiszj->SetMarkerSize(0);
    hiswj->SetMarkerSize(0);
    hiszn->SetMarkerSize(0);

    hisdm->SetMarkerSize(0);
    hisdm->SetLineStyle(7);
    hisdm->SetLineWidth(2);

    TCanvas* canvas = new TCanvas("canvas", "canvas", 500, 500);
    canvas->SetRightMargin(0.075);
    canvas->SetTopMargin(0.075);
    TH1* frame = canvas->DrawFrame(250., 2.0, 1000., 100000.0, "");
    frame->GetXaxis()->SetTitle("E_{T}^{miss} [GeV]");
    frame->GetXaxis()->SetLabelSize(0.9*frame->GetXaxis()->GetLabelSize());
    frame->GetYaxis()->SetLabelSize(0.9*frame->GetYaxis()->GetLabelSize());
    canvas->SetLogy();
    frame->Draw();
    hiszu->Draw("HIST SAME");
    hiszd->Draw("HIST SAME");
    hiszn->Draw("HIST SAME");
    hiswj->Draw("HIST SAME");
    hiszj->Draw("HIST SAME");
    hisdm->Draw("HIST SAME");
    hisdt->Draw("PE SAME");

    canvas->RedrawAxis();
    }

    else {
    TFile* outfile = new TFile("monojet_8TeV_shape_histogram.root", "RECREATE");
    hisdt->Write();
    hisdm->Write();
    hiszn->Write();
    hiswj->Write();
    hiszj->Write();
    hisdi->Write();
    histt->Write();
    hisst->Write();
    hisqc->Write();
    hiszu->Write();
    hiszd->Write();
    hiswu->Write();
    hiswd->Write();
    outfile->Close();
    }
}
开发者ID:kmcdermo,项目名称:AnalysisCode,代码行数:101,代码来源:shapehist.C

示例13: SignfificanceT2tt

void SignfificanceT2tt(bool pval, int exp=0){


    TFile *f = TFile::Open("Significances2DHistograms_T2tt.root");
    TH2F *h;
    if(pval){
        if(exp==0) h = (TH2F*)f->Get("hpObs");
        else if(exp==1) h = (TH2F*)f->Get("hpExpPosteriori");
        else if(exp==2) h = (TH2F*)f->Get("hpExpPriori");
    }
    else {
        if(exp==0) h = (TH2F*)f->Get("hObs");
        else if(exp==1) h = (TH2F*)f->Get("hExpPosteriori");
        else if(exp==2) h = (TH2F*)f->Get("hExpPriori");
    }
    h->GetXaxis()->SetTitle("m_{#tilde{t}} [GeV]");
    h->GetXaxis()->SetLabelFont(42);
    h->GetXaxis()->SetLabelSize(0.035);
    h->GetXaxis()->SetTitleSize(0.05);
    h->GetXaxis()->SetTitleOffset(1.2);
    h->GetXaxis()->SetTitleFont(42);
    h->GetYaxis()->SetTitle("m_{#tilde{#chi}_{1}^{0}} [GeV]");
    h->GetYaxis()->SetLabelFont(42);
    h->GetYaxis()->SetLabelSize(0.035);
    h->GetYaxis()->SetTitleSize(0.05);
    h->GetYaxis()->SetTitleOffset(1.35);
    h->GetYaxis()->SetTitleFont(42);
    double maximum = h->GetMaximum();
    double minimum = h->GetMinimum();
    double sigmin = 99; int sigminx=-1; int sigminy=-1; if(pval) sigmin = -99;
    h->GetZaxis()->SetRangeUser(minimum,maximum);
    for(int x = 1; x<=h->GetNbinsX();++x){
        for(int y = 1; y<=h->GetNbinsX();++y){
            if(!pval&&h->GetBinContent(x,y)<sigmin){ sigmin =h->GetBinContent(x,y); sigminx = x; sigminy = y; }
            if( pval&&h->GetBinContent(x,y)>sigmin){ sigmin =h->GetBinContent(x,y); sigminx = x; sigminy = y; }
            if(!pval&&h->GetXaxis()->GetBinLowEdge(x)<h->GetYaxis()->GetBinLowEdge(y)+75) h->SetBinContent(x,y,-999);
            if(h->GetXaxis()->GetBinLowEdge(x)<374) continue;
            if(h->GetXaxis()->GetBinLowEdge(x)>424) continue;
            if(h->GetYaxis()->GetBinLowEdge(y)<199) continue;
            if(h->GetYaxis()->GetBinLowEdge(y)>249) continue;
            if(!pval&&h->GetBinContent(x,y)>0.3) h->SetBinContent(x,y,0.05);
        }
    }
    h->GetZaxis()->SetRangeUser(minimum,maximum);
    if(!pval) cout << "minimal significance " << sigmin << " at " << h->GetXaxis()->GetBinLowEdge(sigminx) << "-" << h->GetYaxis()->GetBinLowEdge(sigminy) << endl;
    else cout << "maximal p- value " << sigmin << " at " << h->GetXaxis()->GetBinLowEdge(sigminx) << "-" << h->GetYaxis()->GetBinLowEdge(sigminy) << endl;
    
   TCanvas *c1 = new TCanvas("c1", "c1",50,50,600,600);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   gStyle->SetErrorX(0.5); 
   //c1->Range(-6.311689,-1.891383,28.75325,4.56342);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   //c1->SetLogy();
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
//   c1->SetRightMargin(0.05);
    c1->SetRightMargin(0.15);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.15);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
   gStyle->SetHatchesLineWidth(0);

   TH1F *hSum = new TH1F("hSum","",10,100,900);
   hSum->SetMinimum(0.);
   hSum->SetMaximum(550);
   hSum->SetDirectory(0);
   hSum->SetStats(0);
    hSum->Draw();
    hSum->GetYaxis()->SetRangeUser(0,500);
    hSum->GetXaxis()->SetRangeUser(100,900);

   Int_t ci;   // for color index setting
   ci = TColor::GetColor("#000099");
   hSum->SetLineColor(ci);
   hSum->SetLineStyle(0);
   hSum->SetMarkerStyle(20);
   hSum->GetXaxis()->SetTitle("m_{#tilde{t}} [GeV]");
   //hSum->GetXaxis()->SetBit(TAxis::kLabelsVert);
   hSum->GetXaxis()->SetLabelFont(42);
   //hSum->GetXaxis()->SetLabelOffset(0.005);
   hSum->GetXaxis()->SetLabelSize(0.035);
   hSum->GetXaxis()->SetTitleSize(0.06);
   hSum->GetXaxis()->SetTitleOffset(1.2);
   hSum->GetXaxis()->SetTitleFont(42);
   hSum->GetYaxis()->SetTitle("m_{#tilde{#chi}}_{1}^{0} [GeV]");
   hSum->GetYaxis()->SetLabelFont(42);
   //hSum->GetYaxis()->SetLabelOffset(0.007);
   hSum->GetYaxis()->SetLabelSize(0.035);
   hSum->GetYaxis()->SetTitleSize(0.05);
   hSum->GetYaxis()->SetTitleOffset(1.3);
   hSum->GetYaxis()->SetTitleFont(42);
    
//.........这里部分代码省略.........
开发者ID:haweber,项目名称:OneLepStop,代码行数:101,代码来源:SignificanceT2tt.C

示例14: Polarization

void Polarization(){

    TGraph *gObs;
    TGraph *gExp;
    TGraph *gObsL;
    TGraph *gExpL;
    TGraph *gObsR;
    TGraph *gExpR;
    
    TFile *fc = TFile::Open("Limits2DHistograms_T2tt_postfit.root");
    TFile *fl = TFile::Open("Limits2DHistograms_T2tt_lefthanded_postfit.root");
    TFile *fr = TFile::Open("Limits2DHistograms_T2tt_righthanded_postfit.root");
    
    TGraph *g;
    fc->cd();
    g = (TGraph*)fc->Get("gObs");
    gObs = (TGraph*)g->Clone("Obs");
    g = (TGraph*)fc->Get("gExp");
    gExp = (TGraph*)g->Clone("Exp");
    fl->cd();
    g = (TGraph*)fl->Get("gObs_2");
    gObsL = (TGraph*)g->Clone("ObsL");
    g = (TGraph*)fl->Get("gExp_2");
    gExpL = (TGraph*)g->Clone("ExpL");
    fr->cd();
    g = (TGraph*)fr->Get("gObs");
    gObsR = (TGraph*)g->Clone("ObsR");
    g = (TGraph*)fr->Get("gExp");
    gExpR = (TGraph*)g->Clone("ExpR");
    
    gObs->SetLineWidth(4);
    gExp->SetLineWidth(4);
    gObsL->SetLineWidth(2);
    gExpL->SetLineWidth(2);
    gObsR->SetLineWidth(2);
    gExpR->SetLineWidth(2);
    gObs->SetLineStyle(1);
    gExp->SetLineStyle(7);
    gObsL->SetLineStyle(1);
    gExpL->SetLineStyle(7);
    gObsR->SetLineStyle(1);
    gExpR->SetLineStyle(7);
    gObs->SetLineColor(kBlack);
    gExp->SetLineColor(kBlack);
    gObsL->SetLineColor(kBlue);
    gExpL->SetLineColor(kBlue);
    gObsR->SetLineColor(kRed);
    gExpR->SetLineColor(kRed);
    if(killlowdiag){
    for( int i = gObs->GetN()-1; i>=0;--i){
        double x,y;
        gObs->GetPoint(i,x,y);
        if(x-y<172.5) gObs->RemovePoint(i);
    }
    for( int i = gExp->GetN()-1; i>=0;--i){
        double x,y;
        gExp->GetPoint(i,x,y);
        if(x-y<172.5) gExp->RemovePoint(i);
    }
    }
    for( int i = gObsL->GetN()-1; i>=0;--i){
        double x,y;
        gObsL->GetPoint(i,x,y);
        if(x-y<172.5) gObsL->RemovePoint(i);
    }
    for( int i = gObsR->GetN()-1; i>=0;--i){
        double x,y;
        gObsR->GetPoint(i,x,y);
        if(x-y<172.5) gObsR->RemovePoint(i);
    }
    for( int i = gExpL->GetN()-1; i>=0;--i){
        double x,y;
        gExpL->GetPoint(i,x,y);
        if(x-y<172.5) gExpL->RemovePoint(i);
    }
    for( int i = gExpR->GetN()-1; i>=0;--i){
        double x,y;
        gExpR->GetPoint(i,x,y);
        if(x-y<172.5) gExpR->RemovePoint(i);
    }

    
   TCanvas *c1 = new TCanvas("c1", "c1",50,50,600,600);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   gStyle->SetErrorX(0.5); 
   //c1->Range(-6.311689,-1.891383,28.75325,4.56342);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   //c1->SetLogy();
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.15);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
//.........这里部分代码省略.........
开发者ID:haweber,项目名称:OneLepStop,代码行数:101,代码来源:Polarization.C

示例15: CommandMSUGRA


//.........这里部分代码省略.........
  TH2D* hist = new TH2D("h","h",100,m0min,m0max,100,120,m12max);
  hist->Draw();  
  hist->GetXaxis()->SetTitle("m_{0} (GeV/c^{2})");
  hist->GetYaxis()->SetTitle("m_{1/2} (GeV/c^{2})");
  hist->GetYaxis()->SetTitleOffset(1.);
  hist->GetXaxis()->SetNdivisions(506);
  //  if (tanBeta_ == 50)  hist->GetXaxis()->SetNdivisions(504);
  hist->GetYaxis()->SetNdivisions(506);

  //int col[]={2,3,4};

  
  //TFile *f = TFile::Open("exclusion_Spring11_CLs.root");        
  //TFile *f = TFile::Open("exclusion_Fall10_tcmet_JPT.root"); 
  //TFile *f = TFile::Open("exclusion_Fall10_pfmet_pfjets.root"); 
  //TFile *f = new TFile("exclusion_Fall10_pfmet_pfjets_CLs.root");
  
  //TH2F* h = (TH2F*) f->Get("hexcl_NLO_obs");
  //TH2F* h = (TH2F*) f->Get("hexcl_NLO_exp");
  //TH2F* h = (TH2F*) f->Get("hexcl_NLO_expp1");
  //TH2F* h = (TH2F*) f->Get("hexcl_NLO_expm1");

  //h->SetMaximum(3);
  //h->Draw("samecolz");
  
  TSpline3 *sFirst = new TSpline3("sFirst",First);
  sFirst->SetLineColor(kRed);
  sFirst->SetLineWidth(3);
  First->SetLineColor(kRed);
  First->SetLineWidth(3);

  TSpline3 *sSecond = new TSpline3("sSecond",Second);
  sSecond->SetLineColor(kBlue);
  sSecond->SetLineStyle(2);
  sSecond->SetLineWidth(3);
  Second->SetLineColor(kBlue);
  Second->SetLineStyle(2);
  Second->SetLineWidth(3);

  TSpline3 *sSecond_up = new TSpline3("sSecond_up",Second_up);
  sSecond_up->SetLineColor(kCyan);
  sSecond_up->SetLineStyle(1);
  sSecond_up->SetLineWidth(3);
  Second_up->SetLineColor(kBlue);
  //Second_up->SetLineColor(1);
  Second_up->SetLineWidth(2);

  TSpline3 *sSecond_low = new TSpline3("sSecond_low",Second_low);
  sSecond_low->SetLineColor(kCyan);
  sSecond_low->SetLineStyle(1);
  sSecond_low->SetLineWidth(3);
  Second_low->SetLineColor(kBlue);
  //Second_low->SetLineColor(1);
  Second_low->SetLineWidth(2);

  Third->SetLineColor(kCyan);
  Third->SetLineWidth(30);

  
  // TSpline3 *sThird = new TSpline3("sThird",Third);
  // sThird->SetLineColor(kGreen+2);
  // sThird->SetLineStyle(4);
  // sThird->SetLineWidth(3);
  // Third->SetLineColor(kGreen+2);
  // Third->SetLineStyle(4);
  // Third->SetLineWidth(3);
开发者ID:hooberman,项目名称:UserCode,代码行数:67,代码来源:ExclusionPlot.C


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