/[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.77 by mocchiut, Fri Feb 20 08:07:43 2009 UTC revision 1.78 by pam-fi, Fri Mar 13 10:30:11 2009 UTC
# Line 397  PamLevel2::PamLevel2(){ Line 397  PamLevel2::PamLevel2(){
397   * If no options are specified, the default is assumed. Default is:   * If no options are specified, the default is assumed. Default is:
398   * +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB   * +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB
399   */   */
400  PamLevel2::PamLevel2(TString ddir,TString list,TString detlist){  PamLevel2::PamLevel2(TString ddir,TString llist,TString detlist){
401      Initialize();      Initialize();
402      TList*  listf = GetListOfLevel2Files(ddir,list);      TList*  listf = GetListOfLevel2Files(ddir,llist);
403      GetPamTree(listf,detlist);      if(listf)GetPamTree(listf,detlist);
404      GetRunTree(listf);      if(listf)GetRunTree(listf);
405  };  };
406    
407  PamLevel2::PamLevel2(TString ddir,TList *list,TString detlist){  PamLevel2::PamLevel2(TString ddir,TList *llist,TString detlist){
408      Initialize();      Initialize();
409      GetPamTree(list,detlist);      GetPamTree(llist,detlist);
410      GetRunTree(list);      GetRunTree(llist);
411  };  };
412  /**  /**
413   * Constructor   * Constructor
# Line 416  PamLevel2::PamLevel2(TString ddir,TList Line 416  PamLevel2::PamLevel2(TString ddir,TList
416   * Default trees/branches are loaded. Default is:   * Default trees/branches are loaded. Default is:
417   * +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB   * +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB
418   */   */
419  PamLevel2::PamLevel2(TString ddir,TString list){  PamLevel2::PamLevel2(TString ddir,TString llist){
420      Initialize();      Initialize();
421      TList*  listf = GetListOfLevel2Files(ddir,list);      TList*  listf = GetListOfLevel2Files(ddir,llist);
422      GetPamTree(listf,"");      GetPamTree(listf,"");
423      GetRunTree(listf);      GetRunTree(listf);
424  };  };
# Line 1867  TTree *PamLevel2::GetPamTree(TFile *f, T Line 1867  TTree *PamLevel2::GetPamTree(TFile *f, T
1867  TList*  PamLevel2::GetListOfLevel2Files(TString ddir, TString flisttxt = ""){  TList*  PamLevel2::GetListOfLevel2Files(TString ddir, TString flisttxt = ""){
1868                    
1869      TString wdir = gSystem->WorkingDirectory();      TString wdir = gSystem->WorkingDirectory();
1870        //    cout << "Working directory: "<<wdir<<endl;
1871    
1872      //    if(ddir=="")ddir = wdir;      //    if(ddir=="")ddir = wdir;
1873  //      TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir);  //      TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir);
1874      if ( ddir != ""){      if ( ddir != ""){
# Line 1892  TList*  PamLevel2::GetListOfLevel2Files( Line 1893  TList*  PamLevel2::GetListOfLevel2Files(
1893  //      flisttxt = fullpath;  //      flisttxt = fullpath;
1894          if ( !flisttxt.EndsWith(".root") ){          if ( !flisttxt.EndsWith(".root") ){
1895    
1896              flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));              TString dir = gSystem->DirName(flisttxt);
1897    //          cout << " List directory "<<dir<<endl;
1898                if(dir == "." || dir == "")
1899                    flisttxt = gSystem->ConcatFileName(wdir.Data(),gSystem->BaseName(flisttxt));
1900    //              flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));
1901    
1902              if( !gSystem->ChangeDirectory(ddir) ){              if( !gSystem->ChangeDirectory(ddir) ){
1903                  cout << "Cannot change directory : "<<ddir<<endl;                  cout << "Cannot change directory : "<<ddir<<endl;
# Line 1903  TList*  PamLevel2::GetListOfLevel2Files( Line 1908  TList*  PamLevel2::GetListOfLevel2Files(
1908              ifstream in;              ifstream in;
1909              in.open(flisttxt, ios::in); //open input file list              in.open(flisttxt, ios::in); //open input file list
1910              if(!in.good()){              if(!in.good()){
1911                  cout <<" ERROR opening the file "<<endl;                  cout <<" TList*  PamLevel2::GetListOfLevel2Files(TString, TString) --> ERROR opening the file "<<endl;
1912                  gSystem->ChangeDirectory(wdir); // back to the working directory                  gSystem->ChangeDirectory(wdir); // back to the working directory
1913                  return 0;                  return 0;
1914              }                }  
# Line 1957  TList*  PamLevel2::GetListOfLevel2Files( Line 1962  TList*  PamLevel2::GetListOfLevel2Files(
1962    
1963          TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir);          TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir);
1964          TList *temp = datadir->GetListOfFiles();          TList *temp = datadir->GetListOfFiles();
1965            if(!temp)return 0;
1966  //              temp->Print();  //              temp->Print();
1967  //              cout << "*************************************" << endl;  //              cout << "*************************************" << endl;
1968                    
# Line 3123  void  PamLevel2::GetWhichTrees(TFile* f) Line 3129  void  PamLevel2::GetWhichTrees(TFile* f)
3129      }      }
3130    
3131      TList *lk = f->GetListOfKeys();      TList *lk = f->GetListOfKeys();
3132        if(!lk)return;
3133      TIter next(lk);      TIter next(lk);
3134      TKey *key =0;      TKey *key =0;
3135    

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.78

  ViewVC Help
Powered by ViewVC 1.1.23