ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/tschum/FWlite_Analysis/PlotTool.cc
(Generate patch)

Comparing UserCode/tschum/FWlite_Analysis/PlotTool.cc (file contents):
Revision 1.9 by tschum, Thu Dec 3 11:24:14 2009 UTC vs.
Revision 1.10 by tschum, Thu Dec 3 22:29:16 2009 UTC

# Line 41 | Line 41 | int PlotTool::init(string fileName, stri
41                  fileLabel=fileName;
42          }
43          ((TChain*) this->At(currChain))->SetName(fileLabel.c_str());
44 +
45 +        TList *files = new TList();
46 +        TSystemFile* sysFile = 0;
47 +        if(fileName.find(".") != string::npos) {
48 +          ifstream f(fileName.c_str());
49 +          if( ! f.is_open() ) return -1;
50 +          string line;
51 +
52 +          while (!f.eof()) {
53 +            getline(f,line);
54 +            sysFile = new TSystemFile(line.c_str(),dirPath.c_str());
55 +            files->Add(sysFile);
56 +          }
57 +
58 +
59 +        } else {
60          TSystemDirectory dir("sourceDir", dirPath.c_str());
61 <        TList *files = dir.GetListOfFiles();
62 <        if (files) {
61 >        files = dir.GetListOfFiles();
62 >        }
63 >        if (files->GetEntries()>0) {
64                  TIter next(files);
65                  TSystemFile *file;
66                  TString fname;
67                  string filePath;
68  
69 <                if(verbose)     cout<<"Open"<<dirPath.c_str()<<" Search for .root files that contain: "
69 >                if(verbose && fileName.find(".") == string::npos )      cout<<"Open"<<dirPath.c_str()<<" Search for .root files that contain: "
70 >                                <<fileName.c_str()<<endl;
71 >                if(verbose && fileName.find(".") != string::npos )      cout<<"Open"<<dirPath.c_str()<<" Search lines with .root in: "
72                                  <<fileName.c_str()<<endl;
73  
74 +
75                  while ((file=(TSystemFile*)next())) {
76                          fname = file->GetName();
77                          if (!fname.EndsWith(".root"))
78                                  continue;
79 <                        if (!fname.Contains(fileName.c_str()))
79 >                        if (!fname.Contains(fileName.c_str()) && fileName.find(".") == string::npos )
80                                  continue;
81  
82                          filePath = dirPath;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines