From b3ff218a3fa1041fa3632c81467cc7e9770ef377 Mon Sep 17 00:00:00 2001 From: raiqarasool Date: Tue, 22 Oct 2024 16:44:47 -0400 Subject: [PATCH] Added use_factory alternative in jana2 to docs --- docs/jana1to2/developers-transition-guide.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/jana1to2/developers-transition-guide.md b/docs/jana1to2/developers-transition-guide.md index a446e36e5..45cf5fcbe 100644 --- a/docs/jana1to2/developers-transition-guide.md +++ b/docs/jana1to2/developers-transition-guide.md @@ -686,6 +686,26 @@ for (auto hit: results){ Set(results) ``` +### Forcing Factory to Regenerate Objects + +##### **JANA1** +In JANA1, adding `use_factory` in the constructor forces the factory to regenerate objects, regardless of whether they already exist in the input file. This prevents JANA from searching the input file for those objects. For example: + +```cpp +DEventWriterROOT_factory_ReactionEfficiency() { + use_factory = 1; // prevents JANA from searching the input file for these objects +}; +``` + +##### **JANA2** +In JANA2, the `use_factory` flag is no longer used. To achieve the same functionality, the `SetRegenerateFlag` function must be called with `true` as the parameter. This will prevent JANA from searching the input file for these objects, similar to the behavior in JANA1. For example: + +```cpp +DEventWriterROOT_factory_ReactionEfficiency() { + SetRegenerateFlag(true); // prevents JANA from searching the input file for these objects +}; +``` + ## JEvent ### Transition from JEventLoop to JEvent ##### **JANA1**