9 #include <tracking/modules/pxdDataReduction/ROIPayloadAssemblerModule.h>
10 #include <vxd/dataobjects/VxdID.h>
12 #include <hlt/softwaretrigger/core/FinalTriggerDecisionCalculator.h>
13 #include <mdst/dataobjects/SoftwareTriggerResult.h>
14 #include <vxd/geometry/GeoCache.h>
15 #include <vxd/geometry/SensorInfoBase.h>
33 setDescription(
"This module assembles payload for the ROI in the correct format to be sent to the ONSEN");
34 setPropertyFlags(c_ParallelProcessingCertified);
36 addParam(
"ROIListName", m_ROIListName,
"name of the list of ROIs", std::string(
""));
37 addParam(
"ROIpayloadName", m_ROIpayloadName,
"name of the payload of ROIs", std::string(
""));
38 addParam(
"SendAllDownscaler", mSendAllDS,
39 "Send all Data (no selection) downscaler; Workaround for missing ONSEN functionality, 0 never set, 1 alway set, 2 set in every second...",
41 addParam(
"SendROIsDownscaler", mSendROIsDS,
42 "Send ROIs downscaler; Workaround for missing ONSEN functionality, 0 never set, 1 alway set, 2 set in every second...", 3u);
43 addParam(
"CutNrROIs", mCutNrROIs,
44 "If Nr of ROIs per DHHID reach this, send out only one full sensor ROI", 32u);
45 addParam(
"AcceptAll", mAcceptAll,
"Accept all, Ignore HLT decision",
false);
46 addParam(
"NoRejectFlag", mNoRejectFlag,
"Never reject, just send no ROI",
true);
49 void ROIPayloadAssemblerModule::initialize()
51 m_eventMetaData.isRequired();
52 m_ROIList.isOptional(m_ROIListName);
54 m_roiPayloads.registerInDataStore(
66 void ROIPayloadAssemblerModule::event()
68 const VXD::GeoCache& aGeometry = VXD::GeoCache::getInstance();
69 unsigned int evtNr = m_eventMetaData->getEvent();
70 unsigned int countROIs = 0;
75 if (!result.isValid()) {
77 B2INFO(
"SoftwareTriggerResult object not available but needed to generate the ROI payload.");
80 accepted = SoftwareTrigger::FinalTriggerDecisionCalculator::getFinalTriggerDecision(*result);
84 map<VxdID, set<ROIrawID, ROIrawID>> mapOrderedROIraw;
89 B2DEBUG(1,
" number of ROIs in the list = " << m_ROIList.getEntries());
91 for (
auto& iROI : m_ROIList) {
94 int layer = (iROI.getSensorID()).getLayerNumber() - 1;
95 int ladder = (iROI.getSensorID()).getLadderNumber();
96 int sensor = (iROI.getSensorID()).getSensorNumber() - 1;
99 roiraw.
setDHHID(((layer) << 5) | ((ladder) << 1) | (sensor));
107 mapOrderedROIraw[iROI.getSensorID()].insert(roiraw);
110 B2DEBUG(1,
" number of original ROIs = " << m_ROIList.getEntries());
116 for (
auto& it : mapOrderedROIraw) {
117 if (it.second.size() < mCutNrROIs) countROIs += it.second.size();
122 if (m_roiPayloads.isValid()) {
123 B2FATAL(
"ROIpayload already in datastore, this must not be the case when calling the ROIPayloadAssemblerModule.");
128 m_roiPayloads.assign(payload);
131 payload->setHeader(accepted || mNoRejectFlag,
132 mSendAllDS ? (evtNr % mSendAllDS) == 0 : 0, mSendROIsDS ? (evtNr % mSendROIsDS) == 0 : 0);
133 payload->setTriggerNumber(evtNr);
136 payload->setRunSubrunExpNumber(m_eventMetaData->getRun(), m_eventMetaData->getSubrun(), m_eventMetaData->getExperiment());
138 unsigned int addROI = 0;
143 for (
auto& it : mapOrderedROIraw) {
145 if (it.second.size() > 0) {
146 if (it.second.size() < mCutNrROIs) {
147 for (
auto& itSet : it.second) {
148 payload->addROIraw(itSet.getBigEndian());
153 B2INFO(
"Nr ROI on DHHID " << it.second.begin()->getDHHID() << endl <<
154 " exceeds limit CutNrROIs, thus full sensor ROI is created.");
156 const int nPixelsU = aSensorInfo.
getUCells();
157 const int nPixelsV = aSensorInfo.
getVCells();
160 roiraw.
setDHHID(it.second.begin()->getDHHID());
173 payload->setPayloadLength();
176 B2DEBUG(1,
" number of ROIs in payload = " << addROI);
The ROI Payload Assembler Module.
ROIpayload @TODO: Better explanation, Is there a reason to inherit from TObject and not Relationsobje...
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
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.
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.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.