/[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.44 by mocchiut, Mon Sep 3 09:16:48 2007 UTC revision 1.50 by mocchiut, Fri Oct 26 09:08:51 2007 UTC
# Line 11  PamTrack::PamTrack(){ Line 11  PamTrack::PamTrack(){
11      calo_track = 0;      calo_track = 0;
12      tof_track  = 0;      tof_track  = 0;
13      candeleteobj = 0;      candeleteobj = 0;
14        pscore = 0;
15        iscore = 0;
16  };  };
17  //--------------------------------------  //--------------------------------------
18  //  //
# Line 60  void PamTrack::Clear(){ Line 62  void PamTrack::Clear(){
62          calo_track = 0;          calo_track = 0;
63          tof_track  = 0;          tof_track  = 0;
64      }      }
65        pscore = 0;
66        iscore = 0;
67    
68  }  }
69  void PamTrack::Delete(){  void PamTrack::Delete(){
70  //    cout << "PamTrack::Delete() "<<candeleteobj<<endl;  //    cout << "PamTrack::Delete() "<<candeleteobj<<endl;
# Line 140  void PamLevel2::Initialize(){ Line 145  void PamLevel2::Initialize(){
145      dbc     = 0;      dbc     = 0;
146    
147      prevshift = 0;      prevshift = 0;
148        maxshift = 10; //EMILIANO
149            
150      run_tree = NULL;      run_tree = NULL;
151      run_tree_clone = NULL;      run_tree_clone = NULL;
# Line 150  void PamLevel2::Initialize(){ Line 156  void PamLevel2::Initialize(){
156      pam_tree = NULL;      pam_tree = NULL;
157      for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL;      for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL;
158    
159        totdltime[0] = 0LL;
160        totdltime[1] = 0LL;
161    
162      host = "mysql://localhost/pamelaprod";      host = "mysql://localhost/pamelaprod";
163      user = "anonymous";      user = "anonymous";
164      psw = "";      psw = "";
# Line 391  void PamLevel2::Reset(){ Line 400  void PamLevel2::Reset(){
400    runfirstentry = 0ULL;    runfirstentry = 0ULL;
401    runlastentry = 0ULL;        runlastentry = 0ULL;    
402    //    //
403      totdltime[0] = 0LL;
404      totdltime[1] = 0LL;
405      //
406  };  };
407    
408  Bool_t PamLevel2::IsGood(){  Bool_t PamLevel2::IsGood(){
# Line 625  void PamLevel2::SortTracks(TString how){ Line 637  void PamLevel2::SortTracks(TString how){
637  void PamLevel2::SortTracks(){  void PamLevel2::SortTracks(){
638    TString how = howtosort;    TString how = howtosort;
639    
640    //    cout <<" PamLevel2::SortTracks(TString how) "<<endl;    //  cout <<" PamLevel2::SortTracks(TString how) "<<endl;
641    if( !trk2_obj ){    if( !trk2_obj ){
642      cout << "void PamLevel2::SortTracks():  TrkLevel2 not loaded !!!";      cout << "void PamLevel2::SortTracks():  TrkLevel2 not loaded !!!";
643      return;      return;
# Line 655  void PamLevel2::SortTracks(){ Line 667  void PamLevel2::SortTracks(){
667    Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase);    Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase);
668    Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase);    Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase);
669    Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase);    Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase);
670          Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase);
671      Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase);
672      Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase);
673      
674      if ( use_TOF ){
675        use_S1 = true;
676        use_S2 = true;
677        use_S3 = true;
678      };
679    if( !CAL2 &&  use_CAL) use_CAL = false;    if( !CAL2 &&  use_CAL) use_CAL = false;
680    if( !TOF &&  use_TOF) use_TOF = false;    if( !TOF ){
681            use_TOF = false;
682        use_S1  = false;
683        use_S2  = false;
684        use_S3  = false;
685      }
686    
687    if( !TRK2 ){    if( !TRK2 ){
688      //  cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl;      //  cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl;
689      return;      return;
# Line 686  void PamLevel2::SortTracks(){ Line 711  void PamLevel2::SortTracks(){
711      ToFTrkVar  *oi = 0;      ToFTrkVar  *oi = 0;
712      //  cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl;      //  cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl;
713      // if track has an image, check image selection      // if track has an image, check image selection
714    
715        Int_t tp_score = 0;  //main track sorted by the tracker
716        Int_t ti_score = 0;  //image track
717        Int_t totp_score = 0;  //main track sorted by the tracker
718        Int_t toti_score = 0;  //image track
719    
720      if(tp->HasImage()){      if(tp->HasImage()){
721                            
722        ti = trk2_obj->TrkLevel2::GetTrackImage(i);              //tracker (image)        ti = trk2_obj->TrkLevel2::GetTrackImage(i);              //tracker (image)
# Line 695  void PamLevel2::SortTracks(){ Line 726  void PamLevel2::SortTracks(){
726        //            cout << "its image "<<i << " "<<hex<< ti <<dec<< endl;        //            cout << "its image "<<i << " "<<hex<< ti <<dec<< endl;
727    
728        //assign starting scores        //assign starting scores
729        Int_t tp_score = 0;  //main track sorted by the tracker        tp_score = 0;  //main track sorted by the tracker
730        Int_t ti_score = 0;  //image track        ti_score = 0;  //image track
731                            
732        // -----------------------------------------------------------------------------------------        // -----------------------------------------------------------------------------------------
733        // calorimeter check        // calorimeter check
# Line 707  void PamLevel2::SortTracks(){ Line 738  void PamLevel2::SortTracks(){
738          cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!";          cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!";
739          return;          return;
740        };        };
741          if( use_CAL && !cp &&  ci ){
742            ti_score++;
743            toti_score++;
744          };
745          if( use_CAL &&  cp && !ci ){
746            tp_score++;
747            totp_score++;
748          };
749        if(        if(
750           use_CAL            &&           use_CAL            &&
751  //       calo2_obj->npcfit[1] > 5     &&   //no. of fit planes on Y view  //       calo2_obj->npcfit[1] > 5     &&   //no. of fit planes on Y view
# Line 722  void PamLevel2::SortTracks(){ Line 761  void PamLevel2::SortTracks(){
761  //      else                 ti_score++;  //      else                 ti_score++;
762                    
763    
764            if( cp->npresh > ci->npresh) tp_score++;          if( cp->npresh > ci->npresh){
765            if( cp->npresh < ci->npresh) ti_score++;            tp_score++;
766            else ;//niente            totp_score++;
767            };
768            if( cp->npresh < ci->npresh){
769              ti_score++;
770              toti_score++;
771            };
772    
773          //      cout << "CALO "<<tp_score<<ti_score<<endl;          //      cout << "CALO "<<tp_score<<ti_score<<endl;
774    
# Line 734  void PamLevel2::SortTracks(){ Line 778  void PamLevel2::SortTracks(){
778        // -----------------------------------------------------------------------------------------        // -----------------------------------------------------------------------------------------
779        // check the number of hit pmts along the track        // check the number of hit pmts along the track
780        // on S12 S21 and S32, where paddles are parallel to Y axis        // on S12 S21 and S32, where paddles are parallel to Y axis
781        if( use_TOF && !tof_obj ){        if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !tof_obj ){
782          cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!";          cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!";
783          return;          return;
784        };        };
785        if( use_TOF && op && oi ){        //
786                          if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !op && oi ){
787            ti_score++;
788            toti_score++;
789          };
790          if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && !oi ){
791            tp_score++;
792            totp_score++;
793          };
794          if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && oi ){
795          //          //
796          Float_t sen = 0.;          Float_t sen = 0.;
797          for (Int_t ih=0; ih < op->npmtadc; ih++){          for (Int_t ih=0; ih < op->npmtadc; ih++){
# Line 751  void PamLevel2::SortTracks(){ Line 803  void PamLevel2::SortTracks(){
803            if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih);            if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih);
804          };          };
805          //          //
806          if (  sen >= sortthr ){          if (  sen >= sortthr && false){ // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!)
807            //printf(" IS A NUCLEUS! en = %f \n",sen);            //printf(" IS A NUCLEUS! en = %f \n",sen);
808            //            //
809            // is a nucleus use a different algorithm            // is a nucleus use a different algorithm
# Line 844  void PamLevel2::SortTracks(){ Line 896  void PamLevel2::SortTracks(){
896    
897                                    
898            if(            if(
899               use_TOF            &&               (use_TOF || use_S1 || use_S2 || use_S3)            &&
900               (nphit_p+nphit_i) !=0 &&                 (nphit_p+nphit_i) !=0 &&  
901               true){               true){
902                                            
# Line 889  void PamLevel2::SortTracks(){ Line 941  void PamLevel2::SortTracks(){
941            // --- modified to count tdc signals (more efficient?)            // --- modified to count tdc signals (more efficient?)
942            // --- and to implement check on tdcflag            // --- and to implement check on tdcflag
943            for (Int_t ih=0; ih < op->npmttdc; ih++){            for (Int_t ih=0; ih < op->npmttdc; ih++){
944              //      Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) );              Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) );
945  //          if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++;  //          if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++;
946              if( (op->tdcflag).At(ih)==0 )nphit_p++;              if ( (use_S1 && ( pl == 0 || pl == 1 )) || (use_S2 && ( pl == 2 || pl == 3 )) || (use_S3 && ( pl == 4 || pl == 5 )) ){
947                  if( (op->tdcflag).At(ih)==0 )nphit_p++;
948                };
949            };            };
950                                    
951            for (Int_t ih=0; ih < oi->npmttdc; ih++){            for (Int_t ih=0; ih < oi->npmttdc; ih++){
952              //      Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) );              Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) );
953  //          if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++;    //          if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++;  
954              if( (oi->tdcflag).At(ih)==0 )nphit_i++;                  if ( (use_S1 && ( pl == 0 || pl == 1 )) || (use_S2 && ( pl == 2 || pl == 3 )) || (use_S3 && ( pl == 4 || pl == 5 )) ){
955                  if( (oi->tdcflag).At(ih)==0 )nphit_i++;  
956                };
957            };            };
958                                    
959            if(            if(
960               (nphit_p+nphit_i) !=0 &&                 (nphit_p+nphit_i) !=0 &&  
961               true){               true){
962                                            
963              if     ( nphit_p > nphit_i) tp_score++;              if ( nphit_p != nphit_i ){
964              else if( nphit_p < nphit_i) ti_score++;                totp_score += nphit_p;
965              else ;//niente                toti_score += nphit_i;
966                  tp_score+=nphit_p;
967                  ti_score+=nphit_i;
968                };
969                //      if     ( nphit_p > nphit_i) tp_score+=nphit_p;
970                //      else if( nphit_p < nphit_i) ti_score+=nphit_i;
971                //      else ;//niente
972            };            };
973          };          };
974          //      cout << "TOF "<<tp_score<<ti_score<<endl;          //      cout << "TOF "<<tp_score<<ti_score<<endl;
# Line 928  void PamLevel2::SortTracks(){ Line 990  void PamLevel2::SortTracks(){
990  //      else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ;  //      else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ;
991    
992            // CHECK 1 : number of points along X              // CHECK 1 : number of points along X  
993            if ( tp->GetNX() >= ti->GetNX() )tp_score++ ;          if ( tp->GetNX() >= ti->GetNX() ){
994            if ( tp->GetNX() <= ti->GetNX() )ti_score++ ;            tp_score++ ;
995              totp_score++ ;
996            };
997            if ( tp->GetNX() <= ti->GetNX() ){
998              ti_score++ ;
999              toti_score++ ;
1000            };
1001            // CHECK 2 : number of points along Y              // CHECK 2 : number of points along Y  
1002            if ( tp->GetNY() >= ti->GetNY() )tp_score++ ;          if ( tp->GetNY() >= ti->GetNY() ){
1003            if ( tp->GetNY() <= ti->GetNY() )ti_score++ ;            tp_score++ ;
1004              totp_score++ ;
1005            };
1006            if ( tp->GetNY() <= ti->GetNY() ){
1007              ti_score++ ;
1008              toti_score++ ;
1009            };
1010            // CHECK 3 : chi**2 along X              // CHECK 3 : chi**2 along X  
1011  //        if(      tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ;  //        if(      tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ;
1012  //        if(      ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ;  //        if(      ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ;
# Line 960  void PamLevel2::SortTracks(){ Line 1034  void PamLevel2::SortTracks(){
1034          ts = ti;//its image!!          ts = ti;//its image!!
1035          cs = ci;          cs = ci;
1036          os = oi;          os = oi;
1037            Int_t totis = toti_score;
1038    
1039          ti = tp;//its image!!          ti = tp;//its image!!
1040          ci = cp;          ci = cp;
# Line 969  void PamLevel2::SortTracks(){ Line 1044  void PamLevel2::SortTracks(){
1044          cp = cs;          cp = cs;
1045          op = os;          op = os;
1046    
1047            toti_score = totp_score;
1048            totp_score = totis;
1049    
1050                                    
1051        }else {        }else {
1052    
# Line 977  void PamLevel2::SortTracks(){ Line 1055  void PamLevel2::SortTracks(){
1055        };        };
1056                            
1057      }else{      }else{
1058          totp_score = 1;
1059          toti_score = 0;
1060          
1061        //            ts = tp;        //            ts = tp;
1062        //            cs = cp;        //            cs = cp;
1063        //            os = op;        //            os = op;
# Line 990  void PamLevel2::SortTracks(){ Line 1071  void PamLevel2::SortTracks(){
1071      //  cout<<"o "<<tp<<endl;      //  cout<<"o "<<tp<<endl;
1072      //  cout<<"o "<<cp<<endl;      //  cout<<"o "<<cp<<endl;
1073      //  cout<<"o "<<op<<endl;      //  cout<<"o "<<op<<endl;
1074    
1075      new(ttsorted[i]) PamTrack(tp,cp,op);      new(ttsorted[i]) PamTrack(tp,cp,op);
1076      new(ttimage[i])  PamTrack(ti,ci,oi);      new(ttimage[i])  PamTrack(ti,ci,oi);
1077    
1078        ((PamTrack*)(ttsorted[i]))->SetPScore(totp_score);
1079        ((PamTrack*)(ttsorted[i]))->SetIScore(toti_score);
1080        ((PamTrack*)(ttimage[i]))->SetPScore(totp_score);
1081        ((PamTrack*)(ttimage[i]))->SetIScore(toti_score);
1082    };    };
1083    
1084    if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){    if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){
# Line 1889  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1976  Bool_t PamLevel2::UpdateRunInfo(TChain *
1976    //    //
1977    // check if we have already called once GetEntry, if not call it    // check if we have already called once GetEntry, if not call it
1978    //    //
1979      cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) --- NON FUNZIONA BENISSIMO.... "<<endl;      cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) --- ATTENZIONE --- NON E` MANTENUTA!!!!!!!.... "<<endl;
1980      if(!run){      if(!run){
1981            cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing RunInfo tree "<<endl;            cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing RunInfo tree "<<endl;
1982            return(false);                    return(false);        
# Line 2031  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2118  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2118      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
2119      if(SELLI==0){      if(SELLI==0){
2120    
2121            // ---------------------------------------------------------------
2122            // increment dead and live-time counters
2123            // ---------------------------------------------------------------
2124            if( GetTrigLevel2() ){
2125                totdltime[0]+=GetTrigLevel2()->dltime[0];
2126                totdltime[1]+=GetTrigLevel2()->dltime[1];
2127            }
2128            totdltime[2]++;
2129    
2130    //      cout << setw(10)<<totdltime[0]<<setw(10)<<totdltime[1]<<setw(10)<<totdltime[2]<<endl;
2131    
2132            // ---------------------------------------------------------------
2133            // retrieve OBT and absolute time of the event
2134            // ---------------------------------------------------------------
2135          ULong64_t abstime = 0;          ULong64_t abstime = 0;
2136          ULong64_t obt     = 0;          ULong64_t obt     = 0;
2137          if( GetOrbitalInfo() ){          if( GetOrbitalInfo() ){
# Line 2061  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2162  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2162          };                };      
2163    
2164          // -----------------------------------------------------------------------          // -----------------------------------------------------------------------
2165          // if it is simulation, assigh abstime by end (temporaneo!!!)          // if it is simulation, assign abstime by hand (temporaneo!!!)
2166          // -----------------------------------------------------------------------          // -----------------------------------------------------------------------
2167          if(ISGP){          if(ISGP){
2168              abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO              abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO
# Line 2086  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2187  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2187                        obt <= GetRunInfo()->RUNTRAILER_OBT)                        obt <= GetRunInfo()->RUNTRAILER_OBT)
2188                      )                      )
2189                  || GetRunInfo()->NEVENTS==0                  || GetRunInfo()->NEVENTS==0
2190                  || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift)  //              || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) // ERRORE!!! fa saltare i run con 1 evento
2191                    || !(irunentry <= GetRunInfo()->NEVENTS-1-prevshift)
2192                  )                  )
2193                  && irun < run_tree->GetEntries() ){                  && irun < run_tree->GetEntries() ){
2194    
2195                // - - - - - - - - - - - - -
2196                // irunentry = position of current entry, relative to the run
2197                // prevshift = shift needed to synchronize l0 and l2 data (nested events)
2198                // - - - - - - - - - - - - -
2199    
2200                // -----------------------------------------
2201                // store dead and live-time of previous run
2202                // -----------------------------------------
2203                if(fromfirst){
2204                    if(oldrun==irun){
2205                        /// decrement counters
2206                        if( GetTrigLevel2()){
2207                            totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time
2208                            totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time
2209                        }
2210                        totdltime[2]--;                              //event counter
2211                        cout << endl;
2212                        cout << "n.events     : "<<totdltime[2]<<endl;
2213                        cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl;
2214                        cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl;      
2215                    }else{
2216                        totdltime[0]=0;//live-time
2217                        totdltime[1]=0;//dead-time
2218                        totdltime[2]=0;                             //event counter
2219                        cout << " *** JUMP RUN *** irun "<<irun<<endl;
2220                    }
2221                    /// add an entry
2222                    if(run_tree_clone)
2223                        if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries())
2224                            run_tree_clone->GetBranch("DeadLiveTime")->Fill();
2225                    /// reset counters
2226                    if( GetTrigLevel2() ){
2227                        totdltime[0]=GetTrigLevel2()->dltime[0];//live-time
2228                        totdltime[1]=0;                         //dead-time
2229                    }
2230                    totdltime[2]=1;                             //event counter
2231                }
2232    
2233    
2234              irun++;              irun++;
2235              // ------------------------------------              // ------------------------------------
2236              // if the end of run tree is reached...              // if the end of run tree is reached...
# Line 2117  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2258  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2258              // -------------------------------------------------------------------              // -------------------------------------------------------------------
2259              if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift;              if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift;
2260              irunentry = 0;              irunentry = 0;
2261              prevshift = 0;              prevshift = 0;          
2262              run_tree->GetEntry(irun);                    run_tree->GetEntry(irun);      
2263              if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){              if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){
2264                  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;
# Line 2137  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2278  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2278    
2279          // --------------------------------------          // --------------------------------------
2280          // ... otherwise          // ... otherwise
2281            // --------------------------------------
2282    
2283    
2284    
2285    //      // -----------------------------------------
2286    //      // store dead and live-time of previous run
2287    //      // -----------------------------------------
2288    //      // --------------------------------------------------------------
2289    //      // if the run is empty, fill the dead-live time branch with zeros
2290    //      // --------------------------------------------------------------
2291    //      /// if some runs have been jumped, fill with zeros
2292    //      if(irun-oldrun>1){
2293    //          ULong64_t  temp[3];
2294    //          temp[0]=totdltime[0];
2295    //          temp[1]=totdltime[1];
2296    //          temp[2]=totdltime[2];
2297    //          for(int i=oldrun+1; i<irun; irun++){
2298    //              totdltime[0]=0;
2299    //              totdltime[1]=0;
2300    //              totdltime[2]=0;
2301    //              cout << " ** JUMPED RUN **"<<endl;
2302    //              if(run_tree_clone)
2303    //                  if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries())
2304    //                      run_tree_clone->GetBranch("DeadLiveTime")->Fill();
2305    //          }
2306    //          totdltime[0]=temp[0];
2307    //          totdltime[1]=temp[1];
2308    //          totdltime[2]=temp[2];
2309    //      }
2310    //      /// decrement counters
2311    //      if( GetTrigLevel2() ){
2312    //          totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time
2313    //          totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time
2314    //      }
2315    //      totdltime[2]--;                              //event counter
2316    //      /// add an entry
2317    //      if(irun>0 ){
2318    //          cout << endl;
2319    //          cout << "n.events     : "<<totdltime[2]<<endl;
2320    //          cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl;
2321    //          cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl;      
2322    //          if(run_tree_clone)
2323    //              if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries())
2324    //                  run_tree_clone->GetBranch("DeadLiveTime")->Fill();
2325    //      }
2326    //      /// reset counters
2327    //      if( GetTrigLevel2() ){
2328    //          totdltime[0]=GetTrigLevel2()->dltime[0];//live-time
2329    //          totdltime[1]=0;                         //dead-time
2330    //      }
2331    //      totdltime[2]=1;                             //event counter
2332            
2333    
2334            // --------------------------------------
2335          // ---> exit with TRUE          // ---> exit with TRUE
2336          // --------------------------------------          // --------------------------------------
2337          cout << endl << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;          cout << endl << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;
# Line 2151  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2346  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2346              true ){              true ){
2347              cout << "* fragment *"<<endl;                            cout << "* fragment *"<<endl;              
2348          }          }
2349            
2350          return(true);              return(true);    
2351      };      };
2352      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# Line 2831  void PamLevel2::CreateCloneTrees(TFile * Line 3026  void PamLevel2::CreateCloneTrees(TFile *
3026      }      }
3027      cout << "----------------------------------------------------"<<endl;      cout << "----------------------------------------------------"<<endl;
3028    
3029        // ------------------------------------
3030        // add branch with dead and live times
3031        // ------------------------------------
3032        run_tree_clone->Branch("DeadLiveTime",totdltime,"dltime[3]/l");
3033        cout << "Run          : branch DeadLiveTime"<<endl;
3034    
3035    
3036      sel_tree_clone = new TTree("SelectionList","List of selected events ");      sel_tree_clone = new TTree("SelectionList","List of selected events ");
3037      sel_tree_clone->Branch("RunEntry",&irun,"runentry/L");      sel_tree_clone->Branch("RunEntry",&irun,"runentry/L");
# Line 2957  TTree* PamLevel2::GetCloneTree(TString n Line 3158  TTree* PamLevel2::GetCloneTree(TString n
3158  void PamLevel2::WriteCloneTrees(){  void PamLevel2::WriteCloneTrees(){
3159      cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl;      cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl;
3160      cout << "Write clones of PAMELA trees "<<endl;      cout << "Write clones of PAMELA trees "<<endl;
3161      cout << run_tree_clone->GetName()<<endl;          cout << run_tree_clone->GetName()<<endl;  
3162        if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries())
3163            run_tree_clone->GetBranch("DeadLiveTime")->Fill();
3164      run_tree_clone->Write();      run_tree_clone->Write();
3165      cout << sel_tree_clone->GetName()<<endl;          cout << sel_tree_clone->GetName()<<endl;    
3166      sel_tree_clone->Write();      sel_tree_clone->Write();
# Line 3232  Int_t PamLevel2::GetYodaEntry(){ Line 3435  Int_t PamLevel2::GetYodaEntry(){
3435      Int_t answer = 0;      Int_t answer = 0;
3436      Int_t shift =0;      Int_t shift =0;
3437      //    printf(" siamo qui %i %i \n",shift,prevshift);      //    printf(" siamo qui %i %i \n",shift,prevshift);
3438      Int_t maxshift = 10;      //    Int_t maxshift = 50; // EMILIANO
3439      do{      do{
3440          if(shift>0){              if(shift>0){    
3441              cout << " PKTNUM  L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl;              cout << " PKTNUM  L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl;
# Line 3297  Bool_t PamLevel2::SetDBConnection(){ Line 3500  Bool_t PamLevel2::SetDBConnection(){
3500      return true;      return true;
3501    
3502  }  }
3503    
3504    /**
3505     * \Brief Add a friend to the pamela chain.
3506     * @param cname name of the chain to be added
3507     */
3508    
3509    TChain* PamLevel2::AddFriend(TString cname){
3510    
3511        if(!GetPamTree()){
3512            cout << " TChain* PamLevel2::AddFriend(TString cname) --- a pamela tree must be created first"<<endl;
3513            return NULL;
3514        }
3515    
3516    
3517        TChain *c = new TChain( cname.Data() );
3518    
3519        TIter next( GetPamTree()->GetListOfFiles() );
3520        Int_t nf = 0;
3521        TChainElement* element = 0;    
3522        while ((element = (TChainElement*) next())) {      
3523            c->Add(element->GetTitle());
3524            nf++;
3525        }
3526    
3527        GetPamTree()->AddFriend(cname.Data());
3528    
3529        cout << "external chain created and added to pamela friends :"<<cname<<endl;
3530        cout << "n.files "<<nf<<endl;
3531        
3532    
3533        return c;    
3534    
3535    }

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.50

  ViewVC Help
Powered by ViewVC 1.1.23