11 #include "TProofOutputFile.h"
35 using std::setprecision;
49 cout <<
"-W- FairAnaSelector::Init(): There is no tree." << endl;
52 cout <<
"-I- FairAnaSelector::Init(): Got tree : \"" << tree <<
"\"" << endl;
53 cout <<
"-I- FairAnaSelector::Init(): Tree name : \"" << tree->GetName() <<
"\"" << endl;
54 cout <<
"-I- FairAnaSelector::Init(): Tree title : \"" << tree->GetTitle() <<
"\"" << endl;
55 cout <<
"-I- FairAnaSelector::Init(): Tree filename: \"" << tree->GetCurrentFile()->GetName() <<
"\"" << endl;
59 cout <<
"-I- FairAnaSelector::Init(): Already have fRunAna." << endl;
61 cout <<
"-I- FairAnaSelector::Init(): SetInTree(" << tree <<
")" << endl;
63 cout <<
"-I- FairAnaSelector::Init(): SetInTree done" << endl;
73 cout <<
"-I- FairAnaSelector::Init(): Have to create fRunAna." << endl;
75 TString vmcPath = gSystem->Getenv(
"VMCWORKDIR");
77 TNamed* contStat = (TNamed*) fInput->FindObject(
"FAIRRUNANA_fContainerStatic");
78 TNamed* outStat = (TNamed*) fInput->FindObject(
"FAIRRUNANA_fProofOutputStatus");
79 TNamed* outFile = (TNamed*) fInput->FindObject(
"FAIRRUNANA_fOutputFileName");
80 TNamed* outDir = (TNamed*) fInput->FindObject(
"FAIRRUNANA_fOutputDirectory");
81 TNamed* par1Name = (TNamed*) fInput->FindObject(
"FAIRRUNANA_fParInput1FName");
82 TNamed* par2Name = (TNamed*) fInput->FindObject(
"FAIRRUNANA_fParInput2FName");
83 TString containerS = contStat->GetTitle();
84 TString outputStat = outStat->GetTitle();
85 TString par1Str = par1Name->GetTitle();
86 TString par2Str = par2Name->GetTitle();
88 TString outDirName = outDir->GetTitle();
90 cout <<
"-I- FairAnaSelector::Init(): out status : \"" << outputStat.Data() <<
"\"" << endl;
91 cout <<
"-I- FairAnaSelector::Init(): par1 file : \"" << par1Str.Data() <<
"\"" << endl;
92 cout <<
"-I- FairAnaSelector::Init(): par2 file : \"" << par2Str.Data() <<
"\"" << endl;
94 if ( outputStat !=
"copy" ) {
95 cout <<
"-I- FairAnaSelector::Init(): OutputFile option \"" << outputStat.Data() <<
"\" not yet supported, will \"copy\" anyways" << endl;
98 cout <<
"-I- FairAnaSelector::Init(): OutputFile option \"" << outputStat.Data() <<
"\" RECOGNIZED" << endl;
100 cout <<
"-I- FairAnaSelector::Init(): gSystem->WorkingDirectory() = \""
101 << gSystem->WorkingDirectory() <<
"\"" << endl;
102 TString workDir = gSystem->WorkingDirectory();
104 Int_t workerNumber = -1;
106 for ( Int_t iposWork = 0 ; iposWork < 100 ; iposWork++ ) {
107 TString tempStr = Form(
"-0.%d",iposWork);
108 if ( workDir.Contains(tempStr.Data()) ) {
109 workerNumber = iposWork;
113 if ( workerNumber == -1 ) {
114 cout <<
"-E- FairAnaSelector::Init(): Did not recognize worker number." << endl;
116 cout <<
"-I- FairAnaSelector::Init(): worker number = " << workerNumber << endl;
119 outFileName.Remove(outFileName.Length()-5);
120 TString outputFileName = Form(
"%s/%s_worker_0.%d.root",outDirName.Data(),outFileName.Data(),workerNumber);
122 cout <<
"-I- FairAnaSelector::Init(): output will go to file: \"" << outputFileName.Data() <<
"\"" << endl;
123 fFile = TFile::Open(outputFileName.Data(),
"RECREATE");
126 fRunAna->SetRunOnProofWorker();
128 cout <<
"-I- FairAnaSelector::Init(): SetInTree(" << tree <<
")" << endl;
129 fRunAna->SetInTree(tree);
130 cout <<
"-I- FairAnaSelector::Init(): SetInTree done" << endl;
132 fRunAna->SetOutputFile(
fFile);
133 if ( containerS ==
"kTRUE" ) {
134 fRunAna->SetContainerStatic(kTRUE);
136 fRunAna->SetContainerStatic(kFALSE);
142 if ( par1Str.Contains(
".root") ) {
144 parInput1->
open(par1Str.Data());
147 if ( par1Str.Contains(
".par") ) {
149 parInput1->
open(par1Str.Data(),
"in");
153 if ( par2Str.Contains(
".root") ) {
155 parInput2->
open(par2Str.Data());
158 if ( par2Str.Contains(
".par") ) {
160 parInput2->
open(par2Str.Data(),
"in");
166 FairTask* fairTaskList =
dynamic_cast<FairTask*
>(fInput->FindObject(
"FairTaskList"));
167 cout <<
"-I- FairAnaSelector::Init(): FairTask = \"" << fairTaskList <<
"\"" << endl;
170 cout <<
"fairTaskList->Print()" << endl;
171 fairTaskList->Print();
172 cout <<
"fairTaskList->ls()" << endl;
174 cout <<
"fairTaskList finished" << endl;
177 fRunAna->SetTask(fairTaskList);
179 cout <<
"-I- FairAnaSelector::Init(): vvvvv fRunAna->Init() vvvvv" << endl;
181 cout <<
"-I- FairAnaSelector::Init(): ^^^^^ fRunAna->Init() ^^^^^" << endl;
195 cout <<
"-I- FairAnaSelector::Notify()" << endl;
207 cout <<
"-I- FairAnaSelector::Begin()" << endl;
218 cout <<
"-I- FairAnaSelector::SlaveBegin(): Tree address : \"" << tree <<
"\"" << endl;
223 cout <<
"-I- FairAnaSelector::SlaveBegin(): finishing" << endl;
265 cout <<
"-I- FairAnaSelector::SlaveTerminate(): Calling fRunAna->TerminateRun()" << endl;
269 cout <<
"-I- FairAnaSelector::SlaveTerminate(): fProofFile = \"" <<
fProofFile <<
"\"" << endl;
270 cout <<
"-I- FairAnaSelector::SlaveTerminate(): fFile = \"" <<
fFile <<
"\"" << endl;
272 cout <<
"-I- FairAnaSelector::SlaveTerminate(): WorkingDirectory = \"" << gSystem->WorkingDirectory() <<
"\"" << endl;
276 cout <<
"-------------------------------- fOutput->ls()" << endl;
278 cout <<
"-------------------------------- fOutput->Print()" << endl;
280 cout <<
"-------------------------------- fProofFile->Print()" << endl;
282 cout <<
"--------------------------------" << endl;
284 cout <<
"-I- FairAnaSelector::SlaveTerminate(): fOutput->Add(fProofFile);" << endl;
287 cout <<
"-------------------------------- fProofFile->Print()" << endl;
289 cout <<
"--------------------------------" << endl;
291 cout <<
"-I- FairAnaSelector::SlaveTerminate(): fFile->Close();" << endl;
297 cout <<
"-I- FairAnaSelector::SlaveTerminate(): Finishing..." << endl;
307 cout <<
"-I- FairAnaSelector::Terminate(): fOutput->ls()" << endl;
309 cout <<
"-I- FairAnaSelector::Terminate(): -------------" << endl;