void list_files(const char *dirname="/home/work/run_longtest_Y3_oct2019_root_files_3/", const char *ext=".root") { TList* fileList = new TList; std::cout<GetName(); //printf("0\n"); if (!file->IsDirectory() && fname.EndsWith(ext)) { fileList->Add(file); } /*else if (file->IsDirectory() && !fname.EqualTo(".") && !fname.EqualTo("..")) //Directory - recursive call { TList *sublist = GetRootFilesInDir(file->GetTitle(), ext); fileList->AddAll(sublist); }*/ //file->Print(); } } TString fname ; TString fOldName ; int ifl = 0; //fileList->Sort(); fileList->DoSort(); Int_t listSize = fileList->GetSize(); std::cout << "+++++++++I'm going to analyze: " << listSize << " files " << std::endl; while (1) { if (ifl >= listSize) { std::cout<< "=============== All files in the specified dir have been analyzed ========================"<< std::endl; //isIncrementNeeded = kFALSE; break ; } if (ifl < listSize) { nfile = (TSystemFile*) fileList->At(ifl); TString strFileName = nfile->GetName(); TString strPath = nfile->GetTitle(); fname = strPath + "/" + strFileName; } ifl++; int isFileChange = 0; isFileChange = fname.CompareTo(fOldName, TString::kExact); if (isFileChange != 0) { //TString RecoFile = "1521780828.root"; //TFile *event_file = TFile::Open(RecoFile.Data(), "READ"); //TTree *tracktree = (TTree *) event_file->Get("cbmsim"); f = new TFile(fname); f->Print(); } } }