--- DarthVader/RunInfo/src/RunInfo.cpp 2006/05/19 13:15:47 1.1 +++ DarthVader/RunInfo/src/RunInfo.cpp 2006/07/21 11:00:13 1.6 @@ -30,6 +30,21 @@ S4_ver = ""; } +/** + * Fills a struct cSoftInfo with values from a SoftInfo object (to put data into a F77 common). + */ +void SoftInfo::GetLevel2Struct(cSoftInfo *l2) const{ + l2->FillTrigWith(TRIG_ver); + l2->FillTofWith(TOF_ver); + l2->FillAcWith(AC_ver); + l2->FillTrkWith(TRK_ver); + l2->FillOrbWith(ORB_ver); + l2->FillCalWith(CAL_ver); + l2->FillNdWith(ND_ver); + l2->FillS4With(S4_ver); +} +/***********************/ + ItoRunInfo::ItoRunInfo() { reprocessing = false; updating = false; @@ -77,6 +92,7 @@ version->S4_ver = ""; norun = 0; totnorun = 0; + // runlist = new TArrayL(0,NULL); // } @@ -102,6 +118,7 @@ version->S4_ver = ""; norun = 0; totnorun = 0; + runlist = new TArrayL(0,NULL); // } @@ -150,6 +167,7 @@ // norun = 0; runlist = new TArrayL(0,NULL); + //runlist->Reset(); // Bool_t found = false; Int_t error = 0; @@ -244,7 +262,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 +320,10 @@ file->cd(); // file->Write("Run"); //newtree->Delete(); + delete newver; + delete newrun; + delete oldver; + delete oldrun; // return(0); // @@ -441,7 +463,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 +519,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 +606,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 +630,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 +708,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); } +