/[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.15 by mocchiut, Mon Nov 27 16:34:48 2006 UTC revision 1.22 by mocchiut, Wed Aug 27 14:44:35 2014 UTC
# Line 15  Line 15 
15  //  //
16  #include <GLTables.h>  #include <GLTables.h>
17  #include <RunInfo.h>  #include <RunInfo.h>
18    ClassImp(ProcInfo);
19  ClassImp(SoftInfo);  ClassImp(SoftInfo);
20  ClassImp(ItoRunInfo);  ClassImp(ItoRunInfo);
21  //  //
22  using namespace std;  using namespace std;
23  //  //
24    
25    ProcInfo::ProcInfo() {
26      Clear();
27    }
28    
29    void ProcInfo::Clear(Option_t *t){
30      runID = 0;
31      date = "";
32      commandLine = "";
33      outputFilename = "";
34      localDir = "";
35      uname = "";
36      DB = "";
37    }
38    
39  SoftInfo::SoftInfo() {  SoftInfo::SoftInfo() {
40    TRIG_ver = "";    Clear();
   TOF_ver = "";  
   AC_ver = "";  
   TRK_ver = "";  
   ORB_ver = "";  
   CAL_ver = "";  
   ND_ver = "";  
   S4_ver = "";    
   DV_ver = "";  
41  }  }
42    
43  void SoftInfo::Clear(){  void SoftInfo::Clear(Option_t *t){
44    TRIG_ver = "";    TRIG_ver = "";
45    TOF_ver = "";    TOF_ver = "";
46    AC_ver = "";    AC_ver = "";
# Line 96  void SoftInfo::GetLevel2Struct(cSoftInfo Line 103  void SoftInfo::GetLevel2Struct(cSoftInfo
103  }  }
104  /***********************/  /***********************/
105    
106    ItoRunInfo::~ItoRunInfo() {
107      this->GL_RUN::Clear();
108    }
109    
110  ItoRunInfo::ItoRunInfo() {  ItoRunInfo::ItoRunInfo() {
111    reprocessing = false;    reprocessing = false;
112    updating = false;    updating = false;
# Line 109  ItoRunInfo::ItoRunInfo() { Line 120  ItoRunInfo::ItoRunInfo() {
120    norun = 0;    norun = 0;
121    runlist = new TArrayI(500);    runlist = new TArrayI(500);
122    file = NULL;    file = NULL;
123    newtree = new TTree();    newtree = NULL;//new TTree();
124  }  }
125    
126  ItoRunInfo::ItoRunInfo(TFile *processFl){  ItoRunInfo::ItoRunInfo(TFile *processFl){
# Line 130  ItoRunInfo::ItoRunInfo(TFile *processFl) Line 141  ItoRunInfo::ItoRunInfo(TFile *processFl)
141    norun = 0;    norun = 0;
142    totnorun = 0;    totnorun = 0;
143    runlist = new TArrayI(500);    runlist = new TArrayI(500);
144      newtree = NULL;
145    //    //
146  }  }
147    
# Line 177  void ItoRunInfo::CopyFromTo(GL_RUN *glru Line 189  void ItoRunInfo::CopyFromTo(GL_RUN *glru
189    //    //
190    if ( glrun && newrun ){    if ( glrun && newrun ){
191      //      //
192      //    printf("copy \n");  //    printf("copy \n");
193      //      //
194      newrun->ID = glrun->ID                         ;      newrun->ID = glrun->ID                         ;
195      newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG                ;      newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG                ;
# Line 209  void ItoRunInfo::CopyFromTo(GL_RUN *glru Line 221  void ItoRunInfo::CopyFromTo(GL_RUN *glru
221      newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED             ;      newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED             ;
222      newrun->CAL_DSP_MASK  = glrun->CAL_DSP_MASK               ;      newrun->CAL_DSP_MASK  = glrun->CAL_DSP_MASK               ;
223      newrun->BOOT_NUMBER  = glrun->BOOT_NUMBER                ;      newrun->BOOT_NUMBER  = glrun->BOOT_NUMBER                ;
224        newrun->PHYSENDRUN_MASK_S3S2S12  = glrun->PHYSENDRUN_MASK_S3S2S12                 ;
225        newrun->PHYSENDRUN_MASK_S11CRC  = glrun->PHYSENDRUN_MASK_S11CRC                 ;
226      newrun->VALIDATION  = glrun->VALIDATION                 ;      newrun->VALIDATION  = glrun->VALIDATION                 ;
227      //      //
228    };    };
# Line 235  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 249  Int_t ItoRunInfo::Update(UInt_t run, TSt
249    //    //
250    Bool_t debug = false;    Bool_t debug = false;
251    //    //
252    Bool_t ismydir = false;    //  Bool_t ismydir = false;
253    //    //
254    if ( !strcmp(processFolder.Data(),"") ){    if ( !strcmp(processFolder.Data(),"") ){
255      processFolder = "runinfoFolder";      processFolder = "runinfoFolder";
256      ismydir = true;      //    ismydir = true;
257    };    };
258    //    //
259    GL_RUN *oldrun = new GL_RUN();    GL_RUN *oldrun = new GL_RUN();
# Line 368  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 382  Int_t ItoRunInfo::Update(UInt_t run, TSt
382      //      //
383      for ( UInt_t run = 0; run < totnorun; run++){      for ( UInt_t run = 0; run < totnorun; run++){
384        //        //
385        oldtree->GetEntry(run);        if ( oldtree->GetEntry(run) <= 0 ) throw -36;
386        //        //
387        CopyFromTo(oldrun,newrun,oldver,newver);        CopyFromTo(oldrun,newrun,oldver,newver);
388        //        //
# Line 378  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 392  Int_t ItoRunInfo::Update(UInt_t run, TSt
392        //        //
393        if ( idRun == 0 || idRun == newrun->ID ) {        if ( idRun == 0 || idRun == newrun->ID ) {
394          //          //
395          if ( debug ) printf(" Updating run number %u \n",idRun);          if ( debug ) printf(" Updating run number %u newrun->ID %i \n",idRun,(int)newrun->ID);
396          //          //
397          found = true;          found = true;
398          //          //
# Line 517  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 531  Int_t ItoRunInfo::Update(UInt_t run, TSt
531        };        };
532        //        //
533        file->cd();        file->cd();
534          if ( debug ) printf("filling: totnorun %i idRun %i newrun->ID %i \n",(int)totnorun,(int)idRun,(int)newrun->ID);
535        newtree->Fill();        newtree->Fill();
536        //        //
537      };      };
# Line 535  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 550  Int_t ItoRunInfo::Update(UInt_t run, TSt
550        return(-5);        return(-5);
551      };      };
552      //      //
553        this->Write();
554      //    newtree->Write();      //    newtree->Write();
555    };    };
556    //  if ( oldtree ) oldtree->Delete(); // crasha qua in queste righe e se non le metti...
557    //  if ( newver ) delete newver;
558    //  if ( newrun ) delete newrun;
559    //  if ( oldver ) delete oldver;
560    //  if ( oldrun ) delete oldrun;
561    return(0);    return(0);
562  }  }
563    
564    void ItoRunInfo::Write(){
565      file->cd();
566      newtree->Write("Run",TObject::kOverwrite);
567    }
568    
569  Int_t ItoRunInfo::Read(UInt_t idRun){  Int_t ItoRunInfo::Read(UInt_t idRun){
570    //    //
571    isreadonly = true;    isreadonly = true;
# Line 576  Int_t ItoRunInfo::Read(UInt_t idRun){ Line 602  Int_t ItoRunInfo::Read(UInt_t idRun){
602      //      //
603      for ( UInt_t run = 0; run < totnorun; run++){      for ( UInt_t run = 0; run < totnorun; run++){
604        //        //
605        newtree->GetEntry(run);        if ( newtree->GetEntry(run) <= 0 ) throw -36;
606        //        //
607        file_entries += (newrun->EV_TO - newrun->EV_FROM + 1);        file_entries += (newrun->EV_TO - newrun->EV_FROM + 1);
608        //        //
# Line 609  void ItoRunInfo::Close(){ Line 635  void ItoRunInfo::Close(){
635    delete runlist;    delete runlist;
636    //  file = new TFile();      //  file = new TFile();  
637    file = 0;      file = 0;  
638    if ( isreadonly ) newtree->Delete();    //  if ( isreadonly ) newtree->Delete();
639  }  }
640    
641  void ItoRunInfo::Clear(){  void ItoRunInfo::Clear(Option_t *t){
642    if ( newtree ) newtree->Delete();    if ( newtree ) newtree->Delete();
643  }  }
644    
# Line 665  Int_t ItoRunInfo::GetRunInfo(UInt_t run) Line 691  Int_t ItoRunInfo::GetRunInfo(UInt_t run)
691    totnorun = newtree->GetEntries();    totnorun = newtree->GetEntries();
692    //    //
693    for ( UInt_t nrun = 0; nrun < totnorun; nrun++){      for ( UInt_t nrun = 0; nrun < totnorun; nrun++){  
694      newtree->GetEntry(nrun);      if ( newtree->GetEntry(nrun) <= 0 ) throw -36;
695      //      //
696      if ( nwrun->ID == run || run == 0 ){      if ( nwrun->ID == run || run == 0 ){
697        CopyFromTo(nwrun,(GL_RUN*)this,nwver,version);        CopyFromTo(nwrun,(GL_RUN*)this,nwver,version);

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.22

  ViewVC Help
Powered by ViewVC 1.1.23