--- DarthVader/RunInfo/src/RunInfo.cpp 2006/11/09 14:44:08 1.14 +++ DarthVader/RunInfo/src/RunInfo.cpp 2012/05/15 14:35:31 1.21 @@ -22,18 +22,10 @@ // SoftInfo::SoftInfo() { - TRIG_ver = ""; - TOF_ver = ""; - AC_ver = ""; - TRK_ver = ""; - ORB_ver = ""; - CAL_ver = ""; - ND_ver = ""; - S4_ver = ""; - DV_ver = ""; + Clear(); } -void SoftInfo::Clear(){ +void SoftInfo::Clear(Option_t *t){ TRIG_ver = ""; TOF_ver = ""; AC_ver = ""; @@ -96,6 +88,10 @@ } /***********************/ +ItoRunInfo::~ItoRunInfo() { + this->GL_RUN::Clear(); +} + ItoRunInfo::ItoRunInfo() { reprocessing = false; updating = false; @@ -109,7 +105,7 @@ norun = 0; runlist = new TArrayI(500); file = NULL; - newtree = new TTree(); + newtree = NULL;//new TTree(); } ItoRunInfo::ItoRunInfo(TFile *processFl){ @@ -130,6 +126,7 @@ norun = 0; totnorun = 0; runlist = new TArrayI(500); + newtree = NULL; // } @@ -177,7 +174,7 @@ // if ( glrun && newrun ){ // - // printf("copy \n"); +// printf("copy \n"); // newrun->ID = glrun->ID ; newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG ; @@ -209,6 +206,8 @@ newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED ; newrun->CAL_DSP_MASK = glrun->CAL_DSP_MASK ; newrun->BOOT_NUMBER = glrun->BOOT_NUMBER ; + newrun->PHYSENDRUN_MASK_S3S2S12 = glrun->PHYSENDRUN_MASK_S3S2S12 ; + newrun->PHYSENDRUN_MASK_S11CRC = glrun->PHYSENDRUN_MASK_S11CRC ; newrun->VALIDATION = glrun->VALIDATION ; // }; @@ -235,11 +234,11 @@ // Bool_t debug = false; // - Bool_t ismydir = false; + // Bool_t ismydir = false; // if ( !strcmp(processFolder.Data(),"") ){ processFolder = "runinfoFolder"; - ismydir = true; + // ismydir = true; }; // GL_RUN *oldrun = new GL_RUN(); @@ -336,7 +335,7 @@ totnorun = 1; reprocessing = false; first_file_entry = 0; - last_file_entry = (UInt_t)(EV_TO - EV_FROM); + if ( EV_TO >= EV_FROM ) last_file_entry = (UInt_t)(EV_TO - EV_FROM); norun = 1; runlist->AddAt((Int_t)ID,0); // @@ -368,7 +367,7 @@ // for ( UInt_t run = 0; run < totnorun; run++){ // - oldtree->GetEntry(run); + if ( oldtree->GetEntry(run) <= 0 ) throw -36; // CopyFromTo(oldrun,newrun,oldver,newver); // @@ -378,7 +377,7 @@ // if ( idRun == 0 || idRun == newrun->ID ) { // - if ( debug ) printf(" Updating run number %u \n",idRun); + if ( debug ) printf(" Updating run number %u newrun->ID %i \n",idRun,(int)newrun->ID); // found = true; // @@ -510,13 +509,14 @@ }; }; // - last_file_entry = first_file_entry + (oldrun->EV_TO - oldrun->EV_FROM + 1); + if ( oldrun->EV_TO >= oldrun->EV_FROM ) last_file_entry = first_file_entry + (oldrun->EV_TO - oldrun->EV_FROM + 1); // } else { if ( !found ) first_file_entry += (oldrun->EV_TO - oldrun->EV_FROM + 1); }; // file->cd(); + if ( debug ) printf("filling: totnorun %i idRun %i newrun->ID %i \n",(int)totnorun,(int)idRun,(int)newrun->ID); newtree->Fill(); // }; @@ -535,11 +535,22 @@ return(-5); }; // + this->Write(); // newtree->Write(); }; +// if ( oldtree ) oldtree->Delete(); // crasha qua in queste righe e se non le metti... +// if ( newver ) delete newver; +// if ( newrun ) delete newrun; +// if ( oldver ) delete oldver; +// if ( oldrun ) delete oldrun; return(0); } +void ItoRunInfo::Write(){ + file->cd(); + newtree->Write("Run",TObject::kOverwrite); +} + Int_t ItoRunInfo::Read(UInt_t idRun){ // isreadonly = true; @@ -576,7 +587,7 @@ // for ( UInt_t run = 0; run < totnorun; run++){ // - newtree->GetEntry(run); + if ( newtree->GetEntry(run) <= 0 ) throw -36; // file_entries += (newrun->EV_TO - newrun->EV_FROM + 1); // @@ -587,7 +598,7 @@ runlist->AddAt(newrun->ID,norun); norun++; }; - last_file_entry = first_file_entry + (newrun->EV_TO - newrun->EV_FROM + 1); + if ( newrun->EV_TO >= newrun->EV_FROM ) last_file_entry = first_file_entry + (newrun->EV_TO - newrun->EV_FROM + 1); }; }; if ( debug ) printf("norun %i \n",(int)norun); @@ -609,10 +620,10 @@ delete runlist; // file = new TFile(); file = 0; - if ( isreadonly ) newtree->Delete(); + // if ( isreadonly ) newtree->Delete(); } -void ItoRunInfo::Clear(){ +void ItoRunInfo::Clear(Option_t *t){ if ( newtree ) newtree->Delete(); } @@ -665,12 +676,12 @@ totnorun = newtree->GetEntries(); // for ( UInt_t nrun = 0; nrun < totnorun; nrun++){ - newtree->GetEntry(nrun); + if ( newtree->GetEntry(nrun) <= 0 ) throw -36; // if ( nwrun->ID == run || run == 0 ){ CopyFromTo(nwrun,(GL_RUN*)this,nwver,version); found = true; - last_file_entry = first_file_entry + (nwrun->EV_TO - nwrun->EV_FROM + 1); + if ( nwrun->EV_TO >= nwrun->EV_FROM ) last_file_entry = first_file_entry + (nwrun->EV_TO - nwrun->EV_FROM + 1); }; if ( !found ) first_file_entry += (nwrun->EV_TO - nwrun->EV_FROM + 1); };