27 #include <TGeoManager.h>
39 , fRunOnProofWorker(kFALSE)
40 , fProofServerName(proofName)
41 , fProofParName(
"$VMCWORKDIR/gconfig/libFairRoot.par")
42 , fOutputDirectory(
"")
43 , fProofOutputStatus(
"copy")
46 if (strcmp(proofName,
"RunOnProofWorker") == 0) {
49 LOG(info) <<
"+++++++ T P R O O F +++++++++++++++++++++++++++++++++";
50 LOG(info) <<
"creating TProof* proof = TProof::Open(\"" <<
fProofServerName.Data() <<
"\");";
51 TProof::AddEnvVar(
"LOCALDATASERVER",
"file://");
54 LOG(info) <<
"+++++++ C R E A T E D +++++++++++++++++++++++++++++++";
68 LOG(fatal) <<
"Error Init is already called before!";
86 while ((key = static_cast<TKey*>(next()))) {
87 if (strcmp(key->GetClassName(),
"TGeoManager") != 0) {
90 gGeoManager =
static_cast<TGeoManager*
>(key->ReadObj());
102 fProofFileSource->
GetInTree()->GetCurrentFile()->Get(
"FAIRGeom");
109 fProofFileSource->
GetInTree()->GetCurrentFile()->Get(
"FAIRGeom");
113 LOG(info) <<
"Geometry was not found in the input file we will look in the friends if any!";
114 TFile* currentfile = gFile;
116 TSeqCollection* fileList = gROOT->GetListOfFiles();
117 for (Int_t k = 0; k < fileList->GetEntries(); k++) {
118 nextfile =
static_cast<TFile*
>(fileList->At(k));
120 nextfile->Get(
"FAIRGeom");
135 while ((key = static_cast<TKey*>(next()))) {
136 if (strcmp(key->GetClassName(),
"TGeoManager") != 0) {
139 gGeoManager =
static_cast<TGeoManager*
>(key->ReadObj());
150 LOG(warn) <<
"QUITTING, CAUSE IT'S not running on proof worker";
153 gROOT->GetListOfBrowsables()->Add(
fTask);
171 LOG(info) <<
"Parameter and input file are available, Assure that basic info is there for the run!";
192 if (gGeoManager == 0) {}
196 LOG(info) <<
"Initializing without input file or Mixed input";
217 if (fieldfact && !
fField) {
245 LOG(fatal) <<
"Could not read event header.";
259 if (gGeoManager == 0) {
268 if (strncmp(tempSource->GetName(),
"FairFileSource", 14) != 0) {
269 LOG(warn) <<
"FairRunAnaProof. Seems you are trying to set different source than FairFileSource";
312 LOG(warn) <<
"FairRunAnaProof::RunOnProof. Do not know how to create output \"" <<
fProofOutputStatus.Data()
314 LOG(warn) <<
"FairRunAnaProof::RunOnProof. Please use SetProofOutputStatus to either \"copy\" or \"merge\".";
315 LOG(warn) <<
"FairRunAnaProof::RunOnProof. For the current run using the \"merge\" setting.";
320 TChain* inChain =
static_cast<TChain*
>(fProofFileSource->
GetInChain());
321 TString par1File =
"";
322 TString par2File =
"";
336 LOG(info) <<
" outputFileName = " << fileName.Data();
337 if (fileName.Length() < 5)
338 fileName =
"proofOutput.root";
340 fProof->AddInput(
new TNamed(
"FAIRRUNANA_fContainerStatic", (
fStatic ?
"kTRUE" :
"kFALSE")));
342 fProof->AddInput(
new TNamed(
"FAIRRUNANA_fOutputDirectory", outDir.Data()));
343 fProof->AddInput(
new TNamed(
"FAIRRUNANA_fOutputFileName", fileName.Data()));
344 fProof->AddInput(
new TNamed(
"FAIRRUNANA_fParInput1FName", par1File.Data()));
345 fProof->AddInput(
new TNamed(
"FAIRRUNANA_fParInput2FName", par2File.Data()));
347 Int_t nofChainEntries = inChain->GetEntries();
348 LOG(info) <<
"FairRunAnaProof::RunOnProof(): The chain seems to have " << nofChainEntries <<
" entries.";
350 TObjArray* listOfFiles = inChain->GetListOfFiles();
351 LOG(info) <<
"FairRunAnaProof::RunOnProof(): There are " << listOfFiles->GetEntries() <<
" files in the chain.";
355 Int_t nofEventsToAnalyze = NStop - NStart;
357 if (nofEventsToAnalyze <= 0) {
358 LOG(info) <<
"You requested to analyze events from " << NStart <<
" to " << NStop <<
" that is "
359 << nofEventsToAnalyze <<
" events!!!";
360 nofEventsToAnalyze = nofChainEntries - NStart;
361 LOG(info) <<
"It will be changed to analyze all events from " << NStart <<
" to the end of chain ("
362 << nofChainEntries <<
"), that is to analyze " << nofEventsToAnalyze <<
" events.";
365 LOG(info) <<
"FairRunAnaProof::RunOnProof(): Starting inChain->Process(\"FairAnaSelector\",\"\","
366 << nofEventsToAnalyze <<
"," << NStart <<
")";
367 inChain->Process(
"FairAnaSelector",
"", nofEventsToAnalyze, NStart);
368 LOG(info) <<
"FairRunAnaProof::RunOnProof(): inChain->Process DONE";
virtual ~FairRunAnaProof()
virtual FairField * createFairField()
virtual void ExecuteTask(Option_t *option="0")
Int_t ReadEvent(Int_t i=0)
void Reinit(UInt_t runId)
unsigned int generateId(void)
void RunOnProof(Int_t NStart, Int_t NStop)
FairRootManager * fRootManager
void WriteFileHeader(FairFileHeader *f)
FairEventHeader * GetEventHeader()
FairEventHeader * fEvtHeader
ClassImp(FairEventBuilder)
TObject * GetObject(const char *BrName)
static FairFieldFactory * Instance()
FairRunAnaProof(const char *proofName="")
void Run(Int_t NStart=0, Int_t NStop=0)
static FairRunAnaProof * fRAPInstance
FairParSet * getContainer(const Text_t *)
Bool_t initContainers(Int_t runId, Int_t refId=-1, const Text_t *fileName="")
FairMQExParamsParOne * par
FairFileHeader * fFileHeader
static FairTrajFilter * Instance()
FairParIo * getSecondInput(void)
TString fProofOutputStatus
FairRuntimeDb * GetRuntimeDb(void)
const char * getFilename()
static FairRunAnaProof * Instance()
FairRtdbRun * addRun(Int_t runId, Int_t refId=-1)
void SetSource(FairSource *tempSource)
void UpdateListOfTimebasedBranches()
virtual void FinishEvent()
void DeleteOldWriteoutBufferData()
virtual void SetSource(FairSource *tempSource)
void StoreWriteoutBufferData(Double_t eventTime)
virtual TString GetFileName()
FairParIo * getFirstInput(void)
void RunOneEvent(Long64_t entry)
void Init(TString brName="GeoTracks", TString folderName="MCGeoTrack")
void FillEventHeader(FairEventHeader *feh)