/[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.8 by mocchiut, Mon Sep 4 15:43:50 2006 UTC revision 1.19 by mocchiut, Fri Jan 29 05:49:27 2010 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(Option_t *t){
29    TRIG_ver = "";    TRIG_ver = "";
30    TOF_ver = "";    TOF_ver = "";
31    AC_ver = "";    AC_ver = "";
# 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){
131    //    //
132    TChain *Tout=0;    TChain *Tout = new TChain("Run");    
   //  
   TChain *RI = 0;        
   TChain *SI = 0;        
   RI = new TChain("RunInfo");    
   SI = new TChain("SoftInfo");            
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);
     SI->Add(name);  
139    };    };
140    //    //
141    RI->SetBranchAddress("RunInfo", GetPointerToRI());    Tout->SetBranchAddress("RunInfo", GetPointerToRI());
142    Tout = RI;    printf("Run          : set branch address RunInfo\n");
143    SI->SetBranchAddress("SoftInfo", GetPointerToSI());    Tout->SetBranchAddress("SoftInfo", GetPointerToSI());
144    Tout->AddFriend("SoftInfo");    printf("Software     : set branch address SoftInfo\n");
145    //    //
146    return Tout;                      return Tout;                  
147    //    //
# Line 145  void ItoRunInfo::CopyFromTo(GL_RUN *glru Line 169  void ItoRunInfo::CopyFromTo(GL_RUN *glru
169    //    //
170    if ( glrun && newrun ){    if ( glrun && newrun ){
171      //      //
172        //    printf("copy \n");
173        //
174      newrun->ID = glrun->ID                         ;      newrun->ID = glrun->ID                         ;
175      newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG                ;      newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG                ;
176      newrun->ID_ROOT_L0 = glrun->ID_ROOT_L0                 ;      newrun->ID_ROOT_L0 = glrun->ID_ROOT_L0                 ;
# Line 175  void ItoRunInfo::CopyFromTo(GL_RUN *glru Line 201  void ItoRunInfo::CopyFromTo(GL_RUN *glru
201      newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED             ;      newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED             ;
202      newrun->CAL_DSP_MASK  = glrun->CAL_DSP_MASK               ;      newrun->CAL_DSP_MASK  = glrun->CAL_DSP_MASK               ;
203      newrun->BOOT_NUMBER  = glrun->BOOT_NUMBER                ;      newrun->BOOT_NUMBER  = glrun->BOOT_NUMBER                ;
204        newrun->PHYSENDRUN_MASK_S3S2S12  = glrun->PHYSENDRUN_MASK_S3S2S12                 ;
205        newrun->PHYSENDRUN_MASK_S11CRC  = glrun->PHYSENDRUN_MASK_S11CRC                 ;
206      newrun->VALIDATION  = glrun->VALIDATION                 ;      newrun->VALIDATION  = glrun->VALIDATION                 ;
207      //      //
208    };    };
# Line 188  void ItoRunInfo::CopyFromTo(GL_RUN *glru Line 216  void ItoRunInfo::CopyFromTo(GL_RUN *glru
216      newver->ORB_ver = sinfo->ORB_ver;      newver->ORB_ver = sinfo->ORB_ver;
217      newver->CAL_ver = sinfo->CAL_ver;      newver->CAL_ver = sinfo->CAL_ver;
218      newver->S4_ver = sinfo->S4_ver;      newver->S4_ver = sinfo->S4_ver;
219        newver->DV_ver = sinfo->DV_ver;
220      newver->ND_ver = sinfo->ND_ver;      newver->ND_ver = sinfo->ND_ver;
221      //      //
222    };    };
# Line 237  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 266  Int_t ItoRunInfo::Update(UInt_t run, TSt
266      version->ORB_ver = Version;      version->ORB_ver = Version;
267      version->CAL_ver = Version;          version->CAL_ver = Version;    
268      version->S4_ver = Version;      version->S4_ver = Version;
269        version->DV_ver = Version;
270      version->ND_ver = Version;      version->ND_ver = Version;
271    } else {    } else {
272      if ( !strcmp(Detector.Data(),"TRIG") ) version->TRIG_ver = Version;      if ( !strcmp(Detector.Data(),"TRIG") ) version->TRIG_ver = Version;
# Line 245  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 275  Int_t ItoRunInfo::Update(UInt_t run, TSt
275      if ( !strcmp(Detector.Data(),"TRK") ) version->TRK_ver = Version;      if ( !strcmp(Detector.Data(),"TRK") ) version->TRK_ver = Version;
276      if ( !strcmp(Detector.Data(),"CALO") ) version->CAL_ver = Version;      if ( !strcmp(Detector.Data(),"CALO") ) version->CAL_ver = Version;
277      if ( !strcmp(Detector.Data(),"S4") ) version->S4_ver = Version;      if ( !strcmp(Detector.Data(),"S4") ) version->S4_ver = Version;
278        if ( !strcmp(Detector.Data(),"DV") ) version->DV_ver = Version;
279      if ( !strcmp(Detector.Data(),"ND") ) version->ND_ver = Version;      if ( !strcmp(Detector.Data(),"ND") ) version->ND_ver = Version;
280      if ( !strcmp(Detector.Data(),"ORB") ) version->ORB_ver = Version;      if ( !strcmp(Detector.Data(),"ORB") ) version->ORB_ver = Version;
281      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);
282    };    };
283    //    //
284    if ( !oldtree ) {    if ( !oldtree ) {
# Line 299  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 330  Int_t ItoRunInfo::Update(UInt_t run, TSt
330      totnorun = 1;      totnorun = 1;
331      reprocessing = false;      reprocessing = false;
332      first_file_entry = 0;      first_file_entry = 0;
333      last_file_entry = (UInt_t)(EV_TO - EV_FROM);      if ( EV_TO >= EV_FROM ) last_file_entry = (UInt_t)(EV_TO - EV_FROM);
334      norun = 1;      norun = 1;
335      runlist->AddAt((Int_t)ID,0);      runlist->AddAt((Int_t)ID,0);
336      //      //
# Line 331  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 362  Int_t ItoRunInfo::Update(UInt_t run, TSt
362      //      //
363      for ( UInt_t run = 0; run < totnorun; run++){      for ( UInt_t run = 0; run < totnorun; run++){
364        //        //
365        oldtree->GetEntry(run);        if ( oldtree->GetEntry(run) <= 0 ) throw -36;
366        //        //
367        CopyFromTo(oldrun,newrun,oldver,newver);        CopyFromTo(oldrun,newrun,oldver,newver);
368        //        //
# Line 371  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 402  Int_t ItoRunInfo::Update(UInt_t run, TSt
402              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
403              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
404              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
405                newver->DV_ver = oldver->DV_ver;
406              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
407              if ( strcmp(oldver->TRIG_ver.Data(),"") ) reprocessing = true;              if ( strcmp(oldver->TRIG_ver.Data(),"") ) reprocessing = true;
408            };            };
# Line 381  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 413  Int_t ItoRunInfo::Update(UInt_t run, TSt
413              newver->TRK_ver = oldver->TRK_ver;              newver->TRK_ver = oldver->TRK_ver;
414              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
415              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
416                newver->DV_ver = oldver->DV_ver;
417              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
418              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
419              if ( strcmp(oldver->TOF_ver.Data(),"") ) reprocessing = true;              if ( strcmp(oldver->TOF_ver.Data(),"") ) reprocessing = true;
# Line 391  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 424  Int_t ItoRunInfo::Update(UInt_t run, TSt
424              newver->TRK_ver = oldver->TRK_ver;              newver->TRK_ver = oldver->TRK_ver;
425              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
426              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
427                newver->DV_ver = oldver->DV_ver;
428              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
429              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
430              newver->AC_ver = version->AC_ver;              newver->AC_ver = version->AC_ver;
# Line 401  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 435  Int_t ItoRunInfo::Update(UInt_t run, TSt
435              newver->TOF_ver = oldver->TOF_ver;              newver->TOF_ver = oldver->TOF_ver;
436              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
437              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
438                newver->DV_ver = oldver->DV_ver;
439              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
440              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
441              newver->AC_ver = oldver->AC_ver;              newver->AC_ver = oldver->AC_ver;
# Line 412  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 447  Int_t ItoRunInfo::Update(UInt_t run, TSt
447              newver->TOF_ver = oldver->TOF_ver;              newver->TOF_ver = oldver->TOF_ver;
448              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
449              newver->TRK_ver = oldver->TRK_ver;              newver->TRK_ver = oldver->TRK_ver;
450                newver->DV_ver = oldver->DV_ver;
451              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
452              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
453              newver->AC_ver = oldver->AC_ver;              newver->AC_ver = oldver->AC_ver;
# Line 421  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 457  Int_t ItoRunInfo::Update(UInt_t run, TSt
457            if ( !strcmp(Detector.Data(),"CALO") ){            if ( !strcmp(Detector.Data(),"CALO") ){
458              newver->TRIG_ver = oldver->TRIG_ver;              newver->TRIG_ver = oldver->TRIG_ver;
459              newver->TOF_ver = oldver->TOF_ver;              newver->TOF_ver = oldver->TOF_ver;
460                newver->DV_ver = oldver->DV_ver;
461              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
462              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
463              newver->ND_ver = oldver->ND_ver;              newver->ND_ver = oldver->ND_ver;
# Line 437  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 474  Int_t ItoRunInfo::Update(UInt_t run, TSt
474              newver->TRK_ver = oldver->TRK_ver;              newver->TRK_ver = oldver->TRK_ver;
475              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
476              newver->CAL_ver = oldver->CAL_ver;              newver->CAL_ver = oldver->CAL_ver;
477                newver->DV_ver = oldver->DV_ver;
478              newver->S4_ver = version->S4_ver;              newver->S4_ver = version->S4_ver;
479              if ( strcmp(oldver->S4_ver.Data(),"") ) reprocessing = true;              if ( strcmp(oldver->S4_ver.Data(),"") ) reprocessing = true;
480            };            };
481              if ( !strcmp(Detector.Data(),"DV") ){
482                newver->TRIG_ver = oldver->TRIG_ver;
483                newver->TOF_ver = oldver->TOF_ver;
484                newver->ND_ver = oldver->ND_ver;
485                newver->AC_ver = oldver->AC_ver;
486                newver->TRK_ver = oldver->TRK_ver;
487                newver->ORB_ver = oldver->ORB_ver;
488                newver->CAL_ver = oldver->CAL_ver;
489                newver->S4_ver = oldver->S4_ver;
490                newver->DV_ver = version->DV_ver;
491                if ( strcmp(oldver->DV_ver.Data(),"") ) reprocessing = true;
492              };
493            if ( !strcmp(Detector.Data(),"ND") ){            if ( !strcmp(Detector.Data(),"ND") ){
494              newver->TRIG_ver = oldver->TRIG_ver;              newver->TRIG_ver = oldver->TRIG_ver;
495              newver->TOF_ver = oldver->TOF_ver;              newver->TOF_ver = oldver->TOF_ver;
496                newver->DV_ver = oldver->DV_ver;
497              newver->S4_ver = oldver->S4_ver;              newver->S4_ver = oldver->S4_ver;
498              newver->AC_ver = oldver->AC_ver;              newver->AC_ver = oldver->AC_ver;
499              newver->ORB_ver = oldver->ORB_ver;              newver->ORB_ver = oldver->ORB_ver;
# Line 453  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 504  Int_t ItoRunInfo::Update(UInt_t run, TSt
504            };            };
505          };          };
506          //          //
507          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);
508          //          //
509        } else {        } else {
510          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 519  Int_t ItoRunInfo::Read(UInt_t idRun){ Line 570  Int_t ItoRunInfo::Read(UInt_t idRun){
570      //      //
571      for ( UInt_t run = 0; run < totnorun; run++){      for ( UInt_t run = 0; run < totnorun; run++){
572        //        //
573        newtree->GetEntry(run);        if ( newtree->GetEntry(run) <= 0 ) throw -36;
574        //        //
575        file_entries += (newrun->EV_TO - newrun->EV_FROM + 1);        file_entries += (newrun->EV_TO - newrun->EV_FROM + 1);
576        //        //
# Line 530  Int_t ItoRunInfo::Read(UInt_t idRun){ Line 581  Int_t ItoRunInfo::Read(UInt_t idRun){
581          runlist->AddAt(newrun->ID,norun);          runlist->AddAt(newrun->ID,norun);
582          norun++;          norun++;
583        };        };
584        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);
585      };      };
586    };    };
587    if ( debug ) printf("norun %i \n",(int)norun);    if ( debug ) printf("norun %i \n",(int)norun);
# Line 550  void ItoRunInfo::Close(){ Line 601  void ItoRunInfo::Close(){
601    file_entries = 0;    file_entries = 0;
602    norun = 0;    norun = 0;
603    delete runlist;    delete runlist;
604    file = new TFile();      //  file = new TFile();  
605      file = 0;  
606    if ( isreadonly ) newtree->Delete();    if ( isreadonly ) newtree->Delete();
607  }  }
608    
609  void ItoRunInfo::Clear(){  void ItoRunInfo::Clear(Option_t *t){
610    if ( newtree ) newtree->Delete();    if ( newtree ) newtree->Delete();
611  }  }
612    
# Line 607  Int_t ItoRunInfo::GetRunInfo(UInt_t run) Line 659  Int_t ItoRunInfo::GetRunInfo(UInt_t run)
659    totnorun = newtree->GetEntries();    totnorun = newtree->GetEntries();
660    //    //
661    for ( UInt_t nrun = 0; nrun < totnorun; nrun++){      for ( UInt_t nrun = 0; nrun < totnorun; nrun++){  
662      newtree->GetEntry(nrun);      if ( newtree->GetEntry(nrun) <= 0 ) throw -36;
663      //      //
664      if ( nwrun->ID == run || run == 0 ){      if ( nwrun->ID == run || run == 0 ){
665        CopyFromTo(nwrun,(GL_RUN*)this,nwver,version);        CopyFromTo(nwrun,(GL_RUN*)this,nwver,version);
666        found = true;        found = true;
667        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);
668      };      };
669      if ( !found ) first_file_entry += (nwrun->EV_TO - nwrun->EV_FROM + 1);      if ( !found ) first_file_entry += (nwrun->EV_TO - nwrun->EV_FROM + 1);
670    };    };

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.23