/[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.95 by pam-ts, Wed Oct 15 08:51:51 2014 UTC revision 1.100 by mocchiut, Fri Oct 17 15:58:09 2014 UTC
# Line 374  PamTrack::PamTrack(ExtTrack* t, CaloTrkV Line 374  PamTrack::PamTrack(ExtTrack* t, CaloTrkV
374  PamTrack::PamTrack(const PamTrack& track) {  PamTrack::PamTrack(const PamTrack& track) {
375    
376    TrkTrack *t = track.trk_track;    TrkTrack *t = track.trk_track;
377      ExtTrack *e = track.trk_ext_track;
378    CaloTrkVar *c = track.calo_track;    CaloTrkVar *c = track.calo_track;
379    ToFTrkVar *o = track.tof_track;    ToFTrkVar *o = track.tof_track;
380    OrbitalInfoTrkVar *r = track.orb_track;    OrbitalInfoTrkVar *r = track.orb_track;
381    
382    trk_track = 0;    trk_ext_track = 0;
383    calo_track = 0;    trk_track     = 0;
384    tof_track = 0;    calo_track    = 0;
385    orb_track = 0;    tof_track     = 0;
386      orb_track     = 0;
387      if(e)
388          trk_ext_track = new ExtTrack(*e);
389    if (t)    if (t)
390      trk_track = new TrkTrack(*t);      trk_track = new TrkTrack(*t);
391    if (c)    if (c)
# Line 390  PamTrack::PamTrack(const PamTrack& track Line 394  PamTrack::PamTrack(const PamTrack& track
394      tof_track = new ToFTrkVar(*o);      tof_track = new ToFTrkVar(*o);
395    if (r)    if (r)
396      orb_track = new OrbitalInfoTrkVar(*r);      orb_track = new OrbitalInfoTrkVar(*r);
397    
398    candeleteobj = 1;    candeleteobj = 1;
399    pscore = 0;    pscore = 0;
400    iscore = 0;    iscore = 0;
401    
402  }  }
403  void PamTrack::Clear() {  void PamTrack::Clear(Option_t *option) {
404    
405    //    cout << "PamTrack::Clear() "<<candeleteobj<<endl;  //    cout << "PamTrack::Clear( "<<option<<" ) "<<candeleteobj<<endl;
406    if (candeleteobj) {    if (candeleteobj) {
407                
408      if (trk_ext_track)      if (trk_ext_track)
409        trk_ext_track->ExtTrack::Clear();        trk_ext_track->ExtTrack::Clear(option);
410      if (trk_track)      if (trk_track)
411        trk_track->TrkTrack::Clear();        trk_track->TrkTrack::Clear();
412      if (calo_track)      if (calo_track)
# Line 426  void PamTrack::Delete() { Line 431  void PamTrack::Delete() {
431    //    cout << "PamTrack::Delete() "<<candeleteobj<<endl;    //    cout << "PamTrack::Delete() "<<candeleteobj<<endl;
432    if (candeleteobj) {    if (candeleteobj) {
433      if (trk_ext_track) {      if (trk_ext_track) {
434        trk_ext_track->ExtTrack::Clear();        trk_ext_track->ExtTrack::Clear("C");
435        delete trk_ext_track;        delete trk_ext_track;
436      }      }
437      if (trk_track) {      if (trk_track) {
# Line 561  void PamLevel2::Initialize() { Line 566  void PamLevel2::Initialize() {
566    
567    run_obj = 0;//new GL_RUN();    run_obj = 0;//new GL_RUN();
568    soft_obj = 0;// Emiliano    soft_obj = 0;// Emiliano
569      proc_obj = 0;// Emiliano
570    irun = -1LL;    irun = -1LL;
571    irunt = -1LL;    irunt = -1LL;
572    totrunentry = 0LL;    totrunentry = 0LL;
# Line 571  void PamLevel2::Initialize() { Line 577  void PamLevel2::Initialize() {
577    gltsync = 0; // Emiliano    gltsync = 0; // Emiliano
578    fUpdateRunInfo = true; // Emiliano    fUpdateRunInfo = true; // Emiliano
579    fUseDBinRunInfo = true; // Emiliano    fUseDBinRunInfo = true; // Emiliano
580      fDiscarded = false; //EM
581    isSync = false; // by default assume that the level2 file(s) is(are) not sinchronized between L0/DB and L2, that is we miss some packets in L2 due to nested/DV-skipped events    isSync = false; // by default assume that the level2 file(s) is(are) not sinchronized between L0/DB and L2, that is we miss some packets in L2 due to nested/DV-skipped events
582    il0entry = 0LL;    il0entry = 0LL;
583    //  hasL0EE = true;    //  hasL0EE = true;
# Line 586  void PamLevel2::Initialize() { Line 593  void PamLevel2::Initialize() {
593    
594    run_tree = NULL;    run_tree = NULL;
595    run_tree_clone = NULL;    run_tree_clone = NULL;
596    
597      proc_tree = NULL;
598      proc_tree_clone = NULL;
599    
600    sel_tree = NULL;    sel_tree = NULL;
601    sel_tree_clone = NULL;    sel_tree_clone = NULL;
602    
# Line 633  void PamLevel2::Initialize() { Line 644  void PamLevel2::Initialize() {
644    ND = true;    ND = true;
645    AC = true;    AC = true;
646    ORB = true;    ORB = true;
647      PROC = true;
648    GP = false;    GP = false;
649    
650    EXT = false;    EXT = false;
651    NUC = false;    NUC = false;
652    trkAlg = "";//default tracking algorythm    trkAlg = "STD";//default tracking algorythm
653    
654    RUN = true;    RUN = true;
655    
# Line 675  void PamLevel2::Delete() { Line 687  void PamLevel2::Delete() {
687      delete run_obj;      delete run_obj;
688    if (soft_obj)    if (soft_obj)
689      delete soft_obj; //Emiliano      delete soft_obj; //Emiliano
690      if (proc_obj)
691        delete proc_obj; //Emiliano
692    
693    //    cout << "void PamLevel2::Clear()"<<endl;    //    cout << "void PamLevel2::Clear()"<<endl;
694    if (h0_obj)    if (h0_obj)
# Line 875  void PamLevel2::Clear() { Line 889  void PamLevel2::Clear() {
889      orb2_obj->Clear();      orb2_obj->Clear();
890    if (gp_obj)    if (gp_obj)
891      gp_obj->Clear();      gp_obj->Clear();
892      if (proc_obj)
893        proc_obj->Clear();
894    
895    //    if(sorted_tracks)sorted_tracks->Clear();    //    if(sorted_tracks)sorted_tracks->Clear();
896    //    sorted_tracks.Clear();    //    sorted_tracks.Clear();
# Line 978  void PamLevel2::Reset() { Line 994  void PamLevel2::Reset() {
994    ac_obj = 0;    ac_obj = 0;
995    orb2_obj = 0;    orb2_obj = 0;
996    gp_obj = 0;    gp_obj = 0;
997      proc_obj = 0;
998    
999    trk_ext_obj     = 0;    trk_ext_obj     = 0;
1000    trk_ext_nuc_obj = 0;    trk_ext_nuc_obj = 0;
# Line 1009  void PamLevel2::Reset() { Line 1026  void PamLevel2::Reset() {
1026    //    //
1027    run_obj = 0;//new GL_RUN();    run_obj = 0;//new GL_RUN();
1028    soft_obj = 0;// Emiliano    soft_obj = 0;// Emiliano
1029      proc_obj = 0;// Emiliano
1030    irun = -1;    irun = -1;
1031    irunt = -1;    irunt = -1;
1032    totrunentry = 0LL;    totrunentry = 0LL;
# Line 1183  void *PamLevel2::GetPointerTo(const char Line 1201  void *PamLevel2::GetPointerTo(const char
1201    if (!objname.CompareTo("SoftInfo"))    if (!objname.CompareTo("SoftInfo"))
1202      return &soft_obj; // Emiliano      return &soft_obj; // Emiliano
1203    
1204      if (!objname.CompareTo("ProcessingInfo")){
1205        if (!proc_obj)
1206          proc_obj = new ProcInfo();    
1207        return &proc_obj; // Emiliano
1208      }
1209    
1210    return NULL;    return NULL;
1211  }  }
1212  ;  ;
# Line 1448  void PamLevel2::SortTracks() { Line 1472  void PamLevel2::SortTracks() {
1472    // create TCloneArrays to store tracks and its images    // create TCloneArrays to store tracks and its images
1473    if (!tsorted)    if (!tsorted)
1474      tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());      tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
1475    tsorted->Delete();    tsorted->Clear("C+C");//Delete();
1476    TClonesArray &ttsorted = *tsorted;    TClonesArray &ttsorted = *tsorted;
1477    
1478    if (!timage)    if (!timage)
1479      timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());      timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
1480    timage->Delete();    timage->Clear("C+C");//Delete();
1481    TClonesArray &ttimage = *timage;    TClonesArray &ttimage = *timage;
1482    
1483    
# Line 1989  void PamLevel2::SortTracksNew() { Line 2013  void PamLevel2::SortTracksNew() {
2013    //-----------------------------------------------------------    //-----------------------------------------------------------
2014    // create/reset TCloneArrays to store tracks and their images    // create/reset TCloneArrays to store tracks and their images
2015    //-----------------------------------------------------------    //-----------------------------------------------------------
2016    
2017    //  cout << " PamLevel2::SortTracksNew() --- Clear TClonesArray objects"<<endl;
2018        
2019    // main tracks from standard alg    // main tracks from standard alg
2020    if (!tsorted)  //   if (!tsorted)
2021        tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());  //       tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
2022    tsorted->Delete();  //   tsorted->Clear("C+C");//Delete();
2023    // track images from standard alg  //   // track images from standard alg
2024    if (!timage)  //   if (!timage)
2025        timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());  //       timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
2026    timage->Delete();  //   timage->Clear("C+C");//Delete();
2027    // tracks from extended algorythm  //   // tracks from extended algorythm
2028    if(EXT && !text)  //   if(EXT && !text)
2029        text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries());  //       text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries());
2030    if(text)text->Delete();  //   if(text)text->Clear("C+C");//Delete();
2031    
2032      if(tsorted)delete tsorted;
2033      if(timage) delete timage;
2034      if(text)   delete text;
2035      tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
2036      timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
2037      text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries());
2038    
2039    //-----------------------------------------------------------    //-----------------------------------------------------------
2040    // create/reset TCloneArrays to store tracks and their images    // create/reset TCloneArrays to store tracks and their images
2041    //-----------------------------------------------------------    //-----------------------------------------------------------
2042    if(NUC){    if(NUC){
2043    
2044          
2045          if(tsorted_nuc)delete tsorted_nuc;
2046          if(timage_nuc) delete timage_nuc;
2047          if(text_nuc)   delete text_nuc;
2048          tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());
2049          timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());
2050          text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries());
2051    
2052    // main tracks from standard alg    // main tracks from standard alg
2053        if (!tsorted_nuc)  //       if (!tsorted_nuc)
2054            tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());  //        tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());
2055        tsorted_nuc->Delete();  //       tsorted_nuc->Clear("C+C");//Delete();
2056        // track images from standard alg  //       // track images from standard alg
2057        if (!timage_nuc)  //       if (!timage_nuc)
2058            timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());  //        timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());
2059        timage_nuc->Delete();  //       timage_nuc->Clear("C+C");//Delete();
2060        // tracks from extended algorythm  //       // tracks from extended algorythm
2061        if(EXT && !text_nuc)  //       if(EXT && !text_nuc)
2062            text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries());  //        text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries());
2063        if(text_nuc)text_nuc->Delete();  //       if(text_nuc)text_nuc->Clear("C+C");//Delete();
2064    
2065    }    }
2066    //--------------------------------------------------    //--------------------------------------------------
2067    // retrieve sorting method    // retrieve sorting method
# Line 2580  void PamLevel2::SortTracksNew() { Line 2623  void PamLevel2::SortTracksNew() {
2623  /**  /**
2624   * This method overrides TrkLevel2::GetTracks(), where sorting is done by decreasing number of fit points and increasing chi^2.   * This method overrides TrkLevel2::GetTracks(), where sorting is done by decreasing number of fit points and increasing chi^2.
2625   * PamLevel2::GetTracks() keeps the same track order given by TrkLevel2::GetTracks(), but checks image selection by using calorimeter and ToF tracking information.   * PamLevel2::GetTracks() keeps the same track order given by TrkLevel2::GetTracks(), but checks image selection by using calorimeter and ToF tracking information.
2626   /*   */
2627    
2628  // TRefArray *PamLevel2::GetTracks(){  // TRefArray *PamLevel2::GetTracks(){
2629    
# Line 2598  void PamLevel2::SortTracksNew() { Line 2641  void PamLevel2::SortTracksNew() {
2641  //  //
2642  //  //
2643  //--------------------------------------  //--------------------------------------
2644    
2645  /**  /**
2646   * Retrieves the it-th Pamela "physical" track.   * Retrieves the it-th Pamela "physical" track.
2647   * It override TrkLevel2::GetTrack(int it).   * It override TrkLevel2::GetTrack(int it).
2648   * @param it Track number, ranging from 0 to GetNTracks().   * @param it Track number, ranging from 0 to GetNTracks().
2649   */   */
2650  PamTrack *PamLevel2::GetTrack(int it) {  PamTrack *PamLevel2::GetTrackOld(int it) {
2651    
2652    PamTrack *track = NULL;    PamTrack *track = NULL;
2653    
# Line 2620  PamTrack *PamLevel2::GetTrack(int it) { Line 2664  PamTrack *PamLevel2::GetTrack(int it) {
2664      track = (PamTrack*)((*tsorted)[it]);      track = (PamTrack*)((*tsorted)[it]);
2665    }    }
2666    else {    else {
2667      cout << "PamLevel2::GetTrack(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = "      cout << "PamLevel2::GetTrackOld(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = "
2668          << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;          << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;
2669    };    };
2670    
# Line 2636  PamTrack *PamLevel2::GetTrack(int it) { Line 2680  PamTrack *PamLevel2::GetTrack(int it) {
2680   * @param it Track number, ranging from 0 to GetNTracks().   * @param it Track number, ranging from 0 to GetNTracks().
2681   * @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation.   * @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation.
2682   */   */
2683  PamTrack *PamLevel2::GetTrack(int it, char* alg) {  PamTrack *PamLevel2::GetTrack(int it, const char* alg) {
2684    
2685      TString s(alg);      TString s(alg);
2686      if(!s.CompareTo("") ||!s.CompareTo("STD") )return GetTrack(it); //old algorythm      if(!s.CompareTo("") ||!s.CompareTo("STD") )return GetTrackOld(it); //old algorythm
2687    
2688    
2689      SortTracksNew();      SortTracksNew();
# Line 2687  PamTrack *PamLevel2::GetTrack(int it, ch Line 2731  PamTrack *PamLevel2::GetTrack(int it, ch
2731      };      };
2732            
2733            
2734        cout << "PamTrack *PamLevel2::GetTrack("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl;
2735            
2736      return NULL;      return NULL;
2737    
# Line 2702  TClonesArray *PamLevel2::GetTracks() { Line 2747  TClonesArray *PamLevel2::GetTracks() {
2747    
2748  }  }
2749  ;  ;
2750  Int_t  PamLevel2::GetNTracks(char* alg) {  Int_t  PamLevel2::GetNTracks(const char* alg) {
2751    
2752    
2753  //    cout << " trk_nuc_obj->GetEntries() "<<trk_nuc_obj->GetEntries()<<" trk2_nuc_obj->GetNTracks() "<<trk2_nuc_obj->GetNTracks()<<endl;  //    cout << " trk_nuc_obj->GetEntries() "<<trk_nuc_obj->GetEntries()<<" trk2_nuc_obj->GetNTracks() "<<trk2_nuc_obj->GetNTracks()<<endl;
# Line 2723  Int_t  PamLevel2::GetNTracks(char* alg) Line 2768  Int_t  PamLevel2::GetNTracks(char* alg)
2768      if(s.Contains("NUC", TString::kIgnoreCase) && NUC )      if(s.Contains("NUC", TString::kIgnoreCase) && NUC )
2769          return trk2_nuc_obj->TrkLevel2::GetNTracks();          return trk2_nuc_obj->TrkLevel2::GetNTracks();
2770            
2771        cout << "Int_t  PamLevel2::GetNTracks("<<alg<<") -- unrecognised algorithm"<<endl;
2772    
2773      return 0;      return 0;
2774    
2775  }  }
# Line 2736  Int_t  PamLevel2::GetNTracks(char* alg) Line 2783  Int_t  PamLevel2::GetNTracks(char* alg)
2783   * Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks().   * Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks().
2784   * @param it Track number, ranging from 0 to GetNTracks().   * @param it Track number, ranging from 0 to GetNTracks().
2785   */   */
2786  PamTrack *PamLevel2::GetTrackImage(int it) {  PamTrack *PamLevel2::GetTrackImageOld(int it) {
2787    
2788    //  *-*-*-*-*-*-*-*-*-*-*-*-*    //  *-*-*-*-*-*-*-*-*-*-*-*-*
2789    SortTracks();    SortTracks();
# Line 2760  PamTrack *PamLevel2::GetTrackImage(int i Line 2807  PamTrack *PamLevel2::GetTrackImage(int i
2807      };      };
2808    }    }
2809    else {    else {
2810      cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = "      cout << "PamLevel2::GetTrackImageOld(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = "
2811          << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;          << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;
2812    };    };
2813    
# Line 2771  PamTrack *PamLevel2::GetTrackImage(int i Line 2818  PamTrack *PamLevel2::GetTrackImage(int i
2818   * @param it Track number, ranging from 0 to GetNTracks().   * @param it Track number, ranging from 0 to GetNTracks().
2819   * @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation.   * @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation.
2820   */   */
2821  PamTrack *PamLevel2::GetTrackImage(int it, char* alg) {  PamTrack *PamLevel2::GetTrackImage(int it, const char* alg) {
2822    
2823      TString s(alg);      TString s(alg);
2824      if(!s.CompareTo("") || !s.CompareTo("STD"))return GetTrack(it); //old algorythm      if(!s.CompareTo("") || !s.CompareTo("STD"))return GetTrackImageOld(it); //old algorythm
2825    
2826    
2827      SortTracksNew();      SortTracksNew();
# Line 2792  PamTrack *PamLevel2::GetTrackImage(int i Line 2839  PamTrack *PamLevel2::GetTrackImage(int i
2839                  PamTrack *temp = (PamTrack*) t[it];                  PamTrack *temp = (PamTrack*) t[it];
2840                  if (temp->GetTrkTrack()->HasImage()) {                  if (temp->GetTrkTrack()->HasImage()) {
2841                      return (PamTrack*)((*timage_nuc)[it]);                 //ok return the track                      return (PamTrack*)((*timage_nuc)[it]);                 //ok return the track
2842                    }else{
2843                        return NULL;
2844                  }                  }
2845                                    
2846              }              }
# Line 2805  PamTrack *PamLevel2::GetTrackImage(int i Line 2854  PamTrack *PamLevel2::GetTrackImage(int i
2854                  PamTrack *temp = (PamTrack*) t[it];                  PamTrack *temp = (PamTrack*) t[it];
2855                  if (temp->GetTrkTrack()->HasImage()) {                                if (temp->GetTrkTrack()->HasImage()) {              
2856                      return (PamTrack*)((*timage)[it]);                 //ok return the track                      return (PamTrack*)((*timage)[it]);                 //ok return the track
2857                    }else{
2858                        return NULL;
2859                  }                  }
2860              }              }
2861          }          }
2862    
2863      }      }
2864    
2865        cout << "PamTrack *PamLevel2::GetTrackImage("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl;
2866                
2867      return NULL;      return NULL;
2868    
# Line 3269  TChain *PamLevel2::GetPamTree(TList *fl, Line 3322  TChain *PamLevel2::GetPamTree(TList *fl,
3322    TChain *G = 0;    TChain *G = 0;
3323    
3324    TChain *L = 0;    TChain *L = 0;
3325      TChain *P = 0;
3326    
3327    if (TRK2 || TRK1 || TRKh)    if (TRK2 || TRK1 || TRKh)
3328      T = new TChain("Tracker");      T = new TChain("Tracker");
# Line 3288  TChain *PamLevel2::GetPamTree(TList *fl, Line 3342  TChain *PamLevel2::GetPamTree(TList *fl,
3342      B = new TChain("OrbitalInfo");      B = new TChain("OrbitalInfo");
3343    if (GP)    if (GP)
3344      G = new TChain("h20");      G = new TChain("h20");
3345      if (PROC)
3346        P = new TChain("ProcessingInfo");
3347    L = new TChain("SelectionList");    L = new TChain("SelectionList");
3348    
3349    // loop over files and create chains    // loop over files and create chains
# Line 3315  TChain *PamLevel2::GetPamTree(TList *fl, Line 3371  TChain *PamLevel2::GetPamTree(TList *fl,
3371          B->Add(name);          B->Add(name);
3372        if (GP)        if (GP)
3373          G->Add(name);          G->Add(name);
3374          if (P)
3375            P->Add(name);
3376        if (SELLI == 1)        if (SELLI == 1)
3377          L->Add(name);          L->Add(name);
3378       };       };
# Line 3440  TChain *PamLevel2::GetPamTree(TList *fl, Line 3498  TChain *PamLevel2::GetPamTree(TList *fl,
3498        L->Delete();        L->Delete();
3499    };    };
3500    
3501      //ProcessingInfo EM
3502      if ( P && P->GetEntries() ){
3503        cout << "----------------------------------------------------" << endl;
3504        cout << ">>> Found ProcessingInfo <<<" << endl;
3505        //  L->SetBranchAddress("RunEntry",&irun);
3506        P->SetBranchAddress("ProcInfo", &proc_obj);//NEWNEW
3507      }
3508    //  --------------------------------------------    //  --------------------------------------------
3509    //  return the pamela chain with all the friends    //  return the pamela chain with all the friends
3510    //  --------------------------------------------    //  --------------------------------------------
# Line 3767  void PamLevel2::SetBranchAddress(TChain Line 3832  void PamLevel2::SetBranchAddress(TChain
3832   * "NUCEXT" --> as "EXT", but for nuclei   * "NUCEXT" --> as "EXT", but for nuclei
3833   * "NUCEXTF" --> as "EXTF", but for nuclei   * "NUCEXTF" --> as "EXTF", but for nuclei
3834   */   */
3835  void PamLevel2::SetTrakingAlgorythm(char *alg){  // void PamLevel2::SetTrackingAlgorythm(const char *alg){
3836    
3837    
3838      TString s(alg);  //     TString s(alg);
3839      if(s.Contains("NUC", TString::kIgnoreCase) && !NUC)  //     if(s.Contains("NUC", TString::kIgnoreCase) && !NUC)
3840          cout << "Warning! NUC algorythm requested, but branches are missing"<<endl;  //      cout << "Warning! NUC algorythm requested, but branches are missing"<<endl;
3841      if(s.Contains("EXT", TString::kIgnoreCase) && !EXT)  //     if(s.Contains("EXT", TString::kIgnoreCase) && !EXT)
3842          cout << "Warning! EXT algorythm requested, but branches are missing"<<endl;;  //      cout << "Warning! EXT algorythm requested, but branches are missing"<<endl;;
3843                            
3844      trkAlg = alg;  //     trkAlg = alg;
3845    
3846  };  // };
3847  char* PamLevel2::GetTrakingAlgorythm(){  // const char* PamLevel2::GetTrackingAlgorythm(){
3848    
3849    
3850      cout<<endl<<" Implemented tracking algorythm: ";  //     cout<<endl<<" Implemented tracking algorythm: ";
3851      cout<<endl<<"  \"\" or \"STD\"  --> take the output of the standard tracking algorythm";  //     cout<<endl<<"  \"\" or \"STD\"  --> take the output of the standard tracking algorythm";
3852      cout<<endl<<"  \"NUC\"      --> take the output of the standard tracking algorythm for nuclei cluster selection";  //     cout<<endl<<"  \"NUC\"      --> take the output of the standard tracking algorythm for nuclei cluster selection";
3853      cout<<endl<<"  \"EXT\"      --> in case the standard tracking algorythm has not found any track,";  //     cout<<endl<<"  \"EXT\"      --> in case the standard tracking algorythm has not found any track,";
3854      cout<<endl<<"                 take the output of the extended one";  //     cout<<endl<<"                 take the output of the extended one";
3855      cout<<endl<<"  \"EXTF\"     --> force the extended tracking algorythm";  //     cout<<endl<<"  \"EXTF\"     --> force the extended tracking algorythm";
3856      cout<<endl<<"  \"NUCEXT\"   --> as \"EXT\", but for nuclei ";  //     cout<<endl<<"  \"NUCEXT\"   --> as \"EXT\", but for nuclei ";
3857      cout<<endl<<"  \"NUCEXTF\"  --> as \"EXTF\", but for nuclei";  //     cout<<endl<<"  \"NUCEXTF\"  --> as \"EXTF\", but for nuclei";
3858    
3859      cout<<endl;  //     cout<<endl;
3860      cout<<" <<Currently set algorythm>> "<<trkAlg<<endl;  //     cout<<" <<Currently set algorythm>> "<<trkAlg<<endl;
3861      cout<<endl;  //     cout<<endl;
3862    
3863      return trkAlg;  //     return trkAlg;
3864  };  // };
3865    
3866    
3867    
# Line 4537  void PamLevel2::GetWhichTrees(TFile* f) Line 4602  void PamLevel2::GetWhichTrees(TFile* f)
4602    //    cout << "Checking file: "<<f->GetName()<<endl;    //    cout << "Checking file: "<<f->GetName()<<endl;
4603    if (!f || f->IsZombie()) {    if (!f || f->IsZombie()) {
4604      cout << "File: " << f->GetName() << " Non valid root file" << endl;      cout << "File: " << f->GetName() << " Non valid root file" << endl;
4605        fDiscarded = true;
4606      return;      return;
4607    }    }
4608    
# Line 4743  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4809  Bool_t PamLevel2::CheckLevel2File(TStrin
4809    TFile *f = new TFile(name.Data());    TFile *f = new TFile(name.Data());
4810    if (!f || f->IsZombie()) {    if (!f || f->IsZombie()) {
4811      cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl;      cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl;
4812        fDiscarded = true;
4813      return false;      return false;
4814    }    }
4815    //    cout << "Get list of keys: "<<f<<endl;    //    cout << "Get list of keys: "<<f<<endl;
# Line 4781  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4848  Bool_t PamLevel2::CheckLevel2File(TStrin
4848          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4849            cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt            cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt
4850                << " events instead of " << nev << endl;                << " events instead of " << nev << endl;
4851              fDiscarded = true;
4852            return false;            return false;
4853          }          }
4854          nev = nevt;          nev = nevt;
# Line 4795  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4863  Bool_t PamLevel2::CheckLevel2File(TStrin
4863          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4864            cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of "
4865                << nev << endl;                << nev << endl;
4866              fDiscarded = true;
4867            return false;            return false;
4868          }          }
4869          nev = nevt;          nev = nevt;
# Line 4808  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4877  Bool_t PamLevel2::CheckLevel2File(TStrin
4877          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4878            cout << "File: " << f->GetName() << " discarded ---- ToF tree has " << nevt << " events instead of " << nev            cout << "File: " << f->GetName() << " discarded ---- ToF tree has " << nevt << " events instead of " << nev
4879                << endl;                << endl;
4880              fDiscarded = true;
4881            return false;            return false;
4882          }          }
4883          nev = nevt;          nev = nevt;
# Line 4821  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4891  Bool_t PamLevel2::CheckLevel2File(TStrin
4891          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4892            cout << "File: " << f->GetName() << " discarded ---- S4 tree has " << nevt << " events instead of " << nev            cout << "File: " << f->GetName() << " discarded ---- S4 tree has " << nevt << " events instead of " << nev
4893                << endl;                << endl;
4894              fDiscarded = true;
4895            return false;            return false;
4896          }          }
4897          nev = nevt;          nev = nevt;
# Line 4835  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4906  Bool_t PamLevel2::CheckLevel2File(TStrin
4906          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4907            cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of "
4908                << nev << endl;                << nev << endl;
4909              fDiscarded = true;
4910            return false;            return false;
4911          }          }
4912          nev = nevt;          nev = nevt;
# Line 4848  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4920  Bool_t PamLevel2::CheckLevel2File(TStrin
4920          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4921            cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of "
4922                << nev << endl;                << nev << endl;
4923              fDiscarded = true;
4924            return false;            return false;
4925          }          }
4926          nev = nevt;          nev = nevt;
# Line 4861  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4934  Bool_t PamLevel2::CheckLevel2File(TStrin
4934          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4935            cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of "
4936                << nev << endl;                << nev << endl;
4937              fDiscarded = true;
4938            return false;            return false;
4939          }          }
4940          nev = nevt;          nev = nevt;
# Line 4874  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4948  Bool_t PamLevel2::CheckLevel2File(TStrin
4948          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4949            cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of "
4950                << nev << endl;                << nev << endl;
4951              fDiscarded = true;
4952            return false;            return false;
4953          }          }
4954          nev = nevt;          nev = nevt;
# Line 4897  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4972  Bool_t PamLevel2::CheckLevel2File(TStrin
4972          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4973            cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of "
4974                << nev << endl;                << nev << endl;
4975              fDiscarded = true;
4976            return false;            return false;
4977          }          }
4978          nev = nevt;          nev = nevt;
# Line 4919  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4995  Bool_t PamLevel2::CheckLevel2File(TStrin
4995          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4996            cout << "File: " << f->GetName() << " discarded ---- h20 tree has " << nevt << " events instead of " << nev            cout << "File: " << f->GetName() << " discarded ---- h20 tree has " << nevt << " events instead of " << nev
4997                << endl;                << endl;
4998              fDiscarded = true;
4999            return false;            return false;
5000          }          }
5001          nev = nevt;          nev = nevt;
# Line 4931  Bool_t PamLevel2::CheckLevel2File(TStrin Line 5008  Bool_t PamLevel2::CheckLevel2File(TStrin
5008      SELLI = (Int_t) SELLI__ok;      SELLI = (Int_t) SELLI__ok;
5009    if (SELLI == 0 && SELLI__ok) {    if (SELLI == 0 && SELLI__ok) {
5010      cout << "File: " << f->GetName() << " discarded ---- found SelectionList (it is not a full-event file)" << endl;      cout << "File: " << f->GetName() << " discarded ---- found SelectionList (it is not a full-event file)" << endl;
5011        fDiscarded = true;
5012      return false;      return false;
5013    }    }
5014    if (SELLI == 1 && !SELLI__ok) {    if (SELLI == 1 && !SELLI__ok) {
5015      cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl;      cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl;
5016        fDiscarded = true;
5017      return false;      return false;
5018    }    }
5019    
# Line 4973  Bool_t PamLevel2::CheckLevel2File(TStrin Line 5052  Bool_t PamLevel2::CheckLevel2File(TStrin
5052    
5053    if (CAL1 && !CAL1__ok) {    if (CAL1 && !CAL1__ok) {
5054      cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl;
5055        fDiscarded = true;
5056      return false;      return false;
5057    };    };
5058    if (CAL2 && !CAL2__ok) {    if (CAL2 && !CAL2__ok) {
5059      cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl;
5060        fDiscarded = true;
5061      return false;      return false;
5062    };    };
5063    if (TRK2 && !TRK2__ok) {    if (TRK2 && !TRK2__ok) {
5064      cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl;
5065        fDiscarded = true;
5066      return false;      return false;
5067    };    };
5068    if (TRK1 && !TRK1__ok) {    if (TRK1 && !TRK1__ok) {
5069      cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl;
5070        fDiscarded = true;
5071      return false;      return false;
5072    };    };
5073    if (TRKh && !TRKh__ok) {    if (TRKh && !TRKh__ok) {
5074      cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl;
5075        fDiscarded = true;
5076      return false;      return false;
5077    };    };
5078    if (ORB && !ORB__ok) {    if (ORB && !ORB__ok) {
5079      cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl;
5080        fDiscarded = true;
5081      return false;      return false;
5082    };    };
5083    if (AC && !AC__ok) {    if (AC && !AC__ok) {
5084      cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl;
5085        fDiscarded = true;
5086      return false;      return false;
5087    };    };
5088    if (S4 && !S4__ok) {    if (S4 && !S4__ok) {
5089      cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl;
5090        fDiscarded = true;
5091      return false;      return false;
5092    };    };
5093    if (TOF && !TOF__ok) {    if (TOF && !TOF__ok) {
5094      cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl;
5095        fDiscarded = true;
5096      return false;      return false;
5097    };    };
5098    
5099    if (ND && !ND__ok) {    if (ND && !ND__ok) {
5100      cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl;
5101        fDiscarded = true;
5102      return false;      return false;
5103    };    };
5104    if (TRG && !TRG__ok) {    if (TRG && !TRG__ok) {
5105      cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl;
5106        fDiscarded = true;
5107      return false;      return false;
5108    };    };
5109    if (GP && !GP__ok) {    if (GP && !GP__ok) {
5110      cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl;
5111        fDiscarded = true;
5112      return false;      return false;
5113    };    };
5114    
# Line 5117  void PamLevel2::CreateCloneTrees(TFile * Line 5208  void PamLevel2::CreateCloneTrees(TFile *
5208      //  cout << i<< "\t | "<<GetRunInfo()->ID<<"\t "<<GetRunInfo()->NEVENTS<< "\t "<<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME<<endl;      //  cout << i<< "\t | "<<GetRunInfo()->ID<<"\t "<<GetRunInfo()->NEVENTS<< "\t "<<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME<<endl;
5209      run_tree_clone->Fill();      run_tree_clone->Fill();
5210    }    }
5211    cout << "----------------------------------------------------" << endl;    if ( PROC ){
5212        proc_tree_clone->Branch("ProcessingInfo", "ProcInfo", GetPointerTo("ProcessingInfo"));
5213        cout << "ProcessingInfo: branch ProcessingInfo" << endl;  
5214        // ------------------
5215        // replicate processinginfo tree
5216        // ------------------
5217        //    cout << "----------------------------------------------------"<<endl;
5218        //    cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl;
5219        for (Int_t i = 0; i < proc_tree->GetEntries(); i++) {
5220          proc_tree->GetEntry(i);
5221          //        cout << i<< "\t | "<<GetRunInfo()->ID<<"\t "<<GetRunInfo()->NEVENTS<< "\t "<<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME<<endl;
5222          proc_tree_clone->Fill();
5223        }
5224        if ( SELLI != 2 || true ){      
5225          proc_obj->runID = 0;
5226          TTimeStamp *dt = new TTimeStamp();
5227          proc_obj->date = dt->AsString();
5228          delete dt;
5229          proc_obj->commandLine = Form("PamelaLevel2 was called");
5230          proc_obj->outputFilename = "";
5231          proc_obj->localDir = gSystem->WorkingDirectory();
5232          proc_obj->uname = gSystem->GetFromPipe("uname -a");
5233          proc_obj->DB = Form("mysql://%s/%s",dbc->GetHost(),dbc->GetDB());
5234          proc_tree_clone->Fill();
5235        }
5236        cout << "----------------------------------------------------" << endl;
5237      }
5238    // ------------------------------------    // ------------------------------------
5239    // add branch with dead and live times    // add branch with dead and live times
5240    // ------------------------------------    // ------------------------------------
# Line 5309  TTree* PamLevel2::GetCloneTree(TString n Line 5425  TTree* PamLevel2::GetCloneTree(TString n
5425      if (!name.CompareTo(na))      if (!name.CompareTo(na))
5426        return sel_tree_clone;        return sel_tree_clone;
5427    }    }
5428      if (proc_tree_clone && PROC) {
5429        TString na = proc_tree_clone->GetName();
5430        if (!name.CompareTo(na))
5431          return proc_tree_clone;
5432      }
5433    return NULL;    return NULL;
5434    
5435  }  }
# Line 5328  void PamLevel2::WriteCloneTrees() { Line 5449  void PamLevel2::WriteCloneTrees() {
5449    for (Int_t i = 0; i < NCLONES; i++) {    for (Int_t i = 0; i < NCLONES; i++) {
5450      if (pam_tree_clone[i]) {      if (pam_tree_clone[i]) {
5451        cout << pam_tree_clone[i]->GetName() << endl;        cout << pam_tree_clone[i]->GetName() << endl;
5452        pam_tree_clone[i]->Write();        pam_tree_clone[i]->Write(pam_tree_clone[i]->GetName(),TObject::kOverwrite);
5453      };      };
5454    }    }
5455      
5456      if ( PROC ){
5457        proc_tree_clone->Write("ProcessingInfo",TObject::kOverwrite);
5458      }
5459    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;
5460    
5461  }  }

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.100

  ViewVC Help
Powered by ViewVC 1.1.23