void mainPlot(){ FileList dummyFileList; dummyFileList.clear(); //plotInclusiveMass( dummyFileList, 500. ); //plotExclusiveMass( dummyFileList, 500., 32, 22, 4.0, 488, 15., 10); //WP1% //plotExclusiveMass( dummyFileList, 500., 26, 21, 2.9, 417, 15., 10); //WP3% //plotCutFlow( dummyFileList, 500., 32, 22, 4.0, 488, 15., 10); plotCutFlowNotStaggered( dummyFileList, 500., 32, 22, 4.0, 488, 15., 10); return; TFile* fVBF115 = new TFile("/data_CMS/cms/lbianchini/MuTauStream/treeMuTauStream_VBFH115.root","READ"); TFile* fVBF135 = new TFile("/data_CMS/cms/lbianchini/MuTauStream/treeMuTauStream_VBFH135.root","READ"); TFile* fDYJets = new TFile("/data_CMS/cms/lbianchini/MuTauStream/treeMuTauStream_DYJets-madgraph-50-PU.root","READ"); TFile* fTT = new TFile("/data_CMS/cms/lbianchini/MuTauStream/treeMuTauStream_TT-madgraph-PU.root","READ"); TFile* fWJets = new TFile("/data_CMS/cms/lbianchini/MuTauStream/treeMuTauStream_WJets-madgraph-PU.root","READ"); TFile* fT = new TFile("/data_CMS/cms/lbianchini/MuTauStream/treeMuTauStream_TToBLNu-tW-madhraph-PU.root","READ"); TFile* fQCD = new TFile("/data_CMS/cms/lbianchini/MuTauStream/treeMuTauStream_QCD-pythia-PU.root","READ"); FileList fileList; fileList.push_back( make_pair(fT, make_pair("tW", 10.6 ) )); fileList.push_back( make_pair(fQCD, make_pair("QCD", 349988.0 ) )); fileList.push_back( make_pair(fWJets, make_pair("Wjets", 31314.0 ) )); fileList.push_back( make_pair(fTT, make_pair("ttbar", 157.5 ) )); fileList.push_back( make_pair(fDYJets, make_pair("Zjets", 3048.0 ) )); fileList.push_back( make_pair(fVBF115, make_pair("qqH115", 0.1012 ) )); fileList.push_back( make_pair(fVBF135, make_pair("qqH135", 0.05049) )); }
int File::listFiles(FileList &fileList) { fileList.clear(); if (isDirectory() == false) return 0; string dir = getName(); #if defined(WIN32) string findDir = dir + "\\*.*"; WIN32_FIND_DATA fd; HANDLE hFind; hFind = FindFirstFile(findDir.c_str(), &fd); if (hFind != INVALID_HANDLE_VALUE) { do{ string findFilename = fd.cFileName; if (findFilename.compare(".") != 0 && findFilename.compare("..") != 0) { File *file = new File(dir.c_str(), findFilename.c_str()); fileList.add(file); } } while(FindNextFile(hFind,&fd) != FALSE); } FindClose(hFind); #elif defined(BTRON) int fd = open(dir.c_str(), O_RDONLY); if( fd == -1 ) return fileList.size(); char buf[1024] ; int cnt; while(0 < (cnt = u_getdents(fd, (dirent *)buf, sizeof(buf)))) { for(struct dirent *p = (struct dirent *)buf ; (char *)p < &buf[cnt]; p=(struct dirent *) ((int)p+(p->d_reclen)) ) { File *file = new File(dir.c_str(), p->d_name); fileList.add(file); } } close(fd); #elif !defined(ITRON) && !defined(TENGINE) struct dirent **namelist; int n = scandir(dir.c_str(), &namelist, 0, alphasort); if (0 <= n) { while(n--) { string filename = namelist[n]->d_name; if (filename.compare(".") != 0 && filename.compare("..") != 0) { // Thanks for Pekka Virtanen <*****@*****.**> and Bastiaan Van Eeckhoudt <*****@*****.**> File *file = new File(dir.c_str(), filename.c_str()); fileList.add(file); } free(namelist[n]); } free(namelist); } #endif return fileList.size(); }
void FileSystem::glob( const String& dirName, const String& searchPattern, FileList& files, bool recursive/* =false */) { files.clear(); String findSpec(dirName); findSpec.append(PATHSEP).append(searchPattern); WIN32_FIND_DATA data; HANDLE hFile = FindFirstFile(findSpec, &data); BOOL found = (hFile != INVALID_HANDLE_VALUE); while (found) { String pathName(dirName); pathName += "\\"; pathName += data.cFileName; // if this is a directory, and isn't . or .., and we are recursing, then // recurse into this directory if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) { if (String(".") != data.cFileName && String("..") != data.cFileName && String(".svn") != data.cFileName) { if (recursive) glob(pathName, searchPattern, files, recursive); } } // otherwise, add it to the list files.push_back(pathName); // and find the next found = FindNextFile(hFile, &data); } FindClose(hFile); }
void scanDirectory(const char* path, const char* ext, FileList& list) { list.clear(); #ifdef WIN32 _finddata_t dir; char pathWithExt[260]; long fh; strcpy(pathWithExt, path); strcat(pathWithExt, "/"); strcat(pathWithExt, ext); fh = _findfirst(pathWithExt, &dir); if (fh == -1L) return; do { list.push_back(dir.name); } while (_findnext(fh, &dir) == 0); _findclose(fh); #else dirent* current = 0; DIR* dp = opendir(path); if (!dp) return; while ((current = readdir(dp)) != 0) { int len = strlen(current->d_name); if (len > 4 && strncmp(current->d_name+len-4, ext, 4) == 0) // TODO:: may not work due to joker(*) added { list.push_back(current->d_name); } } closedir(dp); #endif }
void QueueEditor::PauseParsInGroups(ItemList* pItemList, bool bExtraParsOnly) { while (true) { FileList GroupFileList; GroupFileList.clear(); FileInfo* pFirstFileInfo = NULL; for (ItemList::iterator it = pItemList->begin(); it != pItemList->end(); ) { EditItem* pItem = *it; if (!pFirstFileInfo || (pFirstFileInfo->GetNZBInfo() == pItem->m_pFileInfo->GetNZBInfo())) { GroupFileList.push_back(pItem->m_pFileInfo); if (!pFirstFileInfo) { pFirstFileInfo = pItem->m_pFileInfo; } delete pItem; pItemList->erase(it); it = pItemList->begin(); continue; } it++; } if (!GroupFileList.empty()) { PausePars(&GroupFileList, bExtraParsOnly); } else { break; } } }
static void fileListClear(FileList& list) { list.clear(); }
void Clear() { files.clear(); }
void QueueEditor::AlignAffectedGroups(DownloadQueue* pDownloadQueue, IDList* pIDList, bool bSmartOrder, int iOffset) { // Build list of all groups; List contains first file of each group FileList cGroupList; BuildGroupList(pDownloadQueue, &cGroupList); // Find affected groups. It includes groups being moved and groups directly // above or under of these groups (those order is also changed) FileList cAffectedGroupList; cAffectedGroupList.clear(); ItemList cItemList; PrepareList(pDownloadQueue, &cItemList, pIDList, bSmartOrder, eaFileMoveOffset, iOffset); for (ItemList::iterator it = cItemList.begin(); it != cItemList.end(); it++) { EditItem* pItem = *it; unsigned int iNum = 0; for (FileList::iterator it = cGroupList.begin(); it != cGroupList.end(); it++, iNum++) { FileInfo* pFileInfo = *it; if (pItem->m_pFileInfo->GetNZBInfo() == pFileInfo->GetNZBInfo()) { if (!ItemExists(&cAffectedGroupList, pFileInfo)) { cAffectedGroupList.push_back(pFileInfo); } if (iOffset < 0) { for (int i = iNum - 1; i >= -iOffset-1; i--) { if (!ItemExists(&cAffectedGroupList, cGroupList[i])) { cAffectedGroupList.push_back(cGroupList[i]); } } } if (iOffset > 0) { for (unsigned int i = iNum + 1; i <= cGroupList.size() - iOffset; i++) { if (!ItemExists(&cAffectedGroupList, cGroupList[i])) { cAffectedGroupList.push_back(cGroupList[i]); } } if (iNum + 1 < cGroupList.size()) { cAffectedGroupList.push_back(cGroupList[iNum + 1]); } } break; } } delete pItem; } cGroupList.clear(); // Aligning groups for (FileList::iterator it = cAffectedGroupList.begin(); it != cAffectedGroupList.end(); it++) { FileInfo* pFileInfo = *it; AlignGroup(pDownloadQueue, pFileInfo->GetNZBInfo()); } }