/[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.35 by mocchiut, Wed Mar 21 13:52:15 2007 UTC revision 1.37 by mocchiut, Wed Mar 28 15:29:14 2007 UTC
# Line 200  void PamLevel2::Initialize(){ Line 200  void PamLevel2::Initialize(){
200    
201      tsorted=0;      tsorted=0;
202      timage=0;      timage=0;
203        
204        howtosort = "+CAL+TOF";
205        //howtosort = "+TOF";
206        sortthr = 100.;
207    
208  };  };
209  /**  /**
# Line 593  PamTrack* PamLevel2::GetStoredTrack(Int_ Line 597  PamTrack* PamLevel2::GetStoredTrack(Int_
597  }  }
598  //--------------------------------------  //--------------------------------------
599  //  //
600    
601    /**
602     * Sort physical (tracker) tracks and stores them in the TRefArray (of TrkTrack objects) which pointer is  PamLevel2::sorted_tracks. Left here as backward compatibility method.
603     **/
604    void PamLevel2::SortTracks(TString how){
605      printf(" WARNING! obsolete, use SortTracks() and SetSortingMethod(TString) instead! \n Setting sorting method to %s \n",how.Data());
606      howtosort = how;  
607      SortTracks();
608    };
609    
610  //  //
611  //--------------------------------------  //--------------------------------------
612  /**  /**
# Line 606  PamTrack* PamLevel2::GetStoredTrack(Int_ Line 620  PamTrack* PamLevel2::GetStoredTrack(Int_
620   *   *
621   * The total number of physical tracks is always given by GetNTracks() and the it-th physical track can be retrieved by means of the methods GetTrack(int it) and GetTrack(int it, TString how).   * The total number of physical tracks is always given by GetNTracks() and the it-th physical track can be retrieved by means of the methods GetTrack(int it) and GetTrack(int it, TString how).
622   */   */
623  void PamLevel2::SortTracks(TString how){  void PamLevel2::SortTracks(){
624      TString how = howtosort;
625    
626  //    cout <<" PamLevel2::SortTracks(TString how) "<<endl;    //    cout <<" PamLevel2::SortTracks(TString how) "<<endl;
627      if( !trk2_obj ){    if( !trk2_obj ){
628          cout << "void PamLevel2::SortTracks(TString how):  TrkLevel2 not loaded !!!";      cout << "void PamLevel2::SortTracks():  TrkLevel2 not loaded !!!";
629          return;      return;
630      };    };
631  //    cout << "call SortTracs() "<<endl;    //    cout << "call SortTracs() "<<endl;
632    //Save current Object count    //Save current Object count
633      Int_t ObjectNumber = TProcessID::GetObjectCount();    Int_t ObjectNumber = TProcessID::GetObjectCount();
634    
635  //    cout << "ObjectNumber  "<<ObjectNumber <<endl;    //    cout << "ObjectNumber  "<<ObjectNumber <<endl;
636    
637  //     if(!sorted_tracks)sorted_tracks = new TRefArray();    //     if(!sorted_tracks)sorted_tracks = new TRefArray();
638  //     sorted_tracks->Clear();    //     sorted_tracks->Clear();
639  //    sorted_tracks.Clear();    //    sorted_tracks.Clear();
640    
641      if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks());    if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks());
642      tsorted->Delete();    tsorted->Delete();
643      TClonesArray &ttsorted = *tsorted;    TClonesArray &ttsorted = *tsorted;
644      if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks());    if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks());
645      timage->Delete();    timage->Delete();
646      TClonesArray &ttimage = *timage;    TClonesArray &ttimage = *timage;
647    
648    
649      // loop over the tracks sorted by the tracker    // loop over the tracks sorted by the tracker
650      Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase);    Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase);
651      Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase);    Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase);
652      Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase);    Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase);
653            
654      if( !CAL2 &&  use_CAL) use_CAL = false;    if( !CAL2 &&  use_CAL) use_CAL = false;
655      if( !TOF &&  use_TOF) use_TOF = false;    if( !TOF &&  use_TOF) use_TOF = false;
656            
657      if( !TRK2 ){    if( !TRK2 ){
658  //      cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl;      //  cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl;
659          return;      return;
660      };    };
661    
662      //   cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl;    //   cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl;
663            
664      for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){    for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){
665                    
666          TrkTrack   *ts = 0;      TrkTrack   *ts = 0;
667          CaloTrkVar *cs = 0;      CaloTrkVar *cs = 0;
668          ToFTrkVar  *os = 0;      ToFTrkVar  *os = 0;
669                    
670          // get tracker tracks      // get tracker tracks
671          TrkTrack   *tp = trk2_obj->TrkLevel2::GetTrack(i);                    //tracker      TrkTrack   *tp = trk2_obj->TrkLevel2::GetTrack(i);                    //tracker
672          CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo());      CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo());
673          ToFTrkVar  *op = GetToFStoredTrack(tp->GetSeqNo());      ToFTrkVar  *op = GetToFStoredTrack(tp->GetSeqNo());
674    
675          TrkTrack   *ti = 0;              //tracker (image)      TrkTrack   *ti = 0;              //tracker (image)
676          CaloTrkVar *ci = 0;      CaloTrkVar *ci = 0;
677          ToFTrkVar  *oi = 0;      ToFTrkVar  *oi = 0;
678  //      cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl;      //  cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl;
679          // if track has an image, check image selection      // if track has an image, check image selection
680          if(tp->HasImage()){      if(tp->HasImage()){
681                            
682              ti = trk2_obj->TrkLevel2::GetTrackImage(i);              //tracker (image)        ti = trk2_obj->TrkLevel2::GetTrackImage(i);              //tracker (image)
683              ci = GetCaloStoredTrack(ti->GetSeqNo());        ci = GetCaloStoredTrack(ti->GetSeqNo());
684              oi = GetToFStoredTrack(ti->GetSeqNo());        oi = GetToFStoredTrack(ti->GetSeqNo());
685                            
686  //          cout << "its image "<<i << " "<<hex<< ti <<dec<< endl;        //            cout << "its image "<<i << " "<<hex<< ti <<dec<< endl;
687    
688              //assign starting scores        //assign starting scores
689              Int_t tp_score = 0;  //main track sorted by the tracker        Int_t tp_score = 0;  //main track sorted by the tracker
690              Int_t ti_score = 0;  //image track        Int_t ti_score = 0;  //image track
691                            
692              // ------------------------        // ------------------------
693              // calorimeter check        // calorimeter check
694              // ------------------------        // ------------------------
695              // check the Y spatial residual on the first calorimeter plane        // check the Y spatial residual on the first calorimeter plane
696              // (cut on calorimeter variables from Emiliano)        // (cut on calorimeter variables from Emiliano)
697              if( use_CAL && !calo2_obj ){        if( use_CAL && !calo2_obj ){
698                  cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but CaloLevel2 not loaded !!!";          cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!";
699                  return;          return;
700              };        };
701              if(        if(
702                  use_CAL            &&           use_CAL            &&
703                  calo2_obj->npcfit[1] > 15     &&   //no. of fit planes on Y view           calo2_obj->npcfit[1] > 5     &&   //no. of fit planes on Y view
704                  calo2_obj->varcfit[1] < 1000. &&  //fit variance on Y view           calo2_obj->varcfit[1] < 1000. &&  //fit variance on Y view
705                  cp && ci &&           cp && ci &&
706                  true){           true){
707    
708                                    
709                  Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p;          Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p;
710                  Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i;          Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i;
711                                    
712                  if(resy_p <= resy_i) tp_score++;          if(resy_p <= resy_i) tp_score++;
713                  else                 ti_score++;          else                 ti_score++;
714            
715            //      cout << "CALO "<<tp_score<<ti_score<<endl;
716    
717  //              cout << "CALO "<<tp_score<<ti_score<<endl;        };
718          // ------------------------
719          // TOF check
720          // ------------------------          
721          // check the number of hit pmts along the track
722          // on S12 S21 and S32, where paddles are parallel to Y axis
723          if( use_TOF && !tof_obj ){
724            cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!";
725            return;
726          };
727          if( use_TOF && op && oi ){
728                    
729            //
730            Float_t sen = 0.;
731            for (Int_t ih=0; ih < op->npmtadc; ih++){
732              Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) );
733              if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (op->dedx).At(ih);
734            };
735            for (Int_t ih=0; ih < oi->npmtadc; ih++){
736              Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) );
737              if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih);
738            };
739            //
740            if (  sen >= sortthr ){
741              //printf(" IS A NUCLEUS! en = %f \n",sen);
742              //
743              // is a nucleus use a different algorithm
744              //
745              Int_t nz = 6; Float_t zin[6];                                          // << define TOF z-coordinates
746              for(Int_t ip=0; ip<nz; ip++)
747                zin[ip] = tof_obj->ToFLevel2::GetZTOF(tof_obj->ToFLevel2::GetToFPlaneID(ip));     // << read ToF plane z-coordinates
748              Trajectory *tr = new Trajectory(nz,zin);
749              //
750              Int_t nphit_p =0;
751              Int_t nphit_i =0;
752              Float_t enhit_p = 0.;
753              Float_t enhit_i = 0.;
754              //
755              for (Int_t ih=0; ih < op->npmtadc; ih++){
756                Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) );
757                if(pl == 1 || pl == 2 || pl == 5){
758                  nphit_p++;
759                  enhit_p += (op->dedx).At(ih);
760                };
761              };
762              //
763              tp->DoTrack2(tr);
764              //
765              if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){
766                for (Int_t ih=0; ih < op->npmtadc; ih++){
767                  Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) );
768                  if(pl == 0){
769                    nphit_p++;
770                    enhit_p += (op->dedx).At(ih);
771                  };
772                };
773              };
774              if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){
775                for (Int_t ih=0; ih < op->npmtadc; ih++){
776                  Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) );
777                  if(pl == 3){
778                    nphit_p++;
779                    enhit_p += (op->dedx).At(ih);
780                  };
781                };
782              };
783              if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){
784                for (Int_t ih=0; ih < op->npmtadc; ih++){
785                  Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) );
786                  if(pl == 4){
787                    nphit_p++;
788                    enhit_p += (op->dedx).At(ih);
789                  };
790                };
791              };
792    
793              for (Int_t ih=0; ih < oi->npmtadc; ih++){
794                Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) );
795                if(pl == 1 || pl == 2 || pl == 5){
796                  nphit_i++;        
797                  enhit_i += (op->dedx).At(ih);
798              };              };
799              // ------------------------            };
800              // TOF check            //
801              // ------------------------                ti->DoTrack2(tr);
802              // check the number of hit pmts along the track            //
803              // on S12 S21 and S32, where paddles are parallel to Y axis            if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){
804              if( use_TOF && !tof_obj ){              for (Int_t ih=0; ih < oi->npmtadc; ih++){
805                  cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!";                Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) );
806                  return;                if(pl == 0){
807                    nphit_i++;
808                    enhit_i += (op->dedx).At(ih);
809                  };
810              };              };
811              if( use_TOF && op && oi ){            };
812              if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){
813                for (Int_t ih=0; ih < oi->npmtadc; ih++){
814                  Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) );
815                  if(pl == 3){
816                    nphit_i++;
817                    enhit_i += (op->dedx).At(ih);
818                  };
819                };
820              };
821              if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){
822                for (Int_t ih=0; ih < oi->npmtadc; ih++){
823                  Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) );
824                  if(pl == 4){
825                    nphit_i++;
826                    enhit_i += (op->dedx).At(ih);
827                  };
828                };
829              };            
830    
831                                    
832                  Int_t nphit_p =0;            if(
833                  Int_t nphit_i =0;               use_TOF            &&
834                 (nphit_p+nphit_i) !=0 &&  
835                 true){
836                        
837                //      printf(" seqno %i nphit_p %i nphit_i %i enhit_p %f enhit_i %f \n",trk2_obj->TrkLevel2::GetSeqNo(i),nphit_p,nphit_i,enhit_p,enhit_i);
838                //      printf(" score p %i score i %i \n",tp_score,ti_score);
839                //            if( enhit_p > enhit_i ) tp_score++;
840                //            if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++;
841                if ( nphit_p > nphit_i ) tp_score++;
842                if ( nphit_p < nphit_i ) ti_score++;
843                if ( nphit_p == nphit_i ){
844                  if ( enhit_p > enhit_i ) tp_score++;
845                  else ti_score++;
846                };
847                //      printf(" dopo score p %i score i %i \n",tp_score,ti_score);
848              };
849              delete tr;
850              //
851            } else {
852              //
853              // NOT a NUCLEUS
854              //
855              //printf(" NOT a NUCLEUS! en = %f \n",sen);
856    
857              Int_t nphit_p =0;
858              Int_t nphit_i =0;
859                                    
860                                    
861  /*                              cout << "track: npmtadc "<< op->npmtadc << endl;            /*                            cout << "track: npmtadc "<< op->npmtadc << endl;
862                                  cout << "track: npmttdc "<< op->npmttdc << endl;              cout << "track: npmttdc "<< op->npmttdc << endl;
863                                  cout << "image: npmtadc "<< oi->npmtadc << endl;              cout << "image: npmtadc "<< oi->npmtadc << endl;
864                                  cout << "image: npmttdc "<< oi->npmttdc << endl;*/              cout << "image: npmttdc "<< oi->npmttdc << endl;*/
865                                    
866                  for (Int_t ih=0; ih < op->npmtadc; ih++){            for (Int_t ih=0; ih < op->npmtadc; ih++){
867                      Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) );              Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) );
868                      if(pl == 1 || pl == 2 || pl == 5)nphit_p++;              if(pl == 1 || pl == 2 || pl == 5)nphit_p++;
869                  };            };
870                                    
871                  for (Int_t ih=0; ih < oi->npmtadc; ih++){            for (Int_t ih=0; ih < oi->npmtadc; ih++){
872                      Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) );              Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) );
873                      if(pl == 1 || pl == 2 || pl == 5)nphit_i++;              if(pl == 1 || pl == 2 || pl == 5)nphit_i++;
874                  };            };
875                                    
876                  if(            if(
877                      use_TOF            &&               use_TOF            &&
878                      (nphit_p+nphit_i) !=0 &&                   (nphit_p+nphit_i) !=0 &&  
879                      true){               true){
880                                            
881                      if( nphit_p >= nphit_i) tp_score++;              if( nphit_p >= nphit_i) tp_score++;
882                      else ti_score++;              else ti_score++;
883                  };            };
884  //              cout << "TOF "<<tp_score<<ti_score<<endl;          };
885              };          //      cout << "TOF "<<tp_score<<ti_score<<endl;
886              if(tp_score == ti_score) use_TRK = true;        };
887              // ------------------------        if(tp_score == ti_score) use_TRK = true;
888              // tracker check        // ------------------------
889              // ------------------------        // tracker check
890              // chi**2 difference is not always large enough to distinguish among        // ------------------------
891              // the real track and its image.        // chi**2 difference is not always large enough to distinguish among
892              // Tracker check will be applied always when calorimeter and tof information is ambiguous.        // the real track and its image.
893              if(use_TRK){        // Tracker check will be applied always when calorimeter and tof information is ambiguous.
894                  if(      tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ;        if(use_TRK){
895                  else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ;          if(      tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ;
896  //              cout << "TRK "<<tp_score<<ti_score<<endl;          else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ;
897              };          //      cout << "TRK "<<tp_score<<ti_score<<endl;
898          };
899                            
900              // ------------------------        // ------------------------
901              // the winner is....        // the winner is....
902              // ------------------------            // ------------------------          
903              if      (tp_score > ti_score) {        if      (tp_score > ti_score) {
904  //              ts = tp;//the track sorted by the tracker!!          //              ts = tp;//the track sorted by the tracker!!
905  //              cs = cp;          //              cs = cp;
906  //              os = op;          //              os = op;
907              }else if (tp_score < ti_score) {          //      cout << "It's primary!" << endl;
908                  ts = ti;//its image!!  
909                  cs = ci;        }else if (tp_score < ti_score) {
910                  os = oi;  
911            //      cout << "It's image!" << endl;
912                  ti = tp;//its image!!  
913                  ci = cp;          ts = ti;//its image!!
914                  oi = op;          cs = ci;
915            os = oi;
916                  tp = ts;//its image!!  
917                  cp = cs;          ti = tp;//its image!!
918                  op = os;          ci = cp;
919            oi = op;
920    
921            tp = ts;//its image!!
922            cp = cs;
923            op = os;
924    
925                                    
926              }else {        }else {
927  //              ts = tp;          //              ts = tp;
928  //              cs = cp;          //              cs = cp;
929  //              os = op;          //              os = op;
930  //                              cout << "Warning - track image ambiguity not solved" << endl;          cout << "Warning - track image ambiguity not solved" << endl;
931  //                              cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl;          //                              cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl;
932              };        };
933                            
934          }else{      }else{
935  //          ts = tp;        //            ts = tp;
936  //          cs = cp;        //            cs = cp;
937  //          os = op;        //            os = op;
938          };      };
939                    
940  //      cout <<" SortTracks() "<<i<<" -- "<<ts<<endl;      //  cout <<" SortTracks() "<<i<<" -- "<<ts<<endl;
941  //      sorted_tracks->Add(ts);//save the track in the sorted array      //  sorted_tracks->Add(ts);//save the track in the sorted array
942  //      sorted_tracks.Add(ts);//save the track in the sorted array      //  sorted_tracks.Add(ts);//save the track in the sorted array
943  //      sorted_tracks.Add(tp);//save the track in the sorted array      //  sorted_tracks.Add(tp);//save the track in the sorted array
944  //      cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl;      //  cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl;
945  //      cout<<"o "<<tp<<endl;      //  cout<<"o "<<tp<<endl;
946  //      cout<<"o "<<cp<<endl;      //  cout<<"o "<<cp<<endl;
947  //      cout<<"o "<<op<<endl;      //  cout<<"o "<<op<<endl;
948          new(ttsorted[i]) PamTrack(tp,cp,op);      new(ttsorted[i]) PamTrack(tp,cp,op);
949          new(ttimage[i])  PamTrack(ti,ci,oi);      new(ttimage[i])  PamTrack(ti,ci,oi);
950      };    };
951    
952      if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){    if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){
953          cout << "void PamLevel2::SortTracks(TString how): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl;      cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl;
954          tsorted->Delete(); tsorted=0;      tsorted->Delete(); tsorted=0;
955          timage->Delete(); timage=0;          timage->Delete(); timage=0;
956      }    }
957    
958      //Restore Object count    //Restore Object count
959      //To save space in the table keeping track of all referenced objects    //To save space in the table keeping track of all referenced objects
960      //We reset the object count to what it was at the beginning of the event.    //We reset the object count to what it was at the beginning of the event.
961      TProcessID::SetObjectCount(ObjectNumber);    TProcessID::SetObjectCount(ObjectNumber);
962            
963  };  };
964  //--------------------------------------  //--------------------------------------
# Line 833  void PamLevel2::SortTracks(TString how){ Line 982  void PamLevel2::SortTracks(TString how){
982  TClonesArray *PamLevel2::GetTracks(){  TClonesArray *PamLevel2::GetTracks(){
983    
984  //  *-*-*-*-*-*-*-*-*-*-*-*-*  //  *-*-*-*-*-*-*-*-*-*-*-*-*
985      SortTracks("+CAL+TOF");      SortTracks();
986  //  *-*-*-*-*-*-*-*-*-*-*-*-*  //  *-*-*-*-*-*-*-*-*-*-*-*-*
987    
988      return tsorted;      return tsorted;
# Line 852  PamTrack *PamLevel2::GetTrack(int it){ Line 1001  PamTrack *PamLevel2::GetTrack(int it){
1001    
1002  //    if(!trk2_obj) return 0;  //    if(!trk2_obj) return 0;
1003                    
1004  // //  *-*-*-*-*-*-*-*-*-*-*-*-*  // //  *-*-*-*+-*-*-*-*-*-*-*-*-*
1005  //     SortTracks("+CAL+TOF");  //     SortTracks("+CAL+TOF");
1006  // //  *-*-*-*-*-*-*-*-*-*-*-*-*  // //  *-*-*-*-*-*-*-*-*-*-*-*-*
1007  // //    if(!sorted_tracks)return 0;  // //    if(!sorted_tracks)return 0;
# Line 871  PamTrack *PamLevel2::GetTrack(int it){ Line 1020  PamTrack *PamLevel2::GetTrack(int it){
1020    
1021  //    cout << "PamLevel2::GetTrack(int it) "<<endl;  //    cout << "PamLevel2::GetTrack(int it) "<<endl;
1022  //  *-*-*-*-*-*-*-*-*-*-*-*-*  //  *-*-*-*-*-*-*-*-*-*-*-*-*
1023      SortTracks("+CAL+TOF");      SortTracks();
1024  //  *-*-*-*-*-*-*-*-*-*-*-*-*  //  *-*-*-*-*-*-*-*-*-*-*-*-*
1025      if(!tsorted)return 0;      if(!tsorted)return 0;
1026      if(!tsorted->GetEntries())return 0;      if(!tsorted->GetEntries())return 0;
# Line 928  PamTrack *PamLevel2::GetTrackImage(int i Line 1077  PamTrack *PamLevel2::GetTrackImage(int i
1077    
1078    
1079  //  *-*-*-*-*-*-*-*-*-*-*-*-*  //  *-*-*-*-*-*-*-*-*-*-*-*-*
1080      SortTracks("+CAL+TOF");      SortTracks();
1081  //  *-*-*-*-*-*-*-*-*-*-*-*-*  //  *-*-*-*-*-*-*-*-*-*-*-*-*
1082      if(!timage)return 0;      if(!timage)return 0;
1083      if(!timage->GetEntries())return 0;      if(!timage->GetEntries())return 0;
# Line 1327  TChain *PamLevel2::GetPamTree(TList *fl, Line 1476  TChain *PamLevel2::GetPamTree(TList *fl,
1476      };      };
1477            
1478      cout << "done chain \n";      cout << "done chain \n";
1479        cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl;
1480    
1481  //    UInt_t *found=0;  //    UInt_t *found=0;
1482  // Tracker  // Tracker
# Line 1412  TChain *PamLevel2::GetPamTree(TList *fl, Line 1562  TChain *PamLevel2::GetPamTree(TList *fl,
1562      }else{      }else{
1563          cout << "OrbitalInfo  : missing tree"<<endl;          cout << "OrbitalInfo  : missing tree"<<endl;
1564      };      };
1565        cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl;
1566    
1567      // Selection List      // Selection List
1568      if(L && SELLI==1) {      if(L && SELLI==1) {
# Line 1423  TChain *PamLevel2::GetPamTree(TList *fl, Line 1574  TChain *PamLevel2::GetPamTree(TList *fl,
1574          sel_tree = L;          sel_tree = L;
1575  //      if(!Trout)Trout=O;  //      if(!Trout)Trout=O;
1576  //      else Trout->AddFriend("SelectionList");  //      else Trout->AddFriend("SelectionList");
1577            cout << "----------------------------------------------------" <<endl;
1578      }else{      }else{
1579  //      cout << "SelectionList  : missing tree"<<endl;  //      cout << "SelectionList  : missing tree"<<endl;
1580          if(L)L->Delete();          if(L)L->Delete();
# Line 1692  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1844  Bool_t PamLevel2::UpdateRunInfo(TChain *
1844    //    //
1845    // check if we have already called once GetEntry, if not call it    // check if we have already called once GetEntry, if not call it
1846    //    //
1847        cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) --- NON FUNZIONA BENISSIMO.... "<<endl;
1848      if(!run){      if(!run){
1849            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;
1850            return(false);                    return(false);        
# Line 1707  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1860  Bool_t PamLevel2::UpdateRunInfo(TChain *
1860    // --------------------------------------    // --------------------------------------
1861    if(SELLI==0){    if(SELLI==0){
1862    
1863          //
1864          // the absolute time is necessary to relate the event with the run
1865          //
1866        if( !GetOrbitalInfo() ){        if( !GetOrbitalInfo() ){
1867            cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl;            cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl;
1868            return(false);            return(false);
1869        }        }
1870    
1871          //
1872          // the first time the routine is called, set run search from the beginning
1873          //
1874        if ( irun < 0LL ){        if ( irun < 0LL ){
1875            irun = 0LL;            irun = 0LL;
1876            run->GetEntry(irun);            run->GetEntry(irun);
1877            runfirstentry = 0LL;            runfirstentry = 0LL;
1878            runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS);            runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS);
1879            if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL;            if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL;
 //        cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;  
 //        cout << "runfirstentry "<<runfirstentry<<endl;  
 //        return(true);  
1880        };              };      
1881        //        //
1882         if ( irun == run->GetEntries()-1LL &&         if ( irun == run->GetEntries()-1LL &&
# Line 1800  Bool_t PamLevel2::UpdateRunInfo(TChain * Line 1956  Bool_t PamLevel2::UpdateRunInfo(TChain *
1956    //    //
1957  };  };
1958    
1959  // Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev){  Bool_t PamLevel2::UpdateRunInfo(Long64_t iev){
1960  //   //  
1961  //   // check if we have already called once GetEntry, if not call it      if(!run_tree){
1962  //   //          cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree not loaded"<<endl;
1963  //     if(!run_tree){          return false;
1964  //      cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree not loaded"<<endl;      }
1965  //      return false;      if ( run_tree->GetEntries() <= 0 ) {
1966  //     }          cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree is empty"<<endl;
1967  //     if ( run_tree->GetEntries() <= 0 ) {          return(false);
1968  //      cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree is empty"<<endl;      }
 //      return(false);  
 //     }  
 //   //  
1969        
1970  //   Int_t oldrun = irun;      Int_t oldrun = irun; // store current run index
1971  //   // --------------------------------------  
1972  //   // if it is a full file (not preselected)      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
1973  //   // --------------------------------------      // if it is a full file (not preselected)
1974  //   if(SELLI==0){      // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
1975        if(SELLI==0){
1976  //       if( !GetOrbitalInfo() ){  
1977  //        cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl;          // ---------------------------------------------------------------
1978  //        return(false);          // the absolute time is necessary to relate the event with the run
1979  //       }          // ---------------------------------------------------------------
1980            if( !GetOrbitalInfo() ){
1981  //       if ( irun < 0 ){              cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- missing OrbitalInfo "<<endl;
1982  //        irun = 0;              return(false);
1983  //        run_tree->GetEntry(irun);          }
1984  //        runfirstentry = iev;        
1985  //        if( iev != 0){          // -----------------------------------------------------------------------
1986  //            cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- WARNING -- "<<endl;          // the first time the routine is called, set run search from the beginning
1987  //        }          // -----------------------------------------------------------------------
1988  //       };                if ( irun < 0 ){
1989                irun = 0LL;
1990  //       bool fromfirst = true;              run_tree->GetEntry(irun);
1991            };      
1992  //       while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries() ){          //
1993  //        irun++;          bool fromfirst = true; // first loop over runs
1994  //        if( irun == run->GetEntries() ){          // ------------------------------------------------------
1995  //            if(!fromfirst){          // loop over runs to find the one that contains the event
1996  //                cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- event entry #"<<iev<<" does not belong to any run (should not happen)" <<endl;          // ------------------------------------------------------
1997  //                return false;          while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME &&    // check on absolute time (s)
1998  //            }                    GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) &&
1999  //            cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- reached end of run tree. searchin again from beginning (should not happen)" <<endl;                  !(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT &&         // additional check on OBT (ms)
2000  //            fromfirst = false;                    GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) &&
2001  //            irun =0;                  irun < run_tree->GetEntries() ){
2002  //        }              irun++;
2003  //        run_tree->GetEntry(irun);              // ------------------------------------
2004  //        runfirstentry = iev;              // if the end of run tree is reached...
2005  //       };              // ------------------------------------
2006  //       //              if( irun == run_tree->GetEntries() ){
2007  //       if ( irun == oldrun ) return(false);                  if(!fromfirst){
2008  //       //                      // -----------------------------------------------------
2009  //       cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;                      // if it happened already once and the run was not found
2010  //       cout << "runfirstentry "<<runfirstentry<<endl;                      // ---> exit with error
2011  //       prevshift = 0;                      // -----------------------------------------------------
2012  //       return(true);                          cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- event entry #"<<iev<<" does not belong to any run (should not happen)" <<endl;
2013  //   };                      return false;
2014  //   // ----------------------------------------------------                  }
2015  //   // if it is a preselected file (there is SelectionList)                  // -----------------------------------------
2016  //   // NBNB - the event tree MUST be read first                  // ...otherwise repeat search from beginning
2017  //   // ----------------------------------------------------                  // -----------------------------------------
2018  //   if(SELLI==1){                        cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- reached end of run tree. searchin again from beginning " <<endl;
2019  //       sel_tree->GetEntry(iev);                  fromfirst = false;
2020  //       if(irun != oldrun){                  irun = 0LL;
2021  //        run->GetEntry(irun);                  runfirstentry = 0LL;
2022  //        cout << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;              }
2023  //        prevshift = 0;              // -------------------------------------------------------------------
2024  //        return true;              // save the index of the first entry of the run, relative to pam_tree,
2025  //       }              // and read a new run
2026  //       return false;              // -------------------------------------------------------------------
2027  //   }              if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS);
2028                run_tree->GetEntry(irun);      
2029  //   return false;              if(GetRunInfo()->RUNHEADER_OBT>=GetRunInfo()->RUNTRAILER_OBT ){
2030  //   //                  cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<"  has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl;
2031  // };                  cout << "                                                            (NB!! in this case some events are assigned to a wrong run)"<<endl;
2032                }
2033            };
2034            // --------------------------------------
2035            // if there was no need to update the run
2036            // ---> exit with FALSE
2037            // --------------------------------------
2038            if ( irun == oldrun ) return(false);
2039    
2040            // --------------------------------------
2041            // ... otherwise
2042            // ---> exit with TRUE
2043            // --------------------------------------
2044            cout << endl << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;
2045            prevshift = 0;
2046            return(true);    
2047        };
2048        // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
2049        // if it is a preselected file (there is SelectionList)
2050        // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
2051        if(SELLI==1){      
2052            sel_tree->GetEntry(iev);
2053            if(irun != oldrun){
2054                run_tree->GetEntry(irun);
2055                cout << endl << " ))))) UPDATE RUN INFO (((((  @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl;
2056                prevshift = 0;
2057                return true;
2058            }
2059            return false;
2060        }
2061    
2062        return false;
2063        //
2064    };
2065  /**  /**
2066   * Update the runinfo informations (to be used to have Run infos event by event basis)   * Update the runinfo informations (to be used to have Run infos event by event basis)
2067   * @param run Pointer to the chain/tree which contains run infos   * @param run Pointer to the chain/tree which contains run infos
# Line 2516  void PamLevel2::CreateCloneTrees(TFile * Line 2702  void PamLevel2::CreateCloneTrees(TFile *
2702      cout << "Run          : branch RunInfo"<<endl;      cout << "Run          : branch RunInfo"<<endl;
2703      run_tree_clone->Branch("SoftInfo","SoftInfo",GetPointerTo("SoftInfo"));      run_tree_clone->Branch("SoftInfo","SoftInfo",GetPointerTo("SoftInfo"));
2704      cout << "Run          : branch SoftInfo"<<endl;      cout << "Run          : branch SoftInfo"<<endl;
2705                    // ------------------
2706        // replicate run tree
2707        // ------------------
2708        cout << "----------------------------------------------------"<<endl;
2709        cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl;
2710        for (Int_t i=0; i<run_tree->GetEntries(); i++){
2711            run_tree->GetEntry(i);
2712            cout << i<< "\t | "<<GetRunInfo()->ID<<"\t "<<GetRunInfo()->NEVENTS<< "\t "<<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME<<endl;
2713            run_tree_clone->Fill();
2714        }
2715        cout << "----------------------------------------------------"<<endl;
2716    
2717    
2718      sel_tree_clone = new TTree("SelectionList","List of selected events ");      sel_tree_clone = new TTree("SelectionList","List of selected events ");
# Line 2531  void PamLevel2::CreateCloneTrees(TFile * Line 2727  void PamLevel2::CreateCloneTrees(TFile *
2727              pam_tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1"));              pam_tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1"));
2728              pam_tree_clone[i]->BranchRef();              pam_tree_clone[i]->BranchRef();
2729              cout << "Tracker      : branch TrkLevel1"<<endl;              cout << "Tracker      : branch TrkLevel1"<<endl;
2730              cout << "CreateCloneTrees " << GetTrkLevel1()<<endl;  //          cout << "CreateCloneTrees " << GetTrkLevel1()<<endl;
2731          };          };
2732          if(TRK2) {          if(TRK2) {
2733              pam_tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2"));              pam_tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2"));
# Line 2692  Int_t PamLevel2::GetEntry(Long64_t iee){ Line 2888  Int_t PamLevel2::GetEntry(Long64_t iee){
2888      //      //
2889      if(!run_tree ){      if(!run_tree ){
2890          if ( TRK0 || CAL0 || TOF0 || RUN ) { //forse cosi` va bene per tornare 1?          if ( TRK0 || CAL0 || TOF0 || RUN ) { //forse cosi` va bene per tornare 1?
2891                  cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl;              cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl;
2892                  return 0;              return 0;
2893          }  else {          }  else {
2894                  return 1; //cosi` se non c'e` run esce qua...              return 1; //cosi` se non c'e` run esce qua...
2895          }          }
2896      }      }
2897    
2898      //-------------------------------      //-------------------------------
2899      ii = iee;      ii = iee;
2900  //    Bool_t UPDATED = UpdateRunInfo(run_tree,ii);  //    Bool_t UPDATED = UpdateRunInfo(run_tree,ii);
2901      Bool_t UPDATED = UpdateRunInfo(ii);  //    Bool_t UPDATED = UpdateRunInfo(ii);
2902        UpdateRunInfo(ii);
2903      if(SELLI==0)irunentry = iee-runfirstentry;      if(SELLI==0)irunentry = iee-runfirstentry;
2904      if(UPDATED && run_tree_clone)run_tree_clone->Fill();  //    if(UPDATED && run_tree_clone)run_tree_clone->Fill();
2905      
2906  //    cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl;  //    cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl;
2907    
2908      if( TRK0 || CAL0 || TOF0 )GetYodaEntry( );  //    cout << " irunentry "<<irunentry << endl;
2909    
2910        if( TRK0 || CAL0 || TOF0 ){
2911            if( !GetYodaEntry( ) ){
2912                cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl;
2913                return 0;
2914            }
2915        }
2916      return 1;      return 1;
2917    
2918  }  }
# Line 2841  Int_t PamLevel2::GetYodaEntry(){ Line 3044  Int_t PamLevel2::GetYodaEntry(){
3044            
3045      // patch      // patch
3046      if( irunentry < 0){      if( irunentry < 0){
3047          cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl;  //      cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl;
3048          irunentry=0LL;          irunentry=0LL;
3049      }      }
3050      //  ---------------------------------      //  ---------------------------------
3051      //  if file is NOT a preselected file      //  if file is NOT a preselected file
3052      //  ---------------------------------      //  ---------------------------------
3053      Long64_t quellagiusta = irunentry + (Long64_t)(run_obj->EV_FROM);      Long64_t quellagiusta = irunentry + (Long64_t)(run_obj->EV_FROM);
3054        //     cout << " irunentry "<<irunentry<<endl;
3055    //     cout << " EV_FROM "<<run_obj->EV_FROM<<endl;
3056    //     cout << " quellagiusta = irunentry + EV_FROM "<< quellagiusta << endl;
3057    
3058  //     cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl;  //     cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl;
3059  //     cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl;  //     cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl;
# Line 2878  Int_t PamLevel2::GetYodaEntry(){ Line 3083  Int_t PamLevel2::GetYodaEntry(){
3083      Int_t answer = 0;      Int_t answer = 0;
3084      Int_t shift =0;      Int_t shift =0;
3085      //    printf(" siamo qui %i %i \n",shift,prevshift);      //    printf(" siamo qui %i %i \n",shift,prevshift);
3086        Int_t maxshift = 100;
3087      do{      do{
3088          if(shift>0){              if(shift>0){    
3089              cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl;              cout << " PKTNUM  L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl;
3090                cout << "         RUN: ID "<< GetRunInfo()->ID << " ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<" ID_RUN_FRAG "<<GetRunInfo()->ID_RUN_FRAG << " EV_FROM "<<GetRunInfo()->EV_FROM  <<endl;
3091                cout << "         L2 <--> L0 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl;
3092          }          }
3093          answer = l0_tree->GetEntry(quellagiusta+(Long64_t)shift+(Long64_t)prevshift);          answer = l0_tree->GetEntry(quellagiusta+(Long64_t)shift+(Long64_t)prevshift);
3094          shift++;          shift++;
# Line 2902  Int_t PamLevel2::GetYodaEntry(){ Line 3110  Int_t PamLevel2::GetYodaEntry(){
3110            shift = -1;            shift = -1;
3111          };          };
3112    
3113      }while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() );      }while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift);
   
     if ( (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() ) cout << " Big trouble here, no such event in Level0 data! " <<endl;  
3114    
3115        if ( (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() || shift == maxshift ) {
3116            cout << " Big trouble here, no such event in Level0 data! " <<endl;
3117            return 0;
3118        }
3119  //    cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl;  //    cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl;
3120  //    return GetYodaTree()->GetEntry(quellagiusta);  //    return GetYodaTree()->GetEntry(quellagiusta);
3121      if ( shift > 1 ) prevshift += (shift-1);      if ( shift > 1 ) prevshift += (shift-1);

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.37

  ViewVC Help
Powered by ViewVC 1.1.23