/[PAMELA software]/PamelaLevel2/src/PamLevel2.cpp
ViewVC logotype

Diff of /PamelaLevel2/src/PamLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by mocchiut, Tue Jan 16 15:26:55 2007 UTC revision 1.18 by pam-fi, Thu Jan 18 08:51:16 2007 UTC
# Line 921  TList*  PamLevel2::GetListOfLevel2Files( Line 921  TList*  PamLevel2::GetListOfLevel2Files(
921      contents->SetOwner();      contents->SetOwner();
922            
923  //    char *fullpath;  //    char *fullpath;
924      const char *fullpath;  //    const char *fullpath;
925            
926      // if no input file list is given:        // if no input file list is given:  
927      if ( flisttxt != "" ){      if ( flisttxt != "" ){
928                    
929  //      if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){          //      if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){        
930          if( !(fullpath = gSystem->FindFile("./",flisttxt)) ){  //      if( !(fullpath = gSystem->FindFile("./",flisttxt)) ){
931              cout <<"File "<<flisttxt<<" not found"<<endl;  //          cout <<"File "<<flisttxt<<" not found"<<endl;
932              return 0;  //          return 0;
933          }        //      }      
934  //              flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));  //      flisttxt = fullpath;
935          flisttxt = fullpath;  
936            flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));
937    
938          if( !gSystem->ChangeDirectory(ddir) ){          if( !gSystem->ChangeDirectory(ddir) ){
939              cout << "Cannot change directory : "<<ddir<<endl;              cout << "Cannot change directory : "<<ddir<<endl;
# Line 942  TList*  PamLevel2::GetListOfLevel2Files( Line 943  TList*  PamLevel2::GetListOfLevel2Files(
943          cout <<"Input file list : " << flisttxt <<endl;          cout <<"Input file list : " << flisttxt <<endl;
944          ifstream in;          ifstream in;
945          in.open(flisttxt, ios::in); //open input file list          in.open(flisttxt, ios::in); //open input file list
946            if(!in.good()){
947                cout <<" ERROR opening the file "<<endl;
948                gSystem->ChangeDirectory(wdir); // back to the working directory
949                return 0;
950            }      
951          int line=0;          int line=0;
952          while (1) {          while (1) {
953              TString file;              TString file;
# Line 956  TList*  PamLevel2::GetListOfLevel2Files( Line 962  TList*  PamLevel2::GetListOfLevel2Files(
962              if(file.Contains("#"))file = file(0,file.First("#"));              if(file.Contains("#"))file = file(0,file.First("#"));
963  //          cout <<"(2) " << file << endl;  //          cout <<"(2) " << file << endl;
964  //          if( gSystem->IsFileInIncludePath(file,&fullpath) ){  //          if( gSystem->IsFileInIncludePath(file,&fullpath) ){
965              if( (fullpath = gSystem->FindFile(ddir,file)) ){  //          if( (fullpath = gSystem->FindFile(ddir,file)) ){
966                char *fullpath = gSystem->ConcatFileName(gSystem->DirName(ddir),gSystem->BaseName(file));
967                  contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list              contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list
968                delete fullpath;
969              }else{  //          }else{
970  //              if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl;  //              if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl;
971              };  //          };
972          };          };
973          in.close();          in.close();
974                    
# Line 984  TList*  PamLevel2::GetListOfLevel2Files( Line 990  TList*  PamLevel2::GetListOfLevel2Files(
990          while ( (questo = (TSystemFile*) next()) ) {          while ( (questo = (TSystemFile*) next()) ) {
991              TString name =  questo-> GetName();              TString name =  questo-> GetName();
992              if( name.EndsWith(".root") ){              if( name.EndsWith(".root") ){
993                  const char *fullpath = gSystem->FindFile(ddir,name);  //              const char *fullpath = gSystem->FindFile(ddir,name);
994  //              char *fullpath;  //              char *fullpath;
995  //              gSystem->IsFileInIncludePath(name,&fullpath);  //              gSystem->IsFileInIncludePath(name,&fullpath);
996                    char *fullpath = gSystem->ConcatFileName(gSystem->DirName(ddir),gSystem->BaseName(name));
997                  contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));                  contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));
998                    delete fullpath;
999              };              };
1000          }          }
1001          delete temp;          delete temp;
# Line 997  TList*  PamLevel2::GetListOfLevel2Files( Line 1005  TList*  PamLevel2::GetListOfLevel2Files(
1005      gSystem->ChangeDirectory(wdir); // back to the working directory      gSystem->ChangeDirectory(wdir); // back to the working directory
1006  //      cout << endl << "Selected files:" << endl;  //      cout << endl << "Selected files:" << endl;
1007  //      contents->Print();  //      contents->Print();
1008      cout << contents->GetEntries()<<" files selected\n";      cout << contents->GetEntries()<<" files \n";
1009  //      cout << endl;  //      cout << endl;
1010  //      cout << "Working directory: "<< gSystem->WorkingDirectory()<< endl;  //      cout << "Working directory: "<< gSystem->WorkingDirectory()<< endl;
1011      return contents;      return contents;

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.23