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


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

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


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

示例1: 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

示例2:

TH1F*	makehist( string id, int ndf )
{
	int	hits_count = ndf + 2;
	TString	hist_name, cut, title;
	hist_name += id;
	hist_name += "_chisq_";
	hist_name += hits_count;
	hist_name += "hits";
	cut += id;
	cut += "_hits_count == ";
	cut += hits_count;
	float	min_x = 0;
	float	max_x = (ndf == 2) ? 2.0 : 0.5;
	TH1F	*hist = new TH1F(hist_name.Data(), cut, 1000, min_x, max_x);
	events->Draw(Form("%s_chisq >> %s", id.c_str(), hist_name.Data()), cut);
	if (hits_count > 3)
	{
		TF1 *func = new TF1("func", "[0]*exp([1]*x)+[2]");
		TFitResultPtr fit = hist->Fit(func, "SQ", "", 0.0, 0.5); // S - return fit result, Q - quiet
		std::cout << hist_name << "\tslope: " << fit->Parameter(1) << "\tadd const: " << fit->Parameter(2) << std::endl;
	}
	if (id[1] == '3')
	{
		title += "Left ";
	}
	else
	{
		title += "Right ";
	}
	title += id[2];
	title += " (";
	title += cut;
	title += ")";
	hist->SetTitle(title);
	hist->SetLabelSize(0.04, "X");
	hist->SetLabelSize(0.04, "Y");
	hist->SetTitleSize(0.05, "X");
	hist->SetTitleSize(0.05, "Y");
	hist->SetTitleOffset(0.9, "X");
	hist->SetTitleOffset(1.1, "Y");
	hist->GetXaxis()->SetTitle("#chi^2, [mm]");
	hist->GetYaxis()->SetTitle("N");

	return hist;
}
开发者ID:veprbl,项目名称:libepecur,代码行数:45,代码来源:drift_chisq.C

示例3: printBfraction

void printBfraction(char *tagger="discr_ssvHighEff", Double_t workingPoint=2, char *taggerName="ssvHighEff", int doCent=2, int do3bin=1) {

  gROOT->ForceStyle(1);

  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);


  gStyle->SetTextFont(42);
  gStyle->SetLabelFont(42,"XYZ");
  gStyle->SetTitleFont(42,"XYZ");

  // hack
  if(doCent)gStyle->SetErrorX(0);
  gStyle->SetLabelSize(0.05,"xy");
  gStyle->SetTitleSize(0.05,"xy");
  gStyle->SetTitleOffset(1.5,"xy");
  gStyle->SetPadLeftMargin(0.15);
  gStyle->SetPadBottomMargin(0.12);
  gStyle->SetNdivisions(408,"y");


  TFile *fin1, *fin2;
  if(doCent){
    if(doCent==1){
      fin1 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL1_centDep_80_100.root");
      fin2 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL0_centDep_80_100.root");
    }
    if(doCent==2){
      fin1 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL1_centDep_100_120.root");
      fin2 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL0_centDep_100_120.root");
    }
    // broken
    //fin1 = new TFile("output/bFractionMerged_ssvHighEffat2.0FixCL1_centDep_80_100.root");
    //fin2 = new TFile("output/bFractionMerged_ssvHighEffat2.0FixCL0_centDep_80_100.root");
  }
  else{
    // try to smear by 2 sigma
    //fin1 = new TFile("output/bFractionMerged_Smear2Sigma_SSVHEat2.0FixCL1_bin_0_40_eta_0_2.root");
    //fin2 = new TFile("output/bFractionMerged_Smear2Sigma_SSVHEat2.0FixCL0_bin_0_40_eta_0_2.root");
    // with reg tracks in reco jets
    //fin1 = new TFile("output/bFractionMerged_regPFJets_SSVHEat2.0FixCL1_bin_0_40_eta_0_2.root");
    //fin2 = new TFile("output/bFractionMerged_regPFJets_SSVHEat2.0FixCL0_bin_0_40_eta_0_2.root");
    if(do3bin){
      fin1 = new TFile("output/bFractionMerged_3bins_SSVHEat2.0FixCL1_bin_0_40_eta_0_2.root");
      fin2 = new TFile("output/bFractionMerged_3bins_SSVHEat2.0FixCL0_bin_0_40_eta_0_2.root");
    }
    else{
      fin1 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL1_bin_0_40_eta_0_2.root");
      fin2 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL0_bin_0_40_eta_0_2.root");
      // old naming convention
    //fin1 = new TFile("output/bFractionMerged_ssvHighEffat2.0FixCL1_bin_0_40_eta_0_2.root");
    //fin2 = new TFile("output/bFractionMerged_ssvHighEffat2.0FixCL0_bin_0_40_eta_0_2.root");

    }
  }

  TH1F *hBFractionMC = (TH1F*) fin1->Get("hBFractionMC");

  TH1F *hBFractionData = (TH1F*) fin1->Get("hBFractionData");
  TH1F *hBFractionDataLTJP = (TH1F*) fin1->Get("hBFractionDataLTJP");
  TH1F *hBFractionJPdirect = (TH1F*) fin1->Get("hBFractionJPdirect");

  TH1F *hBFractionDataFixC = (TH1F*) fin2->Get("hBFractionData");
  TH1F *hBFractionDataLTJPFixC = (TH1F*) fin2->Get("hBFractionDataLTJP");
  TH1F *hBFractionJPdirectFixC = (TH1F*) fin2->Get("hBFractionJPdirect");

  


  /*  --- correction due to Jet Energy Scale (calcul) ---
  correct(hBFractionMC);
  correct(hBFractionData);
  correct(hBFractionDataMoreC);
  correct(hBFractionDataLessC);
  correct(hBFractionDataLTJP);
  correct(hBFractionDataLTJPMoreC);
  correct(hBFractionDataLTJPLessC);
  correct(hBFractionJPdirect);
  correct(hBFractionJPdirectMoreC);
  correct(hBFractionJPdirectLessC);
  //*/

  //*  --- correction due to Jet Energy Scale (by hand) ---
  if(doCent){
    correctByCent(hBFractionMC,doCent);
    correctByCent(hBFractionData,doCent);
    correctByCent(hBFractionDataFixC,doCent);
    correctByCent(hBFractionDataLTJP,doCent);
    correctByCent(hBFractionDataLTJPFixC,doCent);
    correctByCent(hBFractionJPdirect,doCent);
    correctByCent(hBFractionJPdirectFixC,doCent);
  }
  else{
    //*
    correct2(hBFractionMC,do3bin);
    correct2(hBFractionData,do3bin);
    correct2(hBFractionDataFixC,do3bin);
    correct2(hBFractionDataLTJP,do3bin);
    correct2(hBFractionDataLTJPFixC,do3bin);
//.........这里部分代码省略.........
开发者ID:kurtejung,项目名称:bJetTools,代码行数:101,代码来源:printBfraction.C

示例4: plotHitEnergy

void plotHitEnergy(string inputDir, int hittype=1, float radius=0.4) {
    setNCUStyle(true);

    string decversion;
    if(inputDir.find("rfull009")!=std::string::npos)decversion="rfull009";
    else if(inputDir.find("rfull012")!=std::string::npos)decversion="rfull012";

    TH1F* hecal;
    TH1F* hhcal;
    std::string ecalhitname = hittype==1? "EM_BARREL":"EcalBarrelHits";
    std::string hcalhitname = hittype==1? "HAD_BARREL":"HcalBarrelHits";

    TString energy=gSystem->GetFromPipe(Form("file=%s; test=${file##*/}; test2=${test%%mumu*}; echo \"${test2##*tev}\"",inputDir.data()));
    cout << "energy = " << energy.Data() << endl;

    string inputFile = inputDir + "/radius" + Form("%0.1f",radius)+ (hittype==1? "_rawhit.root": "_rawhit_new.root");
    cout << "opening " << inputFile.data() << endl;



    TFile *f = TFile::Open(inputFile.data());
    hecal = (TH1F*)f->FindObjectAny("hecalhit_energy");
    hecal->SetLineWidth(3);
    hecal->SetFillStyle(1001);
    hecal->SetFillColor(4);
    hecal->SetLineColor(4);
    hecal->SetXTitle(Form("%s hit energy [GeV]",ecalhitname.data()));
    hecal->SetYTitle(Form("Number of hits per %.1f GeV",hecal->GetBinWidth(1)));
    hecal->SetTitleOffset(1.2,"X");
    hecal->SetTitleOffset(1.4,"Y");
    hhcal = (TH1F*)f->FindObjectAny("hhcalhit_energy");
    hhcal->SetLineWidth(3);
    hhcal->SetFillStyle(1001);
    hhcal->SetFillColor(2);
    hhcal->SetLineColor(2);
    hhcal->SetXTitle(Form("%s hit energy [GeV]",hcalhitname.data()));
    hhcal->SetYTitle(Form("Number of hits per %.1f GeV",hhcal->GetBinWidth(1)));
    hhcal->SetTitleOffset(1.2,"X");
    hhcal->SetTitleOffset(1.4,"Y");


    TLegend* leg = new TLegend(0.444,0.690,0.990,0.903);
    leg->SetFillColor(0);
    leg->SetFillStyle(0);

    TCanvas* c1 = new TCanvas("c1","",500,500);
    int lastbin=hecal->FindLastBinAbove(0)+20;
    float xmax=hecal->GetBinLowEdge(lastbin);
    hecal->GetXaxis()->SetRangeUser(0,xmax);
    hecal->Draw("hist");
    c1->SetLogy(1);

    leg->SetHeader(decversion.data());
    leg->AddEntry(hecal,Form("%s-TeV Z'#rightarrow qq",energy.Data()),"f");
    leg->Draw("same");

    std::string outputname = decversion + "/" + decversion + "_" + ecalhitname + "hit_energy_" + Form("%s",energy.Data()) + "TeVZp";
    c1->Print(Form("%s.pdf",outputname.data()));
    c1->Print(Form("%s.eps",outputname.data()));
    leg->Clear();


    lastbin=hhcal->FindLastBinAbove(0)+20;
    xmax=hhcal->GetBinLowEdge(lastbin);
    hhcal->GetXaxis()->SetRangeUser(0,xmax);
    hhcal->Draw("hist");
    c1->SetLogy(1);

    leg->SetHeader(decversion.data());
    leg->AddEntry(hhcal,Form("%s-TeV Z'#rightarrow qq",energy.Data()),"f");
    leg->Draw("same");

    outputname = decversion + "/" + decversion + "_" + hcalhitname + "hit_energy_" + Form("%s",energy.Data()) + "TeVZp";

    c1->Print(Form("%s.pdf",outputname.data()));
    c1->Print(Form("%s.eps",outputname.data()));

}
开发者ID:syuvivida,项目名称:VHEPP,代码行数:78,代码来源:plotHitEnergy.C

示例5: compare

int compare(){
	
    gROOT->SetStyle("Plain");

    // For the canvas:
    gStyle->SetCanvasColor(0);

    // For the Pad:
    gStyle->SetPadColor(0);
    gStyle->SetPadTickX(1);
    gStyle->SetPadTickY(1);
    gStyle->SetPadBorderSize(2);

    // For the frame:
    gStyle->SetFrameBorderMode(0);


    // For the statistics box:
    gStyle->SetOptStat(0);

    // Margins:
    gStyle->SetPadBottomMargin(0.25);
    gStyle->SetPadTopMargin(0.15);
    gStyle->SetPadLeftMargin(0.15);
    gStyle->SetPadRightMargin(0.1);

    // For the Global title:
    gStyle->SetOptTitle(0);
    gStyle->SetTitleColor(1);
    gStyle->SetTitleFillColor(10);
    gStyle->SetTitleTextColor(1);
    gStyle->SetTitleFont(42);
    gStyle->SetTitleFontSize(0.05);
    gStyle->SetTitleBorderSize(0);

    // For the axis
    gStyle->SetNdivisions(510, "X");
    gStyle->SetNdivisions(510, "Y");
    gStyle->SetTickLength(0.03);

    // For the axis titles:
    gStyle->SetTitleOffset(1.4, "X");
    gStyle->SetTitleOffset(1.2, "Y");
    gStyle->SetTitleOffset(0.5, "Z");
    gStyle->SetTitleSize(0.061, "XYZ");
    gStyle->SetTitleFont(42, "XYZ");

    // For the axis labels:
    gStyle->SetLabelSize(0.04, "XYZ");
    gStyle->SetLabelOffset(0.01, "XYZ");
    gStyle->SetLabelFont(42, "XYZ");

    // For the legend
    gStyle->SetLegendBorderSize(0);

    gROOT->ForceStyle();

    ////////////////////////////////////////

	TFile *f1 = new TFile("output_GetPrediction/prediction_histos_MyTest_data_METsoftSmeared_noAngSmear_N20_CR_v3.root", "READ", "", 0);
    TFile *f2 = new TFile("output_GetPrediction/bkg.root", "READ", "", 0);
	selection = (TH1F*) f1->FindObjectAny("VBF_MET_presel_4JV_dPhiSide_selection");
	prediction = (TH1F*) f1->FindObjectAny("VBF_MET_presel_4JV_dPhiSide_prediction_px");
	background2 = (TH1F*) f2->FindObjectAny("met_check_inVR_rebin");
	TH1F* background = new TH1F(*prediction);
	background->Reset();
	for (int i = 1; i <= background->GetXaxis()->GetNbins(); ++i) {
		float x = background->GetXaxis()->GetBinCenter(i);
		int j = background2->GetXaxis()->FindBin(x);
		float value = background2->GetBinContent(j);
		float error = background2->GetBinError(j);
		background->SetBinContent(i,value);
		background->SetBinError(i,error);
	}
	
	//double MinX = selection->GetXaxis()->GetBinLowEdge(1);
    //double MaxX = selection->GetXaxis()->GetBinUpEdge(selection->GetXaxis()->GetNbins());
	double MinX = 150;
    double MaxX = 500;
    double BinWidth = selection->GetXaxis()->GetBinWidth(selection->GetXaxis()->GetNbins());
    double MaxY = prediction->GetBinContent(prediction->GetMaximumBin());
    double MaxYsel = selection->GetBinContent(selection->GetMaximumBin());
    if (MaxY < MaxYsel) MaxY = MaxYsel;
    double YRangeMax = 2.*pow(10., int(log10(MaxY))+2);
    double MinY = prediction->GetBinContent(prediction->GetMinimumBin());
    double MinYsel = selection->GetBinContent(selection->GetMinimumBin());
    if (MinY > MinYsel) MinY = MinYsel;
    if (MinY < 0.001) MinY = 0.001;
    double YRangeMin = 0.5*pow(10., int(log10(MinY))-2);
    TString titlePrediction;
    TString titleSelection;
    TString titleBackground;
    TString RatioTitle;
    TString LumiTitle;
    TString Title;
    TString xTitle;
    TString yTitle;

	LumiTitle = "ATLAS internal, L = 36.1 fb^{  -1}, #sqrt{s} = 13 TeV";

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

示例6: plotCutFlowNotStaggered


//.........这里部分代码省略.........
    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);
   

      if( diTauSVfit3->size() < 1) continue;
      bool vbfCut = false;
      bool jetVeto = false;
      if( jets->size()>1 && 
	  (*jets)[0].Et()>pt1_ && (*jets)[1].Et()>pt2_ && 
	  abs((*jets)[0].Eta()-(*jets)[1].Eta())>DEta_ && 
	  ((*jets)[0]+(*jets)[1]).M()>Mjj_ ) vbfCut = true;
      for(unsigned k=0; k < jets->size(); k++){
	if(k>1 && 
	   (  ((*jets)[k].Eta()>(*jets)[1].Eta()+0.5 &&  (*jets)[k].Eta()<(*jets)[0].Eta()-0.5) || 
	      ((*jets)[k].Eta()>(*jets)[0].Eta()+0.5 &&  (*jets)[k].Eta()<(*jets)[1].Eta()-0.5) ) &&
	   (*jets)[k].Et()>jetVeto_ ) jetVeto=true;  
      }
      
      if(vbfCut)  h1->Fill( cutFlow.size()+1.5 ) ;      
      if(vbfCut && !jetVeto)  h1->Fill( cutFlow.size()+2.5 ) ;      
    
    }
   

    h1->Scale( Lumi_ / (totalEvents/((fileList_[i].second).second * signalScale)) );

    if(((fileList_[i].second).first).find("qqH115")!=string::npos){
      hqqH115=(TH1F*)h1->Clone("hqqH115");
      hqqH115 = h1;
      hqqH115->Sumw2();
      continue;
    }
    if(((fileList_[i].second).first).find("qqH135")!=string::npos){
      hqqH135=(TH1F*)h1->Clone("hqqH135");
      hqqH135 = h1;
      hqqH135->Sumw2();
      continue;
    }

    if(i==0) hSiml=(TH1F*)h1->Clone("hSiml");
    else hSiml->Add(h1);

    histos.push_back(h1);

  }

  //float numData = hData->GetEntries();
  //float numSiml = hSiml->Integral();
  //float dataToSimlRatio = numData/numSiml;
  //cout << "data " << numData << "  ---  simul " << numSiml << endl;  

  hqqH115->SetTitle(Form("CMS Preliminary 2010    #sqrt{s}=7 TeV L=%.0f pb^{-1}",Lumi_));
  hqqH115->SetXTitle("");
  hqqH115->SetYTitle("Number of events");
  hqqH115->SetTitleSize(0.05,"X");
  hqqH115->SetTitleSize(0.05,"Y");
  hqqH115->SetTitleOffset(0.75,"Y");
  hqqH115->SetAxisRange(0.1,hSiml->GetMaximum()*1.2,"Y");

  hqqH115->Draw("HIST");
  hqqH135->Draw("HISTSAME");
  for(int p = 0; p<histos.size(); p++){
    histos[p]->Draw("HISTSAME");
  }


  leg->Draw();

  pad2->cd();
  TH1F* hRatio = new TH1F("hRatio", " ; ; purity",
			  hqqH115->GetNbinsX(), 
			  hqqH115->GetXaxis()->GetXmin(), hqqH115->GetXaxis()->GetXmax());
  hRatio->SetLineStyle(kDashed);
  hRatio->SetLineWidth(1.0);
  hRatio->SetLabelSize(0.12,"X");
  hRatio->SetLabelSize(0.10,"Y");
  hRatio->SetTitleSize(0.12,"Y");
  hRatio->SetTitleOffset(0.36,"Y");
  TH1F* hqqH115Clone = (TH1F*)hqqH115->Clone("hqqH115Clone");
  TH1F* hqqH135Clone = (TH1F*)hqqH135->Clone("hqqH135Clone");
  hqqH115Clone->Divide( hqqH115 ,hSiml,1./signalScale,1.0);
  hqqH135Clone->Divide( hqqH135 ,hSiml,1./signalScale,1.0);
  hRatio->SetAxisRange(0.,0.1,"Y");

  hRatio->Draw();
  hqqH115Clone->Draw("HISTSAME");
  hqqH135Clone->Draw("HISTSAME");

  if(SAVE) c1->SaveAs("Zmm_CutFlowNotStaggeredMass.png");

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

示例7: plotInclusiveMass


//.........这里部分代码省略.........
    }
    if( ((fileList_[i].second).first).find("Wjets")!=string::npos ) {
      h1->SetFillColor(kGreen);
      leg->AddEntry(h1,"MadGraph W+jets","F");
    }
    if( ((fileList_[i].second).first).find("tW")!=string::npos ){
      h1->SetFillColor( 44 );
      leg->AddEntry(h1,"MadGraph single-top","F");
    }
    if( ((fileList_[i].second).first).find("QCD")!=string::npos ) {
      h1->SetFillColor(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);
      leg->AddEntry(h1,"VBF H(115)#rightarrow#tau#tau X 100","l");
      signalScale = 100;
    }
    if( ((fileList_[i].second).first).find("qqH135")!=string::npos ) {
      h1->SetLineColor(kBlack);
      h1->SetLineStyle(kDotted);
      h1->SetLineWidth(3.0);
      leg->AddEntry(h1,"VBF H(135)#rightarrow#tau#tau X 100","l");
      signalScale = 100;
    }

    int nEntries = currentTree->GetEntries() ;
    
    std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >* diTauSVfit3;
    currentTree->SetBranchAddress("diTauSVfit3P4",&diTauSVfit3);

    for (int n = 0; n < nEntries ; n++) {
      currentTree->GetEntry(n);
      if( diTauSVfit3->size() < 1) continue;
      h1->Fill( (*diTauSVfit3)[0].M() ) ;
    }

    h1->Scale( Lumi_ / (totalEvents/((fileList_[i].second).second * signalScale)) );

    if(((fileList_[i].second).first).find("qqH115")!=string::npos){
      hqqH115=(TH1F*)h1->Clone("hqqH115");
      hqqH115 = h1;
      hqqH115->Sumw2();
      continue;
    }
    if(((fileList_[i].second).first).find("qqH135")!=string::npos){
      hqqH135=(TH1F*)h1->Clone("hqqH135");
      hqqH135 = h1;
      hqqH135->Sumw2();
      continue;
    }

    if(i==0) hSiml=(TH1F*)h1->Clone("hSiml");
    else hSiml->Add(h1);

    aStack->Add(h1);

  }

  //float numData = hData->GetEntries();
  //float numSiml = hSiml->Integral();
  //float dataToSimlRatio = numData/numSiml;
  //cout << "data " << numData << "  ---  simul " << numSiml << endl;  

  aStack->Draw("HIST");
  hqqH115->Draw("HISTSAME");
  hqqH135->Draw("HISTSAME");
  TH1F* hStack = (TH1F*)aStack->GetHistogram();
  hStack->SetXTitle("SVfit #tau#tau mass");
  hStack->SetYTitle(Form("Number of events/%.0f GeV",hStack->GetBinWidth(1)));
  hStack->SetTitleSize(0.05,"X");
  hStack->SetTitleSize(0.05,"Y");
  hStack->SetTitleOffset(0.75,"Y");
  leg->Draw();

  pad2->cd();
  TH1F* hRatio = new TH1F("hRatio", " ; ; purity",
			  hStack->GetNbinsX(), 
			  hStack->GetXaxis()->GetXmin(), hStack->GetXaxis()->GetXmax());
  hRatio->SetLineStyle(kDashed);
  hRatio->SetLineWidth(1.0);
  hRatio->SetLabelSize(0.12,"X");
  hRatio->SetLabelSize(0.10,"Y");
  hRatio->SetTitleSize(0.12,"Y");
  hRatio->SetTitleOffset(0.36,"Y");
  TH1F* hqqH115Clone = (TH1F*)hqqH115->Clone("hqqH115Clone");
  TH1F* hqqH135Clone = (TH1F*)hqqH135->Clone("hqqH135Clone");
  hqqH115Clone->Divide( hqqH115 ,hSiml,1./signalScale,1.0);
  hqqH135Clone->Divide( hqqH135 ,hSiml,1./signalScale,1.0);
  hRatio->SetAxisRange(0.,0.001,"Y");

  hRatio->Draw();
  hqqH115Clone->Draw("HISTSAME");
  hqqH135Clone->Draw("HISTSAME");

  if(SAVE) c1->SaveAs("Zmm_InclusiveMass.png");

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

示例8: plot

void plot(){

  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);

  TPad* pad1 = new TPad("pad1","",0.05,0.27,0.96,0.97);
  TPad* pad2 = new TPad("pad2","",0.05,0.02,0.96,0.26);
  pad1->SetFillColor(0);
  pad2->SetFillColor(0);
  pad1->Draw();
  pad2->Draw();

  pad1->cd();
  pad1->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() ;

  TH1F* h_TagMult = new TH1F("h_TagMult"," ; multiplicity ; a.u. ", 6,-0.5,5.5);

  TH1F* h_ptTag1  = new TH1F("h_ptTag1","; p_{T} (GeV/c); a.u. ", 60,0,300);
  TH1F* h_ptTag2  = new TH1F("h_ptTag2","; p_{T} (GeV/c); a.u. ", 60,0,300);
  TH1F* h_ptTag3  = new TH1F("h_ptTag3","; p_{T} (GeV/c); a.u. ", 60,0,300);

  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] )  ) ;
    }

    h_TagMult->Fill(tagjets->size());

    int counter=0;
    for(CImap it = sortedTagJets.begin(); 
	it!=sortedTagJets.end(); it++){
      if( counter==0 ) h_ptTag1->Fill( (it->second).Et() );
      if( counter==1 ) h_ptTag2->Fill( (it->second).Et() );
      if( counter==2 ) h_ptTag3->Fill( (it->second).Et() );
      counter++;
    }
   
  }

  h_ptTag1->SetLineColor(kRed);
  h_ptTag1->SetLineStyle(kSolid);
  h_ptTag2->SetLineColor(kBlue);
  h_ptTag2->SetLineStyle(kDashed);
  h_ptTag2->SetLineColor(kMagenta);
  h_ptTag2->SetLineStyle(kDotted);

  cout << "1st jet " << h_ptTag1->GetEntries() << endl;
  cout << "2nd jet " << h_ptTag2->GetEntries() << endl;
  cout << "3rd jet " << h_ptTag3->GetEntries() << endl;

  h_ptTag3->Draw("HISTS");
  h_ptTag1->Draw("HISTSAME");
  h_ptTag2->Draw("HISTSAME");

  leg->AddEntry(h_ptTag1,"1st largest-p_{T} jet","L");
  leg->AddEntry(h_ptTag2,"2nd largest-p_{T} jet","L");
  leg->AddEntry(h_ptTag3,"3rd largest-p_{T} jet","L");

  leg->Draw();

  pad2->cd();
  TH1F* hLow = (TH1F*)h_TagMult->Clone();
  hLow->SetLabelSize(0.12,"X");
  hLow->SetLabelSize(0.10,"Y");
  hLow->SetTitleSize(0.12,"Y");
  hLow->SetTitleSize(0.12,"X");
  hLow->SetTitleOffset(0.36,"Y");
//.........这里部分代码省略.........
开发者ID:aknayak,项目名称:LLRAnalysis,代码行数:101,代码来源:vbfPlotMacro.C

示例9: Draw


//.........这里部分代码省略.........
  hPfMetDphiJJSData->SetMarkerStyle(20);
  hPfMetDphiJJSData->Draw("E1P");
  leg->SetFillColor(10);
  leg->AddEntry(hPfMetDphiJJSData,"Data","PL");

  // EW MC in signal region
  TFile* file = new TFile("AnneMarieEWK_METType1_My.root");

  TH1F *metRangeTotal_DPhiSIGNALClone = (TH1F*)metRangeTotal_DPhiSIGNAL->Clone();
  metRangeTotal_DPhiSIGNALClone->Sumw2();

  metRangeTotal_DPhiSIGNAL->SetLineWidth(2);
  metRangeTotal_DPhiSIGNAL->SetLineStyle(1);
  metRangeTotal_DPhiSIGNAL->Draw("SAMEE1");
  leg->AddEntry(metRangeTotal_DPhiSIGNAL,"EW MC","PL");
  leg->Draw();

  TLatex *t = new TLatex();
  t->SetTextSize(0.042);
  t->DrawLatex(80.,10.,"#Delta#phi_{jj} < 1.0");
  t->DrawLatex(80.,4.,"Type 1 MET");
  t->DrawLatex(60.,2.,"tag.jets with no #mu's");

  c1->SaveAs("met_type1_s_my.gif");

  // Type 1 MET. Bkg area
  TCanvas* c2 = new TCanvas("X","Y",1);

  TLegend *leg = new TLegend(0.60,0.40,0.90,0.50,NULL,"brNDC");

  // data in Bkg region
  TFile* file = new TFile("VBFHinvisQCDAnalysisMy_Type1MET.root");

  TH1F * hPfMetDphiJJBDataClone = (TH1F*)hPfMetDphiJJBData->Clone();
  hPfMetDphiJJBDataClone->Sumw2();

  hPfMetDphiJJBData->GetXaxis()->SetTitle("E_{T}^{miss}, GeV");
  hPfMetDphiJJBData->GetYaxis()->SetTitle("Nev");
  hPfMetDphiJJBData->SetMinimum(1.);
  //  hPfMetDphiJJBData->SetMaximum(100000.);
  hPfMetDphiJJBData->SetMarkerStyle(20);
  hPfMetDphiJJBData->Draw("E1P");
  leg->SetFillColor(10);
  leg->AddEntry(hPfMetDphiJJBData,"Data","PL");

  // EW MC in signal region
  TFile* file = new TFile("AnneMarieEWK_METType1_My.root");

  TH1F *metRangeTotal_DPhiQCDClone = (TH1F*)metRangeTotal_DPhiQCD->Clone();
  metRangeTotal_DPhiQCDClone->Sumw2();

  metRangeTotal_DPhiQCD->SetLineWidth(2);
  metRangeTotal_DPhiQCD->SetLineStyle(1);
  metRangeTotal_DPhiQCD->Draw("SAMEE1");
  leg->AddEntry(metRangeTotal_DPhiQCD,"EW MC","PL");
  leg->Draw();

  TLatex *t = new TLatex();
  t->SetTextSize(0.042);
  t->DrawLatex(80.,10.,"#Delta#phi_{jj} > 2.6");
  t->DrawLatex(80.,4.,"Type 1 MET");
  t->DrawLatex(60.,2.,"tag.jets with no #mu's");

  c2->SaveAs("met_type1_b_my.gif");

  setTDRStyle(0,0,0);

  TCanvas* c3 = new TCanvas("X","Y",1);

  TLegend *leg = new TLegend(0.20,0.80,0.80,0.90,NULL,"brNDC");

  hrD->GetXaxis()->SetTitle("E_{T}^{miss}, GeV");
  hrD->GetYaxis()->SetTitle("multijet extrapolation factor r");
  hrD->Divide(hPfMetDphiJJSDataClone,hPfMetDphiJJBDataClone,1.,1.,"");
  hrD->SetMinimum(0.);
  hrD->SetMaximum(0.07);
  hrD->SetMarkerStyle(24);
  hrD->SetAxisRange(20.,120.,"X");
  hrD->SetTitleOffset(1.5, "Y");
  hrD->Draw("EP");

  hD_EW_S->Add(hPfMetDphiJJSDataClone,metRangeTotal_DPhiSIGNALClone,1.,-1.); 
  hD_EW_B->Add(hPfMetDphiJJBDataClone,metRangeTotal_DPhiQCDClone,1.,-1.);
  hrD_EW->Divide(hD_EW_S,hD_EW_B,1.,1.,"");
  hrD_EW->SetMarkerStyle(20);
  hrD_EW->Draw("SAMEEP");

  leg->AddEntry(hrD,"Data with no EW subtraction","PL");
  leg->AddEntry(hrD_EW,"Data with MC EW subtraction","PL");
  leg->Draw();

  TLatex *t = new TLatex();
  t->SetTextSize(0.042);
  t->DrawLatex(80.,0.015,"Type 1 MET");
  t->DrawLatex(60.,0.010,"tag.jets with no #mu's");


  c3->SaveAs("rD_type1_my.gif");

}
开发者ID:anikiten,项目名称:Nikitenko,代码行数:101,代码来源:VBFHinvisDrawNew1.C

示例10: plotTGraphs

TCanvas* plotTGraphs(std::vector<TGraph*> theGraphs, bool autoFormat, TString titleString, bool logX, bool logY)
{
	gROOT->cd();

	TCanvas* theCanvas = new TCanvas(titleString, titleString, 1600, 1200);
	theCanvas->cd();
	theCanvas->SetLeftMargin(.13);
	theCanvas->SetRightMargin(.06);
	theCanvas->SetGrid(1, 1);
	gPad->SetTickx(1);
	gPad->SetTicky(1);
	gPad->SetLogx(logX);
	gPad->SetLogy(logY);

	//Create frame based on the min and max from all the histograms;
	double minX = minFromTGraphs(theGraphs, true, true);
	double minY = minFromTGraphs(theGraphs, true, false);
	double maxX = maxFromTGraphs(theGraphs, true, true);
	double maxY = maxFromTGraphs(theGraphs, true, false);
	double lengthX = maxX - minX;
	double lengthY = maxY - minY;
	double widen = 0.05;
	if(!logX)
	{
		minX -= widen * lengthX;
		maxX += widen * lengthX;
	}
	else
	{
		minX *= widen;
		maxX /= widen;
	}

	if(!logY)
	{
		minY -= widen * lengthY;
		maxY += widen * lengthY;
	}
	else
	{
		minY *= widen;
		maxY /= widen;
	}
	TH1F* theFrameHist = theCanvas->DrawFrame(minX, minY, maxX, maxY);
	theFrameHist->SetTitleOffset(1.5, "y");
	theFrameHist->SetTitleOffset(1.3, "X");
	theFrameHist->SetTitle(titleString);

	//If it doesn't have a title string use the first histogram
	if(TString(theFrameHist->GetXaxis()->GetTitle()) == "")
	{
		theFrameHist->SetXTitle(theGraphs[0]->GetXaxis()->GetTitle());
		theFrameHist->SetYTitle(theGraphs[0]->GetYaxis()->GetTitle());
	}

	theCanvas->Update();
	theCanvas->Modified();

	TLegend* theLegend = nullptr;

	if(theGraphs.size() > 1)
	{
		double legendSize = .05 * theGraphs.size();
		if(legendSize < .15) legendSize = .15;

//		theLegend = new TLegend(0.55, .8 - legendSize, 0.87, 0.8);  //Top Right
//		theLegend = new TLegend(0.2, .8 - legendSize, 0.47, 0.8);  //Top Left
		theLegend = new TLegend(0.55, .4 - legendSize, 0.87, 0.4); //Bottom Right
	}

	for (unsigned int i = 0; i < theGraphs.size(); i++)
	{
		if(autoFormat)
		{
			theGraphs[i]->SetLineColor(MR_GRAPH_COLOR_LIST[i % MR_GRAPH_NUMCOLORS]);
			theGraphs[i]->SetMarkerColor(MR_GRAPH_COLOR_LIST[i % MR_GRAPH_NUMCOLORS]);
			theGraphs[i]->SetMarkerStyle(MR_MARKER_STYLE_LIST[i % MR_MARKER_NUMSTYLES]);
		}
		theGraphs[i]->Draw("P E1 same");
		if(theLegend != nullptr)
		{
			TString legendString = theGraphs[i]->GetTitle();
			legendString.Resize(legendString.First(';'));
			theLegend->AddEntry(theGraphs[i], legendString, "P E1");
		}
	}

	if(theLegend != nullptr) theLegend->Draw("same");

	return theCanvas;
}
开发者ID:mjbales,项目名称:mattroot,代码行数:91,代码来源:MRGraphics.cpp

示例11: plotMuTau


//.........这里部分代码省略.........
      hTTb->SetFillColor(kMagenta);     
    }
    if( (it->first).find("SS")!=string::npos ) {
      hQCD->Add(h1,1.0);
      hQCD->SetFillColor(42);
    }
    if((it->first).find("qqH115")!=string::npos){
      hSgn1->Add(h1,1.0);
      hSgn1->Scale(magnifySgn_);
      h1->Scale(magnifySgn_);
      hSgn1->SetLineWidth(2);
      h1->SetFillColor(kBlack);
      h1->SetFillStyle(3004);
      h1->SetLineColor(kBlack);
    }
    if((it->first).find("ggH115")!=string::npos){
      hSgn2->Add(h1,1.0);
      hSgn2->Scale(magnifySgn_);
      h1->Scale(magnifySgn_);
      hSgn2->SetLineWidth(2);
      h1->SetFillColor(kBlack);
      h1->SetFillStyle(3005);
      h1->SetLineColor(kBlack);
    }
    if((it->first).find("Data")!=string::npos){
      hData->Add(h1,1.0);
      hData->Sumw2();
      hData->SetMarkerStyle(20);
      hData->SetMarkerSize(1.2);
      hData->SetMarkerColor(kBlack);
      hData->SetLineColor(kBlack);
      hData->SetXTitle(XTitle_+" ("+Unities_+")");
      hData->SetYTitle(Form(" Events/(%.1f %s)", hData->GetBinWidth(1), Unities_.Data() ) );
      hData->SetTitleSize(0.04,"X");
      hData->SetTitleSize(0.05,"Y");
      hData->SetTitleOffset(0.95,"Y");
    }

    // adding alltogether
    hSiml->Add(h1,1.0);

    if(VERBOSE) cout<<(it->first) << " ==> " 
		    << h1->Integral() << " +/- " 
		    << TMath::Sqrt(h1->GetEntries())*(h1->Integral()/h1->GetEntries())
		    << endl;
  }

  // all signal summed together:
  hSgn->Add(hSgn1,hSgn2,1,1);
  hSgn->SetFillColor(kRed);
  hSgn->SetLineWidth(2);

  //Adding to the stack
  aStack->Add(hQCD);
  aStack->Add(hEWK);
  aStack->Add(hTTb);
  aStack->Add(hZtt);
  aStack->Add(hSgn);

  // legend
  leg->AddEntry(hData,"Observed","P");
  leg->AddEntry(hSgn,Form("(%.0fx) H#rightarrow#tau#tau m_{H}=%d",magnifySgn_,mH_),"F");
  leg->AddEntry(hZtt,"Z#rightarrow#tau#tau","F");
  leg->AddEntry(hTTb,"t#bar{t}","F");
  leg->AddEntry(hEWK,"Electroweak","F");
  leg->AddEntry(hQCD,"QCD","F");
  
  hData->Draw("P");
  aStack->Draw("HISTSAME");
  hData->Draw("PSAME");
  
  TH1F* hStack = (TH1F*)aStack->GetHistogram();
  hStack->SetXTitle(XTitle_+" ("+Unities_+")");
  hStack->SetYTitle(Form(" Events/(%.0f %s)", hStack->GetBinWidth(1), Unities_.Data() ) );
  hStack->SetTitleSize(0.04,"X");
  hStack->SetTitleSize(0.05,"Y");
  hStack->SetTitleOffset(0.95,"Y");

  leg->Draw();

  c1->SaveAs(Form("plots/plot_muTau_mH%d_%s_%s_%s.png",mH_,selection_.c_str(),analysis_.c_str(),variable_.Data()));

  // templates for fitting
  TFile* fout = new TFile(Form("histograms/muTau_mH%d_%s_%s_%s.root",mH_,selection_.c_str(),analysis_.c_str(),variable_.Data()),"RECREATE");
  fout->cd();
  hQCD->Write();
  hZmm->Write();
  hZmj->Write();
  hTTb->Write();
  hZtt->Write();
  hW->Write();
  hVV->Write();
  hSgn1->Write();
  hSgn2->Write();
  hData->Write();
  hParameters->Write();
  fout->Write();
  fout->Close();

}
开发者ID:akalinow,项目名称:LLRAnalysis,代码行数:101,代码来源:analyzeMuTau.C

示例12: plotPhotonType

void plotPhotonType(char* var="(ecalRecHitSumEtConeDR04+hcalTowerSumEtConeDR04):genCalIsoDR04")
{
  
  TCut allCut = simpleCut + hardScatterCut;
   
  TProfile *hTemplate;
  TProfile *htmp= new TProfile("htmp","",100,0,20);
  htmp->SetXTitle("genCalIso [GeV]");
  htmp->SetYTitle("recCalIso [GeV]");

  hTemplate= getPlot(htmp,var,allCut,"MPA_PhotonJetPt15_31X.root","Analysis");
  hTemplate->SetName("hTemplate");
  hTemplate->Draw();
  gStyle->SetOptFit(11111);
  hTemplate->Fit("pol1","","");
  TF1* f1 = hTemplate->GetFunction("pol1");

  float p0 = f1->GetParameter(0);
  float p1 = f1->GetParameter(1);

  char tempName[1000];
  sprintf(tempName,
 	  "((ecalRecHitSumEtConeDR04+hcalTowerSumEtConeDR04)-genCalIsoDR04*%f):((ecalRecHitSumEtConeDR04+hcalTowerSumEtConeDR04)-genCalIsoDR04*(%f))",p1,-1.0/p1);
  cout << tempName << endl;

  TProfile *hTemplate_decompos;
  const int nbin=50;
  const float min = 0.0;
  const float max = 10.0;
  TProfile *htmp2= new TProfile("htmp2","",nbin,min,max);
  hTemplate_decompos= getPlot(htmp2,tempName,allCut,"MPA_PhotonJetPt15_31X.root","Analysis");
  hTemplate_decompos->SetName("hTemplate_decompos");
  hTemplate_decompos->Draw();  
  hTemplate_decompos->SetYTitle(Form("recCalIso-genCalIso*%.2f",p1));
  hTemplate_decompos->SetXTitle(Form("recCalIso+genCalIso*%.2f",1.0/p1));
  gStyle->SetOptFit(11111);
//   hTemplate_decompos->Fit("pol1");
  
  
  TCanvas* c1 = new TCanvas("c1","",500,1000);
  c1->Divide(1,2);
  c1->cd(1);
  hTemplate->Draw("");
  c1->cd(2);
  hTemplate_decompos->SetErrorOption("S");
  hTemplate_decompos->Draw("");
  c1->Print("bestGenCalIsoDR04.eps");
  c1->Print("bestGenCalIsoDR04.gif");
 
  TCanvas* c2 = new TCanvas("c2","",500,1000);
  c2->Divide(1,2);
  c2->cd(1);
  TH1F* hMean = new TH1F("hMean","",nbin,min,max);
  hMean->SetXTitle(Form("recCalIso+genCalIso*%.2f",1.0/p1));
  hMean->SetTitleSize(0.06,"Y");
  hMean->SetTitleOffset(1.2,"Y");
  hMean->SetYTitle(Form("Mean of recCalIso-genCalIso*%.2f",p1));
  for(int i=1; i <= nbin; i++)
    hMean->SetBinContent(i,hTemplate_decompos->GetBinContent(i));
  hMean->Draw();
  c2->cd(2);
  TH1F* hRMS = new TH1F("hRMS","",nbin,min,max);
  hRMS->SetXTitle(Form("recCalIso+genCalIso*%.2f",1.0/p1));
  hRMS->SetTitleSize(0.06,"Y");
  hRMS->SetTitleOffset(1.2,"Y");
  hRMS->SetYTitle(Form("RMS of recCalIso-genCalIso*%.2f",p1));
  for(int i=1; i <= nbin; i++)
    hRMS->SetBinContent(i,hTemplate_decompos->GetBinError(i));
  hRMS->Draw();
  c2->Print("bestGenCalIsoDR04_sup.eps");
  c2->Print("bestGenCalIsoDR04_sup.gif");


  int bestDeComposXBin = 11;
  
  float bestDeComposX = hMean->GetBinCenter(bestDeComposXBin);
  float bestDeComposY = hMean->GetBinContent(bestDeComposXBin);

  cout << "bestDeComposX = " << bestDeComposX << endl;
  cout << "bestDeComposY = " << bestDeComposY << endl;
  float bestGenIso = (bestDeComposX - bestDeComposY)/((1.0)/p1 + p1);
  float bestRecIso =  bestDeComposX - (1.0/p1) * bestGenIso;

  cout << "bestGenIso = " << bestGenIso << endl;
  cout << "bestRecIso = " << bestRecIso << endl;


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

示例13: fakeStudyMu


//.........这里部分代码省略.........
    if( (it->first).find("Ztautau")!=string::npos ) {
      h1->SetFillColor(kRed);
      leg->AddEntry(h1,"Z+jets, genuine-#tau","F");
    }
    if( (it->first).find("TTbar")!=string::npos ) {
      h1->SetFillColor(kBlue);
      leg->AddEntry(h1,"t#bar{t}+jets","F");
    }
    if( (it->first).find("SingleTop")!=string::npos ) {
      h1->SetFillColor(29);
      leg->AddEntry(h1,"single-t","F");
    }
    if( (it->first).find("Wjets")!=string::npos ) {
      h1->SetFillColor(kGreen);
      leg->AddEntry(h1,"W+jets","F");
    }
    if( (it->first).find("DiBoson")!=string::npos ) {
      h1->SetFillColor(38);
      leg->AddEntry(h1,"Di-Boson","F");
    }
    if( (it->first).find("QCD")!=string::npos ) {
      h1->SetFillColor(42);
      leg->AddEntry(h1,"QCD-multijets","F");
    }
    if((it->first).find("qqH115")!=string::npos){
      hSgn1 = (TH1F*)h1->Clone("hSgn1");
      hSgn1->Scale(magnifySgn_);
      hSgn1->SetLineWidth(2);
      h1->SetFillColor(kBlack);
      h1->SetFillStyle(3004);
      h1->SetLineColor(kBlack);
      leg->AddEntry(h1,Form("VBF H(115) X %.0f",magnifySgn_),"F");
    }
    if((it->first).find("ggH115")!=string::npos){
      hSgn2 = (TH1F*)h1->Clone("hSgn2");
      hSgn2->Scale(magnifySgn_);
      hSgn2->SetLineWidth(2);
      h1->SetFillColor(kBlack);
      h1->SetFillStyle(3005);
      h1->SetLineColor(kBlack);
      leg->AddEntry(h1,Form("GGF H(115) X %.0f",magnifySgn_),"F");
    }
    if((it->first).find("Data")!=string::npos){
      hData = (TH1F*)h1->Clone("hData");
      hData->Sumw2();
      hData->SetMarkerStyle(20);
      hData->SetMarkerSize(1.2);
      hData->SetMarkerColor(kBlack);
      hData->SetLineColor(kBlack);
      hData->SetXTitle(XTitle_+" ("+Unities_+")");
      hData->SetYTitle(Form(" Events/(%.0f %s)", hData->GetBinWidth(1), Unities_.Data() ) );
      hData->SetTitleSize(0.04,"X");
      hData->SetTitleSize(0.05,"Y");
      hData->SetTitleOffset(0.95,"Y");
      leg->AddEntry(hData,"DATA","P");
    }

    if(iter==0) hSiml=(TH1F*)h1->Clone("hSiml");
    else if((it->first).find("Data")==string::npos) hSiml->Add(h1);

    if((it->first).find("Data")==string::npos) aStack->Add(h1);

    if(VERBOSE) cout<<(it->first) << " ==> " 
		   << h1->Integral() << " +/- " 
		   << TMath::Sqrt(h1->GetEntries())*(h1->Integral()/h1->GetEntries())
		   << endl;
  }

  // all signal summed together:
  hSgn = (TH1F*)hSgn1->Clone("hSgn");
  hSgn->Add(hSgn1,hSgn2,1,1);

  if(VERBOSE) cout<< "S/sqrt(B) ==> " 
		  << hSgn->Integral()/ TMath::Sqrt(hSiml->Integral()) << " +/- " 
		  << (1./2)*TMath::Sqrt(hSiml->GetEntries())*(hSiml->GetSumOfWeights())/hSiml->Integral()*( hSgn->Integral()/ TMath::Sqrt(hSiml->Integral())  )
		  << endl;

  hData->SetXTitle(XTitle_+" ("+Unities_+")");
  hData->SetYTitle(Form(" Events/(%.1f %s)", hData->GetBinWidth(1), Unities_.Data() ) );
  hData->SetTitleSize(0.04,"X");
  hData->SetTitleSize(0.05,"Y");
  hData->SetTitleOffset(0.95,"Y");

  hData->Draw("P");
  aStack->Draw("HISTSAME");
  hData->Draw("PSAME");
  //hSgn1->Draw("HISTSAME");
  //hSgn2->Draw("HISTSAME");

  TH1F* hStack = (TH1F*)aStack->GetHistogram();
  hStack->SetXTitle(XTitle_+" ("+Unities_+")");
  hStack->SetYTitle(Form(" Events/(%.0f %s)", hStack->GetBinWidth(1), Unities_.Data() ) );
  hStack->SetTitleSize(0.04,"X");
  hStack->SetTitleSize(0.05,"Y");
  hStack->SetTitleOffset(0.95,"Y");
  //aStack->GetYaxis()->SetRangeUser(0.0,std::max(hData->GetMaximum(),hStack->GetMaximum())*1.1);
  leg->Draw();


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

示例14: compareplots


//.........这里部分代码省略.........
      if(i == 0){
	histos.at(i)->SetLineColor(kBlack);
      }
      if(i == 1){
	histos.at(i)->SetLineColor(kRed);
      }
      if(i == 2){
	histos.at(i)->SetLineColor(kBlue);
      }
      if(i == 3){
	histos.at(i)->SetLineColor(kGreen+2);
      }
      if(i == 4){
	histos.at(i)->SetLineColor(kMagenta-7);
      }
      if(i == 5){
	histos.at(i)->SetLineColor(kOrange+7);
      }
    }
    
    for(size_t i=0;i<histos.size();i++){
      histos.at(i)->Sumw2();
      histos.at(i)->Scale(1./histos.at(i)->Integral(),"width");
    }

// Set axis title
histos.at(0)->GetYaxis()->SetTitle("Normalized units"); 
std::string const histogramName = histos.at(0)->GetName();
histos.at(0)->GetXaxis()->SetLabelSize(0.06);
histos.at(0)->GetXaxis()->SetLabelOffset(0.006);
histos.at(0)->GetYaxis()->SetLabelSize(0.06);
histos.at(0)->GetYaxis()->SetLabelOffset(0.006);
histos.at(0)->GetXaxis()->SetTitleSize(0.06);
histos.at(0)->GetXaxis()->SetTitleOffset(1.1);
histos.at(0)->GetYaxis()->SetTitleSize(0.06);
histos.at(0)->GetYaxis()->SetTitleOffset(1.08);



histos.at(0)->GetXaxis()->SetTitle(titles.at(run));
run = run+1;
 if(run == (3*8)){
   run = 0;
 }
// If only two histograms per plot make a ratio plot
if(histos.size() == 2)
{

//create main pad  
                                                                                                                                                          
           TPad *mainPad = new TPad("","",0.0,0.3,1.0,1.0);
           mainPad->SetNumber(1);
           mainPad->SetBottomMargin(0.0);
           mainPad->SetRightMargin(0.04);
	   mainPad->SetLeftMargin(0.13);
           mainPad->Draw();

           //create ratio pad                                                                                                                                                           
           TPad *ratioPad = new TPad("","",0.0,0.0,1.0,0.3);
           ratioPad->SetTopMargin(0.0);
           ratioPad->SetBottomMargin(0.4);
           ratioPad->SetLeftMargin(0.13);                                                                                                                                             
           ratioPad->SetRightMargin(0.04);
           gStyle->SetOptTitle(0);
           ratioPad->SetFillColor(0);
           ratioPad->SetNumber(2);
开发者ID:hannes-kit,项目名称:plotscripts,代码行数:67,代码来源:compareplots.C


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