10#include <tracking/trackFindingCDC/rootification/StoreWrappedObjPtr.h>
12#include <tracking/trackFindingCDC/utilities/EvalVariadic.h>
14#include <framework/core/Module.h>
15#include <framework/core/ModuleParamList.h>
26 namespace TrackFindingCDC {
29 template<
class AFindlet>
37 using IOTypes =
typename AFindlet::IOTypes;
40 template<std::
size_t I>
41 using IOType =
typename std::tuple_element<I, IOTypes>::type;
45 using Stripped =
typename std::remove_reference<typename std::remove_const<T>::type>::type;
48 template<std::
size_t I>
52 template <std::
size_t I>
59 template<std::
size_t I>
62 return std::is_const<IOType<I>>::value or std::is_reference<IOType<I>>::value;
66 static const std::size_t
c_nTypes = std::tuple_size<IOTypes>::value;
69 using Indices = std::make_index_sequence<c_nTypes>;
73 explicit FindletModule(
const std::array<std::string, c_nTypes>& storeVectorNames = {})
77 std::string description =
"Findlet: ";
78 if (std::tuple_size<IOTypes>() == 0) {
83 description +=
m_findlet.getDescription();
90 const std::string prefix =
"";
91 m_findlet.exposeParameters(&moduleParamList, prefix);
138 template <
size_t... Is>
145 template <
size_t... Is>
152 template <
size_t... Is>
164 template <std::
size_t I>
173 template <std::
size_t I>
182 template<std::
size_t I>
191 template<std::
size_t I>
199 template<
size_t ... Is>
206 template<std::
size_t I>
226 template <std::
size_t I>
230 int order = primary ? 1 : 2;
239 template<std::
size_t I>
243 int order = primary ? 1 : 2;
260 std::string orderPrefix;
263 }
else if (order == 2) {
264 orderPrefix =
"secondary";
266 B2ERROR(
"More than two inputs of the same type are not supported");
268 std::string inputPrefix = input ?
"input" :
"";
270 if (input or order > 1) {
271 classMnemonic[0] = ::toupper(classMnemonic.at(0));
273 if (input and order > 1) {
274 inputPrefix[0] = ::toupper(inputPrefix.at(0));
277 return orderPrefix + inputPrefix + classMnemonic +
"s";
288 std::string orderPrefix;
291 }
else if (order == 2) {
292 orderPrefix =
"secondary ";
294 B2ERROR(
"More than two inputs of the same type are not supported");
296 std::string inputPrefix = input ?
"input " :
"";
297 return "Name of the " + orderPrefix + inputPrefix + classMnemonic +
" vector.";
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
The Module parameter list class.
void setDescription(const std::string &description)
Sets the description of the module.
const ModuleParamList & getParamList() const
Return module param list.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
virtual void initialize()
Initialize the Module.
virtual void beginRun()
Called when entering a new run.
virtual void endRun()
This method is called if the current run ends.
void setParamList(const ModuleParamList ¶ms)
Replace existing parameter list.
virtual void terminate()
This method is called at the end of the event processing.
typename AFindlet::IOTypes IOTypes
virtual void endRun() override
Signal the end of the run.
virtual void terminate() override
Signal to terminate the event processing.
static constexpr bool isInputStoreVector()
Test if the given io type designates an input store vector.
std::array< std::string, c_nTypes > m_param_storeVectorNames
Parameters : Names of the vectors on the DataStore.
FindletModule(const std::array< std::string, c_nTypes > &storeVectorNames={})
Constructor of the module.
StoreWrappedObjPtr< std::vector< StrippedIOType< I > > > StoreVector
std::string getStoreVectorParameterDescription() const
Get parameter description for the StoreVector at index I.
void registerStoreVector()
StoreVector< I > getStoreVector()
std::string getStoreVectorParameterDescription(const std::string &classMnemonic, int order, bool input) const
Compose a parameter description for the name of the vector on the DataStore.
typename std::tuple_element< I, IOTypes >::type IOType
Stripped< IOType< I > > StrippedIOType
void addStoreVectorParameters(std::index_sequence< Is... >)
Expose parameters to set the names of the vectors on the DataStore.
virtual void event() override
Start processing the current event.
AFindlet m_findlet
Findlet that implements the algorithm to be executed.
static const std::size_t c_nTypes
virtual void initialize() override
Initialize the Module before event processing.
typename std::remove_reference< typename std::remove_const< T >::type >::type Stripped
std::make_index_sequence< c_nTypes > Indices
virtual void beginRun() override
Signal the beginning of a new run.
void requireStoreVector()
std::string getStoreVectorParameterName() const
Get parameter name for the StoreVector at index I.
void applyFindlet(std::index_sequence< Is... >)
Get the vectors from the DataStore and apply the findlet.
std::string getStoreVectorParameterName(std::string classMnemonic, int order, bool input) const
Compose a parameter name for the name of the vector on the DataStore.
void requireOrRegisterStoreVectors(std::index_sequence< Is... >)
Require or register the vectors on the DataStore.
virtual ~FindletModule()=default
Make destructor of interface virtual.
void createStoreVectors(std::index_sequence< Is... >)
Create the vectors on the DataStore.
void addStoreVectorParameter()
This class is for convenience access and registration of objects, that are stored inside the StoreWra...
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Abstract base class for different kinds of events.
Looks up, at which index the given Type can be found in a tuple.
std::string getClassMnemomicParameterName(const CDCWireHit *dispatchTag)
Returns a short name for class CDCWireHit to be used in names of parameters.
std::string getClassMnemomicParameterDescription(const CDCWireHit *dispatchTag)
Returns a short description for class CDCWireHit to be used in descriptions of parameters.