| 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; |
| 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; |
| 2114 |
if (file.EndsWith(".root")) { |
if (file.EndsWith(".root")) { |
| 2115 |
TString filedir; |
TString filedir; |
| 2116 |
cout << ddir << endl; |
cout << ddir << endl; |
| 2117 |
if (ddir != "") { |
if ( ddir != "" ) { |
| 2118 |
filedir = ddir; // take the input dir |
filedir = ddir; // take the input dir |
| 2119 |
} |
} |
| 2120 |
else { |
else { |
| 2122 |
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 |
| 2123 |
}; |
}; |
| 2124 |
filedir.Append("/"); |
filedir.Append("/"); |
| 2125 |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir), gSystem->BaseName(file)); |
// char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir), gSystem->BaseName(file)); |
| 2126 |
|
char *fullpath = gSystem->ConcatFileName(filedir.Data(), gSystem->BaseName(file)); |
| 2127 |
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 |
| 2128 |
cout << fullpath << endl; |
cout << fullpath << endl; |
| 2129 |
delete fullpath; |
delete fullpath; |
| 2886 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if (!dbc || (dbc && !dbc->IsConnected())) |
| 2887 |
SetDBConnection(); //Emiliano |
SetDBConnection(); //Emiliano |
| 2888 |
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) |
| 2889 |
if (dbc) |
if (dbc){ |
| 2890 |
dbc->Close();// Emiliano |
dbc->Close();// Emiliano |
| 2891 |
|
dbc=0; |
| 2892 |
|
}; |
| 2893 |
}; |
}; |
| 2894 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
| 2895 |
// retrieve OBT and absolute time of the event |
// retrieve OBT and absolute time of the event |
| 3034 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if (!dbc || (dbc && !dbc->IsConnected())) |
| 3035 |
SetDBConnection(); //Emiliano |
SetDBConnection(); //Emiliano |
| 3036 |
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano |
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano |
| 3037 |
if (dbc) |
if (dbc){ |
| 3038 |
dbc->Close(); // Emiliano |
dbc->Close(); // Emiliano |
| 3039 |
|
dbc=0; |
| 3040 |
|
}; |
| 3041 |
if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano |
if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano |
| 3042 |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
| 3043 |
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
| 3075 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if (!dbc || (dbc && !dbc->IsConnected())) |
| 3076 |
SetDBConnection(); |
SetDBConnection(); |
| 3077 |
TrkParams::Set(GetRunInfo(), dbc); |
TrkParams::Set(GetRunInfo(), dbc); |
| 3078 |
if (dbc) |
if (dbc){ |
| 3079 |
dbc->Close(); |
dbc->Close(); |
| 3080 |
|
dbc=0; |
| 3081 |
|
}; |
| 3082 |
|
|
| 3083 |
// ---------------------------------------------------- |
// ---------------------------------------------------- |
| 3084 |
// then check if the run has a fragment |
// then check if the run has a fragment |
| 3170 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if (!dbc || (dbc && !dbc->IsConnected())) |
| 3171 |
SetDBConnection(); |
SetDBConnection(); |
| 3172 |
TrkParams::Set(GetRunInfo(), dbc); |
TrkParams::Set(GetRunInfo(), dbc); |
| 3173 |
if (dbc) |
if (dbc){ |
| 3174 |
dbc->Close(); |
dbc->Close(); |
| 3175 |
|
dbc=0; |
| 3176 |
|
}; |
| 3177 |
// cout << endl; |
// cout << endl; |
| 3178 |
prevshift = 0; |
prevshift = 0; |
| 3179 |
return true; |
return true; |
| 4224 |
ii = iee; |
ii = iee; |
| 4225 |
// Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
// Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
| 4226 |
// Bool_t UPDATED = UpdateRunInfo(ii); |
// Bool_t UPDATED = UpdateRunInfo(ii); |
| 4227 |
UpdateRunInfo(ii); |
if ( fUpdateRunInfo ) UpdateRunInfo(ii); // Emiliano |
| 4228 |
if (SELLI == 0 || SELLI == 2) |
if (SELLI == 0 || SELLI == 2) |
| 4229 |
irunentry = iee - runfirstentry; |
irunentry = iee - runfirstentry; |
| 4230 |
// if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
// if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
| 4352 |
} |
} |
| 4353 |
|
|
| 4354 |
dbc->Close(); // EMILIANO, do not leave open connections, open only when needed |
dbc->Close(); // EMILIANO, do not leave open connections, open only when needed |
| 4355 |
|
dbc=0; |
| 4356 |
|
|
| 4357 |
}; |
}; |
| 4358 |
|
|
| 4365 |
// if( !TrkParams::IsLoaded(6) ){ |
// if( !TrkParams::IsLoaded(6) ){ |
| 4366 |
// cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
// cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
| 4367 |
// }; |
// }; |
| 4368 |
// if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); |
if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); // PERCHE` ERA COMMENTATA QUESTA RIGA? |
| 4369 |
TrkParams::SetCalib(run_obj, dbc); |
TrkParams::SetCalib(run_obj, dbc); |
| 4370 |
TrkParams::LoadCalib(); |
TrkParams::LoadCalib(); |
| 4371 |
if (!TrkParams::CalibIsLoaded()) { |
if (!TrkParams::CalibIsLoaded()) { |
| 4372 |
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded" << endl; |
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded" << endl; |
| 4373 |
}; |
}; |
| 4374 |
// if(dbc)dbc->Close(); // EMILIANO, do not leave open connections, open only when needed |
if(dbc){ |
| 4375 |
|
dbc->Close(); // EMILIANO, do not leave open connections, open only when needed |
| 4376 |
|
dbc=0; |
| 4377 |
|
}; |
| 4378 |
} |
} |
| 4379 |
|
|
| 4380 |
// cout << l0_tree << endl; |
// cout << l0_tree << endl; |
| 4505 |
cout << "USER " << user << endl; |
cout << "USER " << user << endl; |
| 4506 |
cout << "PSW " << psw << endl; |
cout << "PSW " << psw << endl; |
| 4507 |
} |
} |
| 4508 |
dbc = TSQLServer::Connect(host.Data(), user.Data(), psw.Data()); |
Bool_t notconn = true; |
| 4509 |
if (!dbc) |
Int_t trials = 0; |
| 4510 |
return false; |
while ( notconn && trials < 10 ){ |
| 4511 |
if (!dbc->IsConnected()) |
// gSystem->Sleep(500); |
| 4512 |
return false; |
dbc = TSQLServer::Connect(host.Data(), user.Data(), psw.Data()); |
| 4513 |
|
//dbc->Connect(host.Data(), user.Data(), psw.Data()); |
| 4514 |
|
if ( dbc ) notconn = false; |
| 4515 |
|
if (DBG) printf("<%i> test connection...\n ",trials); |
| 4516 |
|
if (!dbc){ |
| 4517 |
|
if (DBG) printf(" :( failed, no pointer \n"); |
| 4518 |
|
notconn = true; |
| 4519 |
|
// return false; |
| 4520 |
|
}; |
| 4521 |
|
if (dbc && !dbc->IsConnected()){ |
| 4522 |
|
if (DBG) printf(" :( failed, no connection \n"); |
| 4523 |
|
notconn = true; |
| 4524 |
|
// return false; |
| 4525 |
|
}; |
| 4526 |
|
trials++; |
| 4527 |
|
}; |
| 4528 |
|
if ( notconn ) return false; |
| 4529 |
|
// |
| 4530 |
|
if (DBG) printf("=connected!\n"); |
| 4531 |
stringstream myquery; // EMILIANO |
stringstream myquery; // EMILIANO |
| 4532 |
myquery.str(""); // EMILIANO |
myquery.str(""); // EMILIANO |
| 4533 |
myquery << "SET time_zone='+0:00'"; // EMILIANO |
myquery << "SET time_zone='+0:00'"; // EMILIANO |
| 4534 |
dbc->Query(myquery.str().c_str()); // EMILIANO |
dbc->Query(myquery.str().c_str()); // EMILIANO |
| 4535 |
if (DBG) |
if ( DBG ) printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); |
|
cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl; |
|
| 4536 |
return true; |
return true; |
| 4537 |
|
|
| 4538 |
} |
} |