本文整理汇总了C++中TBranch::SetCompressionLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ TBranch::SetCompressionLevel方法的具体用法?C++ TBranch::SetCompressionLevel怎么用?C++ TBranch::SetCompressionLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBranch
的用法示例。
在下文中一共展示了TBranch::SetCompressionLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateTag
//_____________________________________//
Bool_t UpdateTag(TString faliroot, TString froot, TString fgeant,
TString turl, TString guid,
TString fperiod, TString fpass, TString fname) {
cout<<"> Updating tags...."<<endl;
const char * tagPattern = "tag.root";
// Open the working directory
void * dirp = gSystem->OpenDirectory(gSystem->pwd());
const char * name = 0x0;
// Add all files matching *pattern* to the chain
while((name = gSystem->GetDirEntry(dirp))) {
cout<<">>> Adding to chain file " << name << "...." << endl;
if (strstr(name,tagPattern)) {
TFile *f = TFile::Open(name,"read") ;
AliRunTag *tag = 0x0;
AliFileTag *flTag = 0x0;
TTree *fTree = (TTree *)f->Get("T");
if (!fTree) { f->Close(); continue; }
fTree->SetBranchAddress("AliTAG",&tag);
//Defining new tag objects
AliRunTag *newTag = 0x0;
TTree ttag("T","A Tree with event tags");
TBranch * btag = ttag.Branch("AliTAG", &newTag);
btag->SetCompressionLevel(9);
cout<<">>>>> Found " << fTree->GetEntries() << " entries...." << endl;
for(Int_t iTagFiles = 0; iTagFiles < fTree->GetEntries(); iTagFiles++) {
fTree->GetEntry(0);
newTag = new AliRunTag(*tag);
newTag->SetAlirootVersion(faliroot);
newTag->SetRootVersion(froot);
newTag->SetGeant3Version(fgeant);
newTag->SetLHCPeriod(fperiod);
newTag->SetReconstructionPass(fpass);
newTag->SetProductionName(fname);
cout << "Found " << newTag->GetNFiles() << " file tags" << endl;
for(Int_t j = 0; j < newTag->GetNFiles(); j++) {
flTag = (AliFileTag *) newTag->GetFileTag(j);
flTag->SetTURL(turl);
flTag->SetGUID(guid);
}
ttag.Fill();
delete tag;
delete newTag;
}//tag file loop
TFile* ftag = TFile::Open(name, "recreate");
ftag->cd();
ttag.Write();
ftag->Close();
}//pattern check
}//directory loop
return kTRUE;
}
示例2: UpdateWithRCT
void UpdateWithRCT(const char *inrun, const char *inrct)
{
TFile *inrunfile = new TFile(inrun);
TTree *runtree = (TTree *) inrunfile->Get("T");
IlcRunTag *runt = new IlcRunTag();
runtree->SetBranchAddress("IlcTAG", &runt);
TFile *inrctfile = new TFile(inrct);
TTree *rcttree = (TTree *) inrctfile->Get("T");
IlcRunTag *rctt = new IlcRunTag();
rcttree->SetBranchAddress("IlcTAG", &rctt);
runtree->GetEntry(0);
cout << "Looking for RCT match for run " << runt->GetRunId() << endl;
for (int iter=0; iter<rcttree->GetEntries(); iter++) {
rcttree->GetEntry(iter);
if (rctt->GetRunId() == runt->GetRunId()) {
cout << "Found match in RCT for run " << rctt->GetRunId() << endl;
cout << "Updating " << endl;
runt->UpdateFromRunTable(rctt);
}
}
TFile* ftag = TFile::Open("Updated.root", "recreate");
TTree * ttag = new TTree("T","A Tree with event tags");
TBranch * btag = ttag->Branch("IlcTAG", &runt);
ttag->Fill();
btag->SetCompressionLevel(9);
ftag->cd();
ttag->Write();
ftag->Close();
}