| 409 |
} |
} |
| 410 |
// |
// |
| 411 |
TTree::SetMaxTreeSize(maxsize); |
TTree::SetMaxTreeSize(maxsize); |
| 412 |
Target->SetCompressionLevel(2); |
// Target->SetCompressionLevel(2); |
| 413 |
|
Target->SetCompressionLevel(3); |
| 414 |
//Target->SetCompressionLevel(5); |
//Target->SetCompressionLevel(5); |
| 415 |
// |
// |
| 416 |
fOpen = true; |
fOpen = true; |
| 534 |
// |
// |
| 535 |
if ( li ) li->Delete(); |
if ( li ) li->Delete(); |
| 536 |
li = new PamLevel2(wd,sourcelist,fDList); |
li = new PamLevel2(wd,sourcelist,fDList); |
| 537 |
|
li->SetSELLI(2); |
| 538 |
// |
// |
| 539 |
Target->cd(); |
Target->cd(); |
| 540 |
// |
// |
| 549 |
}; |
}; |
| 550 |
Target->cd(); |
Target->cd(); |
| 551 |
li->WriteCloneTrees(); |
li->WriteCloneTrees(); |
| 552 |
printf(" file %s \n",Target->GetName()); |
printf("Written file %s \n",Target->GetName()); |
| 553 |
// Target->Write(); |
// Target->Write(); |
| 554 |
TTree *slist = (TTree*)Target->Get("SelectionList"); |
// TTree *slist = (TTree*)Target->Get("SelectionList"); |
| 555 |
slist->Delete("all"); |
// slist->Delete("all"); |
| 556 |
Target->Close(); |
Target->Close(); |
| 557 |
|
|
| 558 |
// // |
// // |
| 756 |
}; |
}; |
| 757 |
|
|
| 758 |
|
|
| 759 |
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){ |
| 760 |
// We must have been passed a file, we will use it |
// // We must have been passed a file, we will use it |
| 761 |
// later to reset the compression level of the branches. |
// // later to reset the compression level of the branches. |
| 762 |
if (!file) { |
// if (!file) { |
| 763 |
// FIXME: We need an error message here. |
// // FIXME: We need an error message here. |
| 764 |
printf(" 19 \n"); |
// printf(" 19 \n"); |
| 765 |
return 0; |
// return 0; |
| 766 |
} |
// } |
| 767 |
printf(" 20 \n"); |
// printf(" 20 \n"); |
| 768 |
|
|
| 769 |
// Options |
// // Options |
| 770 |
Bool_t fastClone = kFALSE; |
// Bool_t fastClone = kFALSE; |
| 771 |
TString opt = option; |
// TString opt = option; |
| 772 |
opt.ToLower(); |
// opt.ToLower(); |
| 773 |
if (opt.Contains("fast")) { |
// if (opt.Contains("fast")) { |
| 774 |
fastClone = kTRUE; |
// fastClone = kTRUE; |
| 775 |
printf(" 21 \n"); |
// printf(" 21 \n"); |
| 776 |
} |
// } |
| 777 |
// The chain tree must have a list of branches |
// // The chain tree must have a list of branches |
| 778 |
// because we may try to change their basket |
// // because we may try to change their basket |
| 779 |
// size later. |
// // size later. |
| 780 |
TObjArray* lbranches = mychain->GetListOfBranches(); |
// TObjArray* lbranches = mychain->GetListOfBranches(); |
| 781 |
if (!lbranches) { |
// if (!lbranches) { |
| 782 |
// FIXME: We need an error message here. |
// // FIXME: We need an error message here. |
| 783 |
printf(" 22 \n"); |
// printf(" 22 \n"); |
| 784 |
return 0; |
// return 0; |
| 785 |
} |
// } |
| 786 |
|
|
| 787 |
// file->cd(); |
// // file->cd(); |
| 788 |
// The chain must have a current tree because |
// // The chain must have a current tree because |
| 789 |
// that is the one we will clone. |
// // that is the one we will clone. |
| 790 |
// if (!fTree) { |
// // if (!fTree) { |
| 791 |
// -- LoadTree() has not yet been called, no current tree. |
// // -- LoadTree() has not yet been called, no current tree. |
| 792 |
// FIXME: We need an error message here. |
// // FIXME: We need an error message here. |
| 793 |
// return 0; |
// // return 0; |
| 794 |
// } |
// // } |
| 795 |
|
|
| 796 |
// Copy the chain's current tree without |
// // Copy the chain's current tree without |
| 797 |
// copying any entries, we will do that later. |
// // copying any entries, we will do that later. |
| 798 |
printf(" 23 \n"); |
// printf(" 23 \n"); |
| 799 |
TTree* newTree = mychain->CloneTree(0); |
// TTree* newTree = mychain->CloneTree(0); |
| 800 |
if (!newTree) { |
// if (!newTree) { |
| 801 |
// FIXME: We need an error message here. |
// // FIXME: We need an error message here. |
| 802 |
printf(" 24 \n"); |
// printf(" 24 \n"); |
| 803 |
return 0; |
// return 0; |
| 804 |
} |
// } |
| 805 |
printf(" 25 \n"); |
// printf(" 25 \n"); |
| 806 |
|
|
| 807 |
|
|
| 808 |
// Strip out the (potential) directory name. |
// // Strip out the (potential) directory name. |
| 809 |
// FIXME: The merged chain may or may not have the |
// // FIXME: The merged chain may or may not have the |
| 810 |
// same name as the original chain. This is |
// // same name as the original chain. This is |
| 811 |
// bad because the chain name determines the |
// // bad because the chain name determines the |
| 812 |
// names of the trees in the chain by default. |
// // names of the trees in the chain by default. |
| 813 |
printf(" 26 \n"); |
// printf(" 26 \n"); |
| 814 |
newTree->SetName(gSystem->BaseName(mychain->GetName())); |
// newTree->SetName(gSystem->BaseName(mychain->GetName())); |
| 815 |
printf(" 27 \n"); |
// printf(" 27 \n"); |
| 816 |
|
|
| 817 |
// FIXME: Why do we do this? |
// // FIXME: Why do we do this? |
| 818 |
// newTree->SetAutoSave(-1); |
// // newTree->SetAutoSave(-1); |
| 819 |
newTree->SetAutoSave(900000000000000LL); |
// newTree->SetAutoSave(900000000000000LL); |
| 820 |
|
|
| 821 |
printf(" 28 \n"); |
// printf(" 28 \n"); |
| 822 |
// Circularity is incompatible with merging, it may |
// // Circularity is incompatible with merging, it may |
| 823 |
// force us to throw away entries, which is not what |
// // force us to throw away entries, which is not what |
| 824 |
// we are supposed to do. |
// // we are supposed to do. |
| 825 |
newTree->SetCircular(0); |
// newTree->SetCircular(0); |
| 826 |
|
|
| 827 |
// Reset the compression level of the branches. |
// // Reset the compression level of the branches. |
| 828 |
if (opt.Contains("c")) { |
// if (opt.Contains("c")) { |
| 829 |
TBranch* branch = 0; |
// TBranch* branch = 0; |
| 830 |
TIter nextb(newTree->GetListOfBranches()); |
// TIter nextb(newTree->GetListOfBranches()); |
| 831 |
while ((branch = (TBranch*) nextb())) { |
// while ((branch = (TBranch*) nextb())) { |
| 832 |
printf(" 29 \n"); |
// printf(" 29 \n"); |
| 833 |
branch->SetCompressionLevel(file->GetCompressionLevel()); |
// branch->SetCompressionLevel(file->GetCompressionLevel()); |
| 834 |
} |
// } |
| 835 |
} |
// } |
| 836 |
|
|
| 837 |
printf(" 30 \n"); |
// printf(" 30 \n"); |
| 838 |
// Reset the basket size of the branches. |
// // Reset the basket size of the branches. |
| 839 |
if (basketsize > 1000) { |
// if (basketsize > 1000) { |
| 840 |
TBranch* branch = 0; |
// TBranch* branch = 0; |
| 841 |
TIter nextb(newTree->GetListOfBranches()); |
// TIter nextb(newTree->GetListOfBranches()); |
| 842 |
while ((branch = (TBranch*) nextb())) { |
// while ((branch = (TBranch*) nextb())) { |
| 843 |
printf(" 31 \n"); |
// printf(" 31 \n"); |
| 844 |
branch->SetBasketSize(basketsize); |
// branch->SetBasketSize(basketsize); |
| 845 |
} |
// } |
| 846 |
} |
// } |
| 847 |
|
|
| 848 |
printf(" 32 \n"); |
// printf(" 32 \n"); |
| 849 |
Long64_t nentries = mychain->GetEntriesFast(); |
// Long64_t nentries = mychain->GetEntriesFast(); |
| 850 |
//Long64_t nentries = mychain->GetEntries(); |
// //Long64_t nentries = mychain->GetEntries(); |
| 851 |
|
|
| 852 |
// Copy the entries. |
// // Copy the entries. |
| 853 |
if (fastClone) { |
// if (fastClone) { |
| 854 |
// For each tree in the chain. |
// // For each tree in the chain. |
| 855 |
for (Long64_t i = 0; i < nentries; i += mychain->GetTree()->GetEntries()) { |
// for (Long64_t i = 0; i < nentries; i += mychain->GetTree()->GetEntries()) { |
| 856 |
if (mychain->LoadTree(i) < 0) { |
// if (mychain->LoadTree(i) < 0) { |
| 857 |
break; |
// break; |
| 858 |
} |
// } |
| 859 |
TTreeCloner cloner(mychain->GetTree(), newTree, option); |
// TTreeCloner cloner(mychain->GetTree(), newTree, option); |
| 860 |
if (cloner.IsValid()) { |
// if (cloner.IsValid()) { |
| 861 |
newTree->SetEntries(newTree->GetEntries() + mychain->GetTree()->GetEntries()); |
// newTree->SetEntries(newTree->GetEntries() + mychain->GetTree()->GetEntries()); |
| 862 |
cloner.Exec(); |
// cloner.Exec(); |
| 863 |
} else { |
// } else { |
| 864 |
if (mychain->GetFile()) { |
// if (mychain->GetFile()) { |
| 865 |
printf("Merge Skipped file %s\n", mychain->GetFile()->GetName()); |
// printf("Merge Skipped file %s\n", mychain->GetFile()->GetName()); |
| 866 |
// } else { |
// // } else { |
| 867 |
// Warning("Merge", "Skipped file number %d\n", fTreeNumber); |
// // Warning("Merge", "Skipped file number %d\n", fTreeNumber); |
| 868 |
} |
// } |
| 869 |
} |
// } |
| 870 |
} |
// } |
| 871 |
} else { |
// } else { |
| 872 |
printf(" 33 %llu \n",nentries); |
// printf(" 33 %llu \n",nentries); |
| 873 |
mychain->Print(); |
// mychain->Print(); |
| 874 |
for (Long64_t i = 0; i < nentries; i++) { |
// for (Long64_t i = 0; i < nentries; i++) { |
| 875 |
printf(" i %llu \n",i); |
// printf(" i %llu \n",i); |
| 876 |
// for (Long64_t i = 0; i < 1; i++) { |
// // for (Long64_t i = 0; i < 1; i++) { |
| 877 |
if (mychain->GetEntry(i) <= 0) { |
// if (mychain->GetEntry(i) <= 0) { |
| 878 |
break; |
// break; |
| 879 |
} |
// } |
| 880 |
newTree->Fill(); |
// newTree->Fill(); |
| 881 |
} |
// } |
| 882 |
printf(" 34 \n"); |
// printf(" 34 \n"); |
| 883 |
} |
// } |
| 884 |
|
|
| 885 |
// Write the new tree header. |
// // Write the new tree header. |
| 886 |
printf(" 35 \n"); |
// printf(" 35 \n"); |
| 887 |
newTree->Write(); |
// newTree->Write(); |
| 888 |
|
|
| 889 |
printf(" 36 \n"); |
// printf(" 36 \n"); |
| 890 |
// Get our return value. |
// // Get our return value. |
| 891 |
Int_t nfiles = newTree->GetFileNumber() + 1; |
// Int_t nfiles = newTree->GetFileNumber() + 1; |
| 892 |
|
|
| 893 |
// Close and delete the current file of the new tree. |
// // Close and delete the current file of the new tree. |
| 894 |
if (!opt.Contains("keep")) { |
// if (!opt.Contains("keep")) { |
| 895 |
// FIXME: What happens to fDirectory in newTree here? |
// // FIXME: What happens to fDirectory in newTree here? |
| 896 |
delete newTree->GetCurrentFile(); |
// delete newTree->GetCurrentFile(); |
| 897 |
} |
// } |
| 898 |
return nfiles; |
// return nfiles; |
| 899 |
} |
// } |