9#include <tracking/modules/roiFinding/pxd/ROIPayloadAssemblerModule.h>
10#include <framework/dataobjects/EventMetaData.h>
11#include <tracking/dataobjects/ROIid.h>
12#include <tracking/dataobjects/ROIpayload.h>
13#include <vxd/dataobjects/VxdID.h>
14#include <hlt/softwaretrigger/core/FinalTriggerDecisionCalculator.h>
15#include <mdst/dataobjects/SoftwareTriggerResult.h>
16#include <vxd/geometry/GeoCache.h>
17#include <vxd/geometry/SensorInfoBase.h>
36 setDescription(
"This module assembles payload for the ROI in the correct format to be sent to the ONSEN");
42 "Send all Data (no selection) downscaler; Workaround for missing ONSEN functionality, 0 never set, 1 always set, 2 set in every second...",
45 "Send ROIs downscaler; Workaround for missing ONSEN functionality, 0 never set, 1 always set, 2 set in every second...", 3u);
47 "If Nr of ROIs per DHHID reach this, send out only one full sensor ROI", 32u);
73 unsigned int countROIs = 0;
78 if (!result.isValid()) {
80 B2INFO(
"SoftwareTriggerResult object not available but needed to generate the ROI payload.");
87 std::map<VxdID, std::set<ROIrawID, ROIrawID>> mapOrderedROIraw;
92 B2DEBUG(1,
" number of ROIs in the list = " <<
m_ROIList.getEntries());
97 int layer = (iROI.getSensorID()).getLayerNumber() - 1;
98 int ladder = (iROI.getSensorID()).getLadderNumber();
99 int sensor = (iROI.getSensorID()).getSensorNumber() - 1;
102 roiraw.
setDHHID(((layer) << 5) | ((ladder) << 1) | (sensor));
110 mapOrderedROIraw[iROI.getSensorID()].insert(roiraw);
113 B2DEBUG(1,
" number of original ROIs = " <<
m_ROIList.getEntries());
119 for (
auto& it : mapOrderedROIraw) {
120 if (it.second.size() <
mCutNrROIs) countROIs += it.second.size();
126 B2FATAL(
"ROIpayload already in datastore, this must not be the case when calling the ROIPayloadAssemblerModule.");
136 payload->setTriggerNumber(evtNr);
141 unsigned int addROI = 0;
146 for (
auto& it : mapOrderedROIraw) {
148 if (it.second.size() > 0) {
150 for (
auto& itSet : it.second) {
151 payload->addROIraw(itSet.getBigEndian());
156 B2INFO(
"Nr ROI on DHHID " << it.second.begin()->getDHHID() << std::endl <<
157 " exceeds limit CutNrROIs, thus full sensor ROI is created.");
159 const int nPixelsU = aSensorInfo.
getUCells();
160 const int nPixelsV = aSensorInfo.
getVCells();
163 roiraw.
setDHHID(it.second.begin()->getDHHID());
176 payload->setPayloadLength();
179 B2DEBUG(1,
" number of ROIs in payload = " << addROI);
void setDescription(const std::string &description)
Sets the description of the module.
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...
unsigned int mSendROIsDS
Send ROIs downscaler; Workaround for missing ONSEN functionality.
void initialize() override final
Initializes the Module.
bool mNoRejectFlag
Never reject, just send no ROI.
std::string m_ROIListName
name of the ROI list
StoreObjPtr< ROIpayload > m_roiPayloads
pointer to the ROIpayload dataobject
std::string m_ROIpayloadName
name of the payload to be sent to ONSEN
StoreObjPtr< EventMetaData > m_eventMetaData
pointer to the dataobject with event number etc
unsigned int mCutNrROIs
If Nr of ROIs per DHHID reach this, send out only one full sensor ROI.
void event() override final
This method is the core of the module.
bool mAcceptAll
Accept all event, dont use HLT decision.
ROIPayloadAssemblerModule()
Constructor of the module.
unsigned int mSendAllDS
Send all Data (no selection) downscaler; Workaround for missing ONSEN functionality.
StoreArray< ROIid > m_ROIList
the ROIids dataobjects collection
ROIpayload TODO: Better explanation, Is there a reason to inherit from TObject and not Relationsobjec...
void setMinVid(baseType MinV)
set minimum V
void setSystemFlag(baseType SystemFlag)
set system flag
void setMinUid(baseType MinU)
set minimum U
void setMaxUid(baseType MaxU)
set maximum U
void setDHHID(baseType DHHID)
set DHH ID
void setMaxVid(baseType MaxV)
set maximum V
baseType getBigEndian() const
get bigEndian
static bool getFinalTriggerDecision(const SoftwareTriggerResult &result, bool forgetTotalResult=false)
Calculate the final cut decision using all "total_results" of all sub triggers in the software trigge...
Type-safe access to single objects in the data store.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Base class to provide Sensor Information for PXD and SVD.
int getVCells() const
Return number of pixel/strips in v direction.
int getUCells() const
Return number of pixel/strips in u direction.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.