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


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

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


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

示例1: histogramStyle

void histogramStyle(TH1& hist, int color, int lineStyle, int markerStyle, float markersize, int filled) 
{
  hist.SetLineWidth(3);
  hist.SetStats(kFALSE);
  hist.SetLineColor  (color);
  hist.SetMarkerColor(color);  
  hist.SetMarkerStyle(markerStyle);
  hist.SetMarkerSize(markersize);
  hist.SetLineStyle(lineStyle);
  if(filled==1){
  hist.SetFillStyle(1001);
  hist.SetFillColor(color);
  }
  else{
    hist.SetFillStyle(0);
  }
}
开发者ID:eschliec,项目名称:TopAnalysis,代码行数:17,代码来源:wjetsAsymmetrieEstimator.C

示例2: SetColorAndStyleHisto

/**
SetColor/Style Histo
*/
void SetColorAndStyleHisto(TH1 & histo , EColor color){
 histo.SetFillStyle (3001) ;
 histo.SetFillColor (color) ;
 histo.SetLineColor (color) ;
 histo.SetLineWidth (1) ;
 histo.SetMarkerColor (color) ;
 histo.SetMarkerSize (1) ;
 histo.SetMarkerStyle (20) ;
}
开发者ID:amassiro,项目名称:usercode,代码行数:12,代码来源:EE_EnScale.cpp

示例3: SetStyle

void SetStyle(TH1& h, double size, int color, int style, int fillstyle=0, int linestyle=1){
	h.SetMarkerSize(size);
	h.SetMarkerColor(color);
	h.SetLineColor(color);
	h.SetMarkerStyle(style);
	h.SetFillStyle(fillstyle);
	h.SetLineStyle(linestyle);
	h.GetXaxis()->SetTitleFont(42);
	h.GetYaxis()->SetTitleFont(42);
	h.GetXaxis()->SetTitleSize(0.048);
	h.GetYaxis()->SetTitleSize(0.048);
	h.GetXaxis()->CenterTitle();
	h.GetYaxis()->CenterTitle();
}
开发者ID:XuQiao,项目名称:phenix,代码行数:14,代码来源:SimplifyLife.C

示例4: draw_delta_comparison

void plotter::draw_delta_comparison( TH1* total_, TH1* stat_, std::vector<TH1*> MODEL_DELTA, std::vector<TString> UncertNames, TString category, TString file_name){
  TH1* total = (TH1*) total_->Clone();
  TH1* stat = (TH1*) stat_->Clone();
  std::vector<TH1*> delta;
  for(unsigned int i=0; i<MODEL_DELTA.size(); i++){
    delta.push_back( (TH1*) MODEL_DELTA[i]->Clone() );
  }

  TCanvas *c= new TCanvas("c","",600,600);
  gPad->SetLeftMargin(0.15);
  total->SetTitle("");
  total->GetXaxis()->SetTitle("Leading-jet mass [GeV]");
  total->GetYaxis()->SetTitle("relative uncertainty [%]");
  total->GetYaxis()->SetTitleOffset(1.5);
  total->GetYaxis()->SetNdivisions(505);
  total->GetYaxis()->SetRangeUser(0, 100);
  total->SetFillColor(13);
  total->SetFillStyle(3144);
  total->SetLineColor(13);
  total->SetMarkerStyle(-1);
  total->Draw("HIST");
  stat->SetLineColor(kBlack);
  stat->SetLineWidth(4);
  stat->SetMarkerStyle(0);
  stat->Draw("B SAME");

  Color_t col[] = {kRed-4, kAzure+7, kGreen, 798, kBlue, kOrange-3, kMagenta, kYellow, kAzure, 14, kRed+5, kGreen-8};
  int i=0;
  for(auto hist: delta){
    gPad->SetLeftMargin(0.15);
    hist->SetLineColor(col[i]);
    hist->SetLineWidth(4);
    hist->SetMarkerStyle(0);
    hist->Draw("B SAME");
    i++;
  }

  // LEGEND
  TLegend *leg = new TLegend(0.4,0.6,0.88,0.88);
  leg->SetFillStyle(0);
  leg->SetNColumns(2);
  if(category == "exp")        leg->AddEntry(total, "stat #oplus exp. sys", "f");
  else if(category == "model") leg->AddEntry(total, "stat #oplus model sys", "f");
  leg->AddEntry(stat, "stat", "l");
  for(unsigned int i=0; i<delta.size(); i++){
    if      (UncertNames[i] == "mass")      leg->AddEntry(delta[i],"choice of m_{t}","l");
    else if (UncertNames[i] == "stat")      leg->AddEntry(delta[i],"statistics","l");
    else if (UncertNames[i] == "b-tagging") leg->AddEntry(delta[i],"b tagging","l");
    else if (UncertNames[i] == "pile-up")   leg->AddEntry(delta[i],"pileup","l");
    else if (UncertNames[i] == "jec")       leg->AddEntry(delta[i],"jet energy scale","l");
    else if (UncertNames[i] == "jer")       leg->AddEntry(delta[i],"jet energy resolution","l");
    else if (UncertNames[i] == "cor")       leg->AddEntry(delta[i],"XCone jet correction","l");
    else if (UncertNames[i] == "MuTrigger") leg->AddEntry(delta[i],"muon trigger","l");
    else if (UncertNames[i] == "MuID")      leg->AddEntry(delta[i],"muon ID","l");
    else if (UncertNames[i] == "ElTrigger") leg->AddEntry(delta[i],"electron trigger","l");
    else if (UncertNames[i] == "ElID")      leg->AddEntry(delta[i],"electron ID","l");
    else if (UncertNames[i] == "ElReco")    leg->AddEntry(delta[i],"electron reconstruction","l");
    else if (UncertNames[i] == "hdamp")     leg->AddEntry(delta[i],"h_{damp}","l");
    else                                    leg->AddEntry(delta[i],UncertNames[i],"l");
  }
  leg->Draw();

  gPad->RedrawAxis();
  c->SaveAs(directory + file_name + ".pdf");
  delete c;
}
开发者ID:UHH2,项目名称:MTopJet,代码行数:66,代码来源:plotter.C

示例5: LoadLibraries


//.........这里部分代码省略.........
      spectraArray.Add(hITSsa);
      hITSsa->DrawCopy("same");
      if (hITSsa->GetMaximum() > maximum) maximum = hITSsa->GetMaximum();
      if (hITSsa->GetMinimum() < minimum) minimum = hITSsa->GetMinimum();
    }
    if (hITSTPC) {
      AddPointsToGraph(hITSTPC, gCombined[icent]);
      AddPointsToProfile(hITSTPC, pCombined[icent]);
      spectraArray.Add(hITSTPC);
      hITSTPC->DrawCopy("same");
      if (hITSTPC->GetMaximum() > maximum) maximum = hITSTPC->GetMaximum();
      if (hITSTPC->GetMinimum() < minimum) minimum = hITSTPC->GetMinimum();
    }
    if (hTPCTOF) {
      AddPointsToGraph(hTPCTOF, gCombined[icent]);
      AddPointsToProfile(hTPCTOF, pCombined[icent]);
      spectraArray.Add(hTPCTOF);
      hTPCTOF->DrawCopy("same");
      if (hTPCTOF->GetMaximum() > maximum) maximum = hTPCTOF->GetMaximum();
      if (hTPCTOF->GetMinimum() < minimum) minimum = hTPCTOF->GetMinimum();
    }
    if (hTOF) {
      AddPointsToGraph(hTOF, gCombined[icent]);
      AddPointsToProfile(hTOF, pCombined[icent]);
      spectraArray.Add(hTOF);
      hTOF->DrawCopy("same");
      if (hTOF->GetMaximum() > maximum) maximum = hTOF->GetMaximum();
      if (hTOF->GetMinimum() < minimum) minimum = hTOF->GetMinimum();
    }
    if (hHydro) {
      ;//hHydro->Draw("c,same");
    }
    TLegend *legend = curpad->BuildLegend();
    legend->SetFillStyle(0);
    legend->SetFillColor(0);
    legend->DeleteEntry();

    hArea->SetMaximum(maximum * 1.1);
    hArea->SetMinimum(0.01);
    //    gPad->SetLogy();

    /*** RATIOS ***/

    /* switch canvas */
    if (cent == -1)
      curpad = (TPad *)cCanvasRatio->cd(icent + 1);
    else
      curpad = (TPad *)cCanvasRatio->cd();

   
    /* area histo */
    if (!ratio)
      TH1D *hAreaRatio = new TH1D(Form("hAreaRatio_%d", icent), Form("%s (%s);p_{T} (GeV/c);ratio;", partChargeName[part][charge], centName[icent]), 100, 0., 5.);
    else
      TH1D *hAreaRatio = new TH1D(Form("hAreaRatio_%d", icent), Form("%s (%s);p_{T} (GeV/c);ratio;", "generic ratio", centName[icent]), 100, 0., 5.);

    hAreaRatio->SetMaximum(1.5);
    hAreaRatio->SetMinimum(0.5);
    hAreaRatio->Draw();

    /* do ratios */
    if (hITSsa && hITSTPC) {
      hRatio_ITSsa_ITSTPC[icent] = new TH1D(*hITSsa);
      hRatio_ITSsa_ITSTPC[icent]->Divide(hITSTPC);
      hRatio_ITSsa_ITSTPC[icent]->SetNameTitle(Form("hRatio_ITSsa_ITSTPC_cent%d", icent), "ITSsa / ITSTPC");
      hRatio_ITSsa_ITSTPC[icent]->Draw("same");
开发者ID:ktf,项目名称:AliPhysics,代码行数:67,代码来源:CompareSpectra.C

示例6: GetCentK

TH1* GetCentK(TDirectory* top, Double_t c1, Double_t c2, Int_t s,
	      TLegend* l)
{
  TString dname; dname.Form("cent%06.2f_%06.2f", c1, c2);
  dname.ReplaceAll(".", "d");
  TDirectory* d = top->GetDirectory(dname);
  if (!d) {
    Warning("GetCetnK", "Directory %s not found in %s",
	    dname.Data(), top->GetName());
    return;
  }

  TDirectory* det = d->GetDirectory("details");
  if (!det) {
    Warning("GetCetnK", "Directory details not found in %s",
	    d->GetName());
    d->ls();
    return;
  }

  TObject* o = det->Get("scalar");
  if (!o) {
    Warning("GetCetnK", "Object scalar not found in %s",
	    det->GetName());
    return;
  }

  if (!o->IsA()->InheritsFrom(TH1::Class())) {
    Warning("GetCetnK", "Object %s is not a TH1, but a %s",
	    o->GetName(), o->ClassName());
    return;
  }
  TH1* h = static_cast<TH1*>(o->Clone());
  Color_t col = cc[(s-1)%10];
  h->SetLineColor(col);
  h->SetMarkerColor(col);
  h->SetFillColor(col);
  h->SetFillStyle(1001);
  // h->SetTitle(Form("%5.2f-%5.2f%% #times %d", c1, c2, s));
  h->SetTitle(Form("%2.0f-%2.0f%% + %d", c1, c2, s-1));
  TF1* f = new TF1("", "[0]",-2.2,2.2);
  f->SetParameter(0,s-1);
  f->SetLineColor(col);
  f->SetLineStyle(7);
  f->SetLineWidth(1);
  // h->Scale(s);
  h->Add(f);
  h->GetListOfFunctions()->Add(f);
  f->SetParameter(0,s);
  for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
    if (TMath::Abs(h->GetBinCenter(i)) > 2) {
      h->SetBinContent(i,0);
      h->SetBinError(i,0);
    }
  }
  
  TLegendEntry* e = l->AddEntry(h, h->GetTitle(), "f");
  e->SetFillColor(col);
  e->SetFillStyle(1001);
  e->SetLineColor(col);

  return h;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:63,代码来源:DrawKs.C

示例7: makePlot

void makePlot(const std::string& inputFilePath, const std::string& canvasName, const std::string& sample, int massPoint, const std::string& channel, double k, 
	      const std::string& inputFileName, const std::string& outputFilePath, const std::string& outputFileName)
{
  std::string inputFileName_full = Form("%s%s", inputFilePath.data(), inputFileName.data());
  TFile* inputFile = new TFile(inputFileName_full.data());
  if ( !inputFile ) {
    std::cerr << "Failed to open input file = " << inputFileName_full << " !!" << std::endl;
    assert(0);
  }

  inputFile->ls();

  TCanvas* canvas = dynamic_cast<TCanvas*>(inputFile->Get(canvasName.data()));
  if ( !canvas ) {
    std::cerr << "Failed to load canvas = " << canvasName << " !!" << std::endl;
    assert(0);
  }

  int idxPad = -1;
  if ( massPoint ==  90 ) idxPad = 1;
  if ( massPoint == 125 ) idxPad = 2;
  if ( massPoint == 200 ) idxPad = 3;
  if ( massPoint == 300 ) idxPad = 4;
  if ( massPoint == 500 ) idxPad = 5;
  if ( massPoint == 800 ) idxPad = 6;  
  if ( !(idxPad >= 1 && idxPad <= 6) ) {
    std::cerr << "Invalid sample = " << sample << " !!" << std::endl;
    assert(0);
  }
  TVirtualPad* pad = canvas->GetPad(idxPad);
  std::cout << "pad = " << pad << ": ClassName = " << pad->ClassName() << std::endl;

  TCanvas* canvas_new = new TCanvas("canvas_new", "canvas_new", 900, 800);
  canvas_new->SetFillColor(10);
  canvas_new->SetBorderSize(2);
  canvas_new->SetTopMargin(0.065);
  canvas_new->SetLeftMargin(0.17);
  canvas_new->SetBottomMargin(0.165);
  canvas_new->SetRightMargin(0.015);
  canvas_new->SetLogx(true);
  canvas_new->SetLogy(true);
  canvas_new->Draw();
  canvas_new->cd();

  //TList* pad_primitives = canvas->GetListOfPrimitives();
  TList* pad_primitives = pad->GetListOfPrimitives();

  TH1* histogramCA            = 0;
  TH1* histogramSVfit         = 0;
  TH1* histogramSVfitMEMkEq0  = 0;
  TH1* histogramSVfitMEMkNeq0 = 0;

  TIter pad_nextObj(pad_primitives);
  while ( TObject* obj = pad_nextObj() ) {
    std::string objName = "";
    if ( dynamic_cast<TNamed*>(obj) ) objName = (dynamic_cast<TNamed*>(obj))->GetName();    
    std::cout << "obj = " << obj << ": name = " << objName << ", type = " << obj->ClassName() << std::endl;

    TH1* tmpHistogram = dynamic_cast<TH1*>(obj);
    if ( tmpHistogram ) {
      std::cout << "tmpHistogram:" 
		<< " fillColor = " << tmpHistogram->GetFillColor() << ", fillStyle = " << tmpHistogram->GetFillStyle() << ","
		<< " lineColor = " << tmpHistogram->GetLineColor() << ", lineStyle = " << tmpHistogram->GetLineStyle() << ", lineWidth = " << tmpHistogram->GetLineWidth() << ","
		<< " markerColor = " << tmpHistogram->GetMarkerColor() << ", markerStyle = " << tmpHistogram->GetMarkerStyle() << ", markerSize = " << tmpHistogram->GetMarkerSize() << ","
		<< " integral = " << tmpHistogram->Integral() << std::endl;
      std::cout << "(mean = " << tmpHistogram->GetMean() << ", rms = " << tmpHistogram->GetRMS() << ": rms/mean = " << (tmpHistogram->GetRMS()/tmpHistogram->GetMean()) << ")" << std::endl;
      if ( tmpHistogram->GetLineColor() == 416 ) histogramCA            = tmpHistogram;
      if ( tmpHistogram->GetLineColor() == 600 ) histogramSVfit         = tmpHistogram;
      if ( tmpHistogram->GetLineColor() == 616 ) histogramSVfitMEMkEq0  = tmpHistogram;
      if ( tmpHistogram->GetLineColor() == 632 ) histogramSVfitMEMkNeq0 = tmpHistogram;
    }
  }

  if ( !(histogramCA && histogramSVfit && histogramSVfitMEMkEq0 && histogramSVfitMEMkNeq0) ) {
    std::cerr << "Failed to load histograms !!" << std::endl;
    assert(0);
  }

  //gStyle->SetLineStyleString(2,"40 10 10 10 10 10 10 10");
  //gStyle->SetLineStyleString(3,"25 15");
  //gStyle->SetLineStyleString(4,"60 25");

  //int colors[4] = { kBlack, kGreen - 6, kBlue - 7, kMagenta - 7  };
  int colors[4] = { 28, kGreen - 6, kBlue - 7, kBlack };
  //int lineStyles[4] = { 2, 3, 4, 1 };
  int lineStyles[4] = { 7, 1, 1, 1 };
  //int lineWidths[4] = { 3, 3, 4, 3 };
  int lineWidths[4] = { 3, 3, 1, 1 };
  int markerStyles[4] = { 20, 25, 21, 24 };
  int markerSizes[4] = { 2, 2, 2, 2 };

  histogramCA->SetFillColor(0);
  histogramCA->SetFillStyle(0);
  histogramCA->SetLineColor(colors[0]);
  histogramCA->SetLineStyle(lineStyles[0]);
  histogramCA->SetLineWidth(lineWidths[0]);
  histogramCA->SetMarkerColor(colors[0]);
  histogramCA->SetMarkerStyle(markerStyles[0]);
  histogramCA->SetMarkerSize(markerSizes[0]);

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

示例8: makePlot

void makePlot(const std::string& inputFilePath, const std::string& canvasName, const std::string& histogram, const std::string& channel, const std::string& xAxisTitle, const std::string& yAxisTitle,
	      const std::string& inputFileName, const std::string& outputFilePath, const std::string& outputFileName)
{
  std::string inputFileName_full = Form("%s%s", inputFilePath.data(), inputFileName.data());
  TFile* inputFile = new TFile(inputFileName_full.data());
  if ( !inputFile ) {
    std::cerr << "Failed to open input file = " << inputFileName_full << " !!" << std::endl;
    assert(0);
  }

  inputFile->ls();

  TCanvas* canvas = dynamic_cast<TCanvas*>(inputFile->Get(canvasName.data()));
  if ( !canvas ) {
    std::cerr << "Failed to load canvas = " << canvasName << " !!" << std::endl;
    assert(0);
  }

  int idxPad = -1;
  if ( histogram == "mVis"    ) idxPad = 1;
  if ( histogram == "mTauTau" ) idxPad = 2;
  if ( !(idxPad >= 1 && idxPad <= 2) ) {
    std::cerr << "Invalid histogram = " << histogram << " !!" << std::endl;
    assert(0);
  }
  TVirtualPad* pad = canvas->GetPad(idxPad);
  std::cout << "pad = " << pad << ": ClassName = " << pad->ClassName() << std::endl;

  TCanvas* canvas_new = new TCanvas("canvas_new", "canvas_new", 900, 850);
  canvas_new->SetFillColor(10);
  canvas_new->SetBorderSize(2);
  canvas_new->SetTopMargin(0.065);
  canvas_new->SetLeftMargin(0.17);
  canvas_new->SetBottomMargin(0.155);
  canvas_new->SetRightMargin(0.045);
  canvas_new->SetLogx(false);
  canvas_new->SetLogy(false);
  canvas_new->Draw();
  canvas_new->cd();

  //TList* pad_primitives = canvas->GetListOfPrimitives();
  TList* pad_primitives = pad->GetListOfPrimitives();

  TH1* histogramDYJets   = 0;
  TH1* histogramHiggs125 = 0;
  TH1* histogramHiggs200 = 0;
  TH1* histogramHiggs300 = 0;

  TIter pad_nextObj(pad_primitives);
  while ( TObject* obj = pad_nextObj() ) {
    std::string objName = "";
    if ( dynamic_cast<TNamed*>(obj) ) objName = (dynamic_cast<TNamed*>(obj))->GetName();    
    std::cout << "obj = " << obj << ": name = " << objName << ", type = " << obj->ClassName() << std::endl;

    TH1* tmpHistogram = dynamic_cast<TH1*>(obj);
    if ( tmpHistogram ) {
      std::cout << "tmpHistogram:" 
		<< " fillColor = " << tmpHistogram->GetFillColor() << ", fillStyle = " << tmpHistogram->GetFillStyle() << ","
		<< " lineColor = " << tmpHistogram->GetLineColor() << ", lineStyle = " << tmpHistogram->GetLineStyle() << ", lineWidth = " << tmpHistogram->GetLineWidth() << ","
		<< " markerColor = " << tmpHistogram->GetMarkerColor() << ", markerStyle = " << tmpHistogram->GetMarkerStyle() << ", markerSize = " << tmpHistogram->GetMarkerSize() << ","
		<< " integral = " << tmpHistogram->Integral() << std::endl;
      if ( tmpHistogram->GetFillColor() ==   0 ) histogramDYJets   = tmpHistogram;
      if ( tmpHistogram->GetFillColor() == 632 ) histogramHiggs125 = tmpHistogram;
      if ( tmpHistogram->GetFillColor() == 616 ) histogramHiggs200 = tmpHistogram;
      if ( tmpHistogram->GetFillColor() == 600 ) histogramHiggs300 = tmpHistogram;
    }
  }

  if ( !(histogramDYJets && histogramHiggs125 && histogramHiggs200 && histogramHiggs300) ) {
    std::cerr << "Failed to load histograms !!" << std::endl;
    assert(0);
  }

  int lineColors[4] = { 1, 2, 6, 4 };
  int lineStyles[4] = { 1, 1, 1, 1 };
  int lineWidths[4] = { 2, 2, 2, 2 };
  int fillColors[4] = { 10, 2, 6, 4 };
  int fillStyles[4] = { 0, 3002, 3004, 3005 };

  histogramDYJets->SetFillColor(fillColors[0]);
  histogramDYJets->SetFillStyle(fillStyles[0]);
  histogramDYJets->SetLineColor(lineColors[0]);
  histogramDYJets->SetLineStyle(lineStyles[0]);
  histogramDYJets->SetLineWidth(lineWidths[0]);

  histogramHiggs125->SetFillColor(fillColors[1]);
  histogramHiggs125->SetFillStyle(fillStyles[1]);
  histogramHiggs125->SetLineColor(lineColors[1]);
  histogramHiggs125->SetLineStyle(lineStyles[1]);
  histogramHiggs125->SetLineWidth(lineWidths[1]);

  histogramHiggs200->SetFillColor(fillColors[2]);
  histogramHiggs200->SetFillStyle(fillStyles[2]);
  histogramHiggs200->SetLineColor(lineColors[2]);
  histogramHiggs200->SetLineStyle(lineStyles[2]);
  histogramHiggs200->SetLineWidth(lineWidths[2]);

  histogramHiggs300->SetFillColor(fillColors[3]);
  histogramHiggs300->SetFillStyle(fillStyles[3]);
  histogramHiggs300->SetLineColor(lineColors[3]);
//.........这里部分代码省略.........
开发者ID:veelken,项目名称:SVfitPerformanceStudies,代码行数:101,代码来源:makeSVfitMEM_massPlots_from13.C

示例9: trigeff

void trigeff(){

   gROOT->Reset();
//=========Macro generated from canvas: cEvtSel/EvtSel
//=========  (Wed Apr 14 17:19:34 2010) by ROOT version5.22/00d

   TCanvas *cEvtSel = new TCanvas("cEvtSel", "EvtSel",550,600);

   /*
   TCanvas *cEvtSel = new TCanvas("cEvtSel", "EvtSel",0,22,550,600);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   cEvtSel->Range(-13.62658,-0.215625,63.58861,1.221875);
   cEvtSel->SetFillColor(0);
   cEvtSel->SetBorderMode(0);
   cEvtSel->SetBorderSize(0);
   cEvtSel->SetTickx(1);
   cEvtSel->SetTicky(1);
   cEvtSel->SetLeftMargin(0.17);
   cEvtSel->SetRightMargin(0.04);
   cEvtSel->SetTopMargin(0.05);
   cEvtSel->SetBottomMargin(0.15);
   cEvtSel->SetFrameLineColor(0);
   cEvtSel->SetFrameBorderMode(0);
   cEvtSel->SetFrameLineColor(0);
   cEvtSel->SetFrameBorderMode(0);
   */

   TH1 *hFrame1 = new TH2D("hFrame1","",1,-0.5,60.5,1,0,1.15);
   hFrame1->SetDirectory(0);
   hFrame1->SetStats(0);
   hFrame1->GetXaxis()->SetTitle("Charged-particle multiplicity");
   hFrame1->GetXaxis()->CenterTitle(true);
   hFrame1->GetYaxis()->SetTitle("Selection efficiency");
   hFrame1->GetYaxis()->CenterTitle(true);
   hFrame1->Draw("");
   
   hFrame1->GetXaxis()->SetNdivisions(312);

   /*
   TH1 *hFrame1 = new TH2D("hFrame1","",1,-0.5,60.5,1,0,1.15);
   hFrame1->SetDirectory(0);
   hFrame1->SetStats(0);
   hFrame1->SetFillColor(1);
   hFrame1->SetFillStyle(0);
   hFrame1->SetLineStyle(0);
   hFrame1->SetMarkerStyle(20);
   hFrame1->SetMarkerSize(1.5);
   hFrame1->GetXaxis()->SetTitle("Charged-particle multiplicity");
   hFrame1->GetXaxis()->CenterTitle(true);
   hFrame1->GetXaxis()->SetNdivisions(312);
   hFrame1->GetXaxis()->SetLabelFont(42);
   hFrame1->GetXaxis()->SetLabelOffset(0.01);
   hFrame1->GetXaxis()->SetLabelSize(0.045);
   hFrame1->GetXaxis()->SetTitleSize(0.055);
   hFrame1->GetXaxis()->SetTitleFont(42);
   hFrame1->GetYaxis()->SetTitle("Selection efficiency");
   hFrame1->GetYaxis()->CenterTitle(true);
   hFrame1->GetYaxis()->SetLabelFont(42);
   hFrame1->GetYaxis()->SetLabelOffset(0.01);
   hFrame1->GetYaxis()->SetLabelSize(0.045);
   hFrame1->GetYaxis()->SetTitleSize(0.055);
   hFrame1->GetYaxis()->SetTitleOffset(1.6);
   hFrame1->GetYaxis()->SetTitleFont(42);
   hFrame1->GetZaxis()->SetLabelFont(42);
   hFrame1->GetZaxis()->SetLabelSize(0.045);
   hFrame1->GetZaxis()->SetTitleFont(42);
   hFrame1->Draw("");
   */
   
   TH1 *trigeff = new TH1D("trigeff","trigeff",200,0,200);
   trigeff->SetBinContent(1,0.007879584);
   trigeff->SetBinContent(2,0.3524112);
   trigeff->SetBinContent(3,0.5050529);
   trigeff->SetBinContent(4,0.5978595);
   trigeff->SetBinContent(5,0.6587795);
   trigeff->SetBinContent(6,0.7034895);
   trigeff->SetBinContent(7,0.7451056);
   trigeff->SetBinContent(8,0.7911818);
   trigeff->SetBinContent(9,0.8363224);
   trigeff->SetBinContent(10,0.873251);
   trigeff->SetBinContent(11,0.9012649);
   trigeff->SetBinContent(12,0.9177872);
   trigeff->SetBinContent(13,0.9395182);
   trigeff->SetBinContent(14,0.9502278);
   trigeff->SetBinContent(15,0.9600504);
   trigeff->SetBinContent(16,0.9667429);
   trigeff->SetBinContent(17,0.9722969);
   trigeff->SetBinContent(18,0.977478);
   trigeff->SetBinContent(19,0.9801504);
   trigeff->SetBinContent(20,0.9840849);
   trigeff->SetBinContent(21,0.9843521);
   trigeff->SetBinContent(22,0.9856779);
   trigeff->SetBinContent(23,0.9894354);
   trigeff->SetBinContent(24,0.9892805);
   trigeff->SetBinContent(25,0.9913111);
   trigeff->SetBinContent(26,0.9934833);
   trigeff->SetBinContent(27,0.9907814);
   trigeff->SetBinContent(28,0.9928126);
   trigeff->SetBinContent(29,0.990099);
//.........这里部分代码省略.........
开发者ID:CmsHI,项目名称:CVS_ASYoon,代码行数:101,代码来源:trigeff.C

示例10: diffrac

void diffrac(){

   gROOT->Reset();
   //gROOT->ProcessLine(".x rootlogon.C");
   
//=========Macro generated from canvas: cEvtSel/EvtSel
//=========  (Wed Apr 14 17:19:02 2010) by ROOT version5.22/00d

   TCanvas *cEvtSel = new TCanvas("cEvtSel", "EvtSel",550,600);
   /*
   TCanvas *cEvtSel = new TCanvas("cEvtSel", "EvtSel",0,22,550,600);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   cEvtSel->Range(-32.99367,-0.009375,158.1456,0.053125);
   cEvtSel->SetFillColor(0);
   cEvtSel->SetBorderMode(0);
   cEvtSel->SetBorderSize(0);
   cEvtSel->SetTickx(1);
   cEvtSel->SetTicky(1);
   cEvtSel->SetLeftMargin(0.17);
   cEvtSel->SetRightMargin(0.04);
   cEvtSel->SetTopMargin(0.05);
   cEvtSel->SetBottomMargin(0.15);
   cEvtSel->SetFrameLineColor(0);
   cEvtSel->SetFrameBorderMode(0);
   cEvtSel->SetFrameLineColor(0);
   cEvtSel->SetFrameBorderMode(0);
   */

   //TH1 *hFrame2 = new TH2D("hFrame2","",1,-0.5,60.5,1,0,0.06);
   TH1 *hFrame2 = new TH2D("hFrame2","",1,-0.5,150.5,1,0,0.05); 
   hFrame2->SetDirectory(0);
   hFrame2->SetStats(0);
   hFrame2->GetXaxis()->SetTitle("Charged-particle multiplicity");
   hFrame2->GetXaxis()->CenterTitle(true);
   hFrame2->GetYaxis()->SetTitle("Fraction of events");
   hFrame2->GetYaxis()->CenterTitle(true);
   hFrame2->GetYaxis()->SetTitleOffset(1.5);
   hFrame2->Draw("");
   
   hFrame2->GetXaxis()->SetNdivisions(312);
   hFrame2->GetYaxis()->SetNdivisions(305);  

   /*
   TH1 *hFrame2 = new TH2D("hFrame2","",1,-0.5,150.5,1,0,0.05);
   hFrame2->SetDirectory(0);
   hFrame2->SetStats(0);
   hFrame2->SetFillColor(1);
   hFrame2->SetFillStyle(0);
   hFrame2->SetLineStyle(0);
   hFrame2->SetMarkerStyle(20);
   hFrame2->SetMarkerSize(1.5);
   hFrame2->GetXaxis()->SetTitle("Charged-particle multiplicity");
   hFrame2->GetXaxis()->CenterTitle(true);
   hFrame2->GetXaxis()->SetNdivisions(312);
   hFrame2->GetXaxis()->SetLabelFont(42);
   hFrame2->GetXaxis()->SetLabelOffset(0.01);
   hFrame2->GetXaxis()->SetLabelSize(0.045);
   hFrame2->GetXaxis()->SetTitleSize(0.055);
   hFrame2->GetXaxis()->SetTitleFont(42);
   hFrame2->GetYaxis()->SetTitle("Fraction of events");
   hFrame2->GetYaxis()->CenterTitle(true);
   hFrame2->GetYaxis()->SetLabelFont(42);
   hFrame2->GetYaxis()->SetLabelOffset(0.01);
   hFrame2->GetYaxis()->SetLabelSize(0.045);
   hFrame2->GetYaxis()->SetTitleSize(0.055);
   hFrame2->GetYaxis()->SetTitleOffset(1.5);
   hFrame2->GetYaxis()->SetTitleFont(42);
   hFrame2->GetZaxis()->SetLabelFont(42);
   hFrame2->GetZaxis()->SetLabelSize(0.045);
   hFrame2->GetZaxis()->SetTitleFont(42);
   hFrame2->Draw("");
   */
   
   TH1 *diffrac = new TH1D("diffrac","diffrac",200,0,200);
   diffrac->SetBinContent(1,0.0004697663);
   diffrac->SetBinContent(2,0.008010118);
   diffrac->SetBinContent(3,0.0127921);
   diffrac->SetBinContent(4,0.01698988);
   diffrac->SetBinContent(5,0.02012166);
   diffrac->SetBinContent(6,0.022341);
   diffrac->SetBinContent(7,0.02315105);
   diffrac->SetBinContent(8,0.02518068);
   diffrac->SetBinContent(9,0.02668032);
   diffrac->SetBinContent(10,0.02875512);
   diffrac->SetBinContent(11,0.03089617);
   diffrac->SetBinContent(12,0.0324741);
   diffrac->SetBinContent(13,0.03311853);
   diffrac->SetBinContent(14,0.03265478);
   diffrac->SetBinContent(15,0.03213081);
   diffrac->SetBinContent(16,0.03054987);
   diffrac->SetBinContent(17,0.0283245);
   diffrac->SetBinContent(18,0.02640026);
   diffrac->SetBinContent(19,0.02394001);
   diffrac->SetBinContent(20,0.02234401);
   diffrac->SetBinContent(21,0.02026921);
   diffrac->SetBinContent(22,0.01865213);
   diffrac->SetBinContent(23,0.01720369);
   diffrac->SetBinContent(24,0.01639665);
   diffrac->SetBinContent(25,0.01546013);
//.........这里部分代码省略.........
开发者ID:CmsHI,项目名称:CVS_ASYoon,代码行数:101,代码来源:diffrac.C

示例11: makePlot

void makePlot(double canvasSizeX, double canvasSizeY,
	      TH1* histogramTTH, 
	      TH1* histogramData, 
	      TH1* histogramTT,
	      TH1* histogramTTV,
	      TH1* histogramEWK,
	      TH1* histogramRares,
	      TH1* histogramBgrSum,
	      TH1* histogramBgrUncertainty,		
	      const std::string& xAxisTitle, double xAxisOffset,
	      bool useLogScale, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
	      const std::string& outputFileName)
{
  TH1* histogramTTH_density = 0;
  if ( histogramTTH ) {
    if ( histogramData ) checkCompatibleBinning(histogramTTH, histogramData);
    histogramTTH_density = divideHistogramByBinWidth(histogramTTH);
  }
  TH1* histogramData_density = 0;
  if ( histogramData ) {
    histogramData_density = divideHistogramByBinWidth(histogramData);      
  }
  TH1* histogramTT_density = 0;
  if ( histogramTT ) {
    if ( histogramData ) checkCompatibleBinning(histogramTT, histogramData);
    histogramTT_density = divideHistogramByBinWidth(histogramTT);
  } 
  TH1* histogramTTV_density = 0;
  if ( histogramTTV ) {
    if ( histogramData ) checkCompatibleBinning(histogramTTV, histogramData);
    histogramTTV_density = divideHistogramByBinWidth(histogramTTV);
  }    
  TH1* histogramEWK_density = 0;
  if ( histogramEWK ) {
    if ( histogramData ) checkCompatibleBinning(histogramEWK, histogramData);
    histogramEWK_density = divideHistogramByBinWidth(histogramEWK);
  }
  TH1* histogramRares_density = 0;
  if ( histogramRares ) {
    if ( histogramData ) checkCompatibleBinning(histogramRares, histogramData);
    histogramRares_density = divideHistogramByBinWidth(histogramRares);
  }    
  TH1* histogramBgrSum_density = 0;
  if ( histogramBgrSum ) {
    if ( histogramData ) checkCompatibleBinning(histogramBgrSum, histogramData);
    histogramBgrSum_density = divideHistogramByBinWidth(histogramBgrSum); 
  }
  TH1* histogramBgrUncertainty_density = 0;
  if ( histogramBgrUncertainty ) {
    if ( histogramData ) checkCompatibleBinning(histogramBgrUncertainty, histogramData);
    histogramBgrUncertainty_density = divideHistogramByBinWidth(histogramBgrUncertainty);
  }
  
  TCanvas* canvas = new TCanvas("canvas", "", canvasSizeX, canvasSizeY);
  canvas->SetFillColor(10);
  canvas->SetFillStyle(4000);
  canvas->SetFillColor(10);
  canvas->SetTicky();
  canvas->SetBorderSize(2);  
  canvas->SetLeftMargin(0.12);
  canvas->SetBottomMargin(0.12);
  
  TPad* topPad = new TPad("topPad", "topPad", 0.00, 0.35, 1.00, 1.00);
  topPad->SetFillColor(10);
  topPad->SetTopMargin(0.065);
  topPad->SetLeftMargin(0.15);
  topPad->SetBottomMargin(0.03);
  topPad->SetRightMargin(0.05);
  topPad->SetLogy(useLogScale);
  
  TPad* bottomPad = new TPad("bottomPad", "bottomPad", 0.00, 0.00, 1.00, 0.35);
  bottomPad->SetFillColor(10);
  bottomPad->SetTopMargin(0.02);
  bottomPad->SetLeftMargin(0.15);
  bottomPad->SetBottomMargin(0.31);
  bottomPad->SetRightMargin(0.05);
  bottomPad->SetLogy(false);
  
  canvas->cd();
  topPad->Draw();
  topPad->cd();
  
  TAxis* xAxis_top = histogramData_density->GetXaxis();
  xAxis_top->SetTitle(xAxisTitle.data());
  xAxis_top->SetTitleOffset(xAxisOffset);
  xAxis_top->SetLabelColor(10);
  xAxis_top->SetTitleColor(10);
    
  TAxis* yAxis_top = histogramData_density->GetYaxis();
  yAxis_top->SetTitle(yAxisTitle.data());
  yAxis_top->SetTitleOffset(yAxisOffset);
  yAxis_top->SetTitleSize(0.085);
  yAxis_top->SetLabelSize(0.05);
  yAxis_top->SetTickLength(0.04);  
  
  TLegend* legend = new TLegend(0.66, 0.45, 0.94, 0.92, NULL, "brNDC");
  legend->SetFillStyle(0);
  legend->SetBorderSize(0);
  legend->SetFillColor(10);
  legend->SetTextSize(0.055);
//.........这里部分代码省略.........
开发者ID:cms-analysis,项目名称:CombineHarvester,代码行数:101,代码来源:makePostFitPlots_1l_2tau.C

示例12: plot


//.........这里部分代码省略.........
  hw->Scale(2*br*(1.0-br));
  TH1* signal = (TH1*)hh->Clone();
  signal->Add(hw);

  ci = TColor::GetColor("#ff3399");
  signal->SetLineColor(ci);
  signal->SetLineStyle(2);
  signal->SetLineWidth(2);

  // Fakes
  TH1* fakes = (TH1*)(fakett->Clone());
  fakes->Add(fakeW);
  fakes->Add(faket);

  // stacked backgrounds
  THStack *exp = new THStack();
  exp->SetName("exp");
  exp->SetTitle("exp");
  exp->Add(fakes);
  exp->Add(ewktau);
  exp->Add(qcd);
  exp->Add(signal);
  
  TH1* hExpBkg = (TH1*)fakes->Clone();
  hExpBkg->Add(ewktau);
  hExpBkg->Add(qcd);
  
  // uncertainty
  TH1* uncert = (TH1*)fakeW->Clone();
  uncert->Add(fakett);
  uncert->Add(ewktau);
  uncert->Add(qcd);
  uncert->SetFillColor(1);
  uncert->SetFillStyle(3344);
  uncert->SetLineColor(0);
  uncert->SetLineStyle(0);
  uncert->SetLineWidth(0);

  TH1* hExpBkgTotalUncert = (TH1*)uncert->Clone();
  hExpBkgTotalUncert->SetFillStyle(3354);

  TH1* hAgreement = (TH1*)data->Clone();
  hAgreement->Divide(hExpBkg);
  TGraphErrors* hAgreementRelUncert = new TGraphErrors(hAgreement->GetNbinsX());
  hAgreementRelUncert->SetLineWidth(2);
  hAgreementRelUncert->SetLineColor(kBlack);
  for (int i = 1; i <= hFrame->GetNbinsX(); ++i) {
    double myQCDTotalUncert = TMath::Power(qcd->GetBinError(i), 2)
      + TMath::Power(qcd->GetBinContent(i)*myQCDRelUncert, 2);
    double myEWKTotalUncert = TMath::Power(ewktau->GetBinError(i), 2)
      + TMath::Power(ewktau->GetBinContent(i)*myEWKRelUncert, 2);
    double myFakesTotalUncert = TMath::Power(fakes->GetBinError(i), 2)
      + TMath::Power(fakes->GetBinContent(i)*myFakesRelUncert, 2);
    hExpBkgTotalUncert->SetBinError(i, TMath::Sqrt(myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert));

    if (hExpBkg->GetBinContent(i) > 0) {
      hAgreementRelUncert->SetPoint(i-1, hExpBkg->GetBinCenter(i), data->GetBinContent(i) / hExpBkg->GetBinContent(i));
      double myUncertData = 0;
      if (data->GetBinContent(i) > 0)
        myUncertData = TMath::Power(data->GetBinError(i) / data->GetBinContent(i), 2);
      double myUncertBkg = (myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert) / TMath::Power(hExpBkg->GetBinContent(i), 2);
      hAgreementRelUncert->SetPointError(i-1, 0,  data->GetBinContent(i) / hExpBkg->GetBinContent(i) * TMath::Sqrt(myUncertData + myUncertBkg));
    } else {
      hAgreementRelUncert->SetPoint(i-1, hExpBkg->GetBinCenter(i), 0);
      hAgreementRelUncert->SetPointError(i-1, 0, 0);
    }
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:67,代码来源:combineMt.C

示例13: moveDirHistsToStacks

void stackPlotter::moveDirHistsToStacks(TDirectory* tdir, TString histname, int color){
	if(debug)
		std::cout << "stackPlotter::moveDirHistsToStacks" << std::endl;

	// get metainfo from directory, else exit TODO
	metaInfo tMI;
	tMI.extractFrom(tdir);

	if(debug) {
		std::cout << "stackPlotter::moveDirHistsToStacks || metaInfo color=" << tMI.color << std::endl;
		std::cout << "stackPlotter::moveDirHistsToStacks || metaInfo legendname=" << tMI.legendname<< std::endl;
		std::cout << "stackPlotter::moveDirHistsToStacks || metaInfo legendorder=" << tMI.legendorder << std::endl;
	}


	TIter    histIter(tdir->GetListOfKeys());
	TObject* cHistObj;
	TKey*    cHistKey;

	if(debug)
		std::cout << "stackPlotter::moveDirHistsToStacks || Iterating through histograms." << std::endl;

	// loop through keys in the directory
	while((cHistKey = (TKey*) histIter())) {
        if(histname != cHistKey->GetName()) continue;
		cHistObj=tdir->Get(cHistKey->GetName());
		if(!cHistObj->InheritsFrom(TH1::Class())) continue;

		if(debug)
			std::cout << "stackPlotter::moveDirHistsToStacks || Found histogram "
			<< cHistKey->GetName() << std::endl;

		// prepare the histogram to be added to the stack
		TH1* cHist = (TH1*) cHistObj->Clone();
		cHist->SetDirectory(0);
		TString mapName = cHist->GetName();

		std::pair<Int_t,TH1*> newEntry(tMI.legendorder,cHist);

		// initialize the stack info if needed
		if(!stacksLegEntries_.count(mapName)) {
			std::vector<std::pair<Int_t,TH1*> > legInfo(0);
			legInfo.push_back(newEntry);
			stacksLegEntries_[mapName] = legInfo;
		}

		cHist->SetFillColor(color);
		cHist->SetFillStyle(1001);
		cHist->SetMarkerStyle(kNone);
		cHist->SetMarkerColor(kBlack);
		cHist->SetLineColor(kBlack);
		cHist->SetTitle(mapName);
		cHist->SetName(tMI.legendname);

		std::vector<std::pair<Int_t,TH1*> > legEntries = stacksLegEntries_[mapName];
		if(debug)
			std::cout << "stackPlotter::moveDirHistsToStacks || legEntries size is " << legEntries.size() << std::endl;
		for(size_t i=0; i < legEntries.size(); i++) {
			if(legEntries.at(i).second == cHist && legEntries.at(i).first == tMI.legendorder) break;

			if(legEntries.at(i).first >= tMI.legendorder) {
				if(debug)
					std::cout << "stackPlotter::moveDirHistsToStacks || i is " << i << std::endl;
				stacksLegEntries_[mapName].insert(stacksLegEntries_[mapName].begin()+i,newEntry);
				break;
			}

			if(i==legEntries.size()-1) {
				stacksLegEntries_[mapName].push_back(newEntry);
				break;
			}
		}

		if(debug)
			std::cout << "stackPlotter::moveDirHistsToStacks || legEntries size is " << legEntries.size() << std::endl;
	}

}
开发者ID:ssghosh,项目名称:Brown-FCNC2016-thcu,代码行数:78,代码来源:stackPlotter.cpp

示例14: QAtracklets

void QAtracklets(const Char_t *fdata, const Char_t *fmc)
{

  style();
  
  TFile *fdtin = TFile::Open(fdata);
  TList *ldtin = (TList *)fdtin->Get("clist");
  TH2 *hdtin = (TH2 *)ldtin->FindObject("etaphiTracklets");
  TH1 *pdtin = (TH1 *)hdtin->ProjectionY("pdtin_tracklets");
  pdtin->SetMarkerStyle(20);
  pdtin->SetMarkerSize(1.);
  pdtin->SetMarkerColor(kAzure-3);
  hdtin->Scale(1. / hdtin->GetEntries());
  pdtin->Scale(1. / hdtin->GetEntries());
  
  TFile *fmcin = TFile::Open(fmc);
  TList *lmcin = (TList *)fmcin->Get("clist");

  if(!lmcin) {
      std::cout << "NOLIST" << std::endl;

  }
  lmcin->ls();
  TH2 *hmcin = (TH2 *)lmcin->FindObject("etaphiTracklets");
  if(!hmcin) {
    std::cout << "NO H!! etaphiTracklets" << std::endl;
    
  }
  TH1 *pmcin = (TH1 *)hmcin->ProjectionY("pmcin_tracklets");
  pmcin->SetLineColor(kRed+1);
  pmcin->SetFillStyle(1001);
  pmcin->SetFillColorAlpha(kRed+1, 0.1);
  hmcin->Scale(1. / hmcin->GetEntries());
  pmcin->Scale(1. / hmcin->GetEntries());
  

  /*  
  pdtin->Scale(pmcin->Integral(pmcin->FindBin(0. + 0.001),
			       pmcin->FindBin(1. - 0.001))
	       / pdtin->Integral(pdtin->FindBin(0. + 0.001),
				 pdtin->FindBin(1. - 0.001)));
  */  
  
  TCanvas *cData = new TCanvas("cTrackletData", "cTrackletData", 800, 800);
  //  cData->SetLogz();
  TH1 * hfr = cData->DrawFrame(-2.5, 0., 2.5, 2. * TMath::Pi());
  hfr->SetTitle(";#eta;#varphi");
  hdtin->Draw("same,col");
  cData->SaveAs(canvasPrefix+"trackletData.pdf");

  TCanvas *cMC = new TCanvas("cTrackletMC", "cTrackletMC", 800, 800);
  //  cMC->SetLogz();
  hfr = cMC->DrawFrame(-2.5, 0., 2.5, 2. * TMath::Pi());
  hfr->SetTitle(";#eta;#varphi");
  hmcin->Draw("same,col");
  cMC->SaveAs(canvasPrefix+"trackletMC.pdf");
  
  TCanvas *cPhi = new TCanvas("cTrackletPhi", "cTrackletPhi", 800, 800);
  //  cPhi->SetLogy();
  hfr = cPhi->DrawFrame(0., 0., 2. * TMath::Pi(), 0.01);
  hfr->SetTitle(";#varphi;");
  pdtin->DrawCopy("same");
  pmcin->DrawCopy("same,histo");
  TLegend *legend = new TLegend(0.20, 0.18+0.63, 0.50, 0.30+0.63);
  legend->SetFillColor(0);
  legend->SetBorderSize(0);
  legend->SetTextFont(42);
  legend->SetTextSize(0.04);
  legend->AddEntry(pdtin, "data", "pl");
  legend->AddEntry(pmcin, "Monte Carlo", "l");
  legend->Draw("same");
  cPhi->SaveAs(canvasPrefix+"trackletPhi.pdf");
  
  TCanvas *cPhir = new TCanvas("cTrackletPhir", "cTrackletPhir", 800, 800);
  //  cPhi->SetLogy();
  hfr = cPhir->DrawFrame(0., 0.5, 2. * TMath::Pi(), 1.5);
  hfr->SetTitle(";#varphi;data / Monte Carlo");
  pdtin->Divide(pmcin);
  pdtin->Draw("same");
  cPhir->SaveAs(canvasPrefix+"trackletPhir.pdf");

  
  
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:84,代码来源:QA.C

示例15: GetHistoClSize

//------------------------------------------
TH1* GetHistoClSize(int npix,int id,TObjArray* harr)
{
  // book histos
  TH1* h = 0;
  if (!harr) harr = &histoArr;
  //
  if (npix<1) {
    if (harr->GetEntriesFast()>=id && (h=(TH1*)harr->At(id))) return h;
    h = new TH1F("npixAll","npixAll",150,0.5,54.5); 
    h->SetDirectory(0);
    h->SetLineColor(kRed);
    harr->AddAtAndExpand(h, kNPixAll);
    //
    h = new TH1F("npixSpl","npixSpl",150,0.5,54.5);
    h->SetLineColor(kBlue);
    h->SetDirectory(0);
    harr->AddAtAndExpand(h, kNPixSPL);
    //
    h = (TH1*)harr->At(id);
    if (!h) {printf("Unknown histo id=%d\n",id); exit(1);}
    return h;
  }
  //
  int idh = npix*10+id;
  if (harr->GetEntriesFast()>=idh && (h=(TH1*)harr->At(idh))) return h;
  //
  const int nbin=100;
  const double kdiff=80;
  // need to create set of histos
  //
  h = new TH1F(Form("dxy_npix%d",npix),Form("dr_npix%d",npix),nbin,-kdiff,kdiff);
  h->SetDirectory(0);
  harr->AddAtAndExpand(h, npix*10 + kDR);
  //
  h  = new TH1F(Form("dtxODD_npix%d",npix),Form("dtxODD_npix%d",npix),nbin,-kdiff,kdiff);
  h->SetDirectory(0);
  h->SetLineColor(kRed);
  harr->AddAtAndExpand(h, npix*10 + kDTXodd);
  h  = new TH1F(Form("dtxEVN_npix%d",npix),Form("dtxEVN_npix%d",npix),nbin,-kdiff,kdiff);
  h->SetDirectory(0);
  h->SetLineColor(kBlue);
  harr->AddAtAndExpand(h, npix*10 + kDTXeven);
  //
  h  = new TH1F(Form("dtz_npix%d",npix),Form("dtz_npix%d",npix),nbin,-kdiff,kdiff);
  h->SetLineColor(kGreen);
  h->SetDirectory(0);
  harr->AddAtAndExpand(h, npix*10 + kDTZ);
  //
  //
  h  = new TH1F(Form("SPL_dtxODD_npix%d",npix),Form("SPL_dtxODD_npix%d",npix),nbin,-kdiff,kdiff);
  h->SetLineColor(kMagenta);
  h->SetFillColor(kMagenta);
  h->SetFillStyle(3001);  
  h->SetLineStyle(2);
  h->SetDirectory(0);

  harr->AddAtAndExpand(h, npix*10 + kDTXoddSPL);
  h  = new TH1F(Form("SPL_dtxEVN_npix%d",npix),Form("SPL_dtxEVN_npix%d",npix),nbin,-kdiff,kdiff);
  h->SetLineColor(kCyan);
  h->SetFillColor(kCyan);
  h->SetFillStyle(3006);  
  h->SetLineStyle(2);
  h->SetDirectory(0);
  harr->AddAtAndExpand(h, npix*10 + kDTXevenSPL);
  //
  h  = new TH1F(Form("SPL_dtz_npix%d",npix),Form("SPLdtz_npix%d",npix),nbin,-kdiff,kdiff);
  harr->AddAtAndExpand(h, npix*10 + kDTZSPL);
  h->SetDirectory(0);
  //
  h->SetLineColor(kGreen+2);
  h->SetFillColor(kGreen+2);
  h->SetLineStyle(2);
  h->SetFillStyle(3001);
  h = (TH1*)harr->At(idh);
  if (!h) {printf("Unknown histo id=%d\n",idh); exit(1);}
  return h;
}
开发者ID:alisw,项目名称:AliRoot,代码行数:78,代码来源:compClusHitsMod2.C


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