本文整理汇总了C++中TFile::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ TFile::Append方法的具体用法?C++ TFile::Append怎么用?C++ TFile::Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFile
的用法示例。
在下文中一共展示了TFile::Append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveOutput
// Save to .root file
void SaveOutput(TString name,TList &list)
{
TFile *out = new TFile(name,"RECREATE");
TDirectory *pwd = gDirectory;
for(int i=0;i<list.GetSize();i++)
{
TDecayMode *dm = list.At(i);
TDirectory *subdir = out->mkdir(dm->GetName());
subdir->cd();
subdir->Append(dm);
subdir->Append(dm->histograms);
pwd->cd();
}
if(!genDesc) cout<<"WARNING! No Generator description in files!"<<endl;
else out->Append(genDesc);
if(userHisto)
{
TDecayMode *uh = (TDecayMode*) userHisto;
cout<<"INFO: Appending user histograms"<<endl;
TDirectoryFile *histos = out->mkdir("USER_HISTOGRAMS");
TIter nexthist(uh->histograms);
TKey *key_hist=0;
TH1D *h;
while(h=(TH1D*)nexthist()) histos->Append(h);
}
out->Write();
out->Close();
delete out;
}
示例2: MyMacro
void MyMacro(){
cout<< "this is a ROOT macro template"<<endl;
TFile *file1 = new TFile("./gauss.root");
myc1 = new TCanvas("myc1","My Canvas");
TH1F *histo = (TH1F*) file1->Get("h1");
histo->GetXaxis()->SetTitle("X-Axis");
histo->GetXaxis()->CenterTitle(1);
histo->Fit("gaus");
//histo->Draw();
//histo->Write();
myc1->Modified();
myc1->Update();
TFile *hfile = new TFile("fit_gauss.root","RECREATE");
hfile->Append(myc1);
hfile->Write();
};