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


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

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


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

示例1: Background_order

void Background_order() {
   Int_t i;
   const Int_t nbins = 4096;
   Double_t xmin     = 0;
   Double_t xmax     = 4096;
   Double_t source[nbins];
   gROOT->ForceStyle();

   TH1F *d1 = new TH1F("d1","",nbins,xmin,xmax);
   TH1F *d2 = new TH1F("d2","",nbins,xmin,xmax);
   TH1F *d3 = new TH1F("d3","",nbins,xmin,xmax);
   TH1F *d4 = new TH1F("d4","",nbins,xmin,xmax);

   TString dir  = gROOT->GetTutorialsDir();
   TString file = dir+"/spectrum/TSpectrum.root";
   TFile *f     = new TFile(file.Data());
   TH1F *back = (TH1F*) f->Get("back2");
   back->SetTitle("Influence of clipping filter difference order on the estimated background");
   back->SetAxisRange(1220,1460);
   back->SetMaximum(3000);
   back->Draw("L");

   TSpectrum *s = new TSpectrum();

   for (i = 0; i < nbins; i++) source[i]=back->GetBinContent(i + 1);
   s->Background(source,nbins,40,TSpectrum::kBackDecreasingWindow,
                 TSpectrum::kBackOrder2,kFALSE,
                 TSpectrum::kBackSmoothing3,kFALSE);
   for (i = 0; i < nbins; i++) d1->SetBinContent(i + 1,source[i]);
   d1->SetLineColor(kRed);
   d1->Draw("SAME L");

   for (i = 0; i < nbins; i++) source[i]=back->GetBinContent(i + 1);
   s->Background(source,nbins,40,TSpectrum::kBackDecreasingWindow,
                 TSpectrum::kBackOrder4,kFALSE,
                 TSpectrum::kBackSmoothing3,kFALSE);
   for (i = 0; i < nbins; i++) d2->SetBinContent(i + 1,source[i]);
   d2->SetLineColor(kBlue);
   d2->Draw("SAME L");

   for (i = 0; i < nbins; i++) source[i]=back->GetBinContent(i + 1);
   s->Background(source,nbins,40,TSpectrum::kBackDecreasingWindow,
                 TSpectrum::kBackOrder6,kFALSE,
                 TSpectrum::kBackSmoothing3,kFALSE);
   for (i = 0; i < nbins; i++) d3->SetBinContent(i + 1,source[i]);
   d3->SetLineColor(kGreen);
   d3->Draw("SAME L");

   for (i = 0; i < nbins; i++) source[i]=back->GetBinContent(i + 1);
   s->Background(source,nbins,40,TSpectrum::kBackDecreasingWindow,
                 TSpectrum::kBackOrder8,kFALSE,
                 TSpectrum::kBackSmoothing3,kFALSE);
   for (i = 0; i < nbins; i++) d4->SetBinContent(i + 1,source[i]);
   d4->SetLineColor(kMagenta);
   d4->Draw("SAME L");
}
开发者ID:Y--,项目名称:root,代码行数:56,代码来源:Background_order.C

示例2: setPlottingStyle

void setPlottingStyle(TH1F& hsig){
  
  hsig.SetStats(kFALSE);
  
  hsig.SetAxisRange(80,750,"Y");
  hsig.SetAxisRange(0,520,"X");
  hsig.SetAxisRange(200,520,"X");

  hsig.GetXaxis()->SetTitle("m_{0} (GeV)");
  hsig.GetYaxis()->SetTitle("m_{1/2} (GeV)");
  hsig.GetYaxis()->SetTitleOffset(0.8);
  hsig.GetYaxis()->SetTitleSize(0.06);
  hsig.GetYaxis()->SetLabelSize(0.06);
  hsig.GetXaxis()->SetTitleOffset(0.9);
  hsig.GetXaxis()->SetTitleSize(0.06);
  hsig.GetXaxis()->SetLabelSize(0.06);

  hsig.SetLineWidth(1);  
  hsig.SetLineColor(kBlue);  
  
}
开发者ID:EsmaeelEskandari,项目名称:MyPHDProjects,代码行数:21,代码来源:ExclusionPlot.C

示例3: trackingStudyAroundJet

void trackingStudyAroundJet(char *infname = "skim_jet_ptha120.root")
{
   HiForest *c = new HiForest(infname);
   c->tree->AddFriend("nt");

   TCut trackSelection = "(mtrkQual||mtrkAlgo<4)&&pNRec>0";
   TCut dijetSelection = "leadingJetPt>120&&subleadingJetPt>50&&acos(cos(leadingJetPhi-subleadingJetPhi))>7./8.*3.141593";
   TCut genParticleCut = "abs(pEta)<2.4";
   
   TCanvas *cleadingJetPt = new TCanvas ("cleadingJetPt","",600,600);
   
   TH1F *hEffleadingJetPt = new TH1F("hEffleadingJetPt","",10,0,0.3);
   
   makeHistTitle(hEffleadingJetPt,"","Leading Jet p_{T} (GeV/c)","Tracking Efficiency");
   
   TGraphAsymmErrors *g = getEfficiency(c->tree,"acos(cos(pPhi-leadingJetPhi))",10,0,0.3,trackSelection,TCut("pPt>20")&&dijetSelection&&genParticleCut);
   TGraphAsymmErrors *g2 = getEfficiency(c->tree,"acos(cos(pPhi-leadingJetPhi))",10,0,0.3,trackSelection,TCut("pPt>8")&&dijetSelection&&genParticleCut);
   TGraphAsymmErrors *g3 = getEfficiency(c->tree,"acos(cos(pPhi-leadingJetPhi))",10,0,0.3,trackSelection,TCut("pPt>0")&&dijetSelection&&genParticleCut);

   hEffleadingJetPt->SetAxisRange(0.6,0.9,"Y");
   hEffleadingJetPt->Draw();
   
   g->Draw("p same");
   g2->SetLineColor(2);
   g2->SetMarkerColor(2);
   g2->Draw("p same");
   
   g3->SetLineColor(4);
   g3->SetMarkerColor(4);
   g3->Draw("p same");

   TLegend *legleadingJetPt = myLegend(0.5,0.7,0.9,0.9);
   legleadingJetPt->AddEntry(g,"#hat{p}_{T} 170 GeV/c, Dijet selection","");
   legleadingJetPt->AddEntry(g,"simTrack p_{T} > 20 GeV/c","pl");
   legleadingJetPt->AddEntry(g2,"simTrack p_{T} > 8 GeV/c","pl");
   legleadingJetPt->AddEntry(g3,"simTrack p_{T} > 0 GeV/c","pl");
   
   legleadingJetPt->Draw();
   cleadingJetPt->SaveAs("effFig/EffVsleadingJetDphi-DijetSelection.gif");
   cleadingJetPt->SaveAs("effFig/EffVsleadingJetDphi-DijetSelection.C");

   
}
开发者ID:yenjie,项目名称:pPbAna,代码行数:43,代码来源:trackingStudyAroundJet.C

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

示例5: geugd_riordan

void geugd_riordan() {
	gROOT->SetStyle("HALLA");
	TCanvas *cn = new TCanvas("cn");
	cn->Draw();
	cn->UseCurrentStyle();
	TH1F *frm = new TH1F("frm","",100,0.,12.);
	frm->GetXaxis()->SetTitle("Q^{2}  [GeV^{2}]");
	frm->GetXaxis()->CenterTitle();
	frm->GetYaxis()->SetTitle("G_{E}^{u}/G_{D}");
	frm->GetYaxis()->CenterTitle();
	frm->SetMinimum(.40);
	frm->SetMaximum(2.4);
	//frm->SetMaximum(0.3);
	frm->UseCurrentStyle();
	frm->Draw();
	frm->SetAxisRange(0.10,12.,"X");

	TF1* galster = new TF1("galster",
			"x/(4.*0.938*.938)*1.91/(1.+x/.71)^2/(1.+5.6*x/(4.*.938*.938))",
			0.,4.);
	galster->SetLineColor(kBlack);
	galster->SetLineStyle(kBlack);
	galster->SetLineWidth(2);

	TF1* gen0 = new TF1("gen0", f1dugen0, 0.,12.);
	gen0->SetLineColor(kBlack);
	gen0->SetLineStyle(kBlack);
	gen0->SetLineWidth(1);



	TF1 *genf = new TF1("genf",genff,1.,10.,1);
	genf->SetLineColor(kBlue);
	genf->SetLineStyle(1);
	genf->SetParameter(0,1.);
	// match to Madey point just below 1.5
	// genf->SetParameter(0,.0411/genf->Eval(1.45));
	//  genf->SetParameter(0,-0.558645);
	genf->SetParameter(0,-0.182645);

	TF1 *roberts_curve = new TF1("roberts",roberts_gen,0.035,12.344,1);
	roberts_curve->SetLineColor(kRed);
	roberts_curve->SetLineStyle(9);

	TF1 *ourfit = new TF1("ourfit",gen_ourfit,0.,10.,0);
	ourfit->SetLineColor(kBlue);
	ourfit->SetLineStyle(0);

	/*
	   TF1 *bbba05 = new TF1("BBBA05",gen_bbba05,0.,10.,0);
	   bbba05->SetLineColor(kGreen);
	   bbba05->SetLineStyle(3);
	   */

	//  TF1 *lomon = new TF1("Lomon",Lomon_GEn,0.,10.,0);
	// lomon->SetLineColor(7);
	// lomon->SetLineStyle(4);




	TMultiGraph* mgrDta = new TMultiGraph("Data","G_{E}^{n}");
	//TLegend *legDta = new TLegend(.3448,.6123,.6810,.9110,"","brNDC");
	TLegend *legDta = new TLegend(.6020,.4004,.9382,.9089,"","brNDC");

	TMultiGraph* wgr = mgrDta;
	TLegend *wlg = legDta;

	// the data
	legDta->SetBorderSize(0); // turn off border
	legDta->SetFillStyle(0);

	datafile_t *f = datafiles;
	TGraph* gr=0;
	TGraph* ogr=0;
	while ( f && f->filename ) {
		ogr=OneGraph(f);
		if (ogr) {
			gr = fromGEntransform(ogr);
			gr->SetLineStyle(0);
			if (f->lnpt) {
				mgrDta->Add(gr,f->lnpt);
				if( f->label[0] != 'x' )
					legDta->AddEntry(gr,f->label,f->lnpt);
			}
			mgrDta->Add(gr,"p");
			if( f->label[0] != 'x' )
				legDta->AddEntry(gr,f->label,"p");

			/*
			   else if (gr->GetMarkerStyle()>=20) {
			   mgrDta->Add(gr,"p");
			   if( f->label[0] != 'x' )
			   legDta->AddEntry(gr,f->label,"p");
			   }	
			   else {
			   mgrDta->Add(gr,"l");
			   if( f->label[0] != 'x' )
			   legDta->AddEntry(gr,f->label,"l");
			   }
//.........这里部分代码省略.........
开发者ID:ellie-long,项目名称:analysis-scripts,代码行数:101,代码来源:geugd_riordan.C

示例6: JetResponseMacro_Pt

void JetResponseMacro_Pt(){
    
    
    TH1::SetDefaultSumw2();
    TH2::SetDefaultSumw2();
    
    //  gROOT->ProcessLine(".x rootlogon.C");
    gROOT->ProcessLine(".L format1Dhisto.C");
    gROOT->ProcessLine(".L formatTGraph.C");
    //  gROOT->ProcessLine(".x betterColors.C");
    //TFile *FileA = TFile::Open(Form("correctedFileForBtag.root"));
    TFile *FileA = TFile::Open(Form("../corrected_dijet_pp_mergedpthatbins_2013MCV3.root"));
    //  TFile *FileA = TFile::Open(Form("/Users/ymao/group/CMS/anaOutputs/pPb/JEC/dijet_pp_mergedpthatbins_2012MC.root"));
    TString outname = "JetResponse_Plots.root";
    //  TFile* outf = new TFile(outname,"recreate");
    TString plotsdir = "/Users/ymao/group/CMS/plots/pA";
    
    TString canv_name = "c1";
    const Double_t kw = 1300;
    const Double_t kh = 480;
    c1 = new TCanvas(canv_name," ",10,10,kw,kh);
    makeMultiPanelCanvas(c1,nBin/2,2,0.0,0.0,0.1,0.2,0.05);
    
    gStyle->SetOptStat(0);
    gStyle->SetPadBottomMargin(0.12);
    gStyle->SetPadTopMargin   (0.025);
    gStyle->SetPadLeftMargin  (0.15);
    gStyle->SetPadRightMargin (0.025);
    gStyle->SetPadTickX       (1);
    gStyle->SetPadTickY       (1);
    
    
    TLegend *t1=new TLegend(0.2,0.75,0.8,0.92);
    //   TLegend *t1=new TLegend(0.25,0.6,0.8,0.92);
    t1->SetFillColor(0);
    t1->SetBorderSize(0);
    t1->SetFillStyle(0);
    t1->SetTextFont(63);
    t1->SetTextSize(15);
    TLegend *t2=new TLegend(0.20,0.45,0.35,0.6);
    t2->SetFillColor(0);
    t2->SetBorderSize(0);
    t2->SetFillStyle(0);
    t2->SetTextFont(63);
    t2->SetTextSize(17);
    
    TH1F * dummy = new TH1F("dummy", "dummy", 500, 0., 500.);
    dummy->SetAxisRange(0., 500., "X") ;
    dummy->GetXaxis()->SetTitle("p_{T}^{ref} (GeV/c)");
    
    //    const char* AlgoNames[] = {"ak3PF"};
    //  TCanvas *c1 = new TCanvas("c1","c1",1100,700);
    //makeMultiPanelCanvas(c1,3,2,0.0,0.0,0.2,0.15,0.07);
    //TCanvas *c1B = new TCanvas("c1B","c1B",1100,700);
    //makeMultiPanelCanvas(c1B,3,2,0.0,0.0,0.2,0.15,0.07);
    //TCanvas *c1C = new TCanvas("c1C","c1C",1100,700);
    //makeMultiPanelCanvas(c1C,3,2,0.0,0.0,0.2,0.15,0.07);
    const int cCanDiv = nBin;
    //  makeMultiPanelCanvas(c1,cCanDiv,2,0.0,0.0,0.2,0.15,0.07);
    int nCanvDiv = cCanDiv;
    const int CnXbins = nJetPtBin;
    int nXbins = CnXbins;
    
    TH2D* iHistoCorrPt[cCanDiv];
    TH2D* iHistoRefPt[cCanDiv];
    TH2D* iHistoJtPt[cCanDiv];
    TH2D* iHistoRawPt[cCanDiv];
    TH1D* h1[cCanDiv][CnXbins];
    
    TF1* Gauss6[cCanDiv][CnXbins];
    double mean[cCanDiv][CnXbins];
    double sigma[cCanDiv][CnXbins];
    double meanErr[cCanDiv][CnXbins];
    double sigmaErr[cCanDiv][CnXbins];
    double xPoint[cCanDiv][CnXbins];
    double xPointErr[cCanDiv][CnXbins];
    TLegend*  leg[cCanDiv];
    
    //   Int_t i = 2 ;
    for(int i =0; i<nCanvDiv; i++)
        //  for(int i =1; i<nCanvDiv-1; i++)
    {
        c1->cd(i+1);
        
        TTree* t      = (TTree*)FileA->Get(Form("%sJetAnalyzer/t", AlgoNames[i]));
        
        leg[i]= new TLegend(0.22,0.63,0.45,0.90);//top right
        leg[i]->SetFillColor(0);
        leg[i]->SetTextSize(0.05);
        leg[i]->SetBorderSize(0);
        
        iHistoCorrPt[i] = new TH2D(Form("%s_CorrPt",AlgoNames[i]),Form("%s_CorrPt",AlgoNames[i]),nXbins,0,500,500,0,5);
        iHistoCorrPt[i]->Sumw2();
        t->Draw(Form("corrpt/refpt:refpt>>%s_CorrPt",AlgoNames[i]),"weight*(refpt>-99 && corrpt>0 && fabs(jteta)<3.0 && rawpt>15.)","goff");
        //    t->Draw(Form("corrpt/refpt:refpt>>%s_CorrPt",AlgoNames[i]),Form("corrpt>0 && fabs(jteta)<3.0"),"goff");
        iHistoCorrPt[i]->Draw("colz");
        leg[i]->AddEntry(iHistoCorrPt[i],Form("%s |#eta|<3.0",AlgoNames[i]),"");
        leg[i]->AddEntry(iHistoCorrPt[i],Form("Jet p_{T}^{corrected}/p_{T}^{ref}"),"");
        format1Dhisto(*iHistoCorrPt[i],250,-1,2,20,2,1,"Jet p_{T}^{ref} (GeV/c)","Corrected p_{T}/ ref p_{T}");//Red
        leg[i]->Draw();
//.........这里部分代码省略.........
开发者ID:rkunnawa,项目名称:JEC_jorge,代码行数:101,代码来源:JetResponseMacro_Pt.C

示例7: printBfraction


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

  //*  --- 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);
    correct2(hBFractionJPdirect,do3bin);
    correct2(hBFractionJPdirectFixC,do3bin);
    //*/
  }
  //*/

  //  --- plots with variation of charm ---


  TCanvas *cBFraction1 = new TCanvas("cBFraction1","b-jet fraction",600,600);
  hBFractionMC->SetLineColor(2);
  hBFractionMC->SetLineWidth(2);
  hBFractionMC->SetMarkerColor(2);
  //hBFractionMC->SetMarkerStyle(4);
  if(!doCent)hBFractionMC->SetAxisRange(80,200,"X");
  hBFractionMC->SetAxisRange(0,0.06,"Y");
  hBFractionMC->SetTitleOffset(1,"X");  
  hBFractionMC->GetYaxis()->SetTitle("b-jet fraction");;
  //hBFractionMC->Draw("e1"); 
  
  //hBFractionMC->GetYaxis()->SetNdivisions(505);
  
  TH1F *hBFractionMC_dummy= (TH1F*)hBFractionMC->Clone("hBFractionMC_dummy");
  hBFractionMC_dummy->SetLineWidth(0);
  hBFractionMC_dummy->SetLineColor(0);
  hBFractionMC_dummy->SetMarkerSize(0);
  hBFractionMC_dummy->Draw(); 
  //  hBFractionMC->Draw("hist"); 

  hBFractionData->SetMarkerStyle(8);
  hBFractionData->Draw("e1,same");  
  hBFractionDataLTJP->SetLineColor(kGreen-2); 
  hBFractionDataLTJP->SetMarkerColor(kGreen-2); 
  hBFractionDataLTJP->SetMarkerStyle(8); 
  hBFractionDataLTJP->Draw("e1,same");
  hBFractionJPdirect->SetMarkerStyle(8); 
  hBFractionJPdirect->SetMarkerColor(kBlue);
  hBFractionJPdirect->SetLineColor(kBlue);
  hBFractionJPdirect->Draw("e1,same");

  
  hBFractionDataFixC->SetLineStyle(2);
  //hBFractionDataFixC->Draw("e1same");   
  hBFractionDataLTJPFixC->SetLineColor(kGreen-2);
  hBFractionDataLTJPFixC->SetMarkerColor(kGreen-2);
  hBFractionDataLTJPFixC->SetMarkerStyle(4);
  hBFractionDataLTJPFixC->SetLineStyle(2);
开发者ID:kurtejung,项目名称:bJetTools,代码行数:67,代码来源:printBfraction.C

示例8: plot

void plot(
	  const string tnp_      = "elecTnP",
	  const string category_ = "elecID80",
	  const string ptRange_  = "pt>15 && pt<20",
	  const string bin_      = "15to20",
	  float ymax             = 1.0,
	  double cutValue_       = 0.5,
	  const float xLow_      = 70,
	  const float xHigh_     = 120,
	  const float nBins_     = 24,
	  bool doBinned_         = true,
	  float deltaAlpha_      = 0.0,
	  float deltaN_          = 0.0,
	  float scale_           = 0.0
	  )
{
 
  std::ofstream out(("elecTnP_"+category_+"_"+bin_+".txt").c_str());
  out.precision(4);

  vector<float*> bin1 = simFit(tnp_,category_,cutValue_,"(abseta<1.5 && "+ptRange_+")", 0.75,0.75,xLow_,xHigh_,nBins_,doBinned_,deltaAlpha_,deltaN_,scale_);
  vector<float*> bin2 = simFit(tnp_,category_,cutValue_,"(abseta>1.5 && "+ptRange_+")", 1.90,0.4, xLow_,xHigh_,nBins_,doBinned_,deltaAlpha_,deltaN_,scale_);

  float truthMC_x[2]   = {(bin1[0])[0], (bin2[0])[0]};
  float truthMC_xL[2]  = {(bin1[0])[1], (bin2[0])[1]};
  float truthMC_xH[2]  = {(bin1[0])[2], (bin2[0])[2]};
  float truthMC_y[2]   = {(bin1[0])[3], (bin2[0])[3]};
  float truthMC_yL[2]  = {(bin1[0])[4], (bin2[0])[4]};
  float truthMC_yH[2]  = {(bin1[0])[5], (bin2[0])[5]};

  float tnpData_x[2]   = {(bin1[1])[0], (bin2[1])[0]};
  float tnpData_xL[2]  = {(bin1[1])[1], (bin2[1])[1]};
  float tnpData_xH[2]  = {(bin1[1])[2], (bin2[1])[2]};
  float tnpData_y[2]   = {(bin1[1])[3], (bin2[1])[3]};
  float tnpData_yL[2]  = {(bin1[1])[4], (bin2[1])[4]};
  float tnpData_yH[2]  = {(bin1[1])[5], (bin2[1])[5]};

  out<<"%Tag&probe measurement :" << category_ << ", bin: " << ptRange_ << endl;
  out<<"\\begin{tabular}[!htbp]{|c|c|c|}" << endl;
  out << "\\hline" << endl;
  out << "Bin & MC & Data \\\\" << endl;
  out << "\\hline" << endl;
  out << "|\\eta|<1.5 & " << truthMC_y[0] << " \\pm " << truthMC_yL[0] << " & " << tnpData_y[0] << " \\pm_{" << tnpData_yL[0] << "}^{" 
      << tnpData_yH[0] << "} \\\\" << endl;
  out << "\\hline" << endl;
  out << "|\\eta|>1.5 & " << truthMC_y[1] << " \\pm " << truthMC_yL[1] << " & " << tnpData_y[1] << " \\pm_{" << tnpData_yL[1] << "}^{" 
      << tnpData_yH[1] << "} \\\\" << endl;
  out << "\\hline" << endl;
  out<<"\\end{tabular}"<<endl;

  TCanvas *c2 = new TCanvas("results","canvas",10,30,650,600);
  c2->SetGrid(0,0);
  c2->SetFillStyle(4000);
  c2->SetFillColor(10);
  c2->SetTicky();
  c2->SetObjectStat(0);

  TLegend* leg = new TLegend(0.18,0.20,0.45,0.45,NULL,"brNDC");
  leg->SetBorderSize(0);
  leg->SetTextSize(0.03);
  leg->SetFillColor(0);

  TH1F* hMaster = new TH1F("hMaster","CMS Preliminary 2011  #sqrt{s}=7 TeV L=XXX pb^{-1}; |#eta^{probe}|; electron ID",1,0,2.3);

  hMaster->SetAxisRange(0,ymax,"Y");
  hMaster->SetXTitle( "|#eta^{probe}|" );
  string YTitle="efficiency";
  hMaster->SetYTitle( YTitle.c_str() );
  hMaster->GetYaxis()->SetTitleOffset(1.4);

  TGraphAsymmErrors* graph_truthMC = new TGraphAsymmErrors(2,truthMC_x,truthMC_y, truthMC_xL,truthMC_xH,truthMC_yL,truthMC_yH);
  graph_truthMC->SetMarkerColor(kBlue);
  graph_truthMC->SetMarkerStyle(kOpenCircle);
  graph_truthMC->SetMarkerSize(1.5);

  TGraphAsymmErrors* graph_tnpData = new TGraphAsymmErrors(2,tnpData_x, tnpData_y, tnpData_xL,tnpData_xH,tnpData_yL,tnpData_yH);
  graph_tnpData->SetMarkerColor(kBlack);
  graph_tnpData->SetMarkerStyle(kFullCircle);
  graph_tnpData->SetMarkerSize(1.5);

  string header = "";
  if(category_.find("ID95")!=string::npos)  header = "Eff. of WP95 for "+ptRange_ ;
  if(category_.find("ID80")!=string::npos)  header = "Eff. of WP80 for "+ptRange_ ;
  if(category_.find("Iso")!=string::npos) header = "Eff. of Iso(#Delta#beta) for "+ptRange_ ;
  if(category_.find("HLT")!=string::npos) header = "Eff. of HLT for "+ptRange_ ;
  leg->SetHeader(header.c_str());
  leg->AddEntry(graph_truthMC,"MC-truth","P");
  leg->AddEntry(graph_tnpData,"DATA","P");

  c2->cd();
  hMaster->Draw();
  graph_truthMC->Draw("PSAME");
  graph_tnpData->Draw("PSAME");

  leg->Draw();

  gPad->SaveAs( ("efficiencyElecTnP"+category_+"_"+bin_+".png").c_str() );
  
}
开发者ID:aknayak,项目名称:LLRAnalysis,代码行数:99,代码来源:computeElecTnPMacro.C

示例9: plotPPBalance_Ratio

void plotPPBalance_Ratio(){

  bool isPF = true;

  TString data_tag;
  TString mc_tag;
  TString jetfinder, jetfinder_tag;

  if(!isPF){
    data_tag = "hdata_ak5calo_DijetBalance";
    mc_tag = "hmc_ak5calo_DijetBalance_histonly";
    jetfinder_tag = "calo";
  }else{
    data_tag = "hdata_ak5pf_DijetBalance";
    mc_tag = "hmc_ak5pf_DijetBalance_histonly";
    jetfinder_tag ="pf";
  }

  TFile *fDATA = new TFile(Form("./%s.root",data_tag.Data()));
  TFile *fMC = new TFile(Form("./%s.root",mc_tag.Data()));

  TH1F *hDijetBal_data = (TH1F*) fDATA->Get("hDataDijetBalance");
  TH1F *hDijetBal_mc = (TH1F*) fMC->Get("hQCDDijetBalance");


  // normalization should be matched with what's in ANA
  hDijetBal_data->Scale(1./hDijetBal_data->Integral());
  hDijetBal_data->Rebin(2);

  hDijetBal_mc->Scale(1./hDijetBal_mc->Integral());
  hDijetBal_mc->Rebin(2);

  cout<<"Bin Width = "<<hDijetBal_data->GetBinWidth(1)<<endl;


  // canvas setting ---
  TCanvas *c1 = new TCanvas("c1","",550,600);

  // dum styling ----
  TH1F *hDum = new TH1F("hDum","",10,0,1.0);
  hDum->SetLineColor(kBlue);
  hDum->SetFillColor(kAzure-8);
  hDum->SetFillStyle(3005);

  hDum->SetStats(0);
  hDum->SetXTitle("A_{J} = (p_{T}^{j1}-p_{T}^{j2})/(p_{T}^{j1}+p_{T}^{j2})");
  hDum->SetYTitle("Data/PYTHIA");

  hDum->GetXaxis()->SetLabelSize(30);
  hDum->GetXaxis()->SetLabelFont(43);
  hDum->GetXaxis()->SetTitleSize(30);
  hDum->GetXaxis()->SetTitleFont(43);
  hDum->GetXaxis()->SetTitleOffset(1.3);
  hDum->GetXaxis()->CenterTitle();

  hDum->GetXaxis()->SetNdivisions(905,true);
  
  hDum->GetYaxis()->SetLabelSize(30);
  hDum->GetYaxis()->SetLabelFont(43);
  hDum->GetYaxis()->SetTitleSize(30);
  hDum->GetYaxis()->SetTitleFont(43);
  hDum->GetYaxis()->SetTitleOffset(1.7);
  hDum->GetYaxis()->CenterTitle();

  hDum->SetAxisRange(0,5,"Y");


  // data, mc styling
  hDijetBal_mc->SetLineColor(kBlue);
  hDijetBal_mc->SetFillColor(kAzure-8);
  hDijetBal_mc->SetFillStyle(3005);

  hDum->Draw("hist");

  hDijetBal_data->SetMarkerSize(2.0);
  hDijetBal_data->SetMarkerSize(2.0);
  hDijetBal_data->Sumw2();
  hDijetBal_mc->Sumw2();
  hDijetBal_data->Divide(hDijetBal_mc);
  hDijetBal_data->Draw("pzsame"); 

  // Legend
  TLegend *t3=new TLegend(0.20,0.54,0.58,0.79);
  //t3->SetHeader("ant-k_{T} (R=0.5) CaloJets");
  t3->AddEntry(hDijetBal_data,"p + p  #sqrt{s}=7.0 TeV","pl");
  //t3->AddEntry(hDijetBal_mc,"PYTHIA","lf");
  t3->SetFillColor(0);
  t3->SetBorderSize(0);
  t3->SetFillStyle(0);
  t3->SetTextFont(63);
  t3->SetTextSize(20);
  t3->Draw();


  // other labeling
  TLatex *cms = new TLatex(0.06,4.5,"CMS");
  cms->SetTextFont(63);
  cms->SetTextSize(20);
  cms->Draw();

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

示例10: trigEffMB

void trigEffMB(char* infile="~/scratch02/data/HIAllPhysics/r151058/OpenHLT*.root")
{
   TChain * oh = new TChain("hltanalysis/HltTree");
   oh->Add(infile);

   // Pre-firing study:
   // * Make sure use an enabled bit, but with wide bx accept
   // * then probe a un-enabled bit
   TCut evtSel("L1_ZdcCaloPlus_ZdcCaloMinus_BptxAND_5bx&&recoVrtNtrk>0");

   TH1D * hBptx5Bx = new TH1D("hBptx5Bx","hBptx5Bx",31,0,31);
   TH1D * hBsc5Bx = new TH1D("hBsc5Bx","hBsc5Bx",31,0,31);
   TH1D * hHf5Bx = new TH1D("hHf5Bx","hHf5Bx",31,0,31);
   TH1D * hZdc5Bx = new TH1D("hZdc5Bx","hZdc5Bx",31,0,31);

   TCanvas *cBx = new TCanvas("cBx","cBx",500,500);
   //cBx->SetLogy();
   oh->Draw("L1Tech_BPTX_plus_AND_minus.v0_5bx>>hBptx5Bx",evtSel,"E");
   oh->Draw("L1_BscMinBiasInnerThreshold1_5bx>>hBsc5Bx",evtSel,"Esame");
   oh->Draw("L1_HcalHfCoincidencePm_5bx>>hHf5Bx",evtSel,"Esame");
   oh->Draw("L1_ZdcCaloPlus_ZdcCaloMinus_5bx>>hZdc5Bx",evtSel,"Esame");

   TCanvas *c = new TCanvas("c","",600,600);
   const int nBin=20;
   Float_t bin[nBin+1]={0,5,10,15,30,60,80,100,120,160,200,300,400,500,2000,4000,8000,12000,20000,40000,160000};
   TH1F *hTmp = new TH1F("hTmp","",nBin,bin);

   TGraphAsymmErrors *g = eff(oh,evtSel,"L1_HcalHfCoincidencePm_5bx");
   //TGraphAsymmErrors *g = eff(oh,evtSel,"HLT_HIMinBiasHfOrBSC");
   //TGraphAsymmErrors *g2 = eff(oh,evtSel,"L1Tech_BSC_HighMultiplicity.v0");
   TGraphAsymmErrors *g3 = eff(oh,evtSel,"L1_BscMinBiasThreshold1_5bx");
   TGraphAsymmErrors *g4 = eff(oh,evtSel,"L1_ZdcCaloPlus_ZdcCaloMinus_5bx");
   //TGraphAsymmErrors *g5 = eff(oh,evtSel,"HLT_HIMinBiasPixel_SingleTrack");
   //TGraphAsymmErrors *g5 = eff(oh,evtSel,"HLT_HIMinBiasZDCPixel_SingleTrack");

   //g2->SetLineColor(2);
   //g2->SetMarkerColor(2);
   //g2->SetMarkerStyle(kOpenStar);
   g3->SetLineColor(4);
   g3->SetMarkerColor(4);
   g3->SetMarkerStyle(4);
   g4->SetLineColor(kGreen+2);
   g4->SetMarkerColor(kGreen+2);
   g4->SetMarkerStyle(4);
   //g5->SetMarkerStyle(kOpenSquare);
   //g5->SetMarkerColor(kMagenta);
   hTmp->SetAxisRange(0,1.3,"Y");
   hTmp->SetXTitle("HF (GeV)");
   hTmp->SetYTitle("Firing rate");
   hTmp->Draw();
   TLine *l = new TLine(0,1,bin[nBin],1);
   l->SetLineStyle(2);
   //g5->Draw("p same");
   g->Draw("p same");
   g3->Draw("p same");
   g4->Draw("p same");
   //g2->Draw("p same");
   l->Draw();
   TLegend *t = new TLegend(0.34,0.78,0.94,0.91);
   t->SetBorderSize(0);
   t->SetFillStyle(0);
   t->AddEntry(g,"L1_HcalHfCoincidencePm_5bx","pl");
   //t->AddEntry(g2,"L1Tech_BSC_HighMultiplicity.v0","pl");
   t->AddEntry(g3,"L1_BscMinBiasThreshold1_5bx","pl");
   t->AddEntry(g4,"HLT_HIMinBiasZDC_Calo","pl");
   //t->AddEntry(g5,"HLT_HIMinBiasPixel_SingleTrack","pl");
   t->Draw();
}
开发者ID:CmsHI,项目名称:CVS_SavedFMa,代码行数:68,代码来源:trigEffMB.C

示例11: ppb_merge

void ppb_merge(){
	
	TStopwatch timer;
	timer.Start();
	
	
	//Float_t N_mb = Lumi_ppb*sigma_inelastic*1000;
	//Float_t Lumi_ppb = 30.9;// inverse micro barns
	//Float_t sigma_inelastic = 70.0;//milli barns

	TH1::SetDefaultSumw2();
	
	
	
	TString inname1 = "root://eoscms//eos/cms/store/group/phys_heavyions/yjlee/pPb2013/promptReco/PA2013_HiForest_PromptReco_JSonPPb_forestv77.root";
	TString inname2 = "root://eoscms//eos/cms/store/group/phys_heavyions/krajczar/inbound/mnt/hadoop/cms/store/user/krajczar/pPb_Jet40Jet60_Full_v1/mergedJet40Jet60_KK.root";
	
	TFile *f1 = TFile::Open(inname1);
	TFile *f2 = TFile::Open(inname2);
	
	cout<<" File for HLT_100 HLT_80 = "<<inname1<<endl;
	cout<<" File for HLT_60 HLT_40 = "<<inname2<<endl;
	
	TFile *outfile = new TFile("pPbmerged_output.root","RECREATE");
	
	TTree* jet_80 = (TTree*)f1->Get("akPu3PFJetAnalyzer/t");
	TTree* jet_80_hlt = (TTree*)f1->Get("hltanalysis/HltTree");
	TTree* jet_80_skim = (TTree*)f1->Get("skimanalysis/HltTree");
	TTree* jet_80_evt = (TTree*)f1->Get("hiEvtAnalyzer/HiTree");
	jet_80->AddFriend(jet_80_hlt);
	jet_80->AddFriend(jet_80_skim);
	jet_80->AddFriend(jet_80_evt);
	
	TTree* jet_60 = (TTree*)f2->Get("akPu3PFJetAnalyzer/t");
	TTree* jet_60_hlt = (TTree*)f2->Get("hltanalysis/HltTree");
	TTree* jet_60_skim = (TTree*)f2->Get("skimanalysis/HltTree");
	TTree* jet_60_evt = (TTree*)f2->Get("hiEvtAnalyzer/HiTree");
	jet_60->AddFriend(jet_60_hlt);
	jet_60->AddFriend(jet_60_skim);
	jet_60->AddFriend(jet_60_evt);
	
	TCut Sel = "abs(vz)<15&&pHBHENoiseFilter&&pPAcollisionEventSelectionPA";
	TCut Trig_100 = "HLT_PAJet100_NoJetID_v1";
	TCut Trig_80 = "HLT_PAJet80_NoJetID_v1";
	TCut Trig_60 = "HLT_PAJet60_NoJetID_v1";
	TCut eta = "abs(jteta)<1";

	Float_t N_mb = 7.71e13;
	
	Float_t prescl3 = (Float_t)jet_80->GetEntries()/jet_80->GetEntries(Trig_60);
	Float_t prescl3_test = (Float_t)jet_80->GetEntries(Sel&&eta&&Trig_100)/jet_80->GetEntries(Sel&&eta&&Trig_60);

	
	const Int_t nbins = 16;
	const Double_t bound[nbins+1] = {30., 40., 50., 60., 70., 80., 90., 100., 110., 120., 140., 150., 160., 200., 220., 260., 300.};
	
	TH1F *hMeas_100 = new TH1F("hMeas_100","PPb HLT_100 Measured histo",nbins,bound);
	TH1F *hMeas_80 = new TH1F("hMeas_80","PPb HLT_80 Measured histo",nbins,bound);
	TH1F *hMeas_60 = new TH1F("hMeas_60","PPb HLT_60 Measured histo",nbins,bound);
	TH1F *hCombined = new TH1F("hCombined","PPb Combined spectra",nbins,bound);
	
	hMeas_100->Sumw2();
	hMeas_60->Sumw2();
	hMeas_80->Sumw2();
	
	jet_80->Draw("jtpt>>hMeas_100",Sel&&Trig_100&&eta);
	jet_80->Draw("jtpt>>hMeas_80",Sel&&!Trig_100&&Trig_80&&eta);
	jet_60->Draw("jtpt>>hMeas_60","1.58606"*Sel&&eta&&Trig_60&&!Trig_80&&!Trig_100);
	
	
	divideBinWidth(hMeas_100);
	divideBinWidth(hMeas_80);
	divideBinWidth(hMeas_60);
	
	hMeas_100->Scale(1./2); //scaling by d eta  - from -1 to +1 is 2. 
	hMeas_80->Scale(1./2);
	hMeas_60->Scale(1./2);
	
	hCombined->Add(hMeas_100,1);
	hCombined->Add(hMeas_80,1);
	hCombined->Add(hMeas_60,1);
	
	hCombined->Scale(1./N_mb);
	hMeas_100->Scale(1./N_mb);
	hMeas_80->Scale(1./N_mb);
	hMeas_60->Scale(1./N_mb);
	
	TCanvas *cMerged = new TCanvas("cMerged","Merged PPb spectra",800,600);
	cMerged->SetLogy();

	hCombined->SetXTitle("Jet p_{T} [GeV/c]");
	hCombined->SetYTitle("1/N_mb d^2N/dp_t d eta");
	hCombined->SetMarkerColor(kBlack);
	hCombined->SetMarkerStyle(20);
	hCombined->SetAxisRange(30,300,"X");
	hCombined->Draw();
	hMeas_100->SetMarkerColor(kRed);
	hMeas_100->SetMarkerStyle(21);
	hMeas_100->Draw("same");
	hMeas_80->SetMarkerColor(kBlue);
//.........这里部分代码省略.........
开发者ID:rkunnawa,项目名称:RpPb,代码行数:101,代码来源:ppb_merge.C

示例12: gen5

void gen5() {
  gROOT->SetStyle("HALLA");
  TCanvas *cn = new TCanvas("cn");
  cn->Draw();
  cn->UseCurrentStyle();
  TH1F *frm = new TH1F("frm","",100,0.,10.);
  frm->GetXaxis()->SetTitle("Q^{2}  [GeV^{2}]");
  frm->GetYaxis()->SetTitle("G_{E}^{n}/Gd");
  frm->SetMinimum(-.1);
  frm->SetMaximum(1.);
  frm->UseCurrentStyle();
  frm->Draw();
  frm->SetAxisRange(0.,5.,"X");

  TF1* galstergd = new TF1("galstergd",
			 "(1.+x/.71)*(1.+x/.71)*x/(4.*0.938*.938)*1.91/(1.+x/.71)^2/(1.+5.6*x/(4.*.938*.938))",
			 0.,4.);
  galstergd->SetLineColor(6);
  galstergd->SetLineStyle(3);
  galstergd->SetLineWidth(2);


  TF1 *genf = new TF1("genf",genff,1.,10.,1);
  genf->SetLineColor(2);
  genf->SetLineStyle(2);
  genf->SetParameter(0,1.);
  // match to Madey point just below 1.5
  // genf->SetParameter(0,.0411/genf->Eval(1.45));
  genf->SetParameter(0,-0.558645);

  TF1 *bbba05 = new TF1("BBBA05",gen_bbba05,0.,10.,0);
  bbba05->SetLineColor(7);
  bbba05->SetLineStyle(3);

 
  TMultiGraph* mgrDta = new TMultiGraph("Data","G_{E}^{n}/Gd");
  TLegend *legDta = new TLegend(.54,.6,.875,.90,"","brNDC");

  TMultiGraph* wgr = mgrDta;
  TLegend *wlg = legDta;

   // the data
  legDta->SetBorderSize(0); // turn off border
  legDta->SetFillStyle(0);
  
  datafile_t *f = datafiles;
  TGraph* gr=0;
  TGraph* ogr=0;
  while ( f && f->filename ) {
    ogr=OneGraph(f);
    if (ogr) {
      gr=fromGEntoGEnGd(ogr);
      if (f->lnpt) {
	mgrDta->Add(gr,f->lnpt);
	legDta->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	mgrDta->Add(gr,"p");
	legDta->AddEntry(gr,f->label,"p");
      }	
      else {
	mgrDta->Add(gr,"l");
	legDta->AddEntry(gr,f->label,"l");
      }
    }
    f++;
  }
    

  mgrDta->Draw("p");
  //  legDta->Draw();   don't draw the data legend
  
  TMultiGraph* mgrThry = new TMultiGraph("Theory","G_{E}^{n}/Gd");
  TLegend *legThry = new TLegend(.54,.6,.875,.9,"","brNDC");

  wgr = mgrThry;
  wlg = legThry;

  // the theory
  wlg->SetBorderSize(0); // turn off border
  wlg->SetFillStyle(0);
  
  f = theoryfiles1;
  ogr=0;
  gr=0;
  while ( f && f->filename ) {
    ogr=OneGraph(f);
    if (ogr) {
      gr=fromGEntoGEnGd(ogr);
      TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
      if (egr && egr->GetN()>1 && egr->GetEYhigh() && egr->GetEYhigh()[1]>0) {
	gr = toerror_band(egr);
	gr->SetFillStyle(3000+f->style);
      }
      if (f->lnpt) {
	wgr->Add(gr,f->lnpt);
	wlg->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	wgr->Add(gr,"p");
//.........这里部分代码省略.........
开发者ID:ellie-long,项目名称:analysis-scripts,代码行数:101,代码来源:gen5.C

示例13: PP_MC_normResponseMatrix


//.........这里部分代码省略.........
	mPP_ResponseNorm_recoTrunc->SetBinContent(x, y, 0.0);
	mPP_ResponseNorm_recoTrunc->SetBinError(x, y, 0.0);
      }
	
    }
      
  }
    
  hGen_Projection_recoTrunc = (TH1F*)mPP_ResponseNorm_recoTrunc->ProjectionX();
  hGen_Projection_recoTrunc->SetName("hGen_Projection_recoTrunc");
  // hGen_Projection_recoTrunc->Rebin(10);

  cout<<"finished getting histograms for truncted response matrix"<<endl;
    
  hKineticEfficiency = (TH1F*)hGen_Projection_recoTrunc->Clone("hKineticEfficiency");
  hKineticEfficiency->Divide(hGen_Projection);

  for(int bin = 1; bin<=hKineticEfficiency->GetNbinsX(); ++bin){
    double val = hKineticEfficiency->GetBinContent(bin);
    val = 1./val;
    hKineticEfficiency->SetBinContent(bin, val);
  }

  cout<<"Plotting kinetic efficiency"<<endl;
    
  cKineticEfficiency->cd();

  hKineticEfficiency->SetTitle(" ");
  hKineticEfficiency->SetXTitle("Gen p_{T} (GeV/c)");
  hKineticEfficiency->SetYTitle("Kinetic Efficiency");

  hKineticEfficiency->SetMarkerStyle(20);
  hKineticEfficiency->SetMarkerColor(kBlack);
  hKineticEfficiency->SetAxisRange(60, 299, "X");
  hKineticEfficiency->SetAxisRange(0.98, 1.05, "Y");
  hKineticEfficiency->Draw();

  drawText("PYTHIA, Kinetic Efficiency", 0.25,0.7,14);
  drawText(Form("ak%dPF Jets",radius), 0.25, 0.65, 14);
    
  cout<<"Finished plotting kinetic efficiency"<<endl;

  cGenProj->cd();
  hGen_Projection->SetTitle(" ");
  hGen_Projection->SetXTitle("Gen p_{T} (GeV/c)");
  hGen_Projection->SetYTitle("GenProjection of Normalized Response Matrix");
  hGen_Projection->Scale(1./10);
  hGen_Projection->SetMarkerStyle(33);
  hGen_Projection->SetMarkerColor(kBlack);
  hGen_Projection->SetAxisRange(20, 350, "X");
  hGen_Projection->SetAxisRange(0.6, 1.4, "Y");
  hGen_Projection->Draw();

  hGen_Projection_recoTrunc->Scale(1./10);
  hGen_Projection_recoTrunc->SetMarkerStyle(25);
  hGen_Projection_recoTrunc->SetMarkerColor(kRed);
  hGen_Projection_recoTrunc->Draw("same");

  drawText("PYTHIA, Projection onto Gen axis", 0.25,0.7,14);
  drawText(Form("ak%dPF Jets",radius), 0.25, 0.65, 14);
    
  TLegend * leg = myLegend(0.3,0.6,0.7,0.7);
  leg->AddEntry(hGen_Projection,"No Truncation in Reco pT","pl");
  leg->AddEntry(hGen_Projection_recoTrunc,"reco pT truncated 40 to 350 GeV","pl");
  leg->SetTextSize(0.04);
  leg->Draw();
开发者ID:ilaflott,项目名称:RAA_5p02_code,代码行数:67,代码来源:PP_MC_normResponseMatrix.C

示例14: makeRisetimeDistributionT9

void makeRisetimeDistributionT9(string filename, string plotname, string plotTitle,
			      double ampCutOnMCP, double ampCutOnLYSO, double ampCutOnTrigger,
			    double beamXMin, double beamXMax, double beamYMin, double beamYMax,
			    int nbins, double xmin, double xmax, double fitmin, double fitmax) {


  TFile *inputfile = TFile::Open(filename.c_str(),"READ");
  
  TTree *tree = (TTree*)inputfile->Get("t1065");

  // get the variables from the ntuple
  float amp[36];
  float risetime[36];
  float gauspeak[36];
  float linearTime30[36];
  float beamX;
  float beamY;

  tree->SetBranchStatus("*",0);
  tree->SetBranchStatus("gauspeak",1);
  tree->SetBranchStatus("amp",1);
  tree->SetBranchStatus("risetime",1);
  tree->SetBranchStatus("linearTime30",1);
  tree->SetBranchStatus("TDCx",1);
  tree->SetBranchStatus("TDCy",1);
  tree->SetBranchAddress("gauspeak",gauspeak);
  tree->SetBranchAddress("amp",amp);
  tree->SetBranchAddress("risetime",risetime);
  tree->SetBranchAddress("linearTime30",linearTime30);
  tree->SetBranchAddress("TDCx",&beamX);
  tree->SetBranchAddress("TDCy",&beamY);

  //create histograms
  TH1F *histRisetime;
  histRisetime = new TH1F("histRisetime","; Integrated Charge [pC];Number of Events", nbins, xmin, xmax);

  
  //read all entries and fill the histograms
  Long64_t nentries = tree->GetEntries();

  std::cout<<"Number of events in Sample: "<<nentries<<std::endl;  
  for (Long64_t iEntry=0;iEntry<nentries;iEntry++) {
    if (iEntry %1000 == 0) 
      cout << "Processing Event " << iEntry << "\n";
    tree->GetEntry(iEntry);    
    // cout << "here1\n";
    float MCPTimeGauss = gauspeak[0];
    float CdTeTime = linearTime30[1];
    float MCPAmp = amp[0];
    float LYSOAmp = amp[2];
    float TriggerAmp = amp[3];
    float CherenkovAmp = amp[7];
    float CdTeAmp = amp[1]*(1.0/63.0957);
    float CdTeRisetime = risetime[1];
    // cout << "here2\n";
       
    //use MCP amplitude cut for electron ID
    //cout << "test: " << MCPAmp << " " << siliconIntegral << "\n";
    if( !(MCPAmp > ampCutOnMCP)) continue;
    if( !(TriggerAmp > ampCutOnTrigger)) continue;
    if( !(LYSOAmp > ampCutOnLYSO)) continue;
    if(!(beamX > beamXMin && beamX < beamXMax)) continue;
    if(!(beamY > beamYMin && beamY < beamYMax)) continue;
     // cout << "here3\n";

    //don't fill overflow bins
    //if (1000* siliconIntegral * attenuationFactor / amplificationFactor > xmax) continue;
    
    histRisetime->Fill( CdTeRisetime );

    //cout << CdTeRisetime << " " << beamX << " " << beamY << " " << CdTeAmp << "\n";

    //cout << 1000* amp[21] << " : " << amplificationFactor << " : " << siliconIntegral * attenuationFactor / amplificationFactor << "\n";
 
  }


  TCanvas * c = 0;


  //Energy plot
  c = new TCanvas("c","c",600,600);  
  c->SetRightMargin(0.05);
  c->SetLeftMargin(0.17);
  histRisetime->SetAxisRange(xmin,xmax,"X");
  histRisetime->SetTitle("");
  histRisetime->GetXaxis()->SetTitle("Risetime [ns]");
  histRisetime->GetXaxis()->SetTitleSize(0.045);
  histRisetime->GetXaxis()->SetLabelSize(0.045);
  histRisetime->GetYaxis()->SetTitle("Number of Events");
  histRisetime->GetYaxis()->SetTitleOffset(1.3);
  histRisetime->GetYaxis()->SetTitleSize(0.05);
  histRisetime->GetYaxis()->SetLabelSize(0.045);
  histRisetime->GetYaxis()->SetLabelOffset(0.015);
  histRisetime->GetYaxis()->SetTitleOffset(1.7);
  histRisetime->SetMaximum(1.2*histRisetime->GetMaximum());
  histRisetime->Draw();
  histRisetime->SetStats(0);
  histRisetime->Fit("gaus","","",fitmin,fitmax);
  TVirtualFitter * fitter = TVirtualFitter::GetFitter();
//.........这里部分代码省略.........
开发者ID:CaltechPrecisionTiming,项目名称:t1065-jun-2016,代码行数:101,代码来源:plotRisetime.C

示例15: compareChargeDependantFakeRates

//--------------------------------------------------------------------------------------------------
// Make plots of fake rates for different charges
//--------------------------------------------------------------------------------------------------
void compareChargeDependantFakeRates(char *FakeRateFilename , string sampleName, int denominatortype, int faketype, 
                                     int onlychargetype = -1000, int onlyeventType = -1000 ) {

  string fakeTypeString = "";
  if (faketype == 11) {
    fakeTypeString = "Electron";
  } else if (faketype == 13) {
    fakeTypeString = "Muon";
  } else {
    cerr << "Error: faketype = " << faketype << " not recognized.\n";
    assert(false);
  }

  string denominatorTypeString = "";
  if (denominatortype == 1) {
    denominatorTypeString = "TrackDenominator";
  }

  string plotname = "ChargeDependant" + fakeTypeString + denominatorTypeString + "FakeRateComparison_" + sampleName;

  TCanvas *cv = MakeCanvas("cv", plotname.c_str(), 800, 600);
  TLegend *leg1=0;
  leg1 = new TLegend(0.65,0.6,0.9,0.8);   
  leg1->SetBorderSize(1);
  leg1->SetTextSize(0.03);

  int color = 0;
  for (int chargetype = -1; chargetype <= 1; chargetype += 2) {
    for (int eventType= -1; eventType <= 1; eventType ++) {

      if (!(onlychargetype == chargetype || onlychargetype == -1000))
        continue;

      if (onlyeventType == 0) {
        if (eventType != 0)
          continue;
      } else {
        if (eventType == 0)
          continue;
      }

      //different charges
      string chargeTypeName = "";
      string LegendString = sampleName + " ";

      string eventTypeName = "";
      if (eventType == -1) {
        eventTypeName = "MinusW";
        LegendString += "-";
      } else if (eventType == 1) {
          eventTypeName = "PlusW";
          LegendString += "+";
      } else if (eventType == 0)
        LegendString += "Fake";
        
      if (chargetype == -1) {
        chargeTypeName = "Minus";
        LegendString += "-";
      } else if (chargetype == 1) {
        chargeTypeName = "Plus";
        LegendString += "+";
      }
           
      TFile *file = new TFile(FakeRateFilename, "READ");
      file->cd();
      
      TH1F *tmp = (TH1F*)file->FindObjectAny((chargeTypeName + fakeTypeString + eventTypeName + denominatorTypeString + "FakeRate_Pt_" + sampleName).c_str());
      if (!tmp) {
        cerr << "can't find :"  << chargeTypeName + fakeTypeString + eventTypeName + denominatorTypeString + "FakeRate_Pt_" + sampleName << endl;
        assert(tmp);
      }
      tmp->SetLineColor(COLORS[color]);
      tmp->SetMarkerColor(COLORS[color]);    
      tmp->SetAxisRange(0,100);

      color++;
      leg1->AddEntry(tmp, LegendString.c_str(), "LP");
      if (chargetype == -1 && eventType == -1)
        tmp->Draw();
      else 
        tmp->Draw("same");
    }
  }
  
  leg1->Draw();

  string filename = plotname + ".gif";
  cv->SaveAs(filename.c_str());
  cv->Delete();
}
开发者ID:IlariaVai,项目名称:UserCode-1,代码行数:93,代码来源:computeFakeRates.C


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