本文整理汇总了C++中TTree::SetAutoSave方法的典型用法代码示例。如果您正苦于以下问题:C++ TTree::SetAutoSave方法的具体用法?C++ TTree::SetAutoSave怎么用?C++ TTree::SetAutoSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTree
的用法示例。
在下文中一共展示了TTree::SetAutoSave方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rewritetrees
void rewritetrees(){
TString trees[] = {"iso2j1t" , "noniso2j1t" , "iso2j0t" , "noniso2j0t" , "iso3j2t" , "noniso3j2t" , "iso3j1t" , "noniso3j1t" };
struct{
float weight;
float mtw;
float met;
bool data;
bool qcd;
} info;
TFile* fout = TFile::Open("out.root" , "RECREATE");
for( int i=0 ; i < 8 ; i++){
cout << trees[i] << endl;
TTree* tree = (TTree*)( _file0->Get("Trees/" + trees[i] ) );
tree->SetBranchAddress( "info" , &info );
tree->Print();
TTree* tout = new TTree( tree->GetName() , tree->GetTitle() );
tout->SetAutoSave( 10000 );
tout->Branch( "weight" , &info.weight );
tout->Branch( "mtw" , &info.mtw);
tout->Branch( "met" , &info.met );
tout->Branch( "data" , &info.data );
tout->Branch( "qcd" , &info.qcd );
for(int j = 0 ; j < tree->GetEntries() ; j++){
tree->GetEntry(j);
tout->Fill();
//cout << i ;
}
}
fout->Write();
fout->Close();
}
示例2: stdhep2root
int stdhep2root(int nEvent=100) {
gROOT->Reset();
// In order to refer to shareable libraries in this simple form,
// include their paths in a .rootrc file.
gSystem->Load("libLCDEvent");
gSystem->Load("libLCDRootAppsUtil");
gSystem->Load("libLCDFastMC");
gSystem->Load("libLCDStdHEPUtil");
gSystem->Load("libEG");
gSystem->Load("libEGPythia6");
gSystem->Load("libLCDEvent");
gSystem->Load("libLCDRootAppsUtil");
gSystem->Load("libLCDFastMC");
gSystem->Load("libLCDPhUtil");
gSystem->Load("libLCDGenUtil");
TString parfile_dir;
parfile_dir += gSystem->Getenv("LCDROOT") ;parfile_dir += "/";
parfile_dir += "ParFiles/";
LCDEvent *event= new LCDEvent(); //Create Physics event container first.
// Input stdhep data
Char_t* stdFile = "test.hep";
// Char_t* stdFile = "../../../GenData/eetobbZ0.dat";
LCDreadStdFile source(stdFile,event);
//
// Open root file.
//
Int_t comp=2;
Char_t* rootFile = "eetobbZ0.root";
TFile* hfile = new TFile(rootFile,"RECREATE","LCD Event ROOT file");
hfile->SetCompressionLevel(comp);
//
// Create a tree with one superbranch.
//
TTree* tree = new TTree( "T", "LCD ROOT tree" );
tree->SetAutoSave( 1000000000 );
tree->Branch( "LCDEvent", "LCDEvent", &event);
// Event loop
Int_t iEvent;
for (iEvent = 0; iEvent < nEvent; iEvent++) {
if (!source.GetEvent()) break; // Read an event from the stdhep file.
tree->Fill();
}
//
// Clean up the ROOT file.
//
hfile->Write();
tree->Print();
hfile->Close();
return iEvent;
}