Selector used for auxiliary actions in the PROOF tutorials.
#define ProofAux_cxx
ProofAux::ProofAux()
{
fAction = -1;
fNEvents= -1;
fMainList = 0;
fFriendList = 0;
fDir = "";
}
ProofAux::~ProofAux()
{
}
{
if (ntype) {
if (act == "GenerateTreesSameFile") {
action = 1;
action = 0;
action = 2;
if (!act.
IsNull()) fDir = act;
}
} else {
}
}
return action;
}
{
}
void ProofAux::SlaveBegin(
TTree * )
{
fAction = GetAction(fInput);
if (a) fNEvents = a->
GetVal();
if (fAction < 2) {
}
}
{
if (fAction < 0) {
Error(
"Process",
"action not specified!");
}
if (fInput && (elemPair = dynamic_cast<TPair *>(fInput->FindObject("PROOF_CurrentElement")))) {
if ((fCurrent = dynamic_cast<TDSetElement *>(elemPair->
Value()))) {
Info(
"Process",
"entry %lld: file: '%s'", entry, fCurrent->
GetName());
} else {
Error(
"Process",
"entry %lld: no file specified!", entry);
}
}
if (fAction == 0) {
if (GenerateTree(fCurrent->
GetName(), fNEvents, fnt) != 0) {
Error(
"Process",
"problems generating tree (%lld, %s, %lld)",
entry, fCurrent->
GetName(), fNEvents);
}
} else {
} else {
xf += "_friend";
}
}
if (GenerateFriend(fnt, fnf) != 0) {
Error(
"Process",
"problems generating friend tree for %s (%s)",
}
} else if (fAction == 1) {
if (GenerateTree(fCurrent->
GetName(), fNEvents, fnt) != 0) {
Error(
"Process",
"problems generating tree (%lld, %s, %lld)",
entry, fCurrent->
GetName(), fNEvents);
}
if (GenerateFriend(fnt) != 0) {
Error(
"Process",
"problems generating friend tree for %s (%s)",
}
} else if (fAction == 2) {
if (GenerateTree(fCurrent->
GetName(), fNEvents, fnt) != 0) {
Error(
"Process",
"problems generating tree (%lld, %s, %lld)",
entry, fCurrent->
GetName(), fNEvents);
}
} else {
Warning(
"Process",
"do not know how to process action %d - do nothing", fAction);
}
}
void ProofAux::SlaveTerminate()
{
if (fMainList && fMainList->GetSize() > 0) fOutput->Add(fMainList);
if (fFriendList && fFriendList->GetSize() > 0) fOutput->Add(fFriendList);
}
void ProofAux::Terminate()
{
}
{
fn = fnt;
Error(
"GenerateTree",
"file name undefined!");
return rc;
}
if (!strcmp(uu.GetProtocol(),
"file") && !fn.
BeginsWith(
"/")) {
Error(
"GenerateTree",
"data directory undefined!");
return rc;
}
Error(
"GenerateTree",
"problems creating directory %s to store the file", dir.
Data());
return rc;
}
}
}
Error(
"GenerateTree",
"problems opening file %s", fn.
Data());
return rc;
}
if (!fDir.IsNull()) {
if (f->
mkdir(fDir.Data())) {
Info(
"GenerateTree",
"sub-directory '%s' successfully created", fDir.Data());
} else {
Error(
"GenerateTree",
"creating sub-directory '%s'", fDir.Data());
delete f;
return rc;
}
}
rc = 0;
TTree *T =
new TTree(
"Tmain",
"Main tree for tutorial friends");
T->
Branch(
"Run",&Run,
"Run/I");
T->
Branch(
"Event",&Event,
"Event/L");
if (i > 0 && i%1000 == 0) Run++;
Event = i;
}
delete f;
Info(
"GenerateTree",
"file '%s' successfully created", fn.
Data());
if (!strcmp(uu.GetProtocol(), "file")) {
} else {
}
}
return rc;
}
Int_t ProofAux::GenerateFriend(
const char *fnt,
const char *fnf)
{
if (fin.IsNull()) {
Error(
"GenerateFriend",
"file name for the main tree undefined!");
return rc;
}
Error(
"GenerateFriend",
"input file does not exist or cannot be read: %s", fin.Data());
return rc;
}
const char *openMain = "UPDATE";
if (!fout.IsNull()) {
openMain = "READ";
Error(
"GenerateFriend",
"problems creating directory %s to store the file", dir.
Data());
return rc;
}
}
} else {
fout = fin;
}
Error(
"GenerateFriend",
"problems opening input file %s", fin.Data());
return rc;
}
if (!Tin) {
Error(
"GenerateFriend",
"problems getting tree 'Tmain' from file %s", fin.Data());
delete fi;
return rc;
}
if (!sameFile) {
fo =
new TFile(fout,
"RECREATE");
Error(
"GenerateFriend",
"problems opening file %s", fout.Data());
delete fi;
return rc;
}
} else {
fo = fi;
}
rc = 0;
TTree *Tfrnd =
new TTree(
"Tfrnd",
"Friend tree for tutorial 'friends'");
}
if (!sameFile) {
delete fi;
}
delete fo;
delete Tfrnd;
Info(
"GenerateFriend",
"friend file '%s' successfully created", fout.Data());
if (!strcmp(uu.GetProtocol(), "file")) {
} else {
}
}
return rc;
}