/[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 by mocchiut, Fri May 19 13:15:47 2006 UTC revision 1.7 by mocchiut, Fri Aug 4 10:31:30 2006 UTC
# Line 30  SoftInfo::SoftInfo() { Line 30  SoftInfo::SoftInfo() {
30    S4_ver = "";      S4_ver = "";  
31  }  }
32    
33    /**
34     * Fills a struct cSoftInfo with values from a SoftInfo object (to put data into a F77 common).
35     */
36    void SoftInfo::GetLevel2Struct(cSoftInfo *l2) const{
37      l2->FillTrigWith(TRIG_ver);
38      l2->FillTofWith(TOF_ver);
39      l2->FillAcWith(AC_ver);
40      l2->FillTrkWith(TRK_ver);
41      l2->FillOrbWith(ORB_ver);
42      l2->FillCalWith(CAL_ver);
43      l2->FillNdWith(ND_ver);
44      l2->FillS4With(S4_ver);
45    }
46    /***********************/
47    
48  ItoRunInfo::ItoRunInfo() {  ItoRunInfo::ItoRunInfo() {
49    reprocessing = false;    reprocessing = false;
50    updating = false;    updating = false;
# Line 48  ItoRunInfo::ItoRunInfo() { Line 63  ItoRunInfo::ItoRunInfo() {
63    version->S4_ver = "";      version->S4_ver = "";  
64    version->ORB_ver = "";      version->ORB_ver = "";  
65    norun = 0;    norun = 0;
66    runlist = new TArrayL(0,NULL);    //  runlist = new TArrayL(0,NULL);
67    file = new TFile();    runlist = new TArrayL(500);
68      //  file = new TFile();
69      file = NULL;//new TFile();
70    newtree = new TTree();    newtree = new TTree();
71  }  }
72    
# Line 77  ItoRunInfo::ItoRunInfo(TFile *processFl) Line 94  ItoRunInfo::ItoRunInfo(TFile *processFl)
94    version->S4_ver = "";      version->S4_ver = "";  
95    norun = 0;    norun = 0;
96    totnorun = 0;    totnorun = 0;
97      runlist = new TArrayL(500);
98      //  runlist = new TArrayL(0,NULL);
99    //    //
100  }  }
101    
# Line 102  ItoRunInfo::ItoRunInfo(TSQLServer *db, T Line 121  ItoRunInfo::ItoRunInfo(TSQLServer *db, T
121    version->S4_ver = "";      version->S4_ver = "";  
122    norun = 0;    norun = 0;
123    totnorun = 0;    totnorun = 0;
124      //  runlist = new TArrayL(0,NULL);
125      runlist = new TArrayL(500);
126    //    //
127  }  }
128    
# Line 149  Int_t ItoRunInfo::Update(ULong64_t run, Line 170  Int_t ItoRunInfo::Update(ULong64_t run,
170    version->S4_ver = "";      version->S4_ver = "";  
171    //    //
172    norun = 0;    norun = 0;
173    runlist = new TArrayL(0,NULL);    //  runlist = new TArrayL(0,NULL);
174      //runlist->Reset();
175    //    //
176    Bool_t found = false;    Bool_t found = false;
177    Int_t error = 0;    Int_t error = 0;
# Line 244  Int_t ItoRunInfo::Update(ULong64_t run, Line 266  Int_t ItoRunInfo::Update(ULong64_t run,
266    if ( !updating ){    if ( !updating ){
267      if ( idRun == 0ULL ){      if ( idRun == 0ULL ){
268        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");
269        return(-13);        return(-805);
270      };      };
271      //      //
272      runlist = new TArrayL(1);      //    runlist = new TArrayL(1);
273      //      //
274      error = Query_GL_RUN(idRun, dbc);      error = Query_GL_RUN(idRun, dbc);
275      //      //
# Line 302  Int_t ItoRunInfo::Update(ULong64_t run, Line 324  Int_t ItoRunInfo::Update(ULong64_t run,
324      file->cd();      file->cd();
325      //    file->Write("Run");      //    file->Write("Run");
326      //newtree->Delete();      //newtree->Delete();
327        delete newver;
328        delete newrun;
329        delete oldver;
330        delete oldrun;
331      //      //
332      return(0);      return(0);
333      //      //
# Line 315  Int_t ItoRunInfo::Update(ULong64_t run, Line 341  Int_t ItoRunInfo::Update(ULong64_t run,
341      //      //
342      totnorun = oldtree->GetEntries();      totnorun = oldtree->GetEntries();
343      //      //
344      runlist = new TArrayL((Int_t)totnorun);      if ( totnorun > 500 ){
345          if ( debug ) printf("\n RUNINFO - ERROR: can not handle more than 500 runs!\n");
346          return(-806);
347        };
348        //    runlist = new TArrayL((Int_t)totnorun);
349      //      //
350      found = false;      found = false;
351      //      //
# Line 441  Int_t ItoRunInfo::Update(ULong64_t run, Line 471  Int_t ItoRunInfo::Update(ULong64_t run,
471              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
472              newver->AC_ver = oldver->AC_ver;              newver->AC_ver = oldver->AC_ver;
473              newver->ORB_ver = version->ORB_ver;              newver->ORB_ver = version->ORB_ver;
474              if ( strcmp(oldver->TRK_ver.Data(),"") ) reprocessing = true;              if ( strcmp(oldver->ORB_ver.Data(),"") ) reprocessing = true;
475            };            };
476            if ( !strcmp(Detector.Data(),"CALO") ){            if ( !strcmp(Detector.Data(),"CALO") ){
477              newver->TRIG_ver = oldver->TRIG_ver;              newver->TRIG_ver = oldver->TRIG_ver;
# Line 497  Int_t ItoRunInfo::Update(ULong64_t run, Line 527  Int_t ItoRunInfo::Update(ULong64_t run,
527      newtree->SetName("Run");      newtree->SetName("Run");
528      //    file->Write("Run");      //    file->Write("Run");
529      //    newtree->Delete();      //    newtree->Delete();
530        delete newver;
531        delete newrun;
532        delete oldver;
533        delete oldrun;
534      //      //
535      if ( !found ){      if ( !found ){
536        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 535  Int_t ItoRunInfo::Read(ULong64_t idRun){ Line 569  Int_t ItoRunInfo::Read(ULong64_t idRun){
569      //      //
570      totnorun = newtree->GetEntries();      totnorun = newtree->GetEntries();
571      //      //
572      runlist = new TArrayL((Int_t)totnorun);      if ( totnorun > 500 ){
573          if ( debug ) printf("\n RUNINFO - ERROR: can not handle more than 500 runs!\n");
574          return(-806);
575        };
576        //    runlist = new TArrayL((Int_t)totnorun);
577      //      //
578      first_file_entry = 0;      first_file_entry = 0;
579      //      //
# Line 580  Int_t ItoRunInfo::Read(ULong64_t idRun){ Line 618  Int_t ItoRunInfo::Read(ULong64_t idRun){
618    if ( debug ) printf("norun %i \n",(int)norun);    if ( debug ) printf("norun %i \n",(int)norun);
619    Int_t error = 0;    Int_t error = 0;
620    error = GetRunInfo(idRun);    error = GetRunInfo(idRun);
621      delete newver;
622      delete newrun;
623    if ( error ) return(error);    if ( error ) return(error);
624    return(0);    return(0);
625  }      }    
# Line 591  void ItoRunInfo::Close(){ Line 631  void ItoRunInfo::Close(){
631    last_file_entry = 0;    last_file_entry = 0;
632    file_entries = 0ULL;    file_entries = 0ULL;
633    norun = 0;    norun = 0;
634    runlist = new TArrayL(0,NULL);    //  runlist = new TArrayL(0,NULL);
635      delete runlist;
636      //if ( file ) delete file;
637    file = new TFile();      file = new TFile();  
638    if ( isreadonly ) newtree->Delete();    if ( isreadonly ) newtree->Delete();
639  }  }
# Line 602  void ItoRunInfo::Clear(){ Line 644  void ItoRunInfo::Clear(){
644    
645  UInt_t ItoRunInfo::GetRunForEntry(UInt_t entry){  UInt_t ItoRunInfo::GetRunForEntry(UInt_t entry){
646    //    //
647    ItoRunInfo *run = new ItoRunInfo();    UInt_t startfrom = 0;
648      //
649      if ( entry >= (UInt_t)first_file_entry && entry <= (UInt_t)last_file_entry ) return(ID);
650    //    //
651    for ( UInt_t nrun = 0; nrun < norun; nrun++){      if ( entry > (UInt_t)last_file_entry ){
652      run->GetRunInfo((ULong64_t)nrun);      for ( UInt_t nrun = 0; nrun < norun; nrun++){  
653      if ( entry >= (UInt_t)run->first_file_entry && entry <= (UInt_t)run->last_file_entry ){        if ( ID == (ULong64_t)runlist->At(nrun) ) {
654        run->newtree->Delete();          startfrom = nrun+1;
655        return(nrun);          break;
656          };
657      };      };
658      } else {
659        startfrom = 0;
660    };    };
661    run->newtree->Delete();    //
662      if ( startfrom >= norun ) startfrom = 0;
663      //
664     retry:
665      //
666      for ( UInt_t nrun = startfrom; nrun < norun; nrun++){  
667        GetRunInfo((ULong64_t)runlist->At(nrun));
668        if ( entry >= (UInt_t)first_file_entry && entry <= (UInt_t)last_file_entry ){
669          return((UInt_t)runlist->At(nrun));
670        };
671      };
672      if ( startfrom ){
673        startfrom = 0;
674        goto retry;
675      };
676      printf(" ERROR! run not found \n");
677    return(0);    return(0);
678  }  }
679    
# Line 660  Int_t ItoRunInfo::GetRunInfo(ULong64_t r Line 722  Int_t ItoRunInfo::GetRunInfo(ULong64_t r
722      };      };
723      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);
724    };    };
725      delete nwver;
726      delete nwrun;
727    if ( found ) return(0);    if ( found ) return(0);
728    return(-800);    return(-800);
729  }  }
730    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.23