/[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.43 by pam-fi, Fri Aug 17 16:57:12 2007 UTC revision 1.47 by mocchiut, Wed Sep 12 09:39:32 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 150  void PamLevel2::Initialize(){ Line 155  void PamLevel2::Initialize(){
155      pam_tree = NULL;      pam_tree = NULL;
156      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;
157    
158        totdltime[0] = 0LL;
159        totdltime[1] = 0LL;
160    
161      host = "mysql://localhost/pamelaprod";      host = "mysql://localhost/pamelaprod";
162      user = "anonymous";      user = "anonymous";
163      psw = "";      psw = "";
# Line 391  void PamLevel2::Reset(){ Line 399  void PamLevel2::Reset(){
399    runfirstentry = 0ULL;    runfirstentry = 0ULL;
400    runlastentry = 0ULL;        runlastentry = 0ULL;    
401    //    //
402      totdltime[0] = 0LL;
403      totdltime[1] = 0LL;
404      //
405  };  };
406    
407  Bool_t PamLevel2::IsGood(){  Bool_t PamLevel2::IsGood(){
# Line 625  void PamLevel2::SortTracks(TString how){ Line 636  void PamLevel2::SortTracks(TString how){
636  void PamLevel2::SortTracks(){  void PamLevel2::SortTracks(){
637    TString how = howtosort;    TString how = howtosort;
638    
639    //    cout <<" PamLevel2::SortTracks(TString how) "<<endl;    //  cout <<" PamLevel2::SortTracks(TString how) "<<endl;
640    if( !trk2_obj ){    if( !trk2_obj ){
641      cout << "void PamLevel2::SortTracks():  TrkLevel2 not loaded !!!";      cout << "void PamLevel2::SortTracks():  TrkLevel2 not loaded !!!";
642      return;      return;
# Line 655  void PamLevel2::SortTracks(){ Line 666  void PamLevel2::SortTracks(){
666    Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase);    Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase);
667    Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase);    Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase);
668    Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase);    Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase);
669          Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase);
670      Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase);
671      Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase);
672      
673      if ( use_TOF ){
674        use_S1 = true;
675        use_S2 = true;
676        use_S3 = true;
677      };
678    if( !CAL2 &&  use_CAL) use_CAL = false;    if( !CAL2 &&  use_CAL) use_CAL = false;
679    if( !TOF &&  use_TOF) use_TOF = false;    if( !TOF ){
680            use_TOF = false;
681        use_S1  = false;
682        use_S2  = false;
683        use_S3  = false;
684      }
685    
686    if( !TRK2 ){    if( !TRK2 ){
687      //  cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl;      //  cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl;
688      return;      return;
# Line 686  void PamLevel2::SortTracks(){ Line 710  void PamLevel2::SortTracks(){
710      ToFTrkVar  *oi = 0;      ToFTrkVar  *oi = 0;
711      //  cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl;      //  cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl;
712      // if track has an image, check image selection      // if track has an image, check image selection
713    
714        Int_t tp_score = 0;  //main track sorted by the tracker
715        Int_t ti_score = 0;  //image track
716        Int_t totp_score = 0;  //main track sorted by the tracker
717        Int_t toti_score = 0;  //image track
718    
719      if(tp->HasImage()){      if(tp->HasImage()){
720                            
721        ti = trk2_obj->TrkLevel2::GetTrackImage(i);              //tracker (image)        ti = trk2_obj->TrkLevel2::GetTrackImage(i);              //tracker (image)
# Line 695  void PamLevel2::SortTracks(){ Line 725  void PamLevel2::SortTracks(){
725        //            cout << "its image "<<i << " "<<hex<< ti <<dec<< endl;        //            cout << "its image "<<i << " "<<hex<< ti <<dec<< endl;
726    
727        //assign starting scores        //assign starting scores
728        Int_t tp_score = 0;  //main track sorted by the tracker        tp_score = 0;  //main track sorted by the tracker
729        Int_t ti_score = 0;  //image track        ti_score = 0;  //image track
730                            
731        // -----------------------------------------------------------------------------------------        // -----------------------------------------------------------------------------------------
732        // calorimeter check        // calorimeter check
# Line 707  void PamLevel2::SortTracks(){ Line 737  void PamLevel2::SortTracks(){
737          cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!";          cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!";
738          return;          return;
739        };        };
740          if( use_CAL && !cp &&  ci ){
741            ti_score++;
742            toti_score++;
743          };
744          if( use_CAL &&  cp && !ci ){
745            tp_score++;
746            totp_score++;
747          };
748        if(        if(
749           use_CAL            &&           use_CAL            &&
750  //       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 760  void PamLevel2::SortTracks(){
760  //      else                 ti_score++;  //      else                 ti_score++;
761                    
762    
763            if( cp->npresh > ci->npresh) tp_score++;          if( cp->npresh > ci->npresh){
764            if( cp->npresh < ci->npresh) ti_score++;            tp_score++;
765            else ;//niente            totp_score++;
766            };
767            if( cp->npresh < ci->npresh){
768              ti_score++;
769              toti_score++;
770            };
771    
772          //      cout << "CALO "<<tp_score<<ti_score<<endl;          //      cout << "CALO "<<tp_score<<ti_score<<endl;
773    
# Line 734  void PamLevel2::SortTracks(){ Line 777  void PamLevel2::SortTracks(){
777        // -----------------------------------------------------------------------------------------        // -----------------------------------------------------------------------------------------
778        // check the number of hit pmts along the track        // check the number of hit pmts along the track
779        // on S12 S21 and S32, where paddles are parallel to Y axis        // on S12 S21 and S32, where paddles are parallel to Y axis
780        if( use_TOF && !tof_obj ){        if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !tof_obj ){
781          cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!";          cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!";
782          return;          return;
783        };        };
784        if( use_TOF && op && oi ){        //
785                          if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !op && oi ){
786            ti_score++;
787            toti_score++;
788          };
789          if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && !oi ){
790            tp_score++;
791            totp_score++;
792          };
793          if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && oi ){
794          //          //
795          Float_t sen = 0.;          Float_t sen = 0.;
796          for (Int_t ih=0; ih < op->npmtadc; ih++){          for (Int_t ih=0; ih < op->npmtadc; ih++){
# Line 751  void PamLevel2::SortTracks(){ Line 802  void PamLevel2::SortTracks(){
802            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);
803          };          };
804          //          //
805          if (  sen >= sortthr ){          if (  sen >= sortthr && false){ // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!)
806            //printf(" IS A NUCLEUS! en = %f \n",sen);            //printf(" IS A NUCLEUS! en = %f \n",sen);
807            //            //
808            // is a nucleus use a different algorithm            // is a nucleus use a different algorithm
# Line 844  void PamLevel2::SortTracks(){ Line 895  void PamLevel2::SortTracks(){
895    
896                                    
897            if(            if(
898               use_TOF            &&               (use_TOF || use_S1 || use_S2 || use_S3)            &&
899               (nphit_p+nphit_i) !=0 &&                 (nphit_p+nphit_i) !=0 &&  
900               true){               true){
901                                            
# Line 891  void PamLevel2::SortTracks(){ Line 942  void PamLevel2::SortTracks(){
942            for (Int_t ih=0; ih < op->npmttdc; ih++){            for (Int_t ih=0; ih < op->npmttdc; ih++){
943              Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) );              Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) );
944  //          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++;
945              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 )) ){
946                  if( (op->tdcflag).At(ih)==0 )nphit_p++;
947                };
948            };            };
949                                    
950            for (Int_t ih=0; ih < oi->npmttdc; ih++){            for (Int_t ih=0; ih < oi->npmttdc; ih++){
951              Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) );              Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) );
952  //          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++;  
953              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 )) ){
954                  if( (oi->tdcflag).At(ih)==0 )nphit_i++;  
955                };
956            };            };
957                                    
958            if(            if(
959               (nphit_p+nphit_i) !=0 &&                 (nphit_p+nphit_i) !=0 &&  
960               true){               true){
961                                            
962              if     ( nphit_p > nphit_i) tp_score++;              if ( nphit_p != nphit_i ){
963              else if( nphit_p < nphit_i) ti_score++;                totp_score += nphit_p;
964              else ;//niente                toti_score += nphit_i;
965                  tp_score+=nphit_p;
966                  ti_score+=nphit_i;
967                };
968                //      if     ( nphit_p > nphit_i) tp_score+=nphit_p;
969                //      else if( nphit_p < nphit_i) ti_score+=nphit_i;
970                //      else ;//niente
971            };            };
972          };          };
973          //      cout << "TOF "<<tp_score<<ti_score<<endl;          //      cout << "TOF "<<tp_score<<ti_score<<endl;
# Line 928  void PamLevel2::SortTracks(){ Line 989  void PamLevel2::SortTracks(){
989  //      else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ;  //      else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ;
990    
991            // CHECK 1 : number of points along X              // CHECK 1 : number of points along X  
992            if ( tp->GetNX() >= ti->GetNX() )tp_score++ ;          if ( tp->GetNX() >= ti->GetNX() ){
993            if ( tp->GetNX() <= ti->GetNX() )ti_score++ ;            tp_score++ ;
994              totp_score++ ;
995            };
996            if ( tp->GetNX() <= ti->GetNX() ){
997              ti_score++ ;
998              toti_score++ ;
999            };
1000            // CHECK 2 : number of points along Y              // CHECK 2 : number of points along Y  
1001            if ( tp->GetNY() >= ti->GetNY() )tp_score++ ;          if ( tp->GetNY() >= ti->GetNY() ){
1002            if ( tp->GetNY() <= ti->GetNY() )ti_score++ ;            tp_score++ ;
1003              totp_score++ ;
1004            };
1005            if ( tp->GetNY() <= ti->GetNY() ){
1006              ti_score++ ;
1007              toti_score++ ;
1008            };
1009            // CHECK 3 : chi**2 along X              // CHECK 3 : chi**2 along X  
1010  //        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++ ;
1011  //        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 977  void PamLevel2::SortTracks(){ Line 1050  void PamLevel2::SortTracks(){
1050        };        };
1051                            
1052      }else{      }else{
1053          totp_score = 1;
1054          toti_score = 0;
1055          
1056        //            ts = tp;        //            ts = tp;
1057        //            cs = cp;        //            cs = cp;
1058        //            os = op;        //            os = op;
# Line 990  void PamLevel2::SortTracks(){ Line 1066  void PamLevel2::SortTracks(){
1066      //  cout<<"o "<<tp<<endl;      //  cout<<"o "<<tp<<endl;
1067      //  cout<<"o "<<cp<<endl;      //  cout<<"o "<<cp<<endl;
1068      //  cout<<"o "<<op<<endl;      //  cout<<"o "<<op<<endl;
1069    
1070      new(ttsorted[i]) PamTrack(tp,cp,op);      new(ttsorted[i]) PamTrack(tp,cp,op);
1071      new(ttimage[i])  PamTrack(ti,ci,oi);      new(ttimage[i])  PamTrack(ti,ci,oi);
1072    
1073        ((PamTrack*)(ttsorted[i]))->SetPScore(totp_score);
1074        ((PamTrack*)(ttimage[i]))->SetIScore(toti_score);
1075    };    };
1076    
1077    if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){    if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){
# Line 1980  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 2060  Bool_t PamLevel2::UpdateRunInfo(TChain *
2060             !(abstime >= GetRunInfo()->RUNHEADER_TIME &&             !(abstime >= GetRunInfo()->RUNHEADER_TIME &&
2061               abstime <= GetRunInfo()->RUNTRAILER_TIME)               abstime <= GetRunInfo()->RUNTRAILER_TIME)
2062            ) {            ) {
2063            printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",abstime);          printf(" Something very wrong here: cannot find RUN containing absolute time %llu \n",abstime);
2064            return false;            return false;
2065        }        }
2066        //        //
# Line 2031  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2111  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2111      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
2112      if(SELLI==0){      if(SELLI==0){
2113    
2114            // ---------------------------------------------------------------
2115            // increment dead and live-time counters
2116            // ---------------------------------------------------------------
2117            if( GetTrigLevel2() ){
2118                totdltime[0]+=GetTrigLevel2()->dltime[0];
2119                totdltime[1]+=GetTrigLevel2()->dltime[1];
2120            }
2121            totdltime[2]++;
2122    
2123    //      cout << setw(10)<<totdltime[0]<<setw(10)<<totdltime[1]<<setw(10)<<totdltime[2]<<endl;
2124    
2125            // ---------------------------------------------------------------
2126            // retrieve OBT and absolute time of the event
2127            // ---------------------------------------------------------------
2128          ULong64_t abstime = 0;          ULong64_t abstime = 0;
2129          ULong64_t obt     = 0;          ULong64_t obt     = 0;
2130          if( GetOrbitalInfo() ){          if( GetOrbitalInfo() ){
# Line 2061  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2155  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2155          };                };      
2156    
2157          // -----------------------------------------------------------------------          // -----------------------------------------------------------------------
2158          // if it is simulation, assigh abstime by end (temporaneo!!!)          // if it is simulation, assigh abstime by hand (temporaneo!!!)
2159          // -----------------------------------------------------------------------          // -----------------------------------------------------------------------
2160          if(ISGP){          if(ISGP){
2161              abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO              abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO
# Line 2090  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2184  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2184                  )                  )
2185                  && irun < run_tree->GetEntries() ){                  && irun < run_tree->GetEntries() ){
2186    
2187    
2188    
2189    
2190                // -----------------------------------------
2191                // store dead and live-time of previous run
2192                // -----------------------------------------
2193                if(fromfirst){
2194                    if(oldrun==irun){
2195                        /// decrement counters
2196                        if( GetTrigLevel2()){
2197                            totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time
2198                            totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time
2199                        }
2200                        totdltime[2]--;                              //event counter
2201                        cout << endl;
2202                        cout << "n.events     : "<<totdltime[2]<<endl;
2203                        cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl;
2204                        cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl;      
2205                    }else{
2206                        totdltime[0]=0;//live-time
2207                        totdltime[1]=0;//dead-time
2208                        totdltime[2]=0;                             //event counter
2209                        cout << " *** JUMP RUN *** irun "<<irun<<endl;
2210                    }
2211                    /// add an entry
2212                    if(run_tree_clone)
2213                        if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries())
2214                            run_tree_clone->GetBranch("DeadLiveTime")->Fill();
2215                    /// reset counters
2216                    if( GetTrigLevel2() ){
2217                        totdltime[0]=GetTrigLevel2()->dltime[0];//live-time
2218                        totdltime[1]=0;                         //dead-time
2219                    }
2220                    totdltime[2]=1;                             //event counter
2221                }
2222    
2223    
2224              irun++;              irun++;
2225              // ------------------------------------              // ------------------------------------
2226              // 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 2248  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2248              // -------------------------------------------------------------------              // -------------------------------------------------------------------
2249              if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift;              if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift;
2250              irunentry = 0;              irunentry = 0;
2251              prevshift = 0;              prevshift = 0;          
2252              run_tree->GetEntry(irun);                    run_tree->GetEntry(irun);      
2253              if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){              if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){
2254                  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 2268  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2268    
2269          // --------------------------------------          // --------------------------------------
2270          // ... otherwise          // ... otherwise
2271            // --------------------------------------
2272    
2273    
2274    
2275    //      // -----------------------------------------
2276    //      // store dead and live-time of previous run
2277    //      // -----------------------------------------
2278    //      // --------------------------------------------------------------
2279    //      // if the run is empty, fill the dead-live time branch with zeros
2280    //      // --------------------------------------------------------------
2281    //      /// if some runs have been jumped, fill with zeros
2282    //      if(irun-oldrun>1){
2283    //          ULong64_t  temp[3];
2284    //          temp[0]=totdltime[0];
2285    //          temp[1]=totdltime[1];
2286    //          temp[2]=totdltime[2];
2287    //          for(int i=oldrun+1; i<irun; irun++){
2288    //              totdltime[0]=0;
2289    //              totdltime[1]=0;
2290    //              totdltime[2]=0;
2291    //              cout << " ** JUMPED RUN **"<<endl;
2292    //              if(run_tree_clone)
2293    //                  if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries())
2294    //                      run_tree_clone->GetBranch("DeadLiveTime")->Fill();
2295    //          }
2296    //          totdltime[0]=temp[0];
2297    //          totdltime[1]=temp[1];
2298    //          totdltime[2]=temp[2];
2299    //      }
2300    //      /// decrement counters
2301    //      if( GetTrigLevel2() ){
2302    //          totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time
2303    //          totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time
2304    //      }
2305    //      totdltime[2]--;                              //event counter
2306    //      /// add an entry
2307    //      if(irun>0 ){
2308    //          cout << endl;
2309    //          cout << "n.events     : "<<totdltime[2]<<endl;
2310    //          cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl;
2311    //          cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl;      
2312    //          if(run_tree_clone)
2313    //              if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries())
2314    //                  run_tree_clone->GetBranch("DeadLiveTime")->Fill();
2315    //      }
2316    //      /// reset counters
2317    //      if( GetTrigLevel2() ){
2318    //          totdltime[0]=GetTrigLevel2()->dltime[0];//live-time
2319    //          totdltime[1]=0;                         //dead-time
2320    //      }
2321    //      totdltime[2]=1;                             //event counter
2322            
2323    
2324            // --------------------------------------
2325          // ---> exit with TRUE          // ---> exit with TRUE
2326          // --------------------------------------          // --------------------------------------
2327          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 2336  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2336              true ){              true ){
2337              cout << "* fragment *"<<endl;                            cout << "* fragment *"<<endl;              
2338          }          }
2339            
2340          return(true);              return(true);    
2341      };      };
2342      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# Line 2831  void PamLevel2::CreateCloneTrees(TFile * Line 3016  void PamLevel2::CreateCloneTrees(TFile *
3016      }      }
3017      cout << "----------------------------------------------------"<<endl;      cout << "----------------------------------------------------"<<endl;
3018    
3019        // ------------------------------------
3020        // add branch with dead and live times
3021        // ------------------------------------
3022        run_tree_clone->Branch("DeadLiveTime",totdltime,"dltime[3]/l");
3023        cout << "Run          : branch DeadLiveTime"<<endl;
3024    
3025    
3026      sel_tree_clone = new TTree("SelectionList","List of selected events ");      sel_tree_clone = new TTree("SelectionList","List of selected events ");
3027      sel_tree_clone->Branch("RunEntry",&irun,"runentry/L");      sel_tree_clone->Branch("RunEntry",&irun,"runentry/L");
# Line 2957  TTree* PamLevel2::GetCloneTree(TString n Line 3148  TTree* PamLevel2::GetCloneTree(TString n
3148  void PamLevel2::WriteCloneTrees(){  void PamLevel2::WriteCloneTrees(){
3149      cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl;      cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl;
3150      cout << "Write clones of PAMELA trees "<<endl;      cout << "Write clones of PAMELA trees "<<endl;
3151      cout << run_tree_clone->GetName()<<endl;          cout << run_tree_clone->GetName()<<endl;  
3152        if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries())
3153            run_tree_clone->GetBranch("DeadLiveTime")->Fill();
3154      run_tree_clone->Write();      run_tree_clone->Write();
3155      cout << sel_tree_clone->GetName()<<endl;          cout << sel_tree_clone->GetName()<<endl;    
3156      sel_tree_clone->Write();      sel_tree_clone->Write();
# Line 3297  Bool_t PamLevel2::SetDBConnection(){ Line 3490  Bool_t PamLevel2::SetDBConnection(){
3490      return true;      return true;
3491    
3492  }  }
3493    
3494    /**
3495     * \Brief Add a friend to the pamela chain.
3496     * @param cname name of the chain to be added
3497     */
3498    
3499    TChain* PamLevel2::AddFriend(TString cname){
3500    
3501        if(!GetPamTree()){
3502            cout << " TChain* PamLevel2::AddFriend(TString cname) --- a pamela tree must be created first"<<endl;
3503            return NULL;
3504        }
3505    
3506    
3507        TChain *c = new TChain( cname.Data() );
3508    
3509        TIter next( GetPamTree()->GetListOfFiles() );
3510        Int_t nf = 0;
3511        TChainElement* element = 0;    
3512        while ((element = (TChainElement*) next())) {      
3513            c->Add(element->GetTitle());
3514            nf++;
3515        }
3516    
3517        GetPamTree()->AddFriend(cname.Data());
3518    
3519        cout << "external chain created and added to pamela friends :"<<cname<<endl;
3520        cout << "n.files "<<nf<<endl;
3521        
3522    
3523        return c;    
3524    
3525    }

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.47

  ViewVC Help
Powered by ViewVC 1.1.23