/[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.99 by mocchiut, Fri Oct 17 15:08:35 2014 UTC revision 1.108 by emocchiutti, Fri Oct 17 19:55:11 2014 UTC
# Line 566  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 592  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 623  void PamLevel2::Initialize() { Line 628  void PamLevel2::Initialize() {
628    if (strcmp(pamdbpsw, ""))    if (strcmp(pamdbpsw, ""))
629      psw = pamdbpsw;      psw = pamdbpsw;
630    
631      customString = "";
632    
633    //    sorted_tracks = 0;//new TRefArray();    //    sorted_tracks = 0;//new TRefArray();
634    
635    CAL0 = false;    CAL0 = false;
# Line 639  void PamLevel2::Initialize() { Line 646  void PamLevel2::Initialize() {
646    ND = true;    ND = true;
647    AC = true;    AC = true;
648    ORB = true;    ORB = true;
649      PROC = true;
650    GP = false;    GP = false;
651    
652    EXT = false;    EXT = false;
# Line 681  void PamLevel2::Delete() { Line 689  void PamLevel2::Delete() {
689      delete run_obj;      delete run_obj;
690    if (soft_obj)    if (soft_obj)
691      delete soft_obj; //Emiliano      delete soft_obj; //Emiliano
692      if (proc_obj)
693        delete proc_obj; //Emiliano
694    
695    //    cout << "void PamLevel2::Clear()"<<endl;    //    cout << "void PamLevel2::Clear()"<<endl;
696    if (h0_obj)    if (h0_obj)
# Line 881  void PamLevel2::Clear() { Line 891  void PamLevel2::Clear() {
891      orb2_obj->Clear();      orb2_obj->Clear();
892    if (gp_obj)    if (gp_obj)
893      gp_obj->Clear();      gp_obj->Clear();
894      if (proc_obj)
895        proc_obj->Clear();
896    
897    //    if(sorted_tracks)sorted_tracks->Clear();    //    if(sorted_tracks)sorted_tracks->Clear();
898    //    sorted_tracks.Clear();    //    sorted_tracks.Clear();
# Line 961  void PamLevel2::Reset() { Line 973  void PamLevel2::Reset() {
973    if (sel_tree)    if (sel_tree)
974      sel_tree->Delete();;      sel_tree->Delete();;
975    sel_tree = NULL;    sel_tree = NULL;
976    
977      if (proc_tree)
978        proc_tree->Delete();
979      proc_tree = NULL;
980    //    //
981    // Close file    // Close file
982    //    //
# Line 984  void PamLevel2::Reset() { Line 1000  void PamLevel2::Reset() {
1000    ac_obj = 0;    ac_obj = 0;
1001    orb2_obj = 0;    orb2_obj = 0;
1002    gp_obj = 0;    gp_obj = 0;
1003      proc_obj = 0;
1004    
1005    trk_ext_obj     = 0;    trk_ext_obj     = 0;
1006    trk_ext_nuc_obj = 0;    trk_ext_nuc_obj = 0;
# Line 1015  void PamLevel2::Reset() { Line 1032  void PamLevel2::Reset() {
1032    //    //
1033    run_obj = 0;//new GL_RUN();    run_obj = 0;//new GL_RUN();
1034    soft_obj = 0;// Emiliano    soft_obj = 0;// Emiliano
1035      proc_obj = 0;// Emiliano
1036    irun = -1;    irun = -1;
1037    irunt = -1;    irunt = -1;
1038    totrunentry = 0LL;    totrunentry = 0LL;
# Line 1189  void *PamLevel2::GetPointerTo(const char Line 1207  void *PamLevel2::GetPointerTo(const char
1207    if (!objname.CompareTo("SoftInfo"))    if (!objname.CompareTo("SoftInfo"))
1208      return &soft_obj; // Emiliano      return &soft_obj; // Emiliano
1209    
1210      if (!objname.CompareTo("ProcInfo")){
1211        if (!proc_obj)
1212          proc_obj = new ProcInfo();    
1213        return &proc_obj; // Emiliano
1214      }
1215    
1216    return NULL;    return NULL;
1217  }  }
1218  ;  ;
# Line 3304  TChain *PamLevel2::GetPamTree(TList *fl, Line 3328  TChain *PamLevel2::GetPamTree(TList *fl,
3328    TChain *G = 0;    TChain *G = 0;
3329    
3330    TChain *L = 0;    TChain *L = 0;
3331      TChain *P = 0;
3332    
3333    if (TRK2 || TRK1 || TRKh)    if (TRK2 || TRK1 || TRKh)
3334      T = new TChain("Tracker");      T = new TChain("Tracker");
# Line 3323  TChain *PamLevel2::GetPamTree(TList *fl, Line 3348  TChain *PamLevel2::GetPamTree(TList *fl,
3348      B = new TChain("OrbitalInfo");      B = new TChain("OrbitalInfo");
3349    if (GP)    if (GP)
3350      G = new TChain("h20");      G = new TChain("h20");
3351      if (PROC)
3352        P = new TChain("ProcessingInfo");
3353    L = new TChain("SelectionList");    L = new TChain("SelectionList");
3354    
3355    // loop over files and create chains    // loop over files and create chains
# Line 3350  TChain *PamLevel2::GetPamTree(TList *fl, Line 3377  TChain *PamLevel2::GetPamTree(TList *fl,
3377          B->Add(name);          B->Add(name);
3378        if (GP)        if (GP)
3379          G->Add(name);          G->Add(name);
3380          if (P)
3381            P->Add(name);
3382        if (SELLI == 1)        if (SELLI == 1)
3383          L->Add(name);          L->Add(name);
3384       };       };
# Line 3475  TChain *PamLevel2::GetPamTree(TList *fl, Line 3504  TChain *PamLevel2::GetPamTree(TList *fl,
3504        L->Delete();        L->Delete();
3505    };    };
3506    
3507      //ProcessingInfo EM
3508      if ( P && P->GetEntries() ){
3509        cout << "----------------------------------------------------" << endl;
3510        cout << ">>> Found ProcessingInfo <<<" << endl;
3511        //  L->SetBranchAddress("RunEntry",&irun);
3512        P->SetBranchAddress("ProcInfo", &proc_obj);//NEWNEW
3513        proc_tree = P;
3514      }
3515    //  --------------------------------------------    //  --------------------------------------------
3516    //  return the pamela chain with all the friends    //  return the pamela chain with all the friends
3517    //  --------------------------------------------    //  --------------------------------------------
3518    
3519    pam_tree = Trout;    pam_tree = Trout;
   
3520    return Trout;    return Trout;
3521  }  }
3522    
# Line 5178  void PamLevel2::CreateCloneTrees(TFile * Line 5214  void PamLevel2::CreateCloneTrees(TFile *
5214      //  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;
5215      run_tree_clone->Fill();      run_tree_clone->Fill();
5216    }    }
5217    cout << "----------------------------------------------------" << endl;    //
5218      // replicate processinginfo tree
5219      //
5220      if ( PROC ){ // EMEMEM
5221        proc_tree_clone = new TTree("ProcessingInfo","Log of data processing");
5222        proc_tree_clone->Branch("ProcInfo", "ProcInfo", GetPointerTo("ProcInfo"));
5223        cout << "ProcessingInfo: branch ProcessingInfo" << endl;  
5224        // ------------------
5225        // replicate processinginfo tree
5226        // ------------------
5227        //    cout << "----------------------------------------------------"<<endl;
5228        //    cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl;
5229        for (Int_t i = 0; i < proc_tree->GetEntries(); i++) {
5230          proc_tree->GetEntry(i);
5231          //      cout << i<< "\t | "<<endl;
5232          proc_tree_clone->Fill();
5233        }
5234        if ( SELLI != 2 ){      
5235          proc_obj->runID = 0;
5236          TTimeStamp *dt = new TTimeStamp();
5237          proc_obj->date = dt->AsString();
5238          delete dt;
5239          proc_obj->commandLine = Form("PamelaLevel2 was called: CAL2 %i CAL1 %i CAL0 %i TRK2 %i TRK1 %i TRKh %i TRK0 %i TOF %i TOF0 %i TRG %i \n                                            S4 %i ND %i AC %i ORB %i GP %i EXT %i NUC %i RUN %i ISGP %i SELLI %i \n Custom string   = %s",CAL2,CAL1,CAL0,TRK2,TRK1,TRKh,TRK0,TOF,TOF0,TRG,S4,ND,AC,ORB,GP,EXT,NUC,RUN,ISGP,SELLI,customString.Data());
5240          proc_obj->outputFilename = ofile->GetName();
5241          proc_obj->localDir = gSystem->WorkingDirectory();
5242          proc_obj->uname = gSystem->GetFromPipe("uname -a");
5243          if (!dbc || (dbc && !dbc->IsConnected())) SetDBConnection();
5244          proc_obj->DB = Form("mysql://%s/%s",dbc->GetHost(),dbc->GetDB());
5245          dbc->Close();
5246          proc_tree_clone->Fill();
5247        }
5248        cout << "----------------------------------------------------" << endl;
5249      }
5250    // ------------------------------------    // ------------------------------------
5251    // add branch with dead and live times    // add branch with dead and live times
5252    // ------------------------------------    // ------------------------------------
# Line 5370  TTree* PamLevel2::GetCloneTree(TString n Line 5437  TTree* PamLevel2::GetCloneTree(TString n
5437      if (!name.CompareTo(na))      if (!name.CompareTo(na))
5438        return sel_tree_clone;        return sel_tree_clone;
5439    }    }
5440      if (proc_tree_clone && PROC) {
5441        TString na = proc_tree_clone->GetName();
5442        if (!name.CompareTo(na))
5443          return proc_tree_clone;
5444      }
5445    return NULL;    return NULL;
5446    
5447  }  }
# Line 5392  void PamLevel2::WriteCloneTrees() { Line 5464  void PamLevel2::WriteCloneTrees() {
5464        pam_tree_clone[i]->Write(pam_tree_clone[i]->GetName(),TObject::kOverwrite);        pam_tree_clone[i]->Write(pam_tree_clone[i]->GetName(),TObject::kOverwrite);
5465      };      };
5466    }    }
5467      
5468      if ( PROC ){//EMEMEMEM
5469        proc_tree_clone->Write("ProcessingInfo",TObject::kOverwrite);
5470      }
5471    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;
5472    
5473  }  }

Legend:
Removed from v.1.99  
changed lines
  Added in v.1.108

  ViewVC Help
Powered by ViewVC 1.1.23