/[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.31 by mocchiut, Mon Mar 19 05:39:36 2007 UTC revision 1.34 by pam-fi, Wed Mar 21 10:49:43 2007 UTC
# Line 119  PamLevel2::PamLevel2(){ Line 119  PamLevel2::PamLevel2(){
119    
120      run_obj   = 0;//new GL_RUN();      run_obj   = 0;//new GL_RUN();
121      soft_obj   = 0;// Emiliano      soft_obj   = 0;// Emiliano
122      irun = -1;      irun = -1LL;
123      runfirstentry = 0ULL;      runfirstentry = 0LL;
124      runlastentry = 0ULL;      runlastentry = 0LL;
125    
126      l0_file = NULL;      l0_file = NULL;
127      l0_tree = NULL;      l0_tree = NULL;
# Line 130  PamLevel2::PamLevel2(){ Line 130  PamLevel2::PamLevel2(){
130    
131      prevshift = 0;      prevshift = 0;
132            
     irun = -1;  
133      run_tree = NULL;      run_tree = NULL;
134      run_tree_clone = NULL;      run_tree_clone = NULL;
135      sel_tree = NULL;      sel_tree = NULL;
136      sel_tree_clone = NULL;      sel_tree_clone = NULL;
137            
138      irunentry = -1;      irunentry = -1LL;
139      pam_tree = NULL;      pam_tree = NULL;
140      for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL;      for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL;
141    
# Line 245  void PamLevel2::Clear(){ Line 244  void PamLevel2::Clear(){
244  //    if(soft_obj) soft_obj->Clear();  //    if(soft_obj) soft_obj->Clear();
245    
246      if(h0_obj)   h0_obj->Clear();            if(h0_obj)   h0_obj->Clear();      
247      if(trk0_obj) trk0_obj->Clear();      //    if(trk0_obj) trk0_obj->Clear();  
248      if(calo0_obj) calo0_obj->Clear();        if(calo0_obj) calo0_obj->Clear();  
249      if(trk1_obj) trk1_obj->Clear();          if(trk1_obj) trk1_obj->Clear();    
250      if(trk2_obj) trk2_obj->Clear();      if(trk2_obj) trk2_obj->Clear();
# Line 1521  TTree *PamLevel2::GetRunTree(TFile *f){ Line 1520  TTree *PamLevel2::GetRunTree(TFile *f){
1520   * @param run Pointer to the chain/tree which contains run infos   * @param run Pointer to the chain/tree which contains run infos
1521   * @return true if a new run has been read, false if it is still the same run   * @return true if a new run has been read, false if it is still the same run
1522   */   */
1523  Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev){  Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev){
1524    //    //
1525    // check if we have already called once GetEntry, if not call it    // check if we have already called once GetEntry, if not call it
1526    //    //
1527    if ( run->GetEntries() <= 0 ) return(false);      if(!run){
1528              cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing RunInfo tree "<<endl;
1529              return(false);        
1530        }
1531        if ( run->GetEntries() <= 0 ) return(false);
1532    //    //
1533        
1534    Int_t oldrun = irun;  //  Int_t oldrun = irun;
1535      Long64_t oldrun = irun;
1536    // --------------------------------------    // --------------------------------------
1537    // if it is a full file (not preselected)    // if it is a full file (not preselected)
1538    // --------------------------------------    // --------------------------------------
1539    if(SELLI==0){    if(SELLI==0){
       if ( irun < 0 ){  
           irun = 0;  
           run->GetEntry(irun);  
           runfirstentry = 0ULL;  
           runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS);  
           if ( (ULong64_t)(this->GetRunInfo()->NEVENTS) > 0ULL ) runlastentry -= 1ULL;  
           return(true);  
       };        
1540    
1541        if( !GetOrbitalInfo() ){        if( !GetOrbitalInfo() ){
1542            cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl;            cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl;
1543            return(false);            return(false);
1544        }        }
1545    
1546          if ( irun < 0 ){
1547              irun = 0;
1548              run->GetEntry(irun);
1549              runfirstentry = 0LL;
1550              runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS);
1551              if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL;
1552    //        cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;
1553    //        cout << "runfirstentry "<<runfirstentry<<endl;
1554    //        return(true);
1555          };      
1556    
1557        // modificato il controllo sull'aggiornamento del run, per evitare problemi        // modificato il controllo sull'aggiornamento del run, per evitare problemi
1558        // dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!)        // dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!)
1559        //        //
1560        bool fromfirst = true;        bool fromfirst = true;
1561        //        //
1562        while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries() ){        while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1 ){
1563  //      while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){  //      while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){
1564            irun++;            irun++;
1565            run->GetEntry(irun);            run->GetEntry(irun);
1566            runfirstentry = runlastentry;            runfirstentry = runlastentry;
1567            if ( (ULong64_t)(this->GetRunInfo()->NEVENTS) > 0ULL ) runfirstentry += 1ULL;            if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runfirstentry += 1LL;
1568            runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS);            runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS);
1569    //        cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;
1570    //        cout << "runfirstentry "<<runfirstentry<<endl;
1571            //      printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS)));            //      printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS)));
1572            //      printf(" abstime %u trailertime %u \n",GetOrbitalInfo()->absTime,GetRunInfo()->RUNTRAILER_TIME);            //      printf(" abstime %u trailertime %u \n",GetOrbitalInfo()->absTime,GetRunInfo()->RUNTRAILER_TIME);
1573            //      printf(" IDRUN %u \n",GetRunInfo()->ID);            //      printf(" IDRUN %u \n",GetRunInfo()->ID);
1574            //            //
1575            prevshift = 0;  //        prevshift = 0;
1576            //            //
1577            if ( irun == run->GetEntries()-1 && fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)){            if ( irun == run->GetEntries()-1 && fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)){
1578              //      printf(" resetting irun \n");                printf(" resetting irun  (it should NOT happen!!!)\n");
1579              fromfirst = false;                fromfirst = false;
1580              irun = 0;                irun = 0;
1581              run->GetEntry(irun);                run->GetEntry(irun);
1582              runfirstentry = 0ULL;                runfirstentry = 0ULL;
1583              runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS);                runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS);
1584              if ( (ULong64_t)(this->GetRunInfo()->NEVENTS) > 0ULL ) runlastentry -= 1ULL;                if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL;
1585            };            };
1586            //            //
1587        };        };
1588        //        //
1589        if ( !fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) ) printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",GetOrbitalInfo()->absTime);        if ( !fromfirst &&
1590               !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME &&
1591                 GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)
1592              ) {
1593              printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",GetOrbitalInfo()->absTime);
1594              return false;
1595          }
1596        //        //
1597        if ( irun == oldrun || irun >= run->GetEntries() ) return(false);        if ( irun == oldrun || irun >= run->GetEntries() ) return(false);
1598        //        //
1599        //  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);
1600        //        //
1601          prevshift = 0;
1602          cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;
1603    //      cout << "runfirstentry "<<runfirstentry<<endl;
1604        return(true);            return(true);    
1605    };    };
1606    // ----------------------------------------------------    // ----------------------------------------------------
# Line 1590  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1609  Bool_t PamLevel2::UpdateRunInfo(TChain *
1609    // ----------------------------------------------------    // ----------------------------------------------------
1610    if(SELLI==1){          if(SELLI==1){      
1611        sel_tree->GetEntry(iev);        sel_tree->GetEntry(iev);
1612    //      cout << irun << " "<< irunentry << endl;
1613        if(irun != oldrun){        if(irun != oldrun){
1614            run->GetEntry(irun);            run->GetEntry(irun);
1615              cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;
1616              prevshift = 0;
1617            return true;            return true;
1618        }        }
1619        return false;        return false;
# Line 1600  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1622  Bool_t PamLevel2::UpdateRunInfo(TChain *
1622    return false;    return false;
1623    //    //
1624  };  };
1625    
1626    // Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev){
1627    //   //
1628    //   // check if we have already called once GetEntry, if not call it
1629    //   //
1630    //     if(!run_tree){
1631    //      cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree not loaded"<<endl;
1632    //      return false;
1633    //     }
1634    //     if ( run_tree->GetEntries() <= 0 ) {
1635    //      cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree is empty"<<endl;
1636    //      return(false);
1637    //     }
1638    //   //
1639      
1640    //   Int_t oldrun = irun;
1641    //   // --------------------------------------
1642    //   // if it is a full file (not preselected)
1643    //   // --------------------------------------
1644    //   if(SELLI==0){
1645    
1646    //       if( !GetOrbitalInfo() ){
1647    //        cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl;
1648    //        return(false);
1649    //       }
1650    
1651    //       if ( irun < 0 ){
1652    //        irun = 0;
1653    //        run_tree->GetEntry(irun);
1654    //        runfirstentry = iev;
1655    //        if( iev != 0){
1656    //            cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- WARNING -- "<<endl;
1657    //        }
1658    //       };      
1659    
1660    //       bool fromfirst = true;
1661    
1662    //       while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries() ){
1663    //        irun++;
1664    //        if( irun == run->GetEntries() ){
1665    //            if(!fromfirst){
1666    //                cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- event entry #"<<iev<<" does not belong to any run (should not happen)" <<endl;
1667    //                return false;
1668    //            }
1669    //            cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- reached end of run tree. searchin again from beginning (should not happen)" <<endl;
1670    //            fromfirst = false;
1671    //            irun =0;
1672    //        }
1673    //        run_tree->GetEntry(irun);
1674    //        runfirstentry = iev;
1675    //       };
1676    //       //
1677    //       if ( irun == oldrun ) return(false);
1678    //       //
1679    //       cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;
1680    //       cout << "runfirstentry "<<runfirstentry<<endl;
1681    //       prevshift = 0;
1682    //       return(true);    
1683    //   };
1684    //   // ----------------------------------------------------
1685    //   // if it is a preselected file (there is SelectionList)
1686    //   // NBNB - the event tree MUST be read first
1687    //   // ----------------------------------------------------
1688    //   if(SELLI==1){      
1689    //       sel_tree->GetEntry(iev);
1690    //       if(irun != oldrun){
1691    //        run->GetEntry(irun);
1692    //        cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;
1693    //        prevshift = 0;
1694    //        return true;
1695    //       }
1696    //       return false;
1697    //   }
1698    
1699    //   return false;
1700    //   //
1701    // };
1702  /**  /**
1703   * Update the runinfo informations (to be used to have Run infos event by event basis)   * Update the runinfo informations (to be used to have Run infos event by event basis)
1704   * @param run Pointer to the chain/tree which contains run infos   * @param run Pointer to the chain/tree which contains run infos
1705   * @return true if a new run has been read, false if it is still the same run   * @return true if a new run has been read, false if it is still the same run
1706   */   */
1707  Bool_t PamLevel2::UpdateRunInfo(TTree *run, ULong64_t iev){  Bool_t PamLevel2::UpdateRunInfo(TTree *run, Long64_t iev){
1708    return(UpdateRunInfo((TChain*)run,iev));    return(UpdateRunInfo((TChain*)run,iev));
1709  };  };
1710    
# Line 2244  void PamLevel2::CreateCloneTrees(TFile * Line 2343  void PamLevel2::CreateCloneTrees(TFile *
2343    
2344    
2345      sel_tree_clone = new TTree("SelectionList","List of selected events ");      sel_tree_clone = new TTree("SelectionList","List of selected events ");
2346      sel_tree_clone->Branch("RunEntry",&irun,"runentry/I");      sel_tree_clone->Branch("RunEntry",&irun,"runentry/L");
2347      sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/I");      sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/L");
2348            
2349    
2350      Int_t i=0;      Int_t i=0;
# Line 2385  void PamLevel2::WriteCloneTrees(){ Line 2484  void PamLevel2::WriteCloneTrees(){
2484  /**  /**
2485   * Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry.   * Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry.
2486   */   */
2487  Int_t PamLevel2::GetEntry(Int_t iee){  //Int_t PamLevel2::GetEntry(Int_t iee){
2488    Int_t PamLevel2::GetEntry(Long64_t iee){
2489            
2490      if(!pam_tree){      if(!pam_tree){
2491          cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl;          cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl;
# Line 2401  Int_t PamLevel2::GetEntry(Int_t iee){ Line 2501  Int_t PamLevel2::GetEntry(Int_t iee){
2501      //  return 0;      //  return 0;
2502      //    }      //    }
2503    
2504      Int_t ii=0;      Long64_t ii=0;
2505      //-------------------------------      //-------------------------------
2506      ii = iee;      ii = iee;
2507      if( !pam_tree->GetEntry(ii) ) return 0;      if( !pam_tree->GetEntry(ii) ){      
2508            cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree"<<endl;
2509            return 0;
2510        }
2511      //      //
2512      // ... 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.      // ... 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.
2513      // 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      // 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
# Line 2422  Int_t PamLevel2::GetEntry(Int_t iee){ Line 2524  Int_t PamLevel2::GetEntry(Int_t iee){
2524    
2525      //-------------------------------      //-------------------------------
2526      ii = iee;      ii = iee;
2527      Bool_t UPDATED = UpdateRunInfo(run_tree,ii);  //    Bool_t UPDATED = UpdateRunInfo(run_tree,ii);
2528        Bool_t UPDATED = UpdateRunInfo(ii);
2529      if(SELLI==0)irunentry = iee-runfirstentry;      if(SELLI==0)irunentry = iee-runfirstentry;
2530      if(UPDATED && run_tree_clone)run_tree_clone->Fill();      if(UPDATED && run_tree_clone)run_tree_clone->Fill();
2531    
# Line 2448  TTree* PamLevel2::GetYodaTree( ){ Line 2551  TTree* PamLevel2::GetYodaTree( ){
2551      // check if iroot has changed      // check if iroot has changed
2552      //===================================      //===================================
2553      if( irun<0 ){      if( irun<0 ){
2554          cout << "PamLevel2::GetYodaTree() -- ERROR "<<endl;          cout << "PamLevel2::GetYodaTree() -- ERROR -- irun = "<<irun<<endl;
2555          cout << "In order to use this method you have to load the RunInfo tree "<<endl;  //      cout << "In order to use this method you have to first load the RunInfo tree "<<endl;
         cout << "with the method TChain* PamLevel2::GetRunTree(TString, TString)"<<endl;  
 //      cout << " - read the event with PamLevel2::GetEntry(Int_t)"<<endl;  
2556          return NULL;          return NULL;
2557      }          }    
2558      Int_t irootnew = run_obj->ID_ROOT_L0;      Int_t irootnew = run_obj->ID_ROOT_L0;
# Line 2535  TTree* PamLevel2::GetYodaTree( ){ Line 2636  TTree* PamLevel2::GetYodaTree( ){
2636          cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl;          cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl;
2637      }      }
2638    
2639      if ( TRK0 ) TrkParams::SetCalib(run_obj,dbc);      if ( TRK0 ){
2640            TrkParams::Load(6);
2641            if( !TrkParams::IsLoaded(6) ){
2642                cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl;
2643            };
2644            TrkParams::SetCalib(run_obj,dbc);
2645            TrkParams::LoadCalib( );
2646            if( !TrkParams::CalibIsLoaded() ){
2647                cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded"<<endl;
2648            };
2649        }
2650    
2651  //    cout << l0_tree << endl;  //    cout << l0_tree << endl;
2652            
# Line 2553  Int_t PamLevel2::GetYodaEntry(){ Line 2663  Int_t PamLevel2::GetYodaEntry(){
2663      if(!GetYodaTree())return 0;      if(!GetYodaTree())return 0;
2664            
2665      // patch      // patch
2666      if( (Int_t)irunentry < 0){      if( irunentry < 0){
2667          cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl;          cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl;
2668          irunentry=0;          irunentry=0LL;
2669      }      }
2670      //  ---------------------------------      //  ---------------------------------
2671      //  if file is NOT a preselected file      //  if file is NOT a preselected file
2672      //  ---------------------------------      //  ---------------------------------
2673      UInt_t quellagiusta = irunentry + run_obj->EV_FROM;      Long64_t quellagiusta = irunentry + (Long64_t)(run_obj->EV_FROM);
2674            
2675    
2676  //     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;
# Line 2572  Int_t PamLevel2::GetYodaEntry(){ Line 2682  Int_t PamLevel2::GetYodaEntry(){
2682          cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl;          cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl;
2683          return 0;          return 0;
2684      }      }
2685        if( GetOrbitalInfo()->OBT==0 && GetOrbitalInfo()->pkt_num==0 ){
2686            cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? "<<endl;
2687            return 0;
2688        }
2689    
2690      // ---------------------------------------------------------------------      // ---------------------------------------------------------------------
2691      // ATTENTION!!!      // ATTENTION!!!
# Line 2589  Int_t PamLevel2::GetYodaEntry(){ Line 2703  Int_t PamLevel2::GetYodaEntry(){
2703      //    printf(" siamo qui %i %i \n",shift,prevshift);      //    printf(" siamo qui %i %i \n",shift,prevshift);
2704      do{      do{
2705          if(shift>0){              if(shift>0){    
2706            cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl;              cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl;
2707          }          }
2708          answer = l0_tree->GetEntry(quellagiusta+shift+prevshift);          answer = l0_tree->GetEntry(quellagiusta+(Long64_t)shift+(Long64_t)prevshift);
2709          shift++;          shift++;
2710          if( !GetEventHeader() ){          if( !GetEventHeader() ){
2711              cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl;              cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl;
2712              return 0;              return 0;
2713          }          }
2714    //      cout << "PKTNUM "<<shift<<" ==  L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl;
2715    //      cout << " L2 --- "<< GetOrbitalInfo()->OBT << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<<endl;
2716  //      if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl;  //      if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl;
2717  //      cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl;  //      cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl;
2718  //      cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl;  //      cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl;
# Line 2604  Int_t PamLevel2::GetYodaEntry(){ Line 2720  Int_t PamLevel2::GetYodaEntry(){
2720  //      cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl;  //      cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl;
2721  //      printf(" IDRUN %u \n",GetRunInfo()->ID);  //      printf(" IDRUN %u \n",GetRunInfo()->ID);
2722  //  //
2723          if ( prevshift != 0 && (quellagiusta+shift) == GetYodaTree()->GetEntries() ){          if ( prevshift != 0 && (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() ){
2724            prevshift = 0;            prevshift = 0;
2725            shift = -1;            shift = -1;
2726          };          };
2727    
2728      }while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < GetYodaTree()->GetEntries() );      }while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() );
2729    
2730      if ( (quellagiusta+shift) == GetYodaTree()->GetEntries() ) cout << " Big trouble here, no such event in Level0 data! " <<endl;      if ( (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() ) cout << " Big trouble here, no such event in Level0 data! " <<endl;
2731    
2732  //    cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl;  //    cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl;
2733  //    return GetYodaTree()->GetEntry(quellagiusta);  //    return GetYodaTree()->GetEntry(quellagiusta);

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.34

  ViewVC Help
Powered by ViewVC 1.1.23