| 5 |
* The file contains implementation of the methods to query the DB. |
* The file contains implementation of the methods to query the DB. |
| 6 |
*/ |
*/ |
| 7 |
// |
// |
| 8 |
|
#include <sstream> |
| 9 |
|
#include <iostream> |
| 10 |
|
// |
| 11 |
|
#include <TFile.h> |
| 12 |
|
#include <TTree.h> |
| 13 |
|
#include <TTimeStamp.h> |
| 14 |
|
#include <TTreeCloner.h> |
| 15 |
#include <RunGlue.h> |
#include <RunGlue.h> |
| 16 |
// |
// |
| 17 |
ClassImp(RunGlue); |
ClassImp(RunGlue); |
| 22 |
this->Clear(); |
this->Clear(); |
| 23 |
} |
} |
| 24 |
|
|
| 25 |
RunGlue::RunGlue(TSQLServer *da, UInt_t ru, TString di, TString wrkdi, Bool_t fcas) { |
RunGlue::RunGlue(TSQLServer *da, UInt_t ru, TString di, TString wrkdi) { |
| 26 |
fDBG = false; |
fDBG = false; |
|
castor = fcas; |
|
| 27 |
li = new PamLevel2(); |
li = new PamLevel2(); |
| 28 |
this->Clear(); |
this->Clear(); |
| 29 |
dbc = da; |
dbc = da; |
| 86 |
lList = new TList(); |
lList = new TList(); |
| 87 |
lList->Clear(); |
lList->Clear(); |
| 88 |
TString thisrun; |
TString thisrun; |
|
// TFile *su; |
|
| 89 |
TFile *su; |
TFile *su; |
| 90 |
// |
// |
| 91 |
TSQLResult *pResult; |
TSQLResult *pResult; |
| 169 |
// |
// |
| 170 |
if ( DebugMode() ) printf(" Filename is %s \n",thisrun.Data()); |
if ( DebugMode() ) printf(" Filename is %s \n",thisrun.Data()); |
| 171 |
// |
// |
|
//su = TFile::Open(thisrun); |
|
| 172 |
su = TFile::Open(thisrun); |
su = TFile::Open(thisrun); |
| 173 |
if ( li->CheckLevel2File(thisrun) ){ |
if ( li->CheckLevel2File(thisrun) ){ |
| 174 |
lList->Add(su); |
lList->Add(su); |
| 212 |
if ( DebugMode() ) printf(" fullpath = %s name %s \n",fullpath.Data(),name.Data()); |
if ( DebugMode() ) printf(" fullpath = %s name %s \n",fullpath.Data(),name.Data()); |
| 213 |
// |
// |
| 214 |
// |
// |
|
//su = TFile::Open(fullpath); |
|
| 215 |
su = TFile::Open(fullpath); |
su = TFile::Open(fullpath); |
| 216 |
if ( li->CheckLevel2File((TString)fullpath) ){ |
if ( li->CheckLevel2File((TString)fullpath) ){ |
| 217 |
fList->Add(su); |
fList->Add(su); |
| 335 |
// |
// |
| 336 |
su = TFile::Open(thisrun); |
su = TFile::Open(thisrun); |
| 337 |
if ( su ){ |
if ( su ){ |
|
// TFile *su0 = TFile::Open(thisrun); |
|
| 338 |
TFile *su0 = TFile::Open(thisrun); |
TFile *su0 = TFile::Open(thisrun); |
| 339 |
fDoneList->Add(su0); |
fDoneList->Add(su0); |
| 340 |
fNlistdone++; |
fNlistdone++; |
| 380 |
|
|
| 381 |
Bool_t RunGlue::OpenFile(){ |
Bool_t RunGlue::OpenFile(){ |
| 382 |
// |
// |
|
ifstream myfile; |
|
|
TString thename; |
|
|
// |
|
|
Bool_t exi = false; |
|
| 383 |
fOpen = false; |
fOpen = false; |
| 384 |
thename = Form("rfio://%s",(this->GetFilename()).Data()); |
printf(" Check if output file already exists \n"); |
| 385 |
Target = 0; |
ifstream myfile; |
| 386 |
if ( castor ){ |
myfile.open((this->GetFilename()).Data()); |
| 387 |
Target = new TRFIOFile(thename.Data(),"READ","",1); |
if ( myfile ){ |
|
if ( !Target->IsZombie()) exi = true; |
|
|
} else { |
|
|
// thename = Form("rfio://%s",(this->GetFilename()).Data()); |
|
|
printf(" Check if output file already exists \n"); |
|
|
myfile.open((this->GetFilename()).Data()); |
|
|
if ( myfile ) exi = true; |
|
|
}; |
|
|
if ( exi ){ |
|
| 388 |
// Target = TFile::Open((this->GetFilename()).Data(), "READ" ); |
// Target = TFile::Open((this->GetFilename()).Data(), "READ" ); |
| 389 |
// |
// |
| 390 |
// if ( Target ){ |
// if ( Target ){ |
| 391 |
// Target->Close(); |
// Target->Close(); |
| 392 |
if ( myfile ) myfile.close(); |
myfile.close(); |
| 393 |
// |
printf("Error opening target file, %s already exist!\n",(this->GetFilename()).Data()); |
|
if ( Target ) Target->Close(); |
|
|
// |
|
|
printf("Error opening target file, %s already exist!\n",thename.Data()); |
|
| 394 |
return(false); |
return(false); |
|
// |
|
| 395 |
} else { |
} else { |
| 396 |
// |
// |
| 397 |
printf(" Output file does not exist, creating it\n"); |
printf(" Output file does not exist, creating it\n"); |
| 398 |
// |
// |
| 399 |
Long64_t maxsize = 99900000000LL; |
Long64_t maxsize = 99900000000LL; |
| 400 |
// |
// |
| 401 |
Target = new TRFIOFile(thename.Data(), "RECREATE", "", 2 ); |
Target = TFile::Open((this->GetFilename()).Data(), "RECREATE" ); |
|
// Target = TFile::Open((this->GetFilename()).Data(), "RECREATE" ); |
|
|
// |
|
| 402 |
//fastMethod = kTRUE; |
//fastMethod = kTRUE; |
| 403 |
fastMethod = kFALSE; |
fastMethod = kFALSE; |
| 404 |
// |
// |
| 405 |
// |
// |
| 406 |
if ( !Target || Target->IsZombie()) { |
if ( !Target || Target->IsZombie()) { |
| 407 |
printf("Error opening target file (does %s exist?)\n",thename.Data()); |
printf("Error opening target file (does %s exist?)\n",(this->GetFilename()).Data()); |
| 408 |
exit(1); |
exit(1); |
| 409 |
} |
} |
| 410 |
// |
// |
| 534 |
// |
// |
| 535 |
if ( DebugMode() ) printf("\nTarget path is: %s \n",target->GetPath()); |
if ( DebugMode() ) printf("\nTarget path is: %s \n",target->GetPath()); |
| 536 |
// |
// |
| 537 |
TString path; |
TString path( (char*)strstr( target->GetPath(), ":" ) ); |
|
//if ( castor ){ |
|
|
path = TString(":/"); |
|
|
// } else { |
|
|
// path = TString( (char*)strstr( target->GetPath(), ":" ) ); |
|
|
// }; |
|
| 538 |
path.Remove(0,2); |
path.Remove(0,2); |
|
if ( DebugMode() ) printf("path is %s \n",path.Data()); |
|
| 539 |
// |
// |
| 540 |
TDirectory *first_source = (TDirectory*)sourcelist->First(); |
TDirectory *first_source = (TDirectory*)sourcelist->First(); |
| 541 |
THashList allNames; |
THashList allNames; |
| 620 |
// |
// |
| 621 |
globChain->Add(first_source->GetName()); |
globChain->Add(first_source->GetName()); |
| 622 |
// |
// |
|
// TFile *nextsource = (TFile*)sourcelist->After( first_source ); |
|
| 623 |
TFile *nextsource = (TFile*)sourcelist->After( first_source ); |
TFile *nextsource = (TFile*)sourcelist->After( first_source ); |
| 624 |
// |
// |
| 625 |
while ( nextsource ) { |
while ( nextsource ) { |
| 627 |
//do not add to the list a file that does not contain this Tree |
//do not add to the list a file that does not contain this Tree |
| 628 |
// |
// |
| 629 |
TFile *curf = TFile::Open(nextsource->GetName()); |
TFile *curf = TFile::Open(nextsource->GetName()); |
|
// TFile *curf = TFile::Open(nextsource->GetName()); |
|
| 630 |
// |
// |
| 631 |
if ( curf ) { |
if ( curf ) { |
| 632 |
// |
// |
| 716 |
}; |
}; |
| 717 |
|
|
| 718 |
|
|
|
//Long64_t RunGlue::Mergy(TChain *mychain, TFile* file, Int_t basketsize, Option_t* option){ |
|
| 719 |
Long64_t RunGlue::Mergy(TChain *mychain, TFile* file, Int_t basketsize, Option_t* option){ |
Long64_t RunGlue::Mergy(TChain *mychain, TFile* file, Int_t basketsize, Option_t* option){ |
| 720 |
// We must have been passed a file, we will use it |
// We must have been passed a file, we will use it |
| 721 |
// later to reset the compression level of the branches. |
// later to reset the compression level of the branches. |