 |
Belle II Software
release-05-02-19
|
12 #include <tracking/trackFindingCDC/findlets/base/Findlet.h>
13 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
14 #include <tracking/trackFindingCDC/rootification/StoreWrappedObjPtr.h>
16 #include <framework/core/ModuleParamList.h>
25 namespace TrackFindingCDC {
31 template<
class IOType,
bool a_alwaysWrite = false>
32 class StoreVectorSwapper:
33 public Findlet<IOType> {
37 using Super = Findlet<IOType>;
42 const std::string& classMnemomicName =
"",
43 const std::string& classMnemomicDescription =
"")
64 void exposeParameters(ModuleParamList* moduleParamList,
const std::string& prefix)
override
67 classMnemomicCapitalName[0] = ::toupper(classMnemomicCapitalName.at(0));
69 if (not a_alwaysWrite) {
70 moduleParamList->addParameter(prefixed(prefix,
"Write" + classMnemomicCapitalName +
"s"),
73 "s shall be written to the DataStore",
77 moduleParamList->addParameter(prefixed(prefix, classMnemomicCapitalName +
"sStoreObjName"),
80 "s generated within this module.",
110 if (not storeVector.
isValid()) {
118 void apply(std::vector<IOType>& input)
final {
123 std::vector<IOType>& sink = *storeVector;
StoreVectorSwapper(const std::string &storeVectorName, const std::string &classMnemomicName="", const std::string &classMnemomicDescription="")
Constructor taking the default name of the store vector which is the target of the swap.
std::string m_classMnemomicDescription
Short description for the type of objects to be written out.
void initialize() override
Receive signal before the start of the event processing.
This class is for convenience access and registration of objects, that are stored inside the StoreWra...
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
void beginEvent() override
Receive signal for the start of a new event.
void initialize() override
Receive and dispatch signal before the start of the event processing.
std::vector< IOType > m_backup
Backup storage if the vector should not be written to the DataStore.
std::string getDescription() override
Short description of the findlet.
std::string getClassMnemomicParameterDescription(const RecoTrack *dispatchTag __attribute__((unused)))
Returns a short description for class RecoTrack to be used in descriptions of parameters.
Findlet< IOType > Super
Type of the base class.
std::string m_param_storeVectorName
Name of the store vector to be used.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters to a module.
bool construct(Args &&... params)
Construct an object of type T in this StoreObjPtr, using the provided constructor arguments.
Abstract base class for different kinds of events.
bool m_param_writeStoreVector
Switch if the store vector should be filled.
void beginEvent() override
Receive and dispatch signal for the start of a new event.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_DontWriteOut|DataStore::c_ErrorIfAlreadyRegistered)
Register the object/array in the DataStore.
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
void apply(std::vector< IOType > &input) final
Swaps the items to the DataStore or to the backup storage location.
std::string getClassMnemomicParameterName(const RecoTrack *dispatchTag __attribute__((unused)))
Returns a short name for class RecoTrack to be used in names of parameters.
std::string m_classMnemomicName
Short name for the type of objects to be written out.
bool isValid() const
Check whether the object was created.