/[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.17 by mocchiut, Mon Nov 26 08:01:15 2007 UTC revision 1.21 by mocchiut, Tue May 15 14:35:31 2012 UTC
# Line 88  void SoftInfo::GetLevel2Struct(cSoftInfo Line 88  void SoftInfo::GetLevel2Struct(cSoftInfo
88  }  }
89  /***********************/  /***********************/
90    
91    ItoRunInfo::~ItoRunInfo() {
92      this->GL_RUN::Clear();
93    }
94    
95  ItoRunInfo::ItoRunInfo() {  ItoRunInfo::ItoRunInfo() {
96    reprocessing = false;    reprocessing = false;
97    updating = false;    updating = false;
# Line 101  ItoRunInfo::ItoRunInfo() { Line 105  ItoRunInfo::ItoRunInfo() {
105    norun = 0;    norun = 0;
106    runlist = new TArrayI(500);    runlist = new TArrayI(500);
107    file = NULL;    file = NULL;
108    newtree = new TTree();    newtree = NULL;//new TTree();
109  }  }
110    
111  ItoRunInfo::ItoRunInfo(TFile *processFl){  ItoRunInfo::ItoRunInfo(TFile *processFl){
# Line 122  ItoRunInfo::ItoRunInfo(TFile *processFl) Line 126  ItoRunInfo::ItoRunInfo(TFile *processFl)
126    norun = 0;    norun = 0;
127    totnorun = 0;    totnorun = 0;
128    runlist = new TArrayI(500);    runlist = new TArrayI(500);
129      newtree = NULL;
130    //    //
131  }  }
132    
# Line 169  void ItoRunInfo::CopyFromTo(GL_RUN *glru Line 174  void ItoRunInfo::CopyFromTo(GL_RUN *glru
174    //    //
175    if ( glrun && newrun ){    if ( glrun && newrun ){
176      //      //
177      //    printf("copy \n");  //    printf("copy \n");
178      //      //
179      newrun->ID = glrun->ID                         ;      newrun->ID = glrun->ID                         ;
180      newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG                ;      newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG                ;
# Line 201  void ItoRunInfo::CopyFromTo(GL_RUN *glru Line 206  void ItoRunInfo::CopyFromTo(GL_RUN *glru
206      newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED             ;      newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED             ;
207      newrun->CAL_DSP_MASK  = glrun->CAL_DSP_MASK               ;      newrun->CAL_DSP_MASK  = glrun->CAL_DSP_MASK               ;
208      newrun->BOOT_NUMBER  = glrun->BOOT_NUMBER                ;      newrun->BOOT_NUMBER  = glrun->BOOT_NUMBER                ;
209        newrun->PHYSENDRUN_MASK_S3S2S12  = glrun->PHYSENDRUN_MASK_S3S2S12                 ;
210        newrun->PHYSENDRUN_MASK_S11CRC  = glrun->PHYSENDRUN_MASK_S11CRC                 ;
211      newrun->VALIDATION  = glrun->VALIDATION                 ;      newrun->VALIDATION  = glrun->VALIDATION                 ;
212      //      //
213    };    };
# Line 227  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 234  Int_t ItoRunInfo::Update(UInt_t run, TSt
234    //    //
235    Bool_t debug = false;    Bool_t debug = false;
236    //    //
237    Bool_t ismydir = false;    //  Bool_t ismydir = false;
238    //    //
239    if ( !strcmp(processFolder.Data(),"") ){    if ( !strcmp(processFolder.Data(),"") ){
240      processFolder = "runinfoFolder";      processFolder = "runinfoFolder";
241      ismydir = true;      //    ismydir = true;
242    };    };
243    //    //
244    GL_RUN *oldrun = new GL_RUN();    GL_RUN *oldrun = new GL_RUN();
# Line 360  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 367  Int_t ItoRunInfo::Update(UInt_t run, TSt
367      //      //
368      for ( UInt_t run = 0; run < totnorun; run++){      for ( UInt_t run = 0; run < totnorun; run++){
369        //        //
370        oldtree->GetEntry(run);        if ( oldtree->GetEntry(run) <= 0 ) throw -36;
371        //        //
372        CopyFromTo(oldrun,newrun,oldver,newver);        CopyFromTo(oldrun,newrun,oldver,newver);
373        //        //
# Line 370  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 377  Int_t ItoRunInfo::Update(UInt_t run, TSt
377        //        //
378        if ( idRun == 0 || idRun == newrun->ID ) {        if ( idRun == 0 || idRun == newrun->ID ) {
379          //          //
380          if ( debug ) printf(" Updating run number %u \n",idRun);          if ( debug ) printf(" Updating run number %u newrun->ID %i \n",idRun,(int)newrun->ID);
381          //          //
382          found = true;          found = true;
383          //          //
# Line 509  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 516  Int_t ItoRunInfo::Update(UInt_t run, TSt
516        };        };
517        //        //
518        file->cd();        file->cd();
519          if ( debug ) printf("filling: totnorun %i idRun %i newrun->ID %i \n",(int)totnorun,(int)idRun,(int)newrun->ID);
520        newtree->Fill();        newtree->Fill();
521        //        //
522      };      };
# Line 527  Int_t ItoRunInfo::Update(UInt_t run, TSt Line 535  Int_t ItoRunInfo::Update(UInt_t run, TSt
535        return(-5);        return(-5);
536      };      };
537      //      //
538        this->Write();
539      //    newtree->Write();      //    newtree->Write();
540    };    };
541    //  if ( oldtree ) oldtree->Delete(); // crasha qua in queste righe e se non le metti...
542    //  if ( newver ) delete newver;
543    //  if ( newrun ) delete newrun;
544    //  if ( oldver ) delete oldver;
545    //  if ( oldrun ) delete oldrun;
546    return(0);    return(0);
547  }  }
548    
549    void ItoRunInfo::Write(){
550      file->cd();
551      newtree->Write("Run",TObject::kOverwrite);
552    }
553    
554  Int_t ItoRunInfo::Read(UInt_t idRun){  Int_t ItoRunInfo::Read(UInt_t idRun){
555    //    //
556    isreadonly = true;    isreadonly = true;
# Line 568  Int_t ItoRunInfo::Read(UInt_t idRun){ Line 587  Int_t ItoRunInfo::Read(UInt_t idRun){
587      //      //
588      for ( UInt_t run = 0; run < totnorun; run++){      for ( UInt_t run = 0; run < totnorun; run++){
589        //        //
590        newtree->GetEntry(run);        if ( newtree->GetEntry(run) <= 0 ) throw -36;
591        //        //
592        file_entries += (newrun->EV_TO - newrun->EV_FROM + 1);        file_entries += (newrun->EV_TO - newrun->EV_FROM + 1);
593        //        //
# Line 601  void ItoRunInfo::Close(){ Line 620  void ItoRunInfo::Close(){
620    delete runlist;    delete runlist;
621    //  file = new TFile();      //  file = new TFile();  
622    file = 0;      file = 0;  
623    if ( isreadonly ) newtree->Delete();    //  if ( isreadonly ) newtree->Delete();
624  }  }
625    
626  void ItoRunInfo::Clear(Option_t *t){  void ItoRunInfo::Clear(Option_t *t){
# Line 657  Int_t ItoRunInfo::GetRunInfo(UInt_t run) Line 676  Int_t ItoRunInfo::GetRunInfo(UInt_t run)
676    totnorun = newtree->GetEntries();    totnorun = newtree->GetEntries();
677    //    //
678    for ( UInt_t nrun = 0; nrun < totnorun; nrun++){      for ( UInt_t nrun = 0; nrun < totnorun; nrun++){  
679      newtree->GetEntry(nrun);      if ( newtree->GetEntry(nrun) <= 0 ) throw -36;
680      //      //
681      if ( nwrun->ID == run || run == 0 ){      if ( nwrun->ID == run || run == 0 ){
682        CopyFromTo(nwrun,(GL_RUN*)this,nwver,version);        CopyFromTo(nwrun,(GL_RUN*)this,nwver,version);

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.23