#include <TObject.h>#include <cstring>Go to the source code of this file.
Classes | |
| class | Bmnt |
Functions | |
| void | make_bmnt_one_per_dir (const char *indir, const char *outdir, bool skip_last=true) |
|
||||||||||||||||
|
Definition at line 253 of file Bmnt.cxx. References files, gSystem(), infile, len, outfile, Bmnt::ProcessFiles(), and Bmnt::Write(). 00254 {
00255 void *dir = gSystem->OpenDirectory(indir);
00256 if (!dir) {
00257 cerr << "No such directory: " << indir << endl;
00258 return;
00259 }
00260
00261 vector<string> files;
00262 while (const char* file = gSystem->GetDirEntry(dir)) {
00263 string filename = file;
00264 if ( filename.length() > 5
00265 && filename[0] == 'B'
00266 && filename.find(".mbeam.root") == filename.length()-11 ) {
00267 files.push_back(file);
00268 }
00269 }
00270 std::sort(files.begin(),files.end());
00271 if (skip_last) files.pop_back();
00272 for (size_t ind = 0; ind < files.size(); ++ind) {
00273
00274 string infile = indir;
00275 infile += "/";
00276 infile += files[ind];
00277
00278 string outfile = outdir;
00279 size_t start = infile.rfind("/");
00280 size_t len = infile.find(".mbeam.root") - start;
00281 outfile += infile.substr(start,len);
00282 outfile += ".bmnt.root";
00283
00284 if (!gSystem->AccessPathName(outfile.c_str(),kReadPermission)) {
00285 cerr << "File already exists: " << outfile << endl;
00286 return;
00287 }
00288
00289 Bmnt* bd = new Bmnt(outfile.c_str());
00290 const char* file_array[] = { infile.c_str(), 0 };
00291 bd->ProcessFiles(file_array);
00292 bd->Write();
00293 delete bd;
00294 }
00295 }
|
1.3.9.1