本文整理汇总了C++中TFile::TestBit方法的典型用法代码示例。如果您正苦于以下问题:C++ TFile::TestBit方法的具体用法?C++ TFile::TestBit怎么用?C++ TFile::TestBit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFile
的用法示例。
在下文中一共展示了TFile::TestBit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doEvents
// ------------------ Here is the actual method -----------------------------------------
void doEvents(const Char_t *fileList, const Char_t *outputname)
{
Int_t nEvents = 1000;
Int_t nfiles = 100;
//
// First load some shared libraries we need
//
if (gClassTable->GetID("TTable") < 0) {
gSystem->Load("libStar");
gSystem->Load("libPhysics");
}
gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
loadSharedLibraries();
gSystem->Load("StarMagField");
gSystem->Load("StMagF");
gSystem->Load("StTpcDb");
// gSystem->Load("StDbUtilities");
gSystem->Load("StDaqLib");
gSystem->Load("StDbBroker");
gSystem->Load("StDetectorDbMaker");
gSystem->Load("StDbUtilities");
gSystem->Load("St_db_Maker");
gSystem->Load("StEvent");
gSystem->Load("StEventMaker");
gSystem->Load("StarMagField");
gSystem->Load("StTofUtil");
gSystem->Load("StVpdAnalysisMaker");
//
// Handling depends on whether file is a ROOT file or XDF file
//
chain = new StChain("StChain");
delete setFiles; setFiles =0;
if (fileList) { //Normal case
setFiles= new StFile();
} else { //
return;
}
ifstream* inputStream = new ifstream;
inputStream->open(fileList);
if (!(inputStream)) {
cout << "can not open list file" << endl;
return;
}
cout<<"Open file list: --- "<<fileList<<endl;
char line[512];
for (;inputStream->good();) {
inputStream->getline(line,512);
if ( inputStream->good() ) {
//cout<<" root file "<<line<<endl;
TFile *ftmp = new TFile(line);
//----------
if (!(ftmp->IsOpen())) {
cout<<line<<" open failed ! not chained"<<endl;
continue;
}
if (ftmp->IsZombie()) {
cout<<"sth. very wrong with "<<line<<", not chained "<<endl;
continue;
}
if (ftmp->TestBit(1024)) {
cout<<"revocer procedure applied to "<<line<<endl;
continue;
}
//--------------------------
if( ftmp && ftmp->IsOpen() && ftmp->GetNkeys()) {
cout << "add file " << line << endl;
setFiles->AddFile(line);
} else {
cout << " cannot open file " << line << endl;
}
delete ftmp;
}
}
StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",fileList,"MuDst.root",nfiles);
muDstMaker->SetStatus("*",0);
muDstMaker->SetStatus("MuEvent",1);
muDstMaker->SetStatus("TofRawData",1);
cout<<endl<<"============ Data Base ========="<<endl;
dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
StVpdAnalysisMaker *vpdAna = new StVpdAnalysisMaker();
vpdAna->SetDebug();
//
// Initialize chain
//
Int_t iInit = chain->Init();
if (iInit) chain->Fatal(iInit,"on init");
chain->PrintInfo();
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
edm::InputFileCatalog catalog(in, catalogIn, true);
std::vector<std::string> const& filesIn = catalog.fileNames();
if (json) {
std::cout << '[' << std::endl;
}
// now run..
// Allow user to input multiple files
for(unsigned int j = 0; j < in.size(); ++j) {
// We _only_ want the LFN->PFN conversion. No need to open the file,
// just check the catalog and move on
if (onlyDecodeLFN) {
std::cout << filesIn[j] << std::endl;
continue;
}
// open a data file
if (!json) std::cout << in[j] << "\n";
std::string const& lfn = in[j];
TFile *tfile = edm::openFileHdl(filesIn[j]);
if (tfile == 0) return 1;
std::string const& pfn = filesIn[j];
if (verbose) std::cout << "ECU:: Opened " << pfn << std::endl;
std::string datafile = decodeLFN ? pfn : lfn;
// First check that this file is not auto-recovered
// Stop the job unless specified to do otherwise
bool isRecovered = tfile->TestBit(TFile::kRecovered);
if (isRecovered) {
if (allowRecovery) {
if (!json) {
std::cout << pfn << " appears not to have been closed correctly and has been autorecovered \n";
std::cout << "Proceeding anyway\n";
}
} else {
std::cout << pfn << " appears not to have been closed correctly and has been autorecovered \n";
std::cout << "Stopping. Use --allowRecovery to try ignoring this\n";
return 1;
}
} else {
if (verbose) std::cout << "ECU:: Collection not autorecovered. Continuing\n";
}
// Ok. Do we have the expected trees?
for (unsigned int i = 0; i < expectedTrees.size(); ++i) {
TTree *t = (TTree*) tfile->Get(expectedTrees[i].c_str());
if (t == 0) {
std::cout << "Tree " << expectedTrees[i] << " appears to be missing. Not a valid collection\n";
std::cout << "Exiting\n";
return 1;
} else {
if (verbose) std::cout << "ECU:: Found Tree " << expectedTrees[i] << std::endl;
}
}
if (verbose) std::cout << "ECU:: Found all expected trees\n";
std::ostringstream auout;
if (adler32) {
unsigned int const EDMFILEUTILADLERBUFSIZE = 10*1024*1024; // 10MB buffer