/[PAMELA software]/DarthVader/RunInfo/src/RunInfo.cpp
ViewVC logotype

Diff of /DarthVader/RunInfo/src/RunInfo.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by mocchiut, Fri May 19 13:15:47 2006 UTC revision 1.5 by mocchiut, Tue Jul 18 10:58:52 2006 UTC
# Line 77  ItoRunInfo::ItoRunInfo(TFile *processFl) Line 77  ItoRunInfo::ItoRunInfo(TFile *processFl)
77    version->S4_ver = "";      version->S4_ver = "";  
78    norun = 0;    norun = 0;
79    totnorun = 0;    totnorun = 0;
80      //  runlist = new TArrayL(0,NULL);
81    //    //
82  }  }
83    
# Line 102  ItoRunInfo::ItoRunInfo(TSQLServer *db, T Line 103  ItoRunInfo::ItoRunInfo(TSQLServer *db, T
103    version->S4_ver = "";      version->S4_ver = "";  
104    norun = 0;    norun = 0;
105    totnorun = 0;    totnorun = 0;
106      runlist = new TArrayL(0,NULL);
107    //    //
108  }  }
109    
# Line 150  Int_t ItoRunInfo::Update(ULong64_t run, Line 152  Int_t ItoRunInfo::Update(ULong64_t run,
152    //    //
153    norun = 0;    norun = 0;
154    runlist = new TArrayL(0,NULL);    runlist = new TArrayL(0,NULL);
155      //runlist->Reset();
156    //    //
157    Bool_t found = false;    Bool_t found = false;
158    Int_t error = 0;    Int_t error = 0;
# Line 244  Int_t ItoRunInfo::Update(ULong64_t run, Line 247  Int_t ItoRunInfo::Update(ULong64_t run,
247    if ( !updating ){    if ( !updating ){
248      if ( idRun == 0ULL ){      if ( idRun == 0ULL ){
249        if ( debug ) printf("\n RUNINFO - ERROR: reprocessing data but no RunInfo tree in Level2 file. \n");        if ( debug ) printf("\n RUNINFO - ERROR: reprocessing data but no RunInfo tree in Level2 file. \n");
250        return(-13);        return(-805);
251      };      };
252      //      //
253      runlist = new TArrayL(1);      runlist = new TArrayL(1);
# Line 302  Int_t ItoRunInfo::Update(ULong64_t run, Line 305  Int_t ItoRunInfo::Update(ULong64_t run,
305      file->cd();      file->cd();
306      //    file->Write("Run");      //    file->Write("Run");
307      //newtree->Delete();      //newtree->Delete();
308        delete newver;
309        delete newrun;
310        delete oldver;
311        delete oldrun;
312      //      //
313      return(0);      return(0);
314      //      //
# Line 441  Int_t ItoRunInfo::Update(ULong64_t run, Line 448  Int_t ItoRunInfo::Update(ULong64_t run,
448              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
449              newver->AC_ver = oldver->AC_ver;              newver->AC_ver = oldver->AC_ver;
450              newver->ORB_ver = version->ORB_ver;              newver->ORB_ver = version->ORB_ver;
451              if ( strcmp(oldver->TRK_ver.Data(),"") ) reprocessing = true;              if ( strcmp(oldver->ORB_ver.Data(),"") ) reprocessing = true;
452            };            };
453            if ( !strcmp(Detector.Data(),"CALO") ){            if ( !strcmp(Detector.Data(),"CALO") ){
454              newver->TRIG_ver = oldver->TRIG_ver;              newver->TRIG_ver = oldver->TRIG_ver;
# Line 497  Int_t ItoRunInfo::Update(ULong64_t run, Line 504  Int_t ItoRunInfo::Update(ULong64_t run,
504      newtree->SetName("Run");      newtree->SetName("Run");
505      //    file->Write("Run");      //    file->Write("Run");
506      //    newtree->Delete();      //    newtree->Delete();
507        delete newver;
508        delete newrun;
509        delete oldver;
510        delete oldrun;
511      //      //
512      if ( !found ){      if ( !found ){
513        if ( debug ) printf("\n RUNINFO - ERROR: no run with ID_RUN = %llu \n",idRun);        if ( debug ) printf("\n RUNINFO - ERROR: no run with ID_RUN = %llu \n",idRun);
# Line 580  Int_t ItoRunInfo::Read(ULong64_t idRun){ Line 591  Int_t ItoRunInfo::Read(ULong64_t idRun){
591    if ( debug ) printf("norun %i \n",(int)norun);    if ( debug ) printf("norun %i \n",(int)norun);
592    Int_t error = 0;    Int_t error = 0;
593    error = GetRunInfo(idRun);    error = GetRunInfo(idRun);
594      delete newver;
595      delete newrun;
596    if ( error ) return(error);    if ( error ) return(error);
597    return(0);    return(0);
598  }      }    
# Line 602  void ItoRunInfo::Clear(){ Line 615  void ItoRunInfo::Clear(){
615    
616  UInt_t ItoRunInfo::GetRunForEntry(UInt_t entry){  UInt_t ItoRunInfo::GetRunForEntry(UInt_t entry){
617    //    //
618    ItoRunInfo *run = new ItoRunInfo();    UInt_t startfrom = 0;
619      //
620      if ( entry >= (UInt_t)first_file_entry && entry <= (UInt_t)last_file_entry ) return(ID);
621      //
622      if ( entry > (UInt_t)last_file_entry ){
623        for ( UInt_t nrun = 0; nrun < norun; nrun++){  
624          if ( ID == (ULong64_t)runlist->At(nrun) ) {
625            startfrom = nrun+1;
626            break;
627          };
628        };
629      } else {
630        startfrom = 0;
631      };
632      //
633      if ( startfrom >= norun ) startfrom = 0;
634    //    //
635    for ( UInt_t nrun = 0; nrun < norun; nrun++){     retry:
636      run->GetRunInfo((ULong64_t)nrun);    //
637      if ( entry >= (UInt_t)run->first_file_entry && entry <= (UInt_t)run->last_file_entry ){    for ( UInt_t nrun = startfrom; nrun < norun; nrun++){  
638        run->newtree->Delete();      GetRunInfo((ULong64_t)runlist->At(nrun));
639        return(nrun);      if ( entry >= (UInt_t)first_file_entry && entry <= (UInt_t)last_file_entry ){
640          return((UInt_t)runlist->At(nrun));
641      };      };
642    };    };
643    run->newtree->Delete();    if ( startfrom ){
644        startfrom = 0;
645        goto retry;
646      };
647      printf(" ERROR! run not found \n");
648    return(0);    return(0);
649  }  }
650    
# Line 660  Int_t ItoRunInfo::GetRunInfo(ULong64_t r Line 693  Int_t ItoRunInfo::GetRunInfo(ULong64_t r
693      };      };
694      if ( !found ) first_file_entry += (nwrun->EV_REG_PHYS_TO - nwrun->EV_REG_PHYS_FROM + 1);      if ( !found ) first_file_entry += (nwrun->EV_REG_PHYS_TO - nwrun->EV_REG_PHYS_FROM + 1);
695    };    };
696      delete nwver;
697      delete nwrun;
698    if ( found ) return(0);    if ( found ) return(0);
699    return(-800);    return(-800);
700  }  }
701    

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.23