/[PAMELA software]/PamelaLevel2/src/PamLevel2.cpp
ViewVC logotype

Diff of /PamelaLevel2/src/PamLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.71 by mocchiut, Thu Dec 11 10:41:38 2008 UTC revision 1.72 by mocchiut, Fri Dec 12 14:11:50 2008 UTC
# Line 449  void PamLevel2::Initialize(){ Line 449  void PamLevel2::Initialize(){
449      irunt = -1LL;      irunt = -1LL;
450      runfirstentry = 0LL;      runfirstentry = 0LL;
451      runlastentry = 0LL;      runlastentry = 0LL;
452        gltsync = 0; // Emiliano
453    
454      l0_file = NULL;      l0_file = NULL;
455      l0_tree = NULL;      l0_tree = NULL;
# Line 558  void PamLevel2::Delete(){ Line 559  void PamLevel2::Delete(){
559          dbc->Close();          dbc->Close();
560          delete dbc;          delete dbc;
561      }      }
562    
563        if ( gltsync ) delete gltsync;
564            
565      if(l0_file)l0_file->Close();      if(l0_file)l0_file->Close();
566      //    if(pam_tree)pam_tree->Delete();;      //    if(pam_tree)pam_tree->Delete();;
# Line 1704  TTree *PamLevel2::GetPamTree(TFile *f, T Line 1707  TTree *PamLevel2::GetPamTree(TFile *f, T
1707      if(ORB)cout<<"ORB ";      if(ORB)cout<<"ORB ";
1708      if(GP)cout<<"GP ";      if(GP)cout<<"GP ";
1709      cout << endl;      cout << endl;
1710      if(SELLI)cout<<">>> Found selection-list <<<"<<endl;      if(SELLI && SELLI!=2)cout<<">>> Found selection-list <<<"<<endl; //EMILIANO
1711    
1712      f->cd();      f->cd();
1713    
# Line 2632  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2635  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2635          prevshift = 0;          prevshift = 0;
2636          run_tree->GetEntry(irun);          run_tree->GetEntry(irun);
2637          if( !GetOrbitalInfo() )cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated "<<endl;          if( !GetOrbitalInfo() )cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated "<<endl;
2638            if ( gltsync ) delete gltsync; //Emiliano
2639            if(!dbc || (dbc && !dbc->IsConnected()) )SetDBConnection(); //Emiliano
2640            gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc); //Emiliano
2641            if ( dbc ) dbc->Close();// Emiliano
2642      };            };      
2643      // ---------------------------------------------------------------      // ---------------------------------------------------------------
2644      // retrieve OBT and absolute time of the event      // retrieve OBT and absolute time of the event
2645      // ---------------------------------------------------------------      // ---------------------------------------------------------------
2646      ULong64_t abstime = 0LL;      ULong64_t abstime = 0LL;
2647      ULong64_t obt     = 0LL;      //    ULong64_t obt     = 0LL; // Emiliano
2648        Long64_t obt     = 0LL; // Emiliano, Long64_t GL_TIMESYNC::DBobt(UInt_t obt) since depending on the situation OBT is lowered or boosted
2649      if( GetOrbitalInfo() ){      if( GetOrbitalInfo() ){
2650          abstime = GetOrbitalInfo()->absTime;          abstime = GetOrbitalInfo()->absTime;
2651          obt     = GetOrbitalInfo()->OBT;          obt     = gltsync->DBobt(GetOrbitalInfo()->OBT); // Emiliano
2652      }else{      }else{
2653          abstime = GetRunInfo()->RUNHEADER_TIME;          abstime = GetRunInfo()->RUNHEADER_TIME;
2654          obt     = GetRunInfo()->RUNHEADER_OBT;          obt     = gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT); // Emiliano
2655      }      }
2656            
2657    
2658      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
2659      // if it is a full file (not preselected)      // if it is a full file (not preselected)
2660      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
2661      if(SELLI==0){      if(SELLI==0 || SELLI==2){ // Emiliano
2662    
2663          // ---------------------------------------------------------------          // ---------------------------------------------------------------
2664          // increment dead and live-time counters          // increment dead and live-time counters
# Line 2683  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2691  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2691                  !(abstime >= GetRunInfo()->RUNHEADER_TIME &&    // check on absolute time (s)                  !(abstime >= GetRunInfo()->RUNHEADER_TIME &&    // check on absolute time (s)
2692                    abstime <= GetRunInfo()->RUNTRAILER_TIME)                    abstime <= GetRunInfo()->RUNTRAILER_TIME)
2693                  ||                  ||
2694                  !(obt >= GetRunInfo()->RUNHEADER_OBT &&         // additional check on OBT (ms)                  !(obt >= gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) &&         // additional check on OBT (ms) // Emiliano
2695                    obt <= GetRunInfo()->RUNTRAILER_OBT)                              obt <= gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT))           // Emiliano
2696                  ||                  ||
2697                  GetRunInfo()->NEVENTS==0                  GetRunInfo()->NEVENTS==0
2698  //              || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) // ERRORE!!! fa saltare i run con 1 evento  //              || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) // ERRORE!!! fa saltare i run con 1 evento
# Line 2707  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2715  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2715              // store dead and live-time of previous run              // store dead and live-time of previous run
2716              // -----------------------------------------              // -----------------------------------------
2717  //          if(SELLI==0){  //          if(SELLI==0){
2718              if(SELLI!=2){
2719              if(fromfirst){              if(fromfirst){
2720                  if(oldrun==irun){                  if(oldrun==irun){
2721                      /// decrement counters                      /// decrement counters
# Line 2736  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2745  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2745                  }                  }
2746                  totdltime[2]=1;                             //event counter                  totdltime[2]=1;                             //event counter
2747              }              }
2748  //          }            }
2749              //        }
2750    
2751              irun++;                      irun++;        
2752              // ------------------------------------              // ------------------------------------
# Line 2768  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2778  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2778              prevshift = 0;                        prevshift = 0;          
2779              run_tree->GetEntry(irun);//update runinfo              run_tree->GetEntry(irun);//update runinfo
2780              irunt = irun - irunoffset[run_tree->GetTreeNumber()];              irunt = irun - irunoffset[run_tree->GetTreeNumber()];
2781              if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){              if ( gltsync ) delete gltsync; // Emiliano
2782                if(!dbc || (dbc && !dbc->IsConnected()) )SetDBConnection(); //Emiliano
2783                gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc); // Emiliano
2784                if ( dbc ) dbc->Close(); // Emiliano
2785                if(gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT)>gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ){ // Emiliano
2786                  cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<"  has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl;                  cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<"  has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl;
2787                  cout << "                                                            (NB!! in this case some events are assigned to a wrong run)"<<endl;                  cout << "                                                            (NB!! in this case some events are assigned to a wrong run)"<<endl;
2788              }              }
# Line 3634  void PamLevel2::CreateCloneTrees(TFile * Line 3648  void PamLevel2::CreateCloneTrees(TFile *
3648      // ------------------------------------      // ------------------------------------
3649      // add branch with dead and live times      // add branch with dead and live times
3650      // ------------------------------------      // ------------------------------------
3651      run_tree_clone->Branch("DeadLiveTime",totdltime,"dltime[3]/l");      if ( SELLI != 2 ){ // EMILIANO
3652      cout << "Run          : branch DeadLiveTime"<<endl;        run_tree_clone->Branch("DeadLiveTime",totdltime,"dltime[3]/l");
3653          cout << "Run          : branch DeadLiveTime"<<endl;
3654    
3655    
3656      sel_tree_clone = new TTree("SelectionList","List of selected events ");        sel_tree_clone = new TTree("SelectionList","List of selected events ");
3657  //    sel_tree_clone->Branch("RunEntry",&irun,"runentry/L");        //    sel_tree_clone->Branch("RunEntry",&irun,"runentry/L");
3658      sel_tree_clone->Branch("RunEntry",&irunt,"runentry/L");//NEWNEW        sel_tree_clone->Branch("RunEntry",&irunt,"runentry/L");//NEWNEW
3659      sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/L");        sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/L");
3660            };
3661    
3662      Int_t i=0;      Int_t i=0;
3663      if(TRK1||TRK2||TRKh){      if(TRK1||TRK2||TRKh){
# Line 3772  void PamLevel2::WriteCloneTrees(){ Line 3787  void PamLevel2::WriteCloneTrees(){
3787      cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl;      cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl;
3788      cout << "Write clones of PAMELA trees "<<endl;      cout << "Write clones of PAMELA trees "<<endl;
3789      cout << run_tree_clone->GetName()<<endl;        cout << run_tree_clone->GetName()<<endl;  
3790      if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries())      if ( SELLI != 2){// Emiliano
3791          if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries())
3792          run_tree_clone->GetBranch("DeadLiveTime")->Fill();          run_tree_clone->GetBranch("DeadLiveTime")->Fill();
3793        };
3794      run_tree_clone->Write();      run_tree_clone->Write();
3795      cout << sel_tree_clone->GetName()<<endl;          if ( SELLI != 2){ //Emiliano
3796      sel_tree_clone->Write();        cout << sel_tree_clone->GetName()<<endl;    
3797          sel_tree_clone->Write();
3798        };
3799      for(Int_t i=0; i<NCLONES; i++){          for(Int_t i=0; i<NCLONES; i++){    
3800          if(pam_tree_clone[i]){          if(pam_tree_clone[i]){
3801              cout << pam_tree_clone[i]->GetName()<<endl;              cout << pam_tree_clone[i]->GetName()<<endl;
# Line 3837  Int_t PamLevel2::GetEntry(Long64_t iee){ Line 3856  Int_t PamLevel2::GetEntry(Long64_t iee){
3856  //    Bool_t UPDATED = UpdateRunInfo(run_tree,ii);  //    Bool_t UPDATED = UpdateRunInfo(run_tree,ii);
3857  //    Bool_t UPDATED = UpdateRunInfo(ii);  //    Bool_t UPDATED = UpdateRunInfo(ii);
3858      UpdateRunInfo(ii);      UpdateRunInfo(ii);
3859      if(SELLI==0)irunentry = iee-runfirstentry;      if(SELLI==0||SELLI==2)irunentry = iee-runfirstentry;
3860  //    if(UPDATED && run_tree_clone)run_tree_clone->Fill();  //    if(UPDATED && run_tree_clone)run_tree_clone->Fill();
3861        
3862  //    cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl;  //    cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl;

Legend:
Removed from v.1.71  
changed lines
  Added in v.1.72

  ViewVC Help
Powered by ViewVC 1.1.23