void efficiencies( TString fin = "TMVA.root", Int_t type = 2, Bool_t useTMVAStyle = kTRUE ) { // argument: type = 1 --> plot efficiency(B) versus eff(S) // type = 2 --> plot rejection (B) versus efficiency (S) // set style and remove existing canvas' TMVAGlob::Initialize( useTMVAStyle ); // checks if file with name "fin" is already open, and if not opens one TFile* file = TMVAGlob::OpenFile( fin ); // check if multi-cut MVA or only one set of MVAs Bool_t multiMVA=kFALSE; TIter nextDir(file->GetListOfKeys()); TKey *key; // loop over all directories and check if // one contains the key word 'multicutMVA' while ((key = (TKey*)nextDir())) { TClass *cl = gROOT->GetClass(key->GetClassName()); if (!cl->InheritsFrom("TDirectory")) continue; TDirectory *d = (TDirectory*)key->ReadObj(); TString path(d->GetPath()); if (path.Contains("multicutMVA")){ multiMVA=kTRUE; plot_efficiencies( file, type, d ); } } plot_efficiencies( file, type, gDirectory ); return; }
void S57_DrawWindow::nextDir(const QString & _dir, bool _scan) { if (progress && progress->wasCanceled()) { return; } QStringList _files = QDir(_dir).entryList(QStringList() << "*.000"); foreach (const QString & _fn, _files) { if (!_scan) { builder.build(_dir + "/" + _fn); if (progress) { progress->setLabelText(_dir); progress->setValue(count); } qApp->processEvents(); } count++; } QStringList _dirs = QDir(_dir).entryList(QDir::Dirs | QDir::NoDotAndDotDot); if (_dirs.isEmpty()) { return; } foreach (const QString & _dn, _dirs) { nextDir(_dir + "/" + _dn, _scan); }
bool DirIter::TryNextDir() { while (dirsToVisit.Count() > 0) { ScopedMem<WCHAR> nextDir(dirsToVisit.Pop()); // it's ok if we fail, this might be an auth problem, // we keep going bool ok = StartDirIter(nextDir); if (ok) return true; } return false; }
cmsListDir( const TObjString * firstdirname, const TDirectory * firstDir ) { TObjArray * dirs = new TObjArray ; dirs->AddLast(new TPair(firstdirname,firstDir)) ; TList * keys ; TKey * key ; TH1 * histo ; TIter nextDir(dirs) ; TPair * pair ; const TObjString * dirname ; const TDirectory * dir ; while (pair = (TPair *)nextDir()) { dirname = (TObjString *)pair->Key() ; dir = (TDirectory *)pair->Value() ; keys = dir->GetListOfKeys() ; TIter nextKey(keys) ; while (key = (TKey *)nextKey()) { obj = key->ReadObj() ; if (obj->IsA()->InheritsFrom("TDirectory")) { dirs->AddLast(new TPair(new TObjString(dirname->String()+"/"+obj->GetName()),obj)) ; } else if (obj->IsA()->InheritsFrom("TH1")) { histo = (TH1 *)obj ; std::cout <<"Histo "<<dirname->String()<<"/"<<histo->GetName() <<" has "<<histo->GetEffectiveEntries()<<" entries" <<" of mean value "<<histo->GetMean() <<std::endl ; } else { std::cout<<"What is "<<obj->GetName()<<" ?"<<std::endl ; } } } }
void ParseDirectoryThread::parse(QDir dir) { //Ensure recursion limit hasn't been reached //if (recursionLimit >= RECURSION_LIMIT) // return; //Stop parsing if variable is changed if (pStopParsing) return; //Get only files for now dir.setFilter(QDir::Files | QDir::NoSymLinks); QFileInfo fi(dir.path()); if (fi.isFile()) { //If user shared a single file, add directly to list FileListStruct f; f.rootDir = pRootDir; f.fileName = dir.path(); pFileList->append(f); return; } QFileInfoList list = dir.entryInfoList(); for (int i = 0; i < list.size(); i++) { //Add every file in the current directory FileListStruct f; f.rootDir = pRootDir; f.fileName = list.at(i).filePath(); pFileList->append(f); //pFileList->append(list.at(i).absoluteFilePath()); } //Get only directories dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); list = dir.entryInfoList(); for (int k = 0; k < list.size(); k++) { //Iterate through all subdirectories and recursively call this function QDir nextDir(list.at(k).filePath()); if (nextDir.isReadable()) { recursionLimit++; parse(nextDir); } } }
/* ダンジョン生成 map : フィールドデータ */ void genDungeon(uchar map[FIELD_SZ][FIELD_SZ]){ uchar dir, x, y; uint plen = 0; uint max_plen = FIELD_SZ * FIELD_SZ * 4 / 9; uchar max[2], min[2]; srand(seed); // 初期化 for(y=0; y<FIELD_SZ; y++){ for(x=0; x<FIELD_SZ; x++){ map[y][x] = ID_WALL; } } x = rand() % (FIELD_SZ-1) + 1; // 初期ポイントを設定 y = rand() % (FIELD_SZ-1) + 1; map[y][x] = ID_PASSAGE; // 通路にする plen ++; max[0] = min[0] = x; // 範囲を更新 max[1] = min[1] = y; // 範囲を更新 // 生成する while(plen <= max_plen){ _wdt_reset(); if(scanAround(map, x, y)){ // 周りに進められるところがあるか dir = nextDir(); if(checkdig(map, x, y, dir)){ // その方向に進められるか dig(map, &x, &y, dir, &plen, max, min); // 進める } }else{ // ない findBranchPoint(map, &x, &y, max, min); // 分岐点を決定 } } }
foreach(const QString &nextDirString, dirList){ QDir nextDir(rootDir.absolutePath() + QDir::separator() + nextDirString); buildHash(nextDir, nameFilter); }