/[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.28 by mocchiut, Sat Mar 17 07:44:24 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 968  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;
       
     pam_tree = (TChain*)Trout;  
972    
973        pam_tree = (TChain*)Trout;
974        
975      return Trout;      return Trout;
976            
977  }  }
# Line 999  TList*  PamLevel2::GetListOfLevel2Files( Line 1000  TList*  PamLevel2::GetListOfLevel2Files(
1000  //    char *fullpath;  //    char *fullpath;
1001  //    const char *fullpath;  //    const char *fullpath;
1002            
1003      // if input file list is given:          // if no input file list is given:  
1004      if ( flisttxt != "" ){      if ( flisttxt != "" ){
1005                    
1006  //      if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){          //      if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){        
# Line 1008  TList*  PamLevel2::GetListOfLevel2Files( Line 1009  TList*  PamLevel2::GetListOfLevel2Files(
1009  //          return 0;  //          return 0;
1010  //      }        //      }      
1011  //      flisttxt = fullpath;  //      flisttxt = fullpath;
   
1012        if ( !flisttxt.EndsWith(".root") ){        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    
1016          if( !gSystem->ChangeDirectory(ddir) ){          if( !gSystem->ChangeDirectory(ddir) ){
# Line 1054  TList*  PamLevel2::GetListOfLevel2Files( Line 1055  TList*  PamLevel2::GetListOfLevel2Files(
1055            char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));            char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt));
1056            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
1057            delete fullpath;            delete fullpath;
1058        };              };        
1059      }else{      }else{
1060                    
1061          cout << "No input file list given."<<endl;          cout << "No input file list given."<<endl;
# Line 1529  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1530  Bool_t PamLevel2::UpdateRunInfo(TChain *
1530    if(SELLI==0){    if(SELLI==0){
1531        if ( irun < 0 ){        if ( irun < 0 ){
1532            irun = 0;            irun = 0;
1533            run->GetEntry(0);            run->GetEntry(irun);
1534            runfirstentry = 0ULL;            runfirstentry = 0ULL;
1535            runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL;            runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL;
1536              return(true);
1537        };              };      
1538    
1539        if( !GetOrbitalInfo() ){        if( !GetOrbitalInfo() ){
# Line 1550  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1552  Bool_t PamLevel2::UpdateRunInfo(TChain *
1552        };        };
1553                
1554        //        //
1555        if ( irun == oldrun || irun >= run->GetEntries() ) return(false);        if
1556     ( irun == oldrun || irun >= run->GetEntries() ) return(false);
1557        //        //
1558        //  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);
1559        //        //
# Line 2364  Int_t PamLevel2::GetEntry(Int_t iee){ Line 2367  Int_t PamLevel2::GetEntry(Int_t iee){
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 ){      if(!run_tree ){
2390          cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl;          cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl;
2391          return 0;          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);
2397      if(SELLI==0)irunentry = iee-runfirstentry;      if(SELLI==0)irunentry = iee-runfirstentry;
# Line 2465  TTree* PamLevel2::GetYodaTree( ){ Line 2482  TTree* PamLevel2::GetYodaTree( ){
2482                  trk0_obj->Set();                  trk0_obj->Set();
2483              };              };
2484              l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent());              l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent());
             TrkParams::SetCalib(run_obj,dbc);  
2485          }          }
2486          //---------------------------------------------------          //---------------------------------------------------
2487          // CALORIMETER:          // CALORIMETER:
# Line 2480  TTree* PamLevel2::GetYodaTree( ){ Line 2496  TTree* PamLevel2::GetYodaTree( ){
2496    
2497      };      };
2498    
2499        if(!dbc || (dbc && !dbc->IsConnected())){
2500            cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl;
2501        }
2502    
2503        TrkParams::SetCalib(run_obj,dbc);
2504    
2505    
2506  //    cout << l0_tree << endl;  //    cout << l0_tree << endl;
2507            
2508      return l0_tree;      return l0_tree;
# Line 2494  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;
2532    //     cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl;
2533    //     cout << " time "<< GetOrbitalInfo()->absTime << endl;
2534    //     cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl;
2535        
2536      if( !GetOrbitalInfo() ){      if( !GetOrbitalInfo() ){
2537          cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl;          cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl;
2538          return 0;          return 0;
# Line 2518  Int_t PamLevel2::GetYodaEntry(){ Line 2552  Int_t PamLevel2::GetYodaEntry(){
2552      Int_t answer = 0;      Int_t answer = 0;
2553      Int_t shift =0;      Int_t shift =0;
2554      do{      do{
2555  //      if(shift>0){          if(shift>0){
2556  //          cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl;              cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl;
2557  //      }          }
2558          answer = GetYodaTree()->GetEntry(quellagiusta+shift);          answer = l0_tree->GetEntry(quellagiusta+shift);
2559          shift++;          shift++;
2560          if( !GetEventHeader() ){          if( !GetEventHeader() ){
2561              cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl;              cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl;
2562              return 0;              return 0;
2563          }          }
2564  //      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;
2565      }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;
2566    //      cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl;
2567    //      cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl;
2568    //      cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl;
2569    
2570        }while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < GetYodaTree()->GetEntries() );
2571    
2572  //    cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl;  //    cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl;
2573  //    return GetYodaTree()->GetEntry(quellagiusta);  //    return GetYodaTree()->GetEntry(quellagiusta);

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

  ViewVC Help
Powered by ViewVC 1.1.23