/[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.25 by mocchiut, Thu Mar 15 13:42:36 2007 UTC revision 1.26 by pam-fi, Fri Mar 16 20:27:55 2007 UTC
# Line 554  void PamLevel2::SortTracks(TString how){ Line 554  void PamLevel2::SortTracks(TString how){
554                  use_CAL            &&                  use_CAL            &&
555                  calo2_obj->npcfit[1] > 15     &&   //no. of fit planes on Y view                  calo2_obj->npcfit[1] > 15     &&   //no. of fit planes on Y view
556                  calo2_obj->varcfit[1] < 1000. &&  //fit variance on Y view                  calo2_obj->varcfit[1] < 1000. &&  //fit variance on Y view
557                    cp && ci &&
558                  true){                  true){
559    
560                                    
# Line 575  void PamLevel2::SortTracks(TString how){ Line 576  void PamLevel2::SortTracks(TString how){
576                  cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!";                  cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!";
577                  return;                  return;
578              };              };
579              if( use_TOF ){              if( use_TOF && op && oi ){
580                                    
581                  Int_t nphit_p =0;                  Int_t nphit_p =0;
582                  Int_t nphit_i =0;                  Int_t nphit_i =0;
# Line 969  TTree *PamLevel2::GetPamTree(TFile *f, T Line 970  TTree *PamLevel2::GetPamTree(TFile *f, T
970            
971      cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl;      cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl;
972            
     pam_tree = (TChain*)Trout;  
   
973      return Trout;      return Trout;
974            
975  }  }
# Line 999  TList*  PamLevel2::GetListOfLevel2Files( Line 998  TList*  PamLevel2::GetListOfLevel2Files(
998  //    char *fullpath;  //    char *fullpath;
999  //    const char *fullpath;  //    const char *fullpath;
1000            
1001      // if input file list is given:          // if no input file list is given:  
1002      if ( flisttxt != "" ){      if ( flisttxt != "" ){
1003                    
1004  //      if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){          //      if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){        
# Line 1009  TList*  PamLevel2::GetListOfLevel2Files( Line 1008  TList*  PamLevel2::GetListOfLevel2Files(
1008  //      }        //      }      
1009  //      flisttxt = fullpath;  //      flisttxt = fullpath;
1010    
       if ( !flisttxt.EndsWith(".root") ){  
1011          flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));          flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));
1012    
1013          if( !gSystem->ChangeDirectory(ddir) ){          if( !gSystem->ChangeDirectory(ddir) ){
# Line 1050  TList*  PamLevel2::GetListOfLevel2Files( Line 1048  TList*  PamLevel2::GetListOfLevel2Files(
1048  //          };  //          };
1049          };          };
1050          in.close();          in.close();
1051        } else {          
           char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));  
           contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list  
           delete fullpath;  
       };        
1052      }else{      }else{
1053                    
1054          cout << "No input file list given."<<endl;          cout << "No input file list given."<<endl;
# Line 1504  TTree *PamLevel2::GetRunTree(TFile *f){ Line 1498  TTree *PamLevel2::GetRunTree(TFile *f){
1498          R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano          R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano
1499          cout << "Software    : set branch address SoftInfo"<<endl; // Emiliano          cout << "Software    : set branch address SoftInfo"<<endl; // Emiliano
1500      }      }
   
     run_tree = (TChain*)R;  
   
1501      return R;      return R;
1502            
1503  }  }
# Line 1529  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1520  Bool_t PamLevel2::UpdateRunInfo(TChain *
1520    if(SELLI==0){    if(SELLI==0){
1521        if ( irun < 0 ){        if ( irun < 0 ){
1522            irun = 0;            irun = 0;
1523            run->GetEntry(0);            run->GetEntry(irun);
1524            runfirstentry = 0ULL;            runfirstentry = 0ULL;
1525            runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL;            runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL;
1526              return(true);
1527        };              };      
1528    
1529        if( !GetOrbitalInfo() ){        if( !GetOrbitalInfo() ){
# Line 1550  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1542  Bool_t PamLevel2::UpdateRunInfo(TChain *
1542        };        };
1543                
1544        //        //
1545        if ( irun == oldrun || irun >= run->GetEntries() ) return(false);        if
1546     ( irun == oldrun || irun >= run->GetEntries() ) return(false);
1547        //        //
1548        //  printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry);        //  printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry);
1549        //        //
# Line 2360  void PamLevel2::WriteCloneTrees(){ Line 2353  void PamLevel2::WriteCloneTrees(){
2353  Int_t PamLevel2::GetEntry(Int_t iee){  Int_t PamLevel2::GetEntry(Int_t iee){
2354            
2355      if(!pam_tree){      if(!pam_tree){
2356          cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl;          cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loeaded"<<endl;
2357            return 0;
2358        }
2359        if(!run_tree ){
2360            cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loeaded"<<endl;
2361          return 0;          return 0;
2362      }      }
2363    
# Line 2369  Int_t PamLevel2::GetEntry(Int_t iee){ Line 2366  Int_t PamLevel2::GetEntry(Int_t iee){
2366      ii = iee;      ii = iee;
2367      if( !pam_tree->GetEntry(ii) ) return 0;      if( !pam_tree->GetEntry(ii) ) return 0;
2368      //-------------------------------      //-------------------------------
   
     if(!run_tree ){  
         cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl;  
         return 0;  
     }  
   
2369      ii = iee;      ii = iee;
2370      Bool_t UPDATED = UpdateRunInfo(run_tree,ii);      Bool_t UPDATED = UpdateRunInfo(run_tree,ii);
2371      if(SELLI==0)irunentry = iee-runfirstentry;      if(SELLI==0)irunentry = iee-runfirstentry;
# Line 2465  TTree* PamLevel2::GetYodaTree( ){ Line 2456  TTree* PamLevel2::GetYodaTree( ){
2456                  trk0_obj->Set();                  trk0_obj->Set();
2457              };              };
2458              l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent());              l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent());
             TrkParams::SetCalib(run_obj,dbc);  
2459          }          }
2460          //---------------------------------------------------          //---------------------------------------------------
2461          // CALORIMETER:          // CALORIMETER:
# Line 2480  TTree* PamLevel2::GetYodaTree( ){ Line 2470  TTree* PamLevel2::GetYodaTree( ){
2470    
2471      };      };
2472    
2473        if(!dbc || (dbc && !dbc->IsConnected())){
2474            cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl;
2475        }
2476    
2477        TrkParams::SetCalib(run_obj,dbc);
2478    
2479    
2480  //    cout << l0_tree << endl;  //    cout << l0_tree << endl;
2481            
2482      return l0_tree;      return l0_tree;
# Line 2499  Int_t PamLevel2::GetYodaEntry(){ Line 2496  Int_t PamLevel2::GetYodaEntry(){
2496      //  ---------------------------------      //  ---------------------------------
2497      Int_t quellagiusta = irunentry + run_obj->EV_FROM;      Int_t quellagiusta = irunentry + run_obj->EV_FROM;
2498    
2499    //     cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl;
2500    //     cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl;
2501    //     cout << " time "<< GetOrbitalInfo()->absTime << endl;
2502    //     cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl;
2503        
2504      if( !GetOrbitalInfo() ){      if( !GetOrbitalInfo() ){
2505          cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl;          cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl;
2506          return 0;          return 0;
# Line 2518  Int_t PamLevel2::GetYodaEntry(){ Line 2520  Int_t PamLevel2::GetYodaEntry(){
2520      Int_t answer = 0;      Int_t answer = 0;
2521      Int_t shift =0;      Int_t shift =0;
2522      do{      do{
2523  //      if(shift>0){          if(shift>0){
2524  //          cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl;              cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl;
2525  //      }          }
2526          answer = GetYodaTree()->GetEntry(quellagiusta+shift);          answer = l0_tree->GetEntry(quellagiusta+shift);
2527          shift++;          shift++;
2528          if( !GetEventHeader() ){          if( !GetEventHeader() ){
2529              cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl;              cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl;
2530              return 0;              return 0;
2531          }          }
2532  //      if( (quellagiusta+shift) == GetYodaTree()->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl;  //      if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl;
2533      }while( ( (UInt_t)(GetOrbitalInfo()->OBT) != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < (UInt_t)(GetYodaTree()->GetEntries()) );  //      cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl;
2534    //      cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl;
2535    //      cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl;
2536    //      cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl;
2537    
2538        }while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < GetYodaTree()->GetEntries() );
2539    
2540  //    cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl;  //    cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl;
2541  //    return GetYodaTree()->GetEntry(quellagiusta);  //    return GetYodaTree()->GetEntry(quellagiusta);

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

  ViewVC Help
Powered by ViewVC 1.1.23