/[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.98 by mocchiut, Fri Oct 17 14:03:46 2014 UTC revision 1.104 by mocchiut, Fri Oct 17 16:21:50 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 639  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;
# Line 681  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 881  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 961  void PamLevel2::Reset() { Line 971  void PamLevel2::Reset() {
971    if (sel_tree)    if (sel_tree)
972      sel_tree->Delete();;      sel_tree->Delete();;
973    sel_tree = NULL;    sel_tree = NULL;
974    
975      if (proc_tree)
976        proc_tree->Delete();
977      proc_tree = NULL;
978    //    //
979    // Close file    // Close file
980    //    //
# Line 984  void PamLevel2::Reset() { Line 998  void PamLevel2::Reset() {
998    ac_obj = 0;    ac_obj = 0;
999    orb2_obj = 0;    orb2_obj = 0;
1000    gp_obj = 0;    gp_obj = 0;
1001      proc_obj = 0;
1002    
1003    trk_ext_obj     = 0;    trk_ext_obj     = 0;
1004    trk_ext_nuc_obj = 0;    trk_ext_nuc_obj = 0;
# Line 1015  void PamLevel2::Reset() { Line 1030  void PamLevel2::Reset() {
1030    //    //
1031    run_obj = 0;//new GL_RUN();    run_obj = 0;//new GL_RUN();
1032    soft_obj = 0;// Emiliano    soft_obj = 0;// Emiliano
1033      proc_obj = 0;// Emiliano
1034    irun = -1;    irun = -1;
1035    irunt = -1;    irunt = -1;
1036    totrunentry = 0LL;    totrunentry = 0LL;
# Line 1189  void *PamLevel2::GetPointerTo(const char Line 1205  void *PamLevel2::GetPointerTo(const char
1205    if (!objname.CompareTo("SoftInfo"))    if (!objname.CompareTo("SoftInfo"))
1206      return &soft_obj; // Emiliano      return &soft_obj; // Emiliano
1207    
1208      if (!objname.CompareTo("ProcInfo")){
1209        if (!proc_obj)
1210          proc_obj = new ProcInfo();    
1211        return &proc_obj; // Emiliano
1212      }
1213    
1214    return NULL;    return NULL;
1215  }  }
1216  ;  ;
# Line 3304  TChain *PamLevel2::GetPamTree(TList *fl, Line 3326  TChain *PamLevel2::GetPamTree(TList *fl,
3326    TChain *G = 0;    TChain *G = 0;
3327    
3328    TChain *L = 0;    TChain *L = 0;
3329      TChain *P = 0;
3330    
3331    if (TRK2 || TRK1 || TRKh)    if (TRK2 || TRK1 || TRKh)
3332      T = new TChain("Tracker");      T = new TChain("Tracker");
# Line 3323  TChain *PamLevel2::GetPamTree(TList *fl, Line 3346  TChain *PamLevel2::GetPamTree(TList *fl,
3346      B = new TChain("OrbitalInfo");      B = new TChain("OrbitalInfo");
3347    if (GP)    if (GP)
3348      G = new TChain("h20");      G = new TChain("h20");
3349      if (PROC)
3350        P = new TChain("ProcessingInfo");
3351    L = new TChain("SelectionList");    L = new TChain("SelectionList");
3352    
3353    // loop over files and create chains    // loop over files and create chains
# Line 3350  TChain *PamLevel2::GetPamTree(TList *fl, Line 3375  TChain *PamLevel2::GetPamTree(TList *fl,
3375          B->Add(name);          B->Add(name);
3376        if (GP)        if (GP)
3377          G->Add(name);          G->Add(name);
3378          if (P)
3379            P->Add(name);
3380        if (SELLI == 1)        if (SELLI == 1)
3381          L->Add(name);          L->Add(name);
3382       };       };
# Line 3475  TChain *PamLevel2::GetPamTree(TList *fl, Line 3502  TChain *PamLevel2::GetPamTree(TList *fl,
3502        L->Delete();        L->Delete();
3503    };    };
3504    
3505      //ProcessingInfo EM
3506      if ( P && P->GetEntries() ){
3507        cout << "----------------------------------------------------" << endl;
3508        cout << ">>> Found ProcessingInfo <<<" << endl;
3509        //  L->SetBranchAddress("RunEntry",&irun);
3510        P->SetBranchAddress("ProcInfo", &proc_obj);//NEWNEW
3511        proc_tree = P;
3512      }
3513    //  --------------------------------------------    //  --------------------------------------------
3514    //  return the pamela chain with all the friends    //  return the pamela chain with all the friends
3515    //  --------------------------------------------    //  --------------------------------------------
3516    
3517    pam_tree = Trout;    pam_tree = Trout;
   
3518    return Trout;    return Trout;
3519  }  }
3520    
# Line 4572  void PamLevel2::GetWhichTrees(TFile* f) Line 4606  void PamLevel2::GetWhichTrees(TFile* f)
4606    //    cout << "Checking file: "<<f->GetName()<<endl;    //    cout << "Checking file: "<<f->GetName()<<endl;
4607    if (!f || f->IsZombie()) {    if (!f || f->IsZombie()) {
4608      cout << "File: " << f->GetName() << " Non valid root file" << endl;      cout << "File: " << f->GetName() << " Non valid root file" << endl;
4609        fDiscarded = true;
4610      return;      return;
4611    }    }
4612    
# Line 5177  void PamLevel2::CreateCloneTrees(TFile * Line 5212  void PamLevel2::CreateCloneTrees(TFile *
5212      //  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;
5213      run_tree_clone->Fill();      run_tree_clone->Fill();
5214    }    }
5215    cout << "----------------------------------------------------" << endl;    //
5216      // replicate processinginfo tree
5217      //
5218      if ( PROC ){ // EMEMEM
5219        proc_tree_clone = new TTree("ProcessingInfo","Log of data processing");
5220        proc_tree_clone->Branch("ProcInfo", "ProcInfo", GetPointerTo("ProcInfo"));
5221        cout << "ProcessingInfo: branch ProcessingInfo" << endl;  
5222        // ------------------
5223        // replicate processinginfo tree
5224        // ------------------
5225        //    cout << "----------------------------------------------------"<<endl;
5226        //    cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl;
5227        for (Int_t i = 0; i < proc_tree->GetEntries(); i++) {
5228          proc_tree->GetEntry(i);
5229          cout << i<< "\t | "<<endl;
5230          proc_tree_clone->Fill();
5231        }
5232        if ( SELLI != 2 || true ){      
5233          cout << "|| "<<endl;
5234          proc_obj->runID = 0;
5235          cout << "|||d "<<endl;
5236          TTimeStamp *dt = new TTimeStamp();
5237          proc_obj->date = dt->AsString();
5238          delete dt;
5239          cout << "|||f "<<endl;
5240          proc_obj->commandLine = Form("PamelaLevel2 was called");
5241          cout << "|||g "<<endl;
5242          proc_obj->outputFilename = "";
5243          cout << "|||h "<<endl;
5244          proc_obj->localDir = gSystem->WorkingDirectory();
5245          cout << "|||j "<<endl;
5246          proc_obj->uname = gSystem->GetFromPipe("uname -a");
5247          cout << "|||s "<<endl;
5248          proc_obj->DB = Form("mysql://%s/%s",dbc->GetHost(),dbc->GetDB());
5249          cout << "||| "<<endl;
5250          proc_tree_clone->Fill();
5251        }
5252        cout << "----------------------------------------------------" << endl;
5253      }
5254    // ------------------------------------    // ------------------------------------
5255    // add branch with dead and live times    // add branch with dead and live times
5256    // ------------------------------------    // ------------------------------------
# Line 5369  TTree* PamLevel2::GetCloneTree(TString n Line 5441  TTree* PamLevel2::GetCloneTree(TString n
5441      if (!name.CompareTo(na))      if (!name.CompareTo(na))
5442        return sel_tree_clone;        return sel_tree_clone;
5443    }    }
5444      if (proc_tree_clone && PROC) {
5445        TString na = proc_tree_clone->GetName();
5446        if (!name.CompareTo(na))
5447          return proc_tree_clone;
5448      }
5449    return NULL;    return NULL;
5450    
5451  }  }
# Line 5391  void PamLevel2::WriteCloneTrees() { Line 5468  void PamLevel2::WriteCloneTrees() {
5468        pam_tree_clone[i]->Write(pam_tree_clone[i]->GetName(),TObject::kOverwrite);        pam_tree_clone[i]->Write(pam_tree_clone[i]->GetName(),TObject::kOverwrite);
5469      };      };
5470    }    }
5471      
5472      if ( PROC && false ){//EMEMEMEM
5473        proc_tree_clone->Write("ProcessingInfo",TObject::kOverwrite);
5474      }
5475    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;
5476    
5477  }  }

Legend:
Removed from v.1.98  
changed lines
  Added in v.1.104

  ViewVC Help
Powered by ViewVC 1.1.23