| 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; |
| 602 |
if (dbc) { |
if (dbc) { |
| 603 |
dbc->Close(); |
dbc->Close(); |
| 604 |
delete dbc; |
delete dbc; |
| 605 |
|
dbc=0; |
| 606 |
} |
} |
| 607 |
|
|
| 608 |
if (gltsync) |
if (gltsync) |
| 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; |
| 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; |
| 755 |
// |
// |
| 756 |
TIter next2(contents); |
TIter next2(contents); |
| 757 |
TChain *questa = 0; |
TChain *questa = 0; |
| 758 |
while (questa = (TChain*) next2()) { |
while ( (questa = (TChain*) next2()) ) { |
| 759 |
TString name = questa->GetName(); |
TString name = questa->GetName(); |
| 760 |
questa->Delete(); |
questa->Delete(); |
| 761 |
questa = NULL; |
questa = NULL; |
| 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 |
// |
// |
| 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 { |
| 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; |
| 2907 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if (!dbc || (dbc && !dbc->IsConnected())) |
| 2908 |
SetDBConnection(); //Emiliano |
SetDBConnection(); //Emiliano |
| 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; |
| 2914 |
|
}; |
| 2915 |
}; |
}; |
| 2916 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
| 2917 |
// retrieve OBT and absolute time of the event |
// retrieve OBT and absolute time of the event |
| 3056 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if (!dbc || (dbc && !dbc->IsConnected())) |
| 3057 |
SetDBConnection(); //Emiliano |
SetDBConnection(); //Emiliano |
| 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; |
| 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 |
| 3065 |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
| 3066 |
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
| 3098 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if (!dbc || (dbc && !dbc->IsConnected())) |
| 3099 |
SetDBConnection(); |
SetDBConnection(); |
| 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; |
| 3105 |
|
}; |
| 3106 |
|
|
| 3107 |
// ---------------------------------------------------- |
// ---------------------------------------------------- |
| 3108 |
// then check if the run has a fragment |
// then check if the run has a fragment |
| 3194 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if (!dbc || (dbc && !dbc->IsConnected())) |
| 3195 |
SetDBConnection(); |
SetDBConnection(); |
| 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; |
| 3201 |
|
}; |
| 3202 |
// cout << endl; |
// cout << endl; |
| 3203 |
prevshift = 0; |
prevshift = 0; |
| 3204 |
return true; |
return true; |
| 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; |
| 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(); |
| 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; |
| 4382 |
|
|
| 4383 |
}; |
}; |
| 4384 |
|
|
| 4391 |
// if( !TrkParams::IsLoaded(6) ){ |
// if( !TrkParams::IsLoaded(6) ){ |
| 4392 |
// cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
// cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
| 4393 |
// }; |
// }; |
| 4394 |
// if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); |
if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); // PERCHE` ERA COMMENTATA QUESTA RIGA? |
| 4395 |
TrkParams::SetCalib(run_obj, dbc); |
TrkParams::SetCalib(run_obj, dbc); |
| 4396 |
TrkParams::LoadCalib(); |
TrkParams::LoadCalib(); |
| 4397 |
if (!TrkParams::CalibIsLoaded()) { |
if (!TrkParams::CalibIsLoaded()) { |
| 4398 |
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded" << endl; |
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded" << endl; |
| 4399 |
}; |
}; |
| 4400 |
// if(dbc)dbc->Close(); // EMILIANO, do not leave open connections, open only when needed |
if(dbc){ |
| 4401 |
|
dbc->Close(); // EMILIANO, do not leave open connections, open only when needed |
| 4402 |
|
delete dbc; |
| 4403 |
|
dbc=0; |
| 4404 |
|
}; |
| 4405 |
} |
} |
| 4406 |
|
|
| 4407 |
// cout << l0_tree << endl; |
// cout << l0_tree << endl; |
| 4532 |
cout << "USER " << user << endl; |
cout << "USER " << user << endl; |
| 4533 |
cout << "PSW " << psw << endl; |
cout << "PSW " << psw << endl; |
| 4534 |
} |
} |
| 4535 |
dbc = TSQLServer::Connect(host.Data(), user.Data(), psw.Data()); |
Bool_t notconn = true; |
| 4536 |
if (!dbc) |
Int_t trials = 0; |
| 4537 |
return false; |
while ( notconn && trials < 10 ){ |
| 4538 |
if (!dbc->IsConnected()) |
// gSystem->Sleep(500); |
| 4539 |
return false; |
dbc = TSQLServer::Connect(host.Data(), user.Data(), psw.Data()); |
| 4540 |
|
//dbc->Connect(host.Data(), user.Data(), psw.Data()); |
| 4541 |
|
if ( dbc ) notconn = false; |
| 4542 |
|
if (DBG) printf("<%i> test connection...\n ",trials); |
| 4543 |
|
if (!dbc){ |
| 4544 |
|
if (DBG) printf(" :( failed, no pointer \n"); |
| 4545 |
|
notconn = true; |
| 4546 |
|
// return false; |
| 4547 |
|
}; |
| 4548 |
|
if (dbc && !dbc->IsConnected()){ |
| 4549 |
|
if (DBG) printf(" :( failed, no connection \n"); |
| 4550 |
|
notconn = true; |
| 4551 |
|
// return false; |
| 4552 |
|
}; |
| 4553 |
|
trials++; |
| 4554 |
|
}; |
| 4555 |
|
if ( notconn ) return false; |
| 4556 |
|
// |
| 4557 |
|
if (DBG) printf("=connected!\n"); |
| 4558 |
stringstream myquery; // EMILIANO |
stringstream myquery; // EMILIANO |
| 4559 |
myquery.str(""); // EMILIANO |
myquery.str(""); // EMILIANO |
| 4560 |
myquery << "SET time_zone='+0:00'"; // EMILIANO |
myquery << "SET time_zone='+0:00'"; // EMILIANO |
| 4561 |
dbc->Query(myquery.str().c_str()); // EMILIANO |
dbc->Query(myquery.str().c_str()); // EMILIANO |
| 4562 |
if (DBG) |
if ( DBG ) printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); |
|
cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl; |
|
| 4563 |
return true; |
return true; |
| 4564 |
|
|
| 4565 |
} |
} |