--- DarthVader/RunInfo/src/RunInfo.cpp 2006/05/19 13:15:47 1.1 +++ DarthVader/RunInfo/src/RunInfo.cpp 2006/07/18 10:58:52 1.5 @@ -77,6 +77,7 @@ version->S4_ver = ""; norun = 0; totnorun = 0; + // runlist = new TArrayL(0,NULL); // } @@ -102,6 +103,7 @@ version->S4_ver = ""; norun = 0; totnorun = 0; + runlist = new TArrayL(0,NULL); // } @@ -150,6 +152,7 @@ // norun = 0; runlist = new TArrayL(0,NULL); + //runlist->Reset(); // Bool_t found = false; Int_t error = 0; @@ -244,7 +247,7 @@ if ( !updating ){ if ( idRun == 0ULL ){ if ( debug ) printf("\n RUNINFO - ERROR: reprocessing data but no RunInfo tree in Level2 file. \n"); - return(-13); + return(-805); }; // runlist = new TArrayL(1); @@ -302,6 +305,10 @@ file->cd(); // file->Write("Run"); //newtree->Delete(); + delete newver; + delete newrun; + delete oldver; + delete oldrun; // return(0); // @@ -441,7 +448,7 @@ newver->ND_ver = oldver->ND_ver; newver->AC_ver = oldver->AC_ver; newver->ORB_ver = version->ORB_ver; - if ( strcmp(oldver->TRK_ver.Data(),"") ) reprocessing = true; + if ( strcmp(oldver->ORB_ver.Data(),"") ) reprocessing = true; }; if ( !strcmp(Detector.Data(),"CALO") ){ newver->TRIG_ver = oldver->TRIG_ver; @@ -497,6 +504,10 @@ newtree->SetName("Run"); // file->Write("Run"); // newtree->Delete(); + delete newver; + delete newrun; + delete oldver; + delete oldrun; // if ( !found ){ if ( debug ) printf("\n RUNINFO - ERROR: no run with ID_RUN = %llu \n",idRun); @@ -580,6 +591,8 @@ if ( debug ) printf("norun %i \n",(int)norun); Int_t error = 0; error = GetRunInfo(idRun); + delete newver; + delete newrun; if ( error ) return(error); return(0); } @@ -602,16 +615,36 @@ UInt_t ItoRunInfo::GetRunForEntry(UInt_t entry){ // - ItoRunInfo *run = new ItoRunInfo(); + UInt_t startfrom = 0; + // + if ( entry >= (UInt_t)first_file_entry && entry <= (UInt_t)last_file_entry ) return(ID); + // + if ( entry > (UInt_t)last_file_entry ){ + for ( UInt_t nrun = 0; nrun < norun; nrun++){ + if ( ID == (ULong64_t)runlist->At(nrun) ) { + startfrom = nrun+1; + break; + }; + }; + } else { + startfrom = 0; + }; + // + if ( startfrom >= norun ) startfrom = 0; // - for ( UInt_t nrun = 0; nrun < norun; nrun++){ - run->GetRunInfo((ULong64_t)nrun); - if ( entry >= (UInt_t)run->first_file_entry && entry <= (UInt_t)run->last_file_entry ){ - run->newtree->Delete(); - return(nrun); + retry: + // + for ( UInt_t nrun = startfrom; nrun < norun; nrun++){ + GetRunInfo((ULong64_t)runlist->At(nrun)); + if ( entry >= (UInt_t)first_file_entry && entry <= (UInt_t)last_file_entry ){ + return((UInt_t)runlist->At(nrun)); }; }; - run->newtree->Delete(); + if ( startfrom ){ + startfrom = 0; + goto retry; + }; + printf(" ERROR! run not found \n"); return(0); } @@ -660,6 +693,9 @@ }; if ( !found ) first_file_entry += (nwrun->EV_REG_PHYS_TO - nwrun->EV_REG_PHYS_FROM + 1); }; + delete nwver; + delete nwrun; if ( found ) return(0); return(-800); } +