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


C++ TProfile::SetXTitle方法代码示例

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


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

示例1: drawPtEta

void drawPtEta(char *inf){
TFile a(inf);
a.cd("ana");
TProfile *h = new TProfile("h","",100,-3,3);
TCanvas *c = new TCanvas("c","",400,400);
hi->Draw("(pt):eta>>h","evtType!=92&&evtType!=93&&(abs(eta)<2.4&&chg!=0&&abs(pdg)!=11&&abs(pdg)!=13)","prof",10000);
double nevt = hi->GetEntries("evtType!=92&&evtType!=93");
h->Sumw2();
//h->Scale(2./nevt);
h->SetXTitle("#eta");
h->SetYTitle("Average P_{T}");
h->Draw();
c->SaveAs(Form("%s-PtEta-2.4.gif",inf));
c->SaveAs(Form("%s-PtEta-2.4.C",inf));
}
开发者ID:yenjie,项目名称:usercode,代码行数:15,代码来源:drawPtEta.C

示例2: fitBjetJES


//.........这里部分代码省略.........
	hC->Fill(refptL,jtptL/refptL,weightL);      
    }
  }

  if(ppPbPb){
    for(int i=0;i<tB->GetEntries();i++){
      tB->GetEntry(i);
      if(fabs(jtetaB)<2 && binB>=cbinlo && binB<cbinhi && abs(refparton_flavorForBB)==5)
	hB->Fill(refptB,jtptB/refptB,weightB);
    }
    for(int i=0;i<tC->GetEntries();i++){
      tC->GetEntry(i);
      if(fabs(jtetaC)<2 && binC>=cbinlo && binC<cbinhi && abs(refparton_flavorForBC)==4)
	hC->Fill(refptC,jtptC/refptC,weightC);
    }
  }

  
 
  hL->SetMinimum(0.);
  
  hL->SetLineColor(kBlue);
  hB->SetLineColor(kRed);
  hC->SetLineColor(kGreen);

  hL->SetMarkerColor(kBlue);
  hB->SetMarkerColor(kRed);
  hC->SetMarkerColor(kGreen);
  
  //hL->SetMarkerStyle(4);
  //hB->SetMarkerStyle(4);
  //hC->SetMarkerStyle(4);
  
  hL->SetXTitle("genJet p_{T} (GeV/c)");
  hL->SetYTitle("<reco p_{T} / gen p_{T} >");

  hL->GetXaxis()->SetRangeUser(50.,199.999);
  hL->GetYaxis()->SetRangeUser(0.5,1.05);
  
  TCanvas *c1=new TCanvas("c1","c1",800,600);
  c1->SetGridx(1);
  c1->SetGridy(1);

  hL->Draw("e1");
  hB->Draw("e1,same");
  hC->Draw("e1,same");

  TLegend *leg=new TLegend(0.4,0.15,0.9,0.45);
  leg->SetBorderSize(0);
  leg->SetFillStyle(0);
  if(ppPbPb&&cbinlo==0&&cbinhi==40)leg->SetHeader("Pythia+Hydjet, 0-100%");
  leg->AddEntry(hL,"Inclusive jets","pl");
  leg->AddEntry(hC,"c-jets","pl");
  leg->AddEntry(hB,"b-jets","pl");
  leg->Draw();

  TCanvas *c2=new TCanvas("c2","c2",1);
  /*
  TH1F *hL2 = (TH1F*)hL->Clone("hL2");
  TH1F *hB2 = (TH1F*)hB->Clone("hB2");
  hL2->Add(hB2,-1);
  hL2->Draw();
  */

  TH1F  *hcorr = new TH1F("hcorr","hcorr",250,50,300);
  hcorr->Sumw2();
开发者ID:kurtejung,项目名称:bJetTools,代码行数:67,代码来源:fitBjetJES.C

示例3: calibrateEM

void calibrateEM()
{

  // FIXME: There are two possibilities to execute the script:
  // i) root run_hadron_g4.C
  //    root[] .L calibrateEM.C
  //    root[] calibrateEM()
  // or ii) Include the basics from run_hadron_g4.C here and
  //    execute simply:
  //    root calibrateEM.C
  // Load basic libraries
   // Load basic libraries
  gROOT->LoadMacro("/opt/geant4_vmc.2.15a/examples/macro/basiclibs.C");
  basiclibs();

  // Load Geant4 libraries
  gROOT->LoadMacro("/opt/geant4_vmc.2.15a/examples/macro/g4libs.C");
  g4libs();
  
  // Load the tutorial application library
  gSystem->Load("libTutorialApplication");
  
  // MC application
  TutorialApplication* app 
    = new TutorialApplication("TutorialApplication",
			      "Tutorial Application for HEP Lecture @EKP");
  
  // configure Geant4
  gROOT->LoadMacro("g4Config.C");
  Config();

 // instantiate graphical user interface for tutorial application
 new TutorialMainFrame(app);
  //FIXME: Load "CountChargedinScint.C"
  gROOT->ProcessLine(".L CountChargedinScint.C");

  //FIXME: Initialize the geometry
  app->InitMC("geometry/calor(1,0.2)");
  //FIXME: Set the primary particle to photon
  app->SetPrimaryPDG(22);
  // Profile histogram - will show us the mean numbers of counts in bins of the energy.
  // The given binning refers to the energy, the other binning will be inferred automatically.
  TProfile* hcounts = new TProfile("hcounts","Counts per particle energy",
				   10,0,10);
  hcounts->SetXTitle("energy [GeV]");
  hcounts->SetYTitle("mean number of counts");

  // FIXME loop over different particle momenta, and for each momentum simulate several events (e.g. 10)
  for(Int_t i = 0 ; i < 10 ; ++i) {
    for(Int_t k = 0 ; k < 10; k ++) {
    //FIXME: Set the momentum of the primary particle to p
      Double_t p = i;
      app->SetPrimaryMomentum(p);
    //FIXME: Run the simulation
      app->RunMC();
    //FIXME: Fill both the momentum and the output from CountChargedinScint
    //        into the profile histogram hcounts
      Double_t x = CountChargedinScint();
      hcounts->Fill(p,x);
    }
  }

  TCanvas* c = new TCanvas();
  c->cd();
  hcounts->Draw();

  TF1 *fitter = new TF1("fitf","[0]*x", 0,10);
  fitter->SetParameter(0,1.0);
  fitter->SetParNames("calibration factor");
  //FIXME: Fit the histogram to get the calibration factor
  hcounts->Fit("fitf");
}
开发者ID:harrypuuter,项目名称:tp1,代码行数:72,代码来源:calibrateEM.C

示例4: balanceMetVsAj

void balanceMetVsAj(TString infname = "dj_HCPR-J50U-hiGoodMergedTracks_OfficialSelv2_Final0_120_50.root",TCut myCut = "cent<30", char *title = "",bool drawLegend = false)
{
   TFile *inf = new TFile(infname);
   TTree *t = (TTree*)inf->Get("ntjt");

   const int nBin = 3;
   double bins[nBin+1] = {0.5,4,8,1000};  
   double colors[nBin] = {kOrange-8,kBlue-3,kRed};

   // Selection cut
   TCut evtCut = "nljet>100&&abs(nljetacorr)<2&&aljet>50&&abs(aljetacorr)<2&&jdphi>2./3*TMath::Pi()&&!maskEvt";

   cout << "Sel evt: " << t->GetEntries(evtCut&&myCut) << endl;

   TProfile *p[nBin];

   for (int i=0;i<nBin;i++)
   {
      p[i] = new TProfile(Form("p%d",i),"",5,0.0001,0.49999);
      t->Project(Form("p%d",i),Form("-1*metxMerged%d:Aj",i), "1"*(evtCut&&myCut));
      p[i]->SetLineColor(colors[i]);     
      p[i]->SetMarkerColor(colors[i]);     
   }

   TProfile *pall = new TProfile("pall","",5,0.0001,0.49999);
   pall->SetXTitle("A_{J}");
   pall->SetYTitle("<#slash{p}_{T}^{#parallel}> (GeV/c)");
   pall->GetXaxis()->CenterTitle();
   pall->GetYaxis()->CenterTitle();
   pall->SetNdivisions(505);
   t->Project("pall","-1*metx:Aj", "1"*(evtCut&&myCut));
   pall->SetAxisRange(-50,50,"Y");
   pall->SetMarkerSize(1);
   pall->Draw("E");
   for (int i=0;i<nBin;++i) {
      p[i]->SetLineWidth(3);
      p[i]->Draw("e hist same");
   }
   pall->Draw("E same");

   // Legend
   TLegend *leg = new TLegend(0.10,0.68,0.70,0.96);
   leg->SetFillStyle(0);
   leg->SetBorderSize(0);
   leg->SetTextFont(63);
   leg->SetTextSize(16);
   leg->AddEntry(pall,Form("> %.1f GeV/c",bins[0]),"pl");
   for (int i=0;i<nBin;++i) {
      if (i!=nBin-1){
         leg->AddEntry(p[i],Form("%.1f - %.1f GeV/c",bins[i],bins[i+1]),"l");
      } else {
         leg->AddEntry(p[i],Form("> %.1f GeV/c",bins[i]),"l");
      }
   }

   if (drawLegend) leg->Draw();

   TLine * l0 = new TLine(0,0,0.5,0);
   l0->SetLineStyle(2);
   l0->Draw();

   TText *titleText = new TText(0.3,30,title);
   titleText->Draw();
}
开发者ID:CmsHI,项目名称:CVS_SavedFMa,代码行数:64,代码来源:balanceMetVsAjAllCent_nt.C

示例5: makePlot

void makePlot(char* canv)
{
	t->SetBranchAddress("LM_PX1", &intree.LM_PX1);
	t->SetBranchAddress("LM_PX2", &intree.LM_PX2);
	t->SetBranchAddress("LM_PY1", &intree.LM_PY1);
	t->SetBranchAddress("LM_PY2", &intree.LM_PY2);
	t->SetBranchAddress("LM_P2_Integral", &intree.LM_P2_Integral);
	t->SetBranchAddress("time", &intree.timeline);
	t->Print();

	if(entries<=0)
		entries = t->GetEntries();

	char title[100]=0;
	sprintf(title,"%s runs 1100-1107",canv);
	TProfile *prof = new TProfile(title,title,24,0,entries);
	TProfile *prof1 = new TProfile(title,title,24,0,entries);
	TProfile *prof2 = new TProfile(title,title,24,0,entries);

	/**************************************
     * read entries
     **************************************
    */
	Double_t *ratio = new Double_t[entries];
	Double_t *parmean = new Double_t[entries];
	Double_t *p1 = new Double_t[entries];
	Double_t *p2 = new Double_t[entries];

	for (int j = 0; j < entries; ++j){
		gSystem->Sleep (sleep);
		t->GetEntry(j);
		ratio[j] = intree.LM_PY1/intree.LM_PY2;
		p1[j] = intree.LM_PY1;
		p2[j] = intree.LM_PY2;
		//cout<<"entry "<<j<<" peak2 "<<intree.LM_PY2<<endl;
	}

	Double_t mean = TMath::Mean(entries,ratio);
	Double_t mean1 = TMath::Mean(entries,p1);
	Double_t mean2 = TMath::Mean(entries,p2);
	for (int j = 0; j < entries; ++j){
		prof->Fill(j,(ratio[j]/mean-1)*100);
		prof1->Fill(j,(p1[j]/mean1-1)*100);
		prof2->Fill(j,(p2[j]/mean2-1)*100);
	}

	TCanvas *c1 = new TCanvas(canv,"frascatirun",900,700);
	c1->cd();

    char axisXname[100];
	sprintf(axisXname,"Time (Entries) (total: %i)",entries);
	prof->SetXTitle(axisXname);
	prof->SetYTitle("Variation (%)");
	prof->SetMaximum(1);
	prof->SetMinimum(-1);
	prof->SetMarkerColor(4);
	prof->SetMarkerSize(1);
	prof->SetMarkerStyle(8);
	prof->SetStats(kFALSE);
	prof->Draw();

	prof1->SetMarkerColor(5);
	prof1->SetMarkerSize(1);
	prof1->SetMarkerStyle(6);
	prof1->Draw("same");

	prof2->SetMarkerColor(1);
	prof2->SetMarkerSize(1);
	prof2->SetMarkerStyle(7);
	prof2->Draw("same");

/*	TLegend leg = new TLegend(0.1,0.7,0.48,0.9);
	leg->SetHeader("The Legend Title");
	leg->AddEntry(h1,"Histogram filled with random numbers","f");
	leg->AddEntry("f1","Function abs(#frac{sin(x)}{x})","l");
	leg->AddEntry("gr","Graph with error bars","lep");
	leg->Draw("same");
*/
}
开发者ID:gm2-it,项目名称:test-beam-frascati-feb16,代码行数:79,代码来源:readData.C

示例6: plotMETVsJetPhi

void plotMETVsJetPhi(int num=-1)
{
   char *title="";
   if (num!=-1) {
      title = Form("%d",num);
   }
   TFile *inf = new TFile("nt_dj_mix100_Gen.root");
   TTree *tGen = (TTree*) inf->FindObjectAny("ntjt");
   tGen->SetName("gen");
   TFile *inf2 = new TFile("nt_dj_mix100.root");
   TTree *tReco = (TTree*) inf2->FindObjectAny("ntjt");
   tReco->SetName("reco");
   TFile *inf3 = new TFile("nt_dj_HyUQ80v4_djcalo_genp_100_50.root");
   TTree *tGen2 = (TTree*) inf3->FindObjectAny("ntjt");
   tGen2->SetName("gen2");
   TFile *inf4 = new TFile("dj_HyUQ80v4_djcalo_genp_100_50.root");
   TTree *tDj = (TTree*) inf4->FindObjectAny("djTree");
   tDj->SetName("dj");

   TFile *inf5 = new TFile("nt_dj_data100_cor.root");
   TTree *tRecoData = (TTree*) inf5->FindObjectAny("ntjt");
   tRecoData->SetName("data");
   TFile *inf6 = new TFile("dj_HCPR-J50U-hiGoodMergedTracks_OfficialSelv2_Final0_djcalo_100_50.root");
   TTree *tDjData = (TTree*) inf6->FindObjectAny("djTree");
   tDjData->SetName("djdata");
   tGen->AddFriend(tReco); 
   tGen->AddFriend(tGen2);
   tGen->AddFriend(tDj);
   tRecoData->AddFriend(tDjData);
   setupAlias(tGen);
   setupAlias(tReco);
   
   const int nBin = 10;
   double delta = 0.0; //shift
//   double Bins[nBin+1] = {0,1,2,2.2,2.4,2.6,2.8,3,PI};
//   double BinsMC[nBin+1] = {0+delta,1+delta,2+delta,2.2+delta,2.4+delta,2.6+delta,2.8+delta,3+delta,PI+delta};
   double Bins[nBin+1];
   double BinsMC[nBin+1];
   for (int i=0;i<nBin+1;i++)
   {
      Bins[i]=-PI+2*PI/(double)nBin*i;
      BinsMC[i]=-PI+2*PI/(double)nBin*i+delta;
      cout <<Bins[i]<<endl;
   }


   const int nPtBin = 6;
   double ptBins[nPtBin+1] = {0.5,1.0,1.5,4,8,20,1000};

   TCanvas *c = new TCanvas("c","",600,600);

   TProfile *p = new TProfile("p","",nBin,BinsMC);
   TProfile *p2 = new TProfile("p2","",nBin,BinsMC);
   TProfile *p3 = new TProfile("p3","",nBin,BinsMC);
   TProfile *p4 = new TProfile("p4","",nBin,Bins);

   TCut evtCut = "nljet>120&&abs(nljetacorr)<1.6&&aljet>50&&abs(aljetacorr)<1.6&&!maskEvt&&cent<30&&abs(jdphi)>2./3.*3.14159";

   tGen->Draw(Form("-gen.metOutOfConex%s:nljphi+0.0>>p",title),"weight"*evtCut);
   tGen->Draw(Form("-gen2.metOutOfConex%s:nljphi+0.0>>p2",title),"weight"*evtCut);
   tGen->Draw(Form("-reco.metOutOfConex%s:nljphi+0.0>>p3",title),"weight"*evtCut);
   tRecoData->Draw(Form("-metOutOfConex%s:nljphi>>p4",title),"1"*evtCut);
   p->SetMarkerStyle(24);
   p2->SetMarkerStyle(25);
   p3->SetMarkerStyle(26);
   p4->SetMarkerStyle(20);

   p->SetAxisRange(-80,120,"Y");
   p->Draw();
   p2->SetMarkerColor(2);
   p2->SetLineColor(2);
   p3->SetMarkerColor(4);
   p3->SetLineColor(4);
   p2->Draw("same");
   p3->Draw("same");
   p4->Draw("same");

   TLine *l = new TLine(Bins[0],0,PI,0);
   l->Draw();
   p->SetXTitle("#phi_{Leading Jet}");
   p->SetYTitle("<#slash{p}_{T}^{#parallel}> (GeV/c)");

// ====================
   TLegend *leg = new TLegend(0.45,0.68,0.92,0.9);
   leg->SetFillStyle(0);
   leg->SetBorderSize(0);
   leg->SetTextFont(63);
   leg->SetTextSize(16);
   leg->AddEntry("p","Jets with |#eta|<1.6","");
   if (num!=-1) {
      leg->AddEntry("p",Form("Tracks with %.1f<p_{T}<%.1f GeV/c",ptBins[num],ptBins[num+1]),"");
   } else {
      leg->AddEntry("p",Form("Tracks with %.1f<p_{T}<%.1f GeV/c",ptBins[0],ptBins[nPtBin]),"");
   }
   leg->AddEntry("p","#slash{p}_{T}^{#parallel} PYTHIA+HYDJET GEN Signal","pl");
   leg->AddEntry("p2","#slash{p}_{T}^{#parallel} PYTHIA+HYDJET GEN S+B","pl");
   leg->AddEntry("p3","#slash{p}_{T}^{#parallel} PYTHIA+HYDJET RECO","pl");
   leg->AddEntry("p4","#slash{p}_{T}^{#parallel} Data RECO","pl");
   leg->Draw();

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


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