/[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.40 by pam-fi, Fri May 25 13:38:51 2007 UTC revision 1.44 by mocchiut, Mon Sep 3 09:16:48 2007 UTC
# Line 112  PamLevel2::PamLevel2(TString ddir,TStrin Line 112  PamLevel2::PamLevel2(TString ddir,TStrin
112    
113  void PamLevel2::Initialize(){  void PamLevel2::Initialize(){
114                    
 //     trk2_obj  = TrkLevel2::GetTrkLevel2();  
 //     trk1_obj  = TrkLevel1::GetTrkLevel1();  
 //     trkh_obj  = TrkHough::GetTrkHough();  
 //     calo1_obj = CaloLevel1::GetCaloLevel1();  
 //     calo2_obj = CaloLevel2::GetCaloLevel2();  
 //     tof_obj   = ToFLevel2::GetToFLevel2();  
 //     trig_obj  = TrigLevel2::GetTrigLevel2();  
 //     s4_obj    = S4Level2::GetS4Level2();  
 //     nd_obj    = NDLevel2::GetNDLevel2();  
 //     ac_obj    = AcLevel2::GetAcLevel2();  
 //     orb_obj   = OrbitalInfo::GetOrbitalInfo();  
       
115      h0_obj    = 0;      h0_obj    = 0;
116      trk0_obj  = 0;      trk0_obj  = 0;
117      calo0_obj  = 0;      calo0_obj  = 0;
# Line 198  void PamLevel2::Initialize(){ Line 186  void PamLevel2::Initialize(){
186    
187      SELLI = -1;      SELLI = -1;
188    
189        ISGP = false;
190    
191      tsorted=0;      tsorted=0;
192      timage=0;      timage=0;
193            
# Line 658  void PamLevel2::SortTracks(){ Line 648  void PamLevel2::SortTracks(){
648    TClonesArray &ttimage = *timage;    TClonesArray &ttimage = *timage;
649    
650    
651    // loop over the tracks sorted by the tracker  
652      //--------------------------------------------------
653      // retrieve sorting method
654      //--------------------------------------------------
655    Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase);    Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase);
656    Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase);    Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase);
657    Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase);    Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase);
# Line 672  void PamLevel2::SortTracks(){ Line 665  void PamLevel2::SortTracks(){
665    };    };
666    
667    //   cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl;    //   cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl;
668          
669    
670      //--------------------------------------------------
671      // loop over "physical" tracks sorted by the tracker
672      //--------------------------------------------------
673    for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){    for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){
674                    
675      TrkTrack   *ts = 0;      TrkTrack   *ts = 0;
# Line 680  void PamLevel2::SortTracks(){ Line 677  void PamLevel2::SortTracks(){
677      ToFTrkVar  *os = 0;      ToFTrkVar  *os = 0;
678                    
679      // get tracker tracks      // get tracker tracks
680      TrkTrack   *tp = trk2_obj->TrkLevel2::GetTrack(i);                    //tracker      TrkTrack   *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker
681      CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo());      CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo());
682      ToFTrkVar  *op = GetToFStoredTrack(tp->GetSeqNo());      ToFTrkVar  *op = GetToFStoredTrack(tp->GetSeqNo());
683    
684      TrkTrack   *ti = 0;              //tracker (image)      TrkTrack   *ti = 0; //tracker (image)
685      CaloTrkVar *ci = 0;      CaloTrkVar *ci = 0;
686      ToFTrkVar  *oi = 0;      ToFTrkVar  *oi = 0;
687      //  cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl;      //  cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl;
# Line 701  void PamLevel2::SortTracks(){ Line 698  void PamLevel2::SortTracks(){
698        Int_t tp_score = 0;  //main track sorted by the tracker        Int_t tp_score = 0;  //main track sorted by the tracker
699        Int_t ti_score = 0;  //image track        Int_t ti_score = 0;  //image track
700                            
701        // ------------------------        // -----------------------------------------------------------------------------------------
702        // calorimeter check        // calorimeter check
703        // ------------------------        // -----------------------------------------------------------------------------------------
704        // check the Y spatial residual on the first calorimeter plane        // check the Y spatial residual on the first calorimeter plane
705        // (cut on calorimeter variables from Emiliano)        // (cut on calorimeter variables from Emiliano)
706        if( use_CAL && !calo2_obj ){        if( use_CAL && !calo2_obj ){
# Line 712  void PamLevel2::SortTracks(){ Line 709  void PamLevel2::SortTracks(){
709        };        };
710        if(        if(
711           use_CAL            &&           use_CAL            &&
712           calo2_obj->npcfit[1] > 5     &&   //no. of fit planes on Y view  //       calo2_obj->npcfit[1] > 5     &&   //no. of fit planes on Y view
713           calo2_obj->varcfit[1] < 1000. &&  //fit variance on Y view  //       calo2_obj->varcfit[1] < 1000. &&  //fit variance on Y view
714           cp && ci &&           cp && ci &&
715           true){           true){
716    
717                                    
718          Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p;  //      Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p;
719          Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i;  //      Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i;
720                                    
721          if(resy_p <= resy_i) tp_score++;  //      if(resy_p <= resy_i) tp_score++;
722          else                 ti_score++;  //      else                 ti_score++;
723                    
724    
725              if( cp->npresh > ci->npresh) tp_score++;
726              if( cp->npresh < ci->npresh) ti_score++;
727              else ;//niente
728    
729          //      cout << "CALO "<<tp_score<<ti_score<<endl;          //      cout << "CALO "<<tp_score<<ti_score<<endl;
730    
731        };        };
732        // ------------------------        // -----------------------------------------------------------------------------------------
733        // TOF check        // TOF check
734        // ------------------------                  // -----------------------------------------------------------------------------------------
735        // check the number of hit pmts along the track        // check the number of hit pmts along the track
736        // on S12 S21 and S32, where paddles are parallel to Y axis        // on S12 S21 and S32, where paddles are parallel to Y axis
737        if( use_TOF && !tof_obj ){        if( use_TOF && !tof_obj ){
# Line 875  void PamLevel2::SortTracks(){ Line 877  void PamLevel2::SortTracks(){
877              cout << "image: npmtadc "<< oi->npmtadc << endl;              cout << "image: npmtadc "<< oi->npmtadc << endl;
878              cout << "image: npmttdc "<< oi->npmttdc << endl;*/              cout << "image: npmttdc "<< oi->npmttdc << endl;*/
879                                    
880            for (Int_t ih=0; ih < op->npmtadc; ih++){  //        for (Int_t ih=0; ih < op->npmtadc; ih++){
881              Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) );  //          Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) );
882              if(pl == 1 || pl == 2 || pl == 5)nphit_p++;  //          if(pl == 1 || pl == 2 || pl == 5)nphit_p++;
883    //        };
884                    
885    //        for (Int_t ih=0; ih < oi->npmtadc; ih++){
886    //          Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) );
887    //          if(pl == 1 || pl == 2 || pl == 5)nphit_i++;
888    //        };
889              // --- modified to count tdc signals (more efficient?)
890              // --- and to implement check on tdcflag
891              for (Int_t ih=0; ih < op->npmttdc; ih++){
892                //      Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) );
893    //          if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++;
894                if( (op->tdcflag).At(ih)==0 )nphit_p++;
895            };            };
896                                    
897            for (Int_t ih=0; ih < oi->npmtadc; ih++){            for (Int_t ih=0; ih < oi->npmttdc; ih++){
898              Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) );              //      Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) );
899              if(pl == 1 || pl == 2 || pl == 5)nphit_i++;  //          if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++;  
900                if( (oi->tdcflag).At(ih)==0 )nphit_i++;    
901            };            };
902                                    
903            if(            if(
              use_TOF            &&  
904               (nphit_p+nphit_i) !=0 &&                 (nphit_p+nphit_i) !=0 &&  
905               true){               true){
906                                            
907              if( nphit_p >= nphit_i) tp_score++;              if     ( nphit_p > nphit_i) tp_score++;
908              else ti_score++;              else if( nphit_p < nphit_i) ti_score++;
909                else ;//niente
910            };            };
911          };          };
912          //      cout << "TOF "<<tp_score<<ti_score<<endl;          //      cout << "TOF "<<tp_score<<ti_score<<endl;
913        };        };
914        if(tp_score == ti_score) use_TRK = true;  
915        // ------------------------  
916    //      if(tp_score == ti_score) use_TRK = true;
917    
918    
919          // -----------------------------------------------------------------------------------------
920        // tracker check        // tracker check
921        // ------------------------        // -----------------------------------------------------------------------------------------
922        // chi**2 difference is not always large enough to distinguish among        // chi**2 difference is not always large enough to distinguish among
923        // the real track and its image.        // the real track and its image.
924        // Tracker check will be applied always when calorimeter and tof information is ambiguous.        // Tracker check will be applied always when calorimeter and tof information is ambiguous.
925          // *** MODIFIED ON AUGUST 2007 ***
926        if(use_TRK){        if(use_TRK){
927          if(      tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ;  //      if(      tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ;
928          else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ;  //      else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ;
929    
930              // CHECK 1 : number of points along X  
931              if ( tp->GetNX() >= ti->GetNX() )tp_score++ ;
932              if ( tp->GetNX() <= ti->GetNX() )ti_score++ ;
933              // CHECK 2 : number of points along Y  
934              if ( tp->GetNY() >= ti->GetNY() )tp_score++ ;
935              if ( tp->GetNY() <= ti->GetNY() )ti_score++ ;
936              // CHECK 3 : chi**2 along X  
937    //        if(      tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ;
938    //        if(      ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ;
939              // CHECK 4 : chi**2 along Y  
940    //        if(      tp->GetChi2Y() > 0 && (tp->GetChi2Y() < ti->GetChi2Y() || ti->GetChi2Y() <=0) ) tp_score++ ;
941    //        if(      ti->GetChi2Y() > 0 && (ti->GetChi2Y() < tp->GetChi2Y() || tp->GetChi2Y() <=0) ) ti_score++ ;
942              // CHECK 5 : total chi**2  
943    //        if(      tp->chi2 > 0 && (tp->chi2 < ti->chi2 || ti->chi2 <=0) ) tp_score++ ;
944    //        if(      ti->chi2 > 0 && (ti->chi2 < tp->chi2 || tp->chi2 <=0) ) ti_score++ ;
945    
946          //      cout << "TRK "<<tp_score<<ti_score<<endl;          //      cout << "TRK "<<tp_score<<ti_score<<endl;
947        };        };
948                            
949        // ------------------------  
950    
951          // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
952        // the winner is....        // the winner is....
953        // ------------------------                  // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
954        if      (tp_score > ti_score) {        if      (tp_score > ti_score) {
955          //              ts = tp;//the track sorted by the tracker!!          
         //              cs = cp;  
         //              os = op;  
         //      cout << "It's primary!" << endl;  
956    
957        }else if (tp_score < ti_score) {        }else if (tp_score < ti_score) {
958    
         //      cout << "It's image!" << endl;  
959    
960          ts = ti;//its image!!          ts = ti;//its image!!
961          cs = ci;          cs = ci;
# Line 936  void PamLevel2::SortTracks(){ Line 971  void PamLevel2::SortTracks(){
971    
972                                    
973        }else {        }else {
974          //              ts = tp;  
         //              cs = cp;  
         //              os = op;  
975  //      cout << "Warning - track image ambiguity not solved" << endl;  //      cout << "Warning - track image ambiguity not solved" << endl;
976          //                              cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl;  
977        };        };
978                            
979      }else{      }else{
# Line 1875  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1908  Bool_t PamLevel2::UpdateRunInfo(TChain *
1908        //        //
1909        // the absolute time is necessary to relate the event with the run        // the absolute time is necessary to relate the event with the run
1910        //        //
1911        if( !GetOrbitalInfo() ){        if( !GetOrbitalInfo() && !ISGP){
1912            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;
1913            return(false);            return(false);
1914        }        }
1915    
1916          ULong64_t abstime = 0;
1917          if( GetOrbitalInfo() )abstime=GetOrbitalInfo()->absTime;
1918    
1919    
1920        //        //
1921        // the first time the routine is called, set run search from the beginning        // the first time the routine is called, set run search from the beginning
1922        //        //
# Line 1889  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1926  Bool_t PamLevel2::UpdateRunInfo(TChain *
1926            runfirstentry = 0LL;            runfirstentry = 0LL;
1927            runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS);            runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS);
1928            if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL;            if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL;
1929              
1930              if( ISGP && run->GetEntries()!=1 ){
1931                  cout << "** WARNING ** simulated files are assumed to have 1 single run, not "<< run->GetEntries() << endl;
1932                  cout << "** WARNING ** run will not be updated"<<endl;
1933              }
1934    
1935        };              };      
1936        //        //
1937         if ( irun == run->GetEntries()-1LL &&        if(ISGP)abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO
1938             !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME &&        //
1939               GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)        if ( irun == run->GetEntries()-1LL &&
1940               !(abstime >= GetRunInfo()->RUNHEADER_TIME &&
1941                 abstime <= GetRunInfo()->RUNTRAILER_TIME)
1942              ){              ){
1943           irun = -1LL;           irun = -1LL;
1944           runfirstentry = 0LL;           runfirstentry = 0LL;
# Line 1904  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1949  Bool_t PamLevel2::UpdateRunInfo(TChain *
1949        //        //
1950        bool fromfirst = true;        bool fromfirst = true;
1951        //        //
1952        while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1LL ){        while ( !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1LL ){
1953  //      while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){  //      while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){
1954            irun++;            irun++;
1955            run->GetEntry(irun);            run->GetEntry(irun);
# Line 1914  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1959  Bool_t PamLevel2::UpdateRunInfo(TChain *
1959  //        cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;  //        cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;
1960  //        cout << "runfirstentry "<<runfirstentry<<endl;  //        cout << "runfirstentry "<<runfirstentry<<endl;
1961            //      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)));
1962            //      printf(" abstime %u trailertime %u \n",GetOrbitalInfo()->absTime,GetRunInfo()->RUNTRAILER_TIME);            //      printf(" abstime %u trailertime %u \n",abstime,GetRunInfo()->RUNTRAILER_TIME);
1963            //      printf(" IDRUN %u \n",GetRunInfo()->ID);            //      printf(" IDRUN %u \n",GetRunInfo()->ID);
1964            //            //
1965  //        prevshift = 0;  //        prevshift = 0;
1966            //            //
1967            if ( irun == (Long64_t)(run->GetEntries()-1LL) && fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)){            if ( irun == (Long64_t)(run->GetEntries()-1LL) && fromfirst && !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME)){
1968                printf(" resetting irun  (it should NOT happen!!!)\n");                printf(" resetting irun  (it should NOT happen!!!)\n");
1969                fromfirst = false;                fromfirst = false;
1970                irun = 0;                irun = 0;
# Line 1932  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1977  Bool_t PamLevel2::UpdateRunInfo(TChain *
1977        };        };
1978        //        //
1979        if (        if (
1980             !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME &&             !(abstime >= GetRunInfo()->RUNHEADER_TIME &&
1981               GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)               abstime <= GetRunInfo()->RUNTRAILER_TIME)
1982            ) {            ) {
1983            printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",GetOrbitalInfo()->absTime);          printf(" Something very wrong here: cannot find RUN containing absolute time %llu \n",abstime);
1984            return false;            return false;
1985        }        }
1986        //        //
# Line 1986  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2031  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2031      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
2032      if(SELLI==0){      if(SELLI==0){
2033    
2034            ULong64_t abstime = 0;
2035            ULong64_t obt     = 0;
2036            if( GetOrbitalInfo() ){
2037                abstime = GetOrbitalInfo()->absTime;
2038                obt     = GetOrbitalInfo()->OBT;
2039            }
2040          // ---------------------------------------------------------------          // ---------------------------------------------------------------
2041          // the absolute time is necessary to relate the event with the run          // the absolute time is necessary to relate the event with the run
2042          // ---------------------------------------------------------------          // ---------------------------------------------------------------
2043          if( !GetOrbitalInfo() ){          if( !GetOrbitalInfo() && !ISGP ){
2044              cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- missing OrbitalInfo "<<endl;              cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- missing OrbitalInfo "<<endl;
2045              return(false);              return(false);
2046          }          }
# Line 2002  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2053  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2053              irunentry = 0;              irunentry = 0;
2054              prevshift = 0;              prevshift = 0;
2055              run_tree->GetEntry(irun);              run_tree->GetEntry(irun);
2056    
2057                if( ISGP && run_tree->GetEntries()!=1 ){
2058                    cout << "** WARNING ** simulated files are assumed to have 1 single run, not "<< run_tree->GetEntries() << endl;
2059                    cout << "** WARNING ** run will not be updated"<<endl;
2060                }
2061          };                };      
2062    
2063            // -----------------------------------------------------------------------
2064            // if it is simulation, assigh abstime by end (temporaneo!!!)
2065            // -----------------------------------------------------------------------
2066            if(ISGP){
2067                abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO
2068                obt     = GetRunInfo()->RUNHEADER_OBT; // BARBATRUCCO
2069            }
2070          //          //
2071          bool fromfirst = true; // first loop over runs          bool fromfirst = true; // first loop over runs
2072    
# Line 2016  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2080  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2080          while (          while (
2081              (              (
2082                  (                  (
2083                      !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME &&    // check on absolute time (s)                      !(abstime >= GetRunInfo()->RUNHEADER_TIME &&    // check on absolute time (s)
2084                        GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) &&                        abstime <= GetRunInfo()->RUNTRAILER_TIME) &&
2085                      !(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT &&         // additional check on OBT (ms)                      !(obt >= GetRunInfo()->RUNHEADER_OBT &&         // additional check on OBT (ms)
2086                        GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT)                        obt <= GetRunInfo()->RUNTRAILER_OBT)
2087                      )                      )
2088                  || GetRunInfo()->NEVENTS==0                  || GetRunInfo()->NEVENTS==0
2089                  || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift)                  || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift)
# Line 3135  Int_t PamLevel2::GetYodaEntry(){ Line 3199  Int_t PamLevel2::GetYodaEntry(){
3199    
3200  //     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;
3201  //     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;
3202  //     cout << " time "<< GetOrbitalInfo()->absTime << endl;  //     cout << " time "<< abstime << endl;
3203  //     cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl;  //     cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl;
3204            
3205      if( !GetOrbitalInfo() ){      ULong64_t obt     = 0;
3206        ULong64_t pktn    = 0;
3207        if( GetOrbitalInfo() ){
3208            obt     = GetOrbitalInfo()->OBT;
3209            pktn    = GetOrbitalInfo()->pkt_num;
3210        }
3211    
3212        if( !GetOrbitalInfo() && !ISGP){
3213          cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl;          cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl;
3214          return 0;          return 0;
3215      }      }
3216      if( GetOrbitalInfo()->OBT==0 && GetOrbitalInfo()->pkt_num==0 ){      if( obt==0 && pktn==0 && !ISGP ){
3217          cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? "<<endl;          cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? "<<endl;
3218          return 0;          return 0;
3219      }      }
# Line 3164  Int_t PamLevel2::GetYodaEntry(){ Line 3235  Int_t PamLevel2::GetYodaEntry(){
3235      Int_t maxshift = 10;      Int_t maxshift = 10;
3236      do{      do{
3237          if(shift>0){              if(shift>0){    
3238              cout << " PKTNUM  L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl;              cout << " PKTNUM  L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl;
3239              cout << "         RUN: ID "<< GetRunInfo()->ID << " ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<" ID_RUN_FRAG "<<GetRunInfo()->ID_RUN_FRAG << " EV_FROM "<<GetRunInfo()->EV_FROM  <<endl;              cout << "         RUN: ID "<< GetRunInfo()->ID << " ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<" ID_RUN_FRAG "<<GetRunInfo()->ID_RUN_FRAG << " EV_FROM "<<GetRunInfo()->EV_FROM  <<endl;
3240              cout << "         L2 <--> L0 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl;              cout << "         L2 <--> L0 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl;
3241          }          }
# Line 3174  Int_t PamLevel2::GetYodaEntry(){ Line 3245  Int_t PamLevel2::GetYodaEntry(){
3245              cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl;              cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl;
3246              return 0;              return 0;
3247          }          }
3248  //      cout << "PKTNUM "<<shift<<" ==  L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl;  
3249  //      cout << " L2 --- "<< GetOrbitalInfo()->OBT << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<<endl;          if(ISGP){
3250                obt = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()); //BARBATRUCCO
3251                pktn = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()); //BARBATRUCCO
3252            }
3253    
3254    //      cout << "PKTNUM "<<shift<<" ==  L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl;
3255    //      cout << " L2 --- "<< obt << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<<endl;
3256  //      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;
3257  //      cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl;  //      cout << " obt "<< obt << endl;
3258  //      cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl;  //      cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl;
3259  //      cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl;  //      cout << " pktn "<< pktn << endl;
3260  //      cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl;  //      cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl;
3261  //      printf(" IDRUN %u \n",GetRunInfo()->ID);  //      printf(" IDRUN %u \n",GetRunInfo()->ID);
3262  //  //
# Line 3188  Int_t PamLevel2::GetYodaEntry(){ Line 3265  Int_t PamLevel2::GetYodaEntry(){
3265            shift = -1;            shift = -1;
3266          };          };
3267    
3268      }while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift);      }while( ( obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) ||
3269                  pktn != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())       )
3270                && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift);
3271    
3272      if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) {      if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) {
3273          cout << " Big trouble here, no such event in Level0 data! " <<endl;          cout << " Big trouble here, no such event in Level0 data! " <<endl;

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.44

  ViewVC Help
Powered by ViewVC 1.1.23