/[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.26 by pam-fi, Fri Mar 16 20:27:55 2007 UTC revision 1.28 by mocchiut, Sat Mar 17 07:44:24 2007 UTC
# Line 969  TTree *PamLevel2::GetPamTree(TFile *f, T Line 969  TTree *PamLevel2::GetPamTree(TFile *f, T
969      };      };
970            
971      cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl;      cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl;
972    
973        pam_tree = (TChain*)Trout;
974            
975      return Trout;      return Trout;
976            
# Line 1007  TList*  PamLevel2::GetListOfLevel2Files( Line 1009  TList*  PamLevel2::GetListOfLevel2Files(
1009  //          return 0;  //          return 0;
1010  //      }        //      }      
1011  //      flisttxt = fullpath;  //      flisttxt = fullpath;
1012          if ( !flisttxt.EndsWith(".root") ){
1013    
1014          flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));          flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));
1015    
# Line 1048  TList*  PamLevel2::GetListOfLevel2Files( Line 1051  TList*  PamLevel2::GetListOfLevel2Files(
1051  //          };  //          };
1052          };          };
1053          in.close();          in.close();
1054                  } else {
1055              char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));
1056              contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list
1057              delete fullpath;
1058          };        
1059      }else{      }else{
1060                    
1061          cout << "No input file list given."<<endl;          cout << "No input file list given."<<endl;
# Line 1498  TTree *PamLevel2::GetRunTree(TFile *f){ Line 1505  TTree *PamLevel2::GetRunTree(TFile *f){
1505          R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano          R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano
1506          cout << "Software    : set branch address SoftInfo"<<endl; // Emiliano          cout << "Software    : set branch address SoftInfo"<<endl; // Emiliano
1507      }      }
1508    
1509        run_tree = (TChain*)R;
1510    
1511      return R;      return R;
1512            
1513  }  }
# Line 2353  void PamLevel2::WriteCloneTrees(){ Line 2363  void PamLevel2::WriteCloneTrees(){
2363  Int_t PamLevel2::GetEntry(Int_t iee){  Int_t PamLevel2::GetEntry(Int_t iee){
2364            
2365      if(!pam_tree){      if(!pam_tree){
2366          cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loeaded"<<endl;          cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl;
         return 0;  
     }  
     if(!run_tree ){  
         cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loeaded"<<endl;  
2367          return 0;          return 0;
2368      }      }
2369    
2370    
2371        //
2372        // This is a sort of bug: if you don't have the run tree you don't want to exit here you want to have loaded the event anyway...
2373        //
2374        //    if(!run_tree ){
2375        //  cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loeaded"<<endl;
2376        //  return 0;
2377        //    }
2378    
2379      Int_t ii=0;      Int_t ii=0;
2380      //-------------------------------      //-------------------------------
2381      ii = iee;      ii = iee;
2382      if( !pam_tree->GetEntry(ii) ) return 0;      if( !pam_tree->GetEntry(ii) ) return 0;
2383    
2384        //
2385        // ... that's way I put it here. Notice that nothing change in the code (is backward compatible) since in any case you return with 0.
2386        // in theory one would like to return 1 if run is not loaded but now I don't have the will to add that 2 lines of code and it is not
2387        // a problem if you don't check the return code of getentry.
2388        //
2389        if(!run_tree ){
2390            cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl;
2391            return 0;
2392        }
2393    
2394      //-------------------------------      //-------------------------------
2395      ii = iee;      ii = iee;
2396      Bool_t UPDATED = UpdateRunInfo(run_tree,ii);      Bool_t UPDATED = UpdateRunInfo(run_tree,ii);
# Line 2491  Int_t PamLevel2::GetYodaEntry(){ Line 2517  Int_t PamLevel2::GetYodaEntry(){
2517  //    cout << "Int_t PamLevel2::GetYodaEntry()"<<endl;  //    cout << "Int_t PamLevel2::GetYodaEntry()"<<endl;
2518      if(!GetYodaTree())return 0;      if(!GetYodaTree())return 0;
2519            
2520        // patch
2521        if( (Int_t)irunentry < 0){
2522            cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl;
2523            irunentry=0;
2524        }
2525      //  ---------------------------------      //  ---------------------------------
2526      //  if file is NOT a preselected file      //  if file is NOT a preselected file
2527      //  ---------------------------------      //  ---------------------------------
2528      Int_t quellagiusta = irunentry + run_obj->EV_FROM;      UInt_t quellagiusta = irunentry + run_obj->EV_FROM;
2529        
2530    
2531  //     cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl;  //     cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl;
2532  //     cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl;  //     cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl;

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.23