/[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.82 by mocchiut, Thu Jun 4 15:10:47 2009 UTC revision 1.87 by pam-fi, Fri May 14 15:30:05 2010 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 633  void PamLevel2::Delete() { Line 634  void PamLevel2::Delete() {
634      //      //
635      TIter next2(contents);      TIter next2(contents);
636      TChain *questa = 0;      TChain *questa = 0;
637      while (questa = (TChain*) next2()) {      while ( (questa = (TChain*)next2()) ) {
638        TString name = questa->GetName();        TString name = questa->GetName();
639        questa->Delete();        questa->Delete();
640        questa = NULL;        questa = NULL;
# Line 747  void PamLevel2::Reset() { Line 748  void PamLevel2::Reset() {
748      //      //
749      TIter next2(contents);      TIter next2(contents);
750      TChain *questa = 0;      TChain *questa = 0;
751      while (questa = (TChain*) next2()) {      while ( (questa = (TChain*) next2()) ) {
752        TString name = questa->GetName();        TString name = questa->GetName();
753        questa->Delete();        questa->Delete();
754        questa = NULL;        questa = NULL;
# Line 833  Bool_t PamLevel2::IsGood(Bool_t strict) Line 834  Bool_t PamLevel2::IsGood(Bool_t strict)
834  }  }
835  ;  ;
836    
837    void PamLevel2::SkipRunInfoUpdate(){
838      printf("\n\n ******** WARNING ******** \n Skip DB connections, DO NOT USE PamLevel2::GetRunInfo() method! \n\n");
839      fUpdateRunInfo = false;
840      this->SetSELLI(2);
841      printf(" ===============> W A R N I N G <================ \n");
842      printf(" in case PamLevel2::CreateCloneTrees() will be called \n");
843      printf(" it will be reverted to PadmeAmidala level2 structure , i.e. NO SELECTIONLIST WILL BE CREATED IN THE NEW LEVEL2 FILE! \n\n");
844      if ( run_tree_clone ){
845        printf(" ===============> W A R N I N G <================ \n");
846        printf(" PamLevel2::SkipRunIndoUpdate or PamLevel2::NoDBconnections() has been called together with PamLevel2::CreateCloneTrees() \n");
847        printf(" TO AVOID CRASHES call PamLevel2::CreateCloneTrees() after PamLevel2::SkipRunIndoUpdate or PamLevel2::NoDBconnections() \n");    
848      };
849    }
850    
851  //--------------------------------------  //--------------------------------------
852  //  //
853  //  //
# Line 2113  TList* PamLevel2::GetListOfLevel2Files(T Line 2128  TList* PamLevel2::GetListOfLevel2Files(T
2128          if (file.EndsWith(".root")) {          if (file.EndsWith(".root")) {
2129            TString filedir;            TString filedir;
2130            cout << ddir << endl;            cout << ddir << endl;
2131            if (ddir != "") {            if ( ddir != "" ) {
2132              filedir = ddir; // take the input dir              filedir = ddir; // take the input dir
2133            }            }
2134            else {            else {
# Line 2121  TList* PamLevel2::GetListOfLevel2Files(T Line 2136  TList* PamLevel2::GetListOfLevel2Files(T
2136              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
2137            };            };
2138            filedir.Append("/");            filedir.Append("/");
2139            char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir), gSystem->BaseName(file));            //          char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir), gSystem->BaseName(file));
2140              char *fullpath = gSystem->ConcatFileName(filedir.Data(), gSystem->BaseName(file));
2141            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
2142            cout << fullpath << endl;            cout << fullpath << endl;
2143            delete fullpath;            delete fullpath;
# Line 2886  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 2902  Bool_t PamLevel2::UpdateRunInfo(Long64_t
2902      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)
2903      if (dbc){      if (dbc){
2904        dbc->Close();// Emiliano        dbc->Close();// Emiliano
2905          delete dbc;
2906        dbc=0;        dbc=0;
2907      };      };
2908    };    };
# Line 3034  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 3051  Bool_t PamLevel2::UpdateRunInfo(Long64_t
3051        gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano        gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano
3052        if (dbc){        if (dbc){
3053          dbc->Close(); // Emiliano          dbc->Close(); // Emiliano
3054            delete dbc;
3055          dbc=0;          dbc=0;
3056        };        };
3057        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 3093  Bool_t PamLevel2::UpdateRunInfo(Long64_t
3093      TrkParams::Set(GetRunInfo(), dbc);      TrkParams::Set(GetRunInfo(), dbc);
3094      if (dbc){      if (dbc){
3095        dbc->Close();        dbc->Close();
3096          delete dbc;
3097        dbc=0;        dbc=0;
3098      };      };
3099    
# Line 3170  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 3189  Bool_t PamLevel2::UpdateRunInfo(Long64_t
3189        TrkParams::Set(GetRunInfo(), dbc);        TrkParams::Set(GetRunInfo(), dbc);
3190        if (dbc){        if (dbc){
3191          dbc->Close();          dbc->Close();
3192            delete dbc;
3193          dbc=0;          dbc=0;
3194        };        };
3195        //            cout << endl;        //            cout << endl;
# Line 4222  Int_t PamLevel2::GetEntry(Long64_t iee) Line 4242  Int_t PamLevel2::GetEntry(Long64_t iee)
4242    ii = iee;    ii = iee;
4243    //    Bool_t UPDATED = UpdateRunInfo(run_tree,ii);    //    Bool_t UPDATED = UpdateRunInfo(run_tree,ii);
4244    //    Bool_t UPDATED = UpdateRunInfo(ii);    //    Bool_t UPDATED = UpdateRunInfo(ii);
4245    UpdateRunInfo(ii);    if ( fUpdateRunInfo ) UpdateRunInfo(ii); // Emiliano
4246    if (SELLI == 0 || SELLI == 2)    if (SELLI == 0 || SELLI == 2)
4247      irunentry = iee - runfirstentry;      irunentry = iee - runfirstentry;
4248    //    if(UPDATED && run_tree_clone)run_tree_clone->Fill();    //    if(UPDATED && run_tree_clone)run_tree_clone->Fill();
# Line 4350  TTree* PamLevel2::GetYodaTree() { Line 4370  TTree* PamLevel2::GetYodaTree() {
4370      }      }
4371    
4372      dbc->Close(); // EMILIANO, do not leave open connections, open only when needed      dbc->Close(); // EMILIANO, do not leave open connections, open only when needed
4373        delete dbc;
4374      dbc=0;      dbc=0;
4375    
4376    };    };
# Line 4371  TTree* PamLevel2::GetYodaTree() { Line 4392  TTree* PamLevel2::GetYodaTree() {
4392      };      };
4393      if(dbc){      if(dbc){
4394        dbc->Close(); // EMILIANO, do not leave open connections, open only when needed        dbc->Close(); // EMILIANO, do not leave open connections, open only when needed
4395          delete dbc;
4396        dbc=0;        dbc=0;
4397      };      };
4398    }    }

Legend:
Removed from v.1.82  
changed lines
  Added in v.1.87

  ViewVC Help
Powered by ViewVC 1.1.23