30 #include <TProofOutputFile.h>
31 #include <TProofServ.h>
44 LOG(warn) <<
"FairAnaSelector::Init(): There is no tree.";
47 LOG(info) <<
"FairAnaSelector::Init(): Got tree : \"" << tree <<
"\"";
48 LOG(info) <<
"FairAnaSelector::Init(): Tree name : \"" << tree->GetName() <<
"\"";
49 LOG(info) <<
"FairAnaSelector::Init(): Tree title : \"" << tree->GetTitle() <<
"\"";
50 LOG(info) <<
"FairAnaSelector::Init(): Tree filename: \"" << tree->GetCurrentFile()->GetName() <<
"\"";
54 LOG(info) <<
"FairAnaSelector::Init(): Already have fRunAna.";
56 LOG(info) <<
"FairAnaSelector::Init(): SetInTree(" << tree <<
")";
58 LOG(info) <<
"FairAnaSelector::Init(): SetInTree done";
67 LOG(info) <<
"FairAnaSelector::Init(): Have to create fRunAna.";
69 TString vmcPath = gSystem->Getenv(
"VMCWORKDIR");
71 TNamed* contStat =
static_cast<TNamed*
>(fInput->FindObject(
"FAIRRUNANA_fContainerStatic"));
72 TNamed* outStat =
static_cast<TNamed*
>(fInput->FindObject(
"FAIRRUNANA_fProofOutputStatus"));
73 TNamed* outFile =
static_cast<TNamed*
>(fInput->FindObject(
"FAIRRUNANA_fOutputFileName"));
74 TNamed* outDir =
static_cast<TNamed*
>(fInput->FindObject(
"FAIRRUNANA_fOutputDirectory"));
75 TNamed* par1Name =
static_cast<TNamed*
>(fInput->FindObject(
"FAIRRUNANA_fParInput1FName"));
76 TNamed* par2Name =
static_cast<TNamed*
>(fInput->FindObject(
"FAIRRUNANA_fParInput2FName"));
77 TString containerS = contStat->GetTitle();
78 TString outputStat = outStat->GetTitle();
79 TString par1Str = par1Name->GetTitle();
80 TString par2Str = par2Name->GetTitle();
81 TString outFileName = outFile->GetTitle();
82 TString outDirName = outDir->GetTitle();
84 LOG(info) <<
"FairAnaSelector::Init(): out status : \"" << outputStat.Data() <<
"\"";
85 LOG(info) <<
"FairAnaSelector::Init(): par1 file : \"" << par1Str.Data() <<
"\"";
86 LOG(info) <<
"FairAnaSelector::Init(): par2 file : \"" << par2Str.Data() <<
"\"";
88 LOG(info) <<
"FairAnaSelector::Init(): OutputFile option \"" << outputStat.Data() <<
"\" RECOGNIZED";
90 if (outputStat.Contains(
"copy")) {
91 TString outputFileName = outFile->GetTitle();
92 if (outputFileName[0] !=
'/') {
93 outputFileName = Form(
"%s/%s", outDir->GetTitle(), outFile->GetTitle());
95 outputFileName.Remove(outputFileName.Length() - 5);
96 outputFileName = Form(
"%s_worker_%s.root", outputFileName.Data(), gProofServ->GetOrdinal());
98 LOG(info) <<
"the file name = \"" << outputFileName.Data() <<
"\"";
99 fFile = TFile::Open(outputFileName.Data(),
"RECREATE");
100 }
else if (outputStat.Contains(
"merge")) {
101 TString outputFileName = outFile->GetTitle();
102 if (outputFileName[0] !=
'/') {
103 outputFileName = Form(
"%s/%s", outDir->GetTitle(), outFile->GetTitle());
106 fProofFile =
new TProofOutputFile(outputFileName.Data());
108 Warning(
"SlaveBegin",
"problems opening file: %s/%s",
fProofFile->GetDir(),
fProofFile->GetFileName());
114 LOG(info) <<
"FairAnaSelector::Init(): SetInTree(" << tree <<
")";
117 LOG(info) <<
"FairAnaSelector::Init(): SetInTree done";
120 if (containerS ==
"kTRUE") {
129 if (par1Str.Contains(
".root")) {
131 parInput1->
open(par1Str.Data());
134 if (par1Str.Contains(
".par")) {
136 parInput1->
open(par1Str.Data(),
"in");
140 if (par2Str.Contains(
".root")) {
142 parInput2->
open(par2Str.Data());
145 if (par2Str.Contains(
".par")) {
147 parInput2->
open(par2Str.Data(),
"in");
153 FairTask* fairTaskList =
dynamic_cast<FairTask*
>(fInput->FindObject(
"FairTaskList"));
155 if (fairTaskList != 0) {
156 LOG(info) <<
"FairAnaSelector::Init(): FairTask = \"" << fairTaskList <<
"\"";
160 LOG(info) <<
"FairAnaSelector::Init(): vvvvv fRunAna->Init() vvvvv";
162 LOG(info) <<
"FairAnaSelector::Init(): ^^^^^ fRunAna->Init() ^^^^^";
173 LOG(info) <<
"FairAnaSelector::Notify()";
183 LOG(info) <<
"FairAnaSelector::Begin()";
185 fCurrentDirectory = gSystem->pwd();
186 TNamed* outFile =
static_cast<TNamed*
>(fInput->FindObject(
"FAIRRUNANA_fOutputFileName"));
187 TNamed* outDir =
static_cast<TNamed*
>(fInput->FindObject(
"FAIRRUNANA_fOutputDirectory"));
189 TString outputFileName = outFile->GetTitle();
190 if (outputFileName[0] !=
'/') {
191 outputFileName = Form(
"%s/%s", outDir->GetTitle(), outFile->GetTitle());
193 TString outputDir = outputFileName(0, outputFileName.Last(
'/') + 1);
194 fCurrentDirectory = gSystem->pwd();
195 gSystem->cd(outputDir.Data());
203 LOG(info) <<
"FairAnaSelector::SlaveBegin(): Tree address : \"" << tree <<
"\"";
208 LOG(info) <<
"FairAnaSelector::SlaveBegin(): finishing";
248 LOG(info) <<
"FairAnaSelector::SlaveTerminate(): Calling fRunAna->TerminateRun()";
252 LOG(info) <<
"FairAnaSelector::SlaveTerminate(): fProofFile = \"" <<
fProofFile <<
"\"";
254 LOG(info) <<
"FairAnaSelector::SlaveTerminate(): fProofFile = \"" <<
fProofFile->GetName() <<
"\"";
255 LOG(info) <<
"FairAnaSelector::SlaveTerminate(): fFile = \"" <<
fFile <<
"\"";
257 LOG(info) <<
"FairAnaSelector::SlaveTerminate(): fFile = \"" <<
fFile->GetName() <<
"\"";
259 LOG(info) <<
"FairAnaSelector::SlaveTerminate(): WorkingDirectory = \"" << gSystem->WorkingDirectory() <<
"\"";
266 LOG(info) <<
"FairAnaSelector::SlaveTerminate(): fOutput->Add(fProofFile);";
271 LOG(info) <<
"FairAnaSelector::SlaveTerminate(): fFile->Close();";
276 LOG(info) <<
"FairAnaSelector::SlaveTerminate(): Finishing...";
284 LOG(info) <<
"FairAnaSelector::Terminate(): fOutput->ls()";
285 gSystem->cd(fCurrentDirectory.Data());
286 LOG(info) <<
"FairAnaSelector::Terminate(): -------------";
list of container factories
Bool_t open(const Text_t *fname, const Text_t *status="in")
virtual void SlaveBegin(TTree *tree)
void SetInTree(TTree *tempTree)
TProofOutputFile * fProofFile
virtual void SlaveTerminate()
static FairRootManager * Instance()
Bool_t setSecondInput(FairParIo *)
Bool_t GetContainerStatic()
void SetSink(FairSink *tempSink)
FairRunAnaProof * fRunAna
pointer to the analyzed TTree or TChain
virtual void Init(TTree *tree)
void SetContainerStatic(Bool_t tempBool=kTRUE)
virtual void Begin(TTree *tree)
virtual Bool_t Process(Long64_t entry)
FairRuntimeDb * GetRuntimeDb(void)
Bool_t open(const Text_t *fname, Option_t *option="READ", const Text_t *ftitle="", Int_t compress=1)
virtual void SetSource(FairSource *tempSource)
Bool_t setFirstInput(FairParIo *)
virtual void SetTask(FairTask *t)
void RunOneEvent(Long64_t entry)