Skip to content

Commit

Permalink
Allow running without sink
Browse files Browse the repository at this point in the history
Replaced `LOG(fatal)` with `LOG(warning)` in `FairRootManager::RegisterImpl()`.
Note that in this mode also persistent branches would not be stored anywhere.
Without sink, `FairRootManager::InitSink()` returns `false`.

Addresses issue #1355.
  • Loading branch information
karabowi committed Feb 24, 2023
1 parent 70aa91d commit e0807d9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to FairRoot will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## 18.8.1 (UNRELEASED) - 2023-01-XX

### Breaking Changes
* The output folder name changed from 'folderName_0' to 'folderName'.
In the MT mode of Geant4 the folder names changed from 'folderName_1' and 'folderName_2' to 'folderName'.

### Bug fixes
* Check the return value of `source->InitUnpackers()`/`source->ReinitUnpackers()`
in `FairRunOnline`. Stop run if `false` returned.

### Other Notable Changes
* Allow running without output sink. In this case even persistent branches would not be stored anywhere.

## 18.8.0 - 2022-12-16

### Breaking Changes
Expand Down
6 changes: 4 additions & 2 deletions base/steer/FairRootManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@ Bool_t FairRootManager::InitSink()
{
if (fSink) {
fSink->InitSink();
return true;
}
return kTRUE;
LOG(info) << "The output sink is not set. No branches will be stored.";
return false;
}

template<typename T>
Expand All @@ -204,7 +206,7 @@ void FairRootManager::RegisterImpl(const char* name, const char* folderName, T*
if (fSink) {
fSink->RegisterImpl(name, folderName, obj);
} else {
LOG(fatal) << "The sink does not exist to store persistent branches.";
LOG(warning) << "The sink does not exist to store persistent branches (" << name << ").";
}
}
AddMemoryBranch(name, obj);
Expand Down
5 changes: 2 additions & 3 deletions base/steer/FairRunAna.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void FairRunAna::Init()
fRunId = GetEvtHeaderRunId();

// Copy the Event Header Info to Output
fEvtHeader->Register(fStoreEventHeader);
fEvtHeader->Register(GetSink() ? fStoreEventHeader : false);

// Init the containers in Tasks
LOG(info) << "--- Initialize with RunId --- " << fRunId;
Expand All @@ -225,7 +225,7 @@ void FairRunAna::Init()
} else { // end----- if(fMixedInput)
LOG(info) << "Initializing without input file or Mixed input";
FairEventHeader* evt = GetEventHeader();
evt->Register(fStoreEventHeader);
evt->Register(GetSink() ? fStoreEventHeader : false);
FairRunIdGenerator genid;
fRunId = genid.generateId();
fRtdb->addRun(fRunId);
Expand Down Expand Up @@ -269,7 +269,6 @@ void FairRunAna::Init()
// create the output tree after tasks initialisation
fRootManager->WriteFolder();
fRootManager->WriteFileHeader(fFileHeader);

}
//_____________________________________________________________________________

Expand Down
7 changes: 2 additions & 5 deletions base/steer/FairRunAnaProof.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@ void FairRunAnaProof::Init()
fRunId = GetEvtHeaderRunId();

// Copy the Event Header Info to Output
fEvtHeader->Register(kTRUE);

// Copy the Event Header Info to Output
fEvtHeader->Register();
fEvtHeader->Register(GetSink() ? fStoreEventHeader : false);

// Init the containers in Tasks

Expand All @@ -196,7 +193,7 @@ void FairRunAnaProof::Init()
} else {
LOG(info) << "Initializing without input file or Mixed input";
FairEventHeader* evt = GetEventHeader();
evt->Register();
evt->Register(GetSink() ? fStoreEventHeader : false);
FairRunIdGenerator genid;
fRunId = genid.generateId();
fRtdb->addRun(fRunId);
Expand Down

0 comments on commit e0807d9

Please sign in to comment.