/[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.83 by mocchiut, Tue Aug 4 13:58:47 2009 UTC revision 1.88 by pam-fi, Tue Nov 29 15:34:12 2011 UTC
# Line 467  void PamLevel2::Initialize() { Line 467  void PamLevel2::Initialize() {
467    runfirstentry = 0LL;    runfirstentry = 0LL;
468    runlastentry = 0LL;    runlastentry = 0LL;
469    gltsync = 0; // Emiliano    gltsync = 0; // Emiliano
470      fUpdateRunInfo = true; // Emiliano
471    
472    l0_file = NULL;    l0_file = NULL;
473    l0_tree = NULL;    l0_tree = NULL;
# Line 646  void PamLevel2::Delete() { Line 647  void PamLevel2::Delete() {
647      run_tree->Delete();;      run_tree->Delete();;
648    if (sel_tree)    if (sel_tree)
649      sel_tree->Delete();;      sel_tree->Delete();;
650    for (Int_t i = 0; i < NCLONES; i++)  
651      // The following lines are commented out since they may generate a double delete error
652      // if the file containing the clone trees is closed. This is because the file owns the
653      // clone trees which are written into it, so it will delete them when it is closed; if
654      // also PamLevel2 will try to delete these trees, a double delete error will be generated
655      // when exiting from analysis program. (Nicola 28/11/2011)
656    
657      /*for (Int_t i = 0; i < NCLONES; i++)
658      if (pam_tree_clone[i])      if (pam_tree_clone[i])
659        pam_tree_clone[i]->Delete();;        pam_tree_clone[i]->Delete();;
660    if (run_tree_clone)    if (run_tree_clone)
661      run_tree_clone->Delete();;      run_tree_clone->Delete();;
662    if (sel_tree_clone)    if (sel_tree_clone)
663      sel_tree_clone->Delete();;      sel_tree_clone->Delete();;*/
664    
665    if (irunoffset)    if (irunoffset)
666      delete[] irunoffset;      delete[] irunoffset;
# Line 833  Bool_t PamLevel2::IsGood(Bool_t strict) Line 841  Bool_t PamLevel2::IsGood(Bool_t strict)
841  }  }
842  ;  ;
843    
844    void PamLevel2::SkipRunInfoUpdate(){
845      printf("\n\n ******** WARNING ******** \n Skip DB connections, DO NOT USE PamLevel2::GetRunInfo() method! \n\n");
846      fUpdateRunInfo = false;
847      this->SetSELLI(2);
848      printf(" ===============> W A R N I N G <================ \n");
849      printf(" in case PamLevel2::CreateCloneTrees() will be called \n");
850      printf(" it will be reverted to PadmeAmidala level2 structure , i.e. NO SELECTIONLIST WILL BE CREATED IN THE NEW LEVEL2 FILE! \n\n");
851      if ( run_tree_clone ){
852        printf(" ===============> W A R N I N G <================ \n");
853        printf(" PamLevel2::SkipRunIndoUpdate or PamLevel2::NoDBconnections() has been called together with PamLevel2::CreateCloneTrees() \n");
854        printf(" TO AVOID CRASHES call PamLevel2::CreateCloneTrees() after PamLevel2::SkipRunIndoUpdate or PamLevel2::NoDBconnections() \n");    
855      };
856    }
857    
858  //--------------------------------------  //--------------------------------------
859  //  //
860  //  //
# Line 2113  TList* PamLevel2::GetListOfLevel2Files(T Line 2135  TList* PamLevel2::GetListOfLevel2Files(T
2135          if (file.EndsWith(".root")) {          if (file.EndsWith(".root")) {
2136            TString filedir;            TString filedir;
2137            cout << ddir << endl;            cout << ddir << endl;
2138            if (ddir != "") {            if ( ddir != "" ) {
2139              filedir = ddir; // take the input dir              filedir = ddir; // take the input dir
2140            }            }
2141            else {            else {
# Line 2121  TList* PamLevel2::GetListOfLevel2Files(T Line 2143  TList* PamLevel2::GetListOfLevel2Files(T
2143              filedir = gSystem->DirName(file); // this will take the path if exist in the list otherwise it will return automatically the working dir              filedir = gSystem->DirName(file); // this will take the path if exist in the list otherwise it will return automatically the working dir
2144            };            };
2145            filedir.Append("/");            filedir.Append("/");
2146            char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir), gSystem->BaseName(file));            //          char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir), gSystem->BaseName(file));
2147              char *fullpath = gSystem->ConcatFileName(filedir.Data(), gSystem->BaseName(file));
2148            contents->Add(new TSystemFile(fullpath, gSystem->DirName(fullpath)));// add file to the list            contents->Add(new TSystemFile(fullpath, gSystem->DirName(fullpath)));// add file to the list
2149            cout << fullpath << endl;            cout << fullpath << endl;
2150            delete fullpath;            delete fullpath;
# Line 2886  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2909  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2909      gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); //Emiliano // the "false" means not to use level0 file (not necessary here)      gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); //Emiliano // the "false" means not to use level0 file (not necessary here)
2910      if (dbc){      if (dbc){
2911        dbc->Close();// Emiliano        dbc->Close();// Emiliano
2912          delete dbc;
2913        dbc=0;        dbc=0;
2914      };      };
2915    };    };
# Line 3034  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 3058  Bool_t PamLevel2::UpdateRunInfo(Long64_t
3058        gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano        gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano
3059        if (dbc){        if (dbc){
3060          dbc->Close(); // Emiliano          dbc->Close(); // Emiliano
3061            delete dbc;
3062          dbc=0;          dbc=0;
3063        };        };
3064        if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano        if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano
# Line 3075  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 3100  Bool_t PamLevel2::UpdateRunInfo(Long64_t
3100      TrkParams::Set(GetRunInfo(), dbc);      TrkParams::Set(GetRunInfo(), dbc);
3101      if (dbc){      if (dbc){
3102        dbc->Close();        dbc->Close();
3103          delete dbc;
3104        dbc=0;        dbc=0;
3105      };      };
3106    
# Line 3170  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 3196  Bool_t PamLevel2::UpdateRunInfo(Long64_t
3196        TrkParams::Set(GetRunInfo(), dbc);        TrkParams::Set(GetRunInfo(), dbc);
3197        if (dbc){        if (dbc){
3198          dbc->Close();          dbc->Close();
3199            delete dbc;
3200          dbc=0;          dbc=0;
3201        };        };
3202        //            cout << endl;        //            cout << endl;
# Line 4104  void PamLevel2::CreateCloneTrees(TFile * Line 4131  void PamLevel2::CreateCloneTrees(TFile *
4131    if (GP) {    if (GP) {
4132      pam_tree_clone[i] = new TTree("h20", "GPAMELA info ");      pam_tree_clone[i] = new TTree("h20", "GPAMELA info ");
4133      pam_tree_clone[i]->Branch("GPamela", "GPamela", GetPointerTo("GPamela"), 32000, 1);//split      pam_tree_clone[i]->Branch("GPamela", "GPamela", GetPointerTo("GPamela"), 32000, 1);//split
4134      cout << "OrbitalInfo  : branch OrbitalInfo" << endl;      cout << "GPamela  : branch GPamela" << endl;
4135      i++;      i++;
4136    };    };
4137    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;
# Line 4222  Int_t PamLevel2::GetEntry(Long64_t iee) Line 4249  Int_t PamLevel2::GetEntry(Long64_t iee)
4249    ii = iee;    ii = iee;
4250    //    Bool_t UPDATED = UpdateRunInfo(run_tree,ii);    //    Bool_t UPDATED = UpdateRunInfo(run_tree,ii);
4251    //    Bool_t UPDATED = UpdateRunInfo(ii);    //    Bool_t UPDATED = UpdateRunInfo(ii);
4252    UpdateRunInfo(ii);    if ( fUpdateRunInfo ) UpdateRunInfo(ii); // Emiliano
4253    if (SELLI == 0 || SELLI == 2)    if (SELLI == 0 || SELLI == 2)
4254      irunentry = iee - runfirstentry;      irunentry = iee - runfirstentry;
4255    //    if(UPDATED && run_tree_clone)run_tree_clone->Fill();    //    if(UPDATED && run_tree_clone)run_tree_clone->Fill();
# Line 4350  TTree* PamLevel2::GetYodaTree() { Line 4377  TTree* PamLevel2::GetYodaTree() {
4377      }      }
4378    
4379      dbc->Close(); // EMILIANO, do not leave open connections, open only when needed      dbc->Close(); // EMILIANO, do not leave open connections, open only when needed
4380        delete dbc;
4381      dbc=0;      dbc=0;
4382    
4383    };    };
# Line 4371  TTree* PamLevel2::GetYodaTree() { Line 4399  TTree* PamLevel2::GetYodaTree() {
4399      };      };
4400      if(dbc){      if(dbc){
4401        dbc->Close(); // EMILIANO, do not leave open connections, open only when needed        dbc->Close(); // EMILIANO, do not leave open connections, open only when needed
4402          delete dbc;
4403        dbc=0;        dbc=0;
4404      };      };
4405    }    }

Legend:
Removed from v.1.83  
changed lines
  Added in v.1.88

  ViewVC Help
Powered by ViewVC 1.1.23