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


C++ TDirectoryFile::Write方法代码示例

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


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

示例1: Terminate

void mySelector::Terminate()
{
   // The Terminate() function is the last function to be called during
   // a query. It always runs on the client, it can be used to present
   // the results graphically or save the results to file.
  TString option = GetOption();
  TString output = "gr_";
  output += option;
  output += ".root";
  TFile *hfile = new TFile(output,"RECREATE","FONLL CCbar cross section");
  
  hfile->cd();
  const Int_t npoint = eventnumber;
  Float_t x[npoint];
  Float_t y[npoint];
  Float_t ylow[npoint];
  Float_t yup[npoint];
  for(int i=0;i<npoint;i++)
    {
      x[i] = Pt[i];
      y[i] = Central[i];
      ylow[i] = Down[i];
      yup[i] = Up[i];
    }
  //TGraph *grFONLLD0 = new TGraph(npoint,Pt,Central);
  TDirectoryFile *ratioErr = new TDirectoryFile(option,"ratio error of scale pp500 to pp200 ");
  ratioErr->SetName(option);
  ratioErr->Add(hRatio);
  TGraph *grFONLLRatio = new TGraph(npoint,x,y);
  grFONLLRatio->SetName("grFONLLRatio");
  TGraph *grFONLLRatio_u = new TGraph(npoint,x,yup);
  grFONLLRatio_u->SetName("grFONLLRatio_u");
  TGraph *grFONLLRatio_d = new TGraph(npoint,x,ylow);
  grFONLLRatio_d->SetName("grFONLLRatio_d");
  grFONLLRatio->Print();
  ///grFONLLRatio->Write();
  ratioErr->Add(grFONLLRatio);
  grFONLLRatio_u->Print();
  //grFONLLRatio_u->Write();
  ratioErr->Add(grFONLLRatio_u);
  grFONLLRatio_d->Print();
  //grFONLLRatio_d->Write();
  ratioErr->Add(grFONLLRatio_d);
  ratioErr->Write();
  hfile->Print();
  hfile->Close();
  tNow.Set();
  cout<<"----------End of job----------"<<endl;
  tNow.Print();
}
开发者ID:heavyflavor,项目名称:script,代码行数:50,代码来源:UseTDirectoryFile.C

示例2: make2Droot_total_noPtWeight


//.........这里部分代码省略.........
	TH2D* h2D_corrY_NP_pPb = (TH2D*)h2D_fit_pt_y_NP_pPb->Clone("h2D_corrY_NP_pPb");
	h2D_corrY_NP_pPb->SetName("h2D_corrY_NP_pPb");
	h2D_corrY_NP_pPb->Divide(h2D_Acc_pt_y_NPMC_pPb);
	h2D_corrY_NP_pPb->Divide(h2D_Eff_pt_y_NPMC_pPb);
	
	////////////////////////////////////////////////
	////// MC corrected yield RECO/(Acc*Eff)
	TH2D* h2D_MCcorrY_PR_Pbp = (TH2D*)h2D_Eff_Num_pt_y_PRMC_Pbp->Clone("h2D_MCcorrY_PR_Pbp");
	h2D_MCcorrY_PR_Pbp->SetName("h2D_MCcorrY_PR_Pbp");
	h2D_MCcorrY_PR_Pbp->Divide(h2D_Acc_pt_y_PRMC_Pbp);
	h2D_MCcorrY_PR_Pbp->Divide(h2D_Eff_pt_y_PRMC_Pbp);
	TH2D* h2D_MCcorrY_NP_Pbp = (TH2D*)h2D_Eff_Num_pt_y_NPMC_Pbp->Clone("h2D_MCcorrY_NP_Pbp");
	h2D_MCcorrY_NP_Pbp->SetName("h2D_MCcorrY_NP_Pbp");
	h2D_MCcorrY_NP_Pbp->Divide(h2D_Acc_pt_y_NPMC_Pbp);
	h2D_MCcorrY_NP_Pbp->Divide(h2D_Eff_pt_y_NPMC_Pbp);
	TH2D* h2D_MCcorrY_PR_pPb = (TH2D*)h2D_Eff_Num_pt_y_PRMC_pPb->Clone("h2D_MCcorrY_PR_pPb");
	h2D_MCcorrY_PR_pPb->SetName("h2D_MCcorrY_PR_pPb");
	h2D_MCcorrY_PR_pPb->Divide(h2D_Acc_pt_y_PRMC_pPb);
	h2D_MCcorrY_PR_pPb->Divide(h2D_Eff_pt_y_PRMC_pPb);
	TH2D* h2D_MCcorrY_NP_pPb = (TH2D*)h2D_Eff_Num_pt_y_NPMC_pPb->Clone("h2D_MCcorrY_NP_pPb");
	h2D_MCcorrY_NP_pPb->SetName("h2D_MCcorrY_NP_pPb");
	h2D_MCcorrY_NP_pPb->Divide(h2D_Acc_pt_y_NPMC_pPb);
	h2D_MCcorrY_NP_pPb->Divide(h2D_Eff_pt_y_NPMC_pPb);
	
	
	////////////////////////////////////////////////
	////// save as a root file
	TFile *outFile = new TFile(Form("total2Dhist_%s_noPtWeight.root",dirName),"RECREATE");
	std::cout << "dirName: " << dirName << std::endl;
	cout << "total2Dhist_"<<dirName<<"_noPtWeight.root has been created :) " <<endl;	

	outFile->cd();
	//Acc	
	h2D_Acc_pt_y_PRMC_Pbp->Write();
	h2D_Acc_pt_y_PRMC_pPb->Write();
	h2D_Acc_pt_y_NPMC_Pbp->Write();
	h2D_Acc_pt_y_NPMC_pPb->Write();
	//Eff
	h2D_Eff_pt_y_PRMC_Pbp->Write();
	h2D_Eff_pt_y_PRMC_pPb->Write();
	h2D_Eff_pt_y_NPMC_Pbp->Write();
	h2D_Eff_pt_y_NPMC_pPb->Write();
	//raw yield
	h2D_fit_pt_y_PR_Pbp->Write();	
	h2D_fit_pt_y_PR_pPb->Write();	
	h2D_fit_pt_y_NP_Pbp->Write();	
	h2D_fit_pt_y_NP_pPb->Write();	
	//corrYield
	h2D_corrY_PR_Pbp->Write();	
	h2D_corrY_PR_pPb->Write();	
	h2D_corrY_NP_Pbp->Write();	
	h2D_corrY_NP_pPb->Write();	
	
	// DIRECTORY : num, den distributions for acc & eff
	TDirectoryFile *otherMCInfo = new TDirectoryFile("otherMCInfo","otherMCInfo");
	otherMCInfo->cd();
	// acc den & num
	h2D_Acc_Den_pt_y_PRMC_Pbp->Write();
	h2D_Acc_Den_pt_y_PRMC_pPb->Write();
	h2D_Acc_Den_pt_y_NPMC_Pbp->Write();
	h2D_Acc_Den_pt_y_NPMC_pPb->Write();
	h2D_Acc_Num_pt_y_PRMC_Pbp->Write();
	h2D_Acc_Num_pt_y_PRMC_pPb->Write();
	h2D_Acc_Num_pt_y_NPMC_Pbp->Write();
	h2D_Acc_Num_pt_y_NPMC_pPb->Write();
	// eff den & num
开发者ID:CmsHI,项目名称:pPbJPsiAnalysis,代码行数:67,代码来源:make2Droot_total_noPtWeight.C


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