/[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.11 by mocchiut, Tue Oct 24 07:28:37 2006 UTC revision 1.16 by mocchiut, Tue Jan 16 14:24:14 2007 UTC
# Line 22  using namespace std; Line 22  using namespace std;
22  //  //
23    
24  SoftInfo::SoftInfo() {  SoftInfo::SoftInfo() {
25    TRIG_ver = "";    Clear();
   TOF_ver = "";  
   AC_ver = "";  
   TRK_ver = "";  
   ORB_ver = "";  
   CAL_ver = "";  
   ND_ver = "";  
   S4_ver = "";    
26  }  }
27    
28  void SoftInfo::Clear(){  void SoftInfo::Clear(){
# Line 41  void SoftInfo::Clear(){ Line 34  void SoftInfo::Clear(){
34    CAL_ver = "";    CAL_ver = "";
35    ND_ver = "";    ND_ver = "";
36    S4_ver = "";      S4_ver = "";  
37      DV_ver = "";
38  }  }
39    
40    UInt_t SoftInfo::GetSWinfo(TString Detector){
41      TString sver;
42      UInt_t version = 0;
43      if ( !strcmp(Detector.Data(),"TRIG") ){
44        sver = TRIG_ver;
45      };
46      if ( !strcmp(Detector.Data(),"TOF") ){
47        sver = TOF_ver;
48      };
49      if ( !strcmp(Detector.Data(),"AC") ){
50        sver = AC_ver;
51      };
52      if ( !strcmp(Detector.Data(),"TRK") ){
53        sver = TRK_ver;
54      };
55      if ( !strcmp(Detector.Data(),"CALO") ){
56        sver = CAL_ver;
57      };
58      if ( !strcmp(Detector.Data(),"S4") ){
59        sver = S4_ver;
60      };
61      if ( !strcmp(Detector.Data(),"DV") ){
62        sver = DV_ver;
63      };
64      if ( !strcmp(Detector.Data(),"ND") ){
65        sver = ND_ver;
66      };
67      if ( !strcmp(Detector.Data(),"ORB") ){
68        sver = ORB_ver;
69      };
70      sver.ReplaceAll("v",1," ",1);
71      sver.ReplaceAll("r",1," ",1);
72      version = (UInt_t)sver.Atoi();
73      return(version);
74    };
75    
76  /**  /**
77   * Fills a struct cSoftInfo with values from a SoftInfo object (to put data into a F77 common).   * Fills a struct cSoftInfo with values from a SoftInfo object (to put data into a F77 common).
# Line 89  ItoRunInfo::ItoRunInfo(TFile *processFl) Line 118  ItoRunInfo::ItoRunInfo(TFile *processFl)
118    last_file_entry = 0;    last_file_entry = 0;
119    file_entries = 0;    file_entries = 0;
120    version = new SoftInfo();    version = new SoftInfo();
121      //  glrun = new GL_RUN();
122    norun = 0;    norun = 0;
123    totnorun = 0;    totnorun = 0;
124    runlist = new TArrayI(500);    runlist = new TArrayI(500);
# Line 97  ItoRunInfo::ItoRunInfo(TFile *processFl) Line 127  ItoRunInfo::ItoRunInfo(TFile *processFl)
127    
128    
129    
130  TChain *ItoRunInfo::LoadRunInfoTree(TList *fl){  TChain *ItoRunInfo::GetRunTree(TList *fl){
   //  
   TChain *Tout=0;  
131    //    //
132    TChain *RI = 0;          TChain *Tout = new TChain("Run");    
   RI = new TChain("Run");        
133    // loop over files and create chains      // loop over files and create chains  
134    TIter next(fl);    TIter next(fl);
135    TSystemFile *questo = 0;    TSystemFile *questo = 0;
136    while ( (questo = (TSystemFile*) next()) ) {    while ( (questo = (TSystemFile*) next()) ) {
137      TString name =  questo->GetName();      TString name =  questo->GetName();
138      RI->Add(name);      Tout->Add(name);
139    };    };
140    //    //
141    RI->SetBranchAddress("Run", GetPointerToRI());    Tout->SetBranchAddress("RunInfo", GetPointerToRI());
142    Tout = RI;    printf("Run          : set branch address RunInfo\n");
143      Tout->SetBranchAddress("SoftInfo", GetPointerToSI());
144      printf("Software     : set branch address SoftInfo\n");
145    //    //
146    return Tout;                      return Tout;                  
147    //    //
# Line 185  void ItoRunInfo::CopyFromTo(GL_RUN *glru Line 214  void ItoRunInfo::CopyFromTo(GL_RUN *glru
214      newver->ORB_ver = sinfo->ORB_ver;      newver->ORB_ver = sinfo->ORB_ver;
215      newver->CAL_ver = sinfo->CAL_ver;      newver->CAL_ver = sinfo->CAL_ver;
216      newver->S4_ver = sinfo->S4_ver;      newver->S4_ver = sinfo->S4_ver;
217        newver->DV_ver = sinfo->DV_ver;
218      newver->ND_ver = sinfo->ND_ver;      newver->ND_ver = sinfo->ND_ver;
219      //      //
220    };    };
# Line 234  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 264  Int_t ItoRunInfo::Update(UInt_t run, TSt
264      version->ORB_ver = Version;      version->ORB_ver = Version;
265      version->CAL_ver = Version;          version->CAL_ver = Version;    
266      version->S4_ver = Version;      version->S4_ver = Version;
267        version->DV_ver = Version;
268      version->ND_ver = Version;      version->ND_ver = Version;
269    } else {    } else {
270      if ( !strcmp(Detector.Data(),"TRIG") ) version->TRIG_ver = Version;      if ( !strcmp(Detector.Data(),"TRIG") ) version->TRIG_ver = Version;
# Line 242  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 273  Int_t ItoRunInfo::Update(UInt_t run, TSt
273      if ( !strcmp(Detector.Data(),"TRK") ) version->TRK_ver = Version;      if ( !strcmp(Detector.Data(),"TRK") ) version->TRK_ver = Version;
274      if ( !strcmp(Detector.Data(),"CALO") ) version->CAL_ver = Version;      if ( !strcmp(Detector.Data(),"CALO") ) version->CAL_ver = Version;
275      if ( !strcmp(Detector.Data(),"S4") ) version->S4_ver = Version;      if ( !strcmp(Detector.Data(),"S4") ) version->S4_ver = Version;
276        if ( !strcmp(Detector.Data(),"DV") ) version->DV_ver = Version;
277      if ( !strcmp(Detector.Data(),"ND") ) version->ND_ver = Version;      if ( !strcmp(Detector.Data(),"ND") ) version->ND_ver = Version;
278      if ( !strcmp(Detector.Data(),"ORB") ) version->ORB_ver = Version;      if ( !strcmp(Detector.Data(),"ORB") ) version->ORB_ver = Version;
279      if ( strcmp(Detector.Data(),"TRIG") && strcmp(Detector.Data(),"TOF") &&  strcmp(Detector.Data(),"AC") && strcmp(Detector.Data(),"TRK") &&  strcmp(Detector.Data(),"CALO") && strcmp(Detector.Data(),"S4") && strcmp(Detector.Data(),"ND") && strcmp(Detector.Data(),"ORB") ) return(-804);      if ( strcmp(Detector.Data(),"TRIG") && strcmp(Detector.Data(),"TOF") &&  strcmp(Detector.Data(),"AC") && strcmp(Detector.Data(),"TRK") &&  strcmp(Detector.Data(),"CALO") && strcmp(Detector.Data(),"S4") && strcmp(Detector.Data(),"ND") && strcmp(Detector.Data(),"ORB") && strcmp(Detector.Data(),"DV") ) return(-804);
280    };    };
281    //    //
282    if ( !oldtree ) {    if ( !oldtree ) {
# Line 296  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 328  Int_t ItoRunInfo::Update(UInt_t run, TSt
328      totnorun = 1;      totnorun = 1;
329      reprocessing = false;      reprocessing = false;
330      first_file_entry = 0;      first_file_entry = 0;
331      last_file_entry = (UInt_t)(EV_TO - EV_FROM);      if ( EV_TO >= EV_FROM ) last_file_entry = (UInt_t)(EV_TO - EV_FROM);
332      norun = 1;      norun = 1;
333      runlist->AddAt((Int_t)ID,0);      runlist->AddAt((Int_t)ID,0);
334      //      //
# Line 368  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 400  Int_t ItoRunInfo::Update(UInt_t run, TSt
400              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
401              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
402              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
403                newver->DV_ver = oldver->DV_ver;
404              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
405              if ( strcmp(oldver->TRIG_ver.Data(),"") ) reprocessing = true;              if ( strcmp(oldver->TRIG_ver.Data(),"") ) reprocessing = true;
406            };            };
# Line 378  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 411  Int_t ItoRunInfo::Update(UInt_t run, TSt
411              newver->TRK_ver = oldver->TRK_ver;              newver->TRK_ver = oldver->TRK_ver;
412              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
413              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
414                newver->DV_ver = oldver->DV_ver;
415              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
416              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
417              if ( strcmp(oldver->TOF_ver.Data(),"") ) reprocessing = true;              if ( strcmp(oldver->TOF_ver.Data(),"") ) reprocessing = true;
# Line 388  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 422  Int_t ItoRunInfo::Update(UInt_t run, TSt
422              newver->TRK_ver = oldver->TRK_ver;              newver->TRK_ver = oldver->TRK_ver;
423              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
424              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
425                newver->DV_ver = oldver->DV_ver;
426              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
427              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
428              newver->AC_ver = version->AC_ver;              newver->AC_ver = version->AC_ver;
# Line 398  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 433  Int_t ItoRunInfo::Update(UInt_t run, TSt
433              newver->TOF_ver = oldver->TOF_ver;              newver->TOF_ver = oldver->TOF_ver;
434              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
435              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
436                newver->DV_ver = oldver->DV_ver;
437              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
438              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
439              newver->AC_ver = oldver->AC_ver;              newver->AC_ver = oldver->AC_ver;
# Line 409  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 445  Int_t ItoRunInfo::Update(UInt_t run, TSt
445              newver->TOF_ver = oldver->TOF_ver;              newver->TOF_ver = oldver->TOF_ver;
446              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
447              newver->TRK_ver = oldver->TRK_ver;              newver->TRK_ver = oldver->TRK_ver;
448                newver->DV_ver = oldver->DV_ver;
449              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
450              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
451              newver->AC_ver = oldver->AC_ver;              newver->AC_ver = oldver->AC_ver;
# Line 418  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 455  Int_t ItoRunInfo::Update(UInt_t run, TSt
455            if ( !strcmp(Detector.Data(),"CALO") ){            if ( !strcmp(Detector.Data(),"CALO") ){
456              newver->TRIG_ver = oldver->TRIG_ver;              newver->TRIG_ver = oldver->TRIG_ver;
457              newver->TOF_ver = oldver->TOF_ver;              newver->TOF_ver = oldver->TOF_ver;
458                newver->DV_ver = oldver->DV_ver;
459              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
460              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
461              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
# Line 434  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 472  Int_t ItoRunInfo::Update(UInt_t run, TSt
472              newver->TRK_ver = oldver->TRK_ver;              newver->TRK_ver = oldver->TRK_ver;
473              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
474              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
475                newver->DV_ver = oldver->DV_ver;
476              newver->S4_ver = version->S4_ver;              newver->S4_ver = version->S4_ver;
477              if ( strcmp(oldver->S4_ver.Data(),"") ) reprocessing = true;              if ( strcmp(oldver->S4_ver.Data(),"") ) reprocessing = true;
478            };            };
479              if ( !strcmp(Detector.Data(),"DV") ){
480                newver->TRIG_ver = oldver->TRIG_ver;
481                newver->TOF_ver = oldver->TOF_ver;
482                newver->ND_ver = oldver->ND_ver;
483                newver->AC_ver = oldver->AC_ver;
484                newver->TRK_ver = oldver->TRK_ver;
485                newver->ORB_ver = oldver->ORB_ver;
486                newver->CAL_ver = oldver->CAL_ver;
487                newver->S4_ver = oldver->S4_ver;
488                newver->DV_ver = version->DV_ver;
489                if ( strcmp(oldver->DV_ver.Data(),"") ) reprocessing = true;
490              };
491            if ( !strcmp(Detector.Data(),"ND") ){            if ( !strcmp(Detector.Data(),"ND") ){
492              newver->TRIG_ver = oldver->TRIG_ver;              newver->TRIG_ver = oldver->TRIG_ver;
493              newver->TOF_ver = oldver->TOF_ver;              newver->TOF_ver = oldver->TOF_ver;
494                newver->DV_ver = oldver->DV_ver;
495              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
496              newver->AC_ver = oldver->AC_ver;              newver->AC_ver = oldver->AC_ver;
497              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
# Line 450  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 502  Int_t ItoRunInfo::Update(UInt_t run, TSt
502            };            };
503          };          };
504          //          //
505          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);
506          //          //
507        } else {        } else {
508          if ( !found ) first_file_entry += (oldrun->EV_TO - oldrun->EV_FROM + 1);          if ( !found ) first_file_entry += (oldrun->EV_TO - oldrun->EV_FROM + 1);
# Line 527  Int_t ItoRunInfo::Read(UInt_t idRun){ Line 579  Int_t ItoRunInfo::Read(UInt_t idRun){
579          runlist->AddAt(newrun->ID,norun);          runlist->AddAt(newrun->ID,norun);
580          norun++;          norun++;
581        };        };
582        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);
583      };      };
584    };    };
585    if ( debug ) printf("norun %i \n",(int)norun);    if ( debug ) printf("norun %i \n",(int)norun);
# Line 547  void ItoRunInfo::Close(){ Line 599  void ItoRunInfo::Close(){
599    file_entries = 0;    file_entries = 0;
600    norun = 0;    norun = 0;
601    delete runlist;    delete runlist;
602    file = new TFile();      //  file = new TFile();  
603      file = 0;  
604    if ( isreadonly ) newtree->Delete();    if ( isreadonly ) newtree->Delete();
605  }  }
606    
# Line 609  Int_t ItoRunInfo::GetRunInfo(UInt_t run) Line 662  Int_t ItoRunInfo::GetRunInfo(UInt_t run)
662      if ( nwrun->ID == run || run == 0 ){      if ( nwrun->ID == run || run == 0 ){
663        CopyFromTo(nwrun,(GL_RUN*)this,nwver,version);        CopyFromTo(nwrun,(GL_RUN*)this,nwver,version);
664        found = true;        found = true;
665        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);
666      };      };
667      if ( !found ) first_file_entry += (nwrun->EV_TO - nwrun->EV_FROM + 1);      if ( !found ) first_file_entry += (nwrun->EV_TO - nwrun->EV_FROM + 1);
668    };    };

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.23