Belle II Software development
PXDUnpackerOTModule Class Reference

The PXDUnpackerOT module. More...

#include <PXDUnpackerOTModule.h>

Inheritance diagram for PXDUnpackerOTModule:
Module PathElement

Public Types

enum  EModulePropFlags {
  c_Input = 1 ,
  c_Output = 2 ,
  c_ParallelProcessingCertified = 4 ,
  c_HistogramManager = 8 ,
  c_InternalSerializer = 16 ,
  c_TerminateInAllProcesses = 32 ,
  c_DontCollectStatistics = 64
}
 Each module can be tagged with property flags, which indicate certain features of the module. More...
 
typedef ModuleCondition::EAfterConditionPath EAfterConditionPath
 Forward the EAfterConditionPath definition from the ModuleCondition.
 

Public Member Functions

 PXDUnpackerOTModule ()
 Constructor defining the parameters.
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
virtual void beginRun ()
 Called when entering a new run.
 
virtual void endRun ()
 This method is called if the current run ends.
 
const std::string & getName () const
 Returns the name of the module.
 
const std::string & getType () const
 Returns the type of the module (i.e.
 
const std::string & getPackage () const
 Returns the package this module is in.
 
const std::string & getDescription () const
 Returns the description of the module.
 
void setName (const std::string &name)
 Set the name of the module.
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties.
 
LogConfiggetLogConfig ()
 Returns the log system configuration.
 
void setLogConfig (const LogConfig &logConfig)
 Set the log system configuration.
 
void setLogLevel (int logLevel)
 Configure the log level.
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level.
 
void setAbortLevel (int abortLevel)
 Configure the abort log level.
 
void setLogInfo (int logLevel, unsigned int logInfo)
 Configure the printed log information for the given level.
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module.
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module.
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module.
 
bool hasCondition () const
 Returns true if at least one condition was set for the module.
 
const ModuleConditiongetCondition () const
 Return a pointer to the first condition (or nullptr, if none was set)
 
const std::vector< ModuleCondition > & getAllConditions () const
 Return all set conditions for this module.
 
bool evalCondition () const
 If at least one condition was set, it is evaluated and true returned if at least one condition returns true.
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished.
 
std::vector< std::shared_ptr< Path > > getAllConditionPaths () const
 Return all condition paths currently set (no matter if the condition is true or not).
 
bool hasProperties (unsigned int propertyFlags) const
 Returns true if all specified property flags are available in this module.
 
bool hasUnsetForcedParams () const
 Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.
 
const ModuleParamListgetParamList () const
 Return module param list.
 
template<typename T>
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter.
 
bool hasReturnValue () const
 Return true if this module has a valid return value set.
 
int getReturnValue () const
 Return the return value set by this module.
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module.
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters.
 

Static Public Member Functions

static int nr5bits (int i)
 helper function to "count" nr of set bits within lower 5 bits.
 
static void dump_dhp (void *data, unsigned int frame_len)
 dump to a file, helper function for debugging.
 
static void dump_roi (void *data, unsigned int frame_len)
 dump to a file, helper function for debugging.
 
static void exposePythonAPI ()
 Exposes methods of the Module class to Python.
 

Protected Member Functions

virtual void def_initialize ()
 Wrappers to make the methods without "def_" prefix callable from Python.
 
virtual void def_beginRun ()
 Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.
 
virtual void def_event ()
 Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.
 
virtual void def_endRun ()
 This method can receive that the current run ends as a call from the Python side.
 
virtual void def_terminate ()
 Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.
 
void setDescription (const std::string &description)
 Sets the description of the module.
 
void setType (const std::string &type)
 Set the module type.
 
template<typename T>
void addParam (const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
 Adds a new parameter to the module.
 
template<typename T>
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module.
 
void setReturnValue (int value)
 Sets the return value for this module as integer.
 
void setReturnValue (bool value)
 Sets the return value for this module as bool.
 
void setParamList (const ModuleParamList &params)
 Replace existing parameter list.
 

Private Member Functions

void initialize () override final
 Initialize the module.
 
void event () override final
 do the unpacking
 
void terminate () override final
 Terminate the module.
 
void unpack_rawpxd (RawPXD &px, int inx)
 Unpack one event (several frames) stored in RawPXD object.
 
void unpack_dhc_frame (void *data, const int len, const int Frame_Number, const int Frames_in_event, PXDDAQPacketStatus &daqpktstat)
 Unpack one frame (within an event).
 
void unpack_dhp (void *data, unsigned int len, unsigned int dhe_first_readout_frame_lo, unsigned int dhe_ID, unsigned dhe_DHPport, unsigned dhe_reformat, VxdID vxd_id, PXDDAQPacketStatus &daqpktstat)
 Unpack DHP data within one DHE frame.
 
void unpack_dhp_raw (void *data, unsigned int len, unsigned int dhe_ID, unsigned dhe_DHPport, VxdID vxd_id)
 Unpack DHP RAW data within one DHE frame (pedestals, etc)
 
void unpack_fce (unsigned short *data, unsigned int length, VxdID vxd_id)
 Unpack DHP/FCE data within one DHE frame Not fully implemented as cluster format not 100% fixed.
 
std::list< ModulePtrgetModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects.
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary.
 

Private Attributes

std::string m_RawPXDsName
 The name of the StoreArray of processed RawPXDs.
 
std::string m_PXDDAQEvtStatsName
 The name of the StoreObjPtr of PXDDAQStatus to be generated.
 
std::string m_PXDRawHitsName
 The name of the StoreArray of PXDRawHits to be generated.
 
std::string m_PXDRawAdcsName
 The name of the StoreArray of PXDRawAdcs to be generated.
 
std::string m_PXDRawROIsName
 The name of the StoreArray of PXDRawROIs to be generated.
 
bool m_doNotStore {false}
 Only unpack, but Do Not Store anything to file.
 
bool m_checkPaddingCRC {false}
 Check for susp.
 
bool m_forceMapping {false}
 Force Mapping even if DHH bit is not requesting it.
 
bool m_forceNoMapping {false}
 Force No Mapping even if DHH bit is requesting it.
 
unsigned int m_maxDHPFrameDiff {0}
 Maximum DHP frame difference until error is reported.
 
PXDError::PXDErrorFlags m_criticalErrorMask {}
 Critical error mask which defines return value of task.
 
PXDError::PXDErrorFlags m_suppressErrorMask {}
 Mask for suppressing selected error messages.
 
PXDError::PXDErrorFlags m_errorSkipPacketMask {}
 Mask for error which stop package unpacking directly.
 
unsigned long m_meta_event_nr {0}
 Event Number from MetaInfo.
 
unsigned long m_meta_run_nr {0}
 Run Number from MetaInfo.
 
unsigned long m_meta_subrun_nr {0}
 Subrun Number from MetaInfo.
 
unsigned long m_meta_experiment {0}
 Experiment from MetaInfo.
 
unsigned long long int m_meta_time {0}
 Time(Tag) from MetaInfo.
 
unsigned int m_meta_sec {0}
 Time(Tag) from MetaInfo, seconds (masked to lower bits)
 
unsigned int m_meta_ticks {0}
 Time(Tag) from MetaInfo, Ticks of 127MHz.
 
unsigned int m_unpackedEventsCount {0}
 Event counter.
 
unsigned int m_errorCounter [PXDError::ONSEN_MAX_TYPE_ERR] {}
 Error counters.
 
bool m_verbose {false}
 give verbose unpacking information
 
bool m_continueOnError {false}
 flag continue unpacking of frames even after error (for debugging)
 
StoreArray< RawPXDm_storeRawPXD
 Input array for PXD Raw.
 
StoreObjPtr< EventMetaDatam_eventMetaData
 Input ptr for EventMetaData.
 
StoreArray< PXDRawHitm_storeRawHits
 Output array for Raw Hits.
 
StoreArray< PXDRawROIsm_storeROIs
 Output array for Raw ROIs.
 
StoreObjPtr< PXDDAQStatusm_storeDAQEvtStats
 Output array for DAQ Status.
 
StoreArray< PXDRawAdcm_storeRawAdc
 Output array for Raw Adcs.
 
PXDError::PXDErrorFlags m_errorMask {0}
 Error Mask set per packet / frame.
 
PXDError::PXDErrorFlags m_errorMaskDHE {0}
 Error Mask set per packet / DHE.
 
PXDError::PXDErrorFlags m_errorMaskDHC {0}
 Error Mask set per packet / DHC.
 
PXDError::PXDErrorFlags m_errorMaskPacket {0}
 Error Mask set per packet / packet.
 
PXDError::PXDErrorFlags m_errorMaskEvent {0}
 Error Mask set per packet / event.
 
unsigned int m_notaccepted {0}
 counter for not accepted events... should not happen TODO discussion ongoing with DAQ group
 
unsigned int m_sendrois {0}
 counter for send debug rois
 
unsigned int m_sendunfiltered {0}
 counter for send unfiltered
 
bool m_formatBonnDAQ {false}
 flag ONSEN or BonnDAQ format
 
int m_last_dhp_readout_frame_lo [4] { -1}
 some workaround check for continouous frame ids
 
std::string m_name
 The name of the module, saved as a string (user-modifiable)
 
std::string m_type
 The type of the module, saved as a string.
 
std::string m_package
 Package this module is found in (may be empty).
 
std::string m_description
 The description of the module.
 
unsigned int m_propertyFlags
 The properties of the module as bitwise or (with |) of EModulePropFlags.
 
LogConfig m_logConfig
 The log system configuration of the module.
 
ModuleParamList m_moduleParamList
 List storing and managing all parameter of the module.
 
bool m_hasReturnValue
 True, if the return value is set.
 
int m_returnValue
 The return value.
 
std::vector< ModuleConditionm_conditions
 Module condition, only non-null if set.
 

Detailed Description

The PXDUnpackerOT module.

This module is responsible for unpacking the Raw PXD data to Pixels in v_cellID and u_cellID (global tracking coordinates system) Doing that, sophisticated error and consistency checking is done from the lowest data level on

Definition at line 38 of file PXDUnpackerOTModule.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

Each module can be tagged with property flags, which indicate certain features of the module.

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)

c_HistogramManager 

This module is used to manage histograms accumulated by other modules.

c_InternalSerializer 

This module is an internal serializer/deserializer for parallel processing.

c_TerminateInAllProcesses 

When using parallel processing, call this module's terminate() function in all processes().

This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

77 {
78 c_Input = 1,
79 c_Output = 2,
80 c_ParallelProcessingCertified = 4,
81 c_HistogramManager = 8,
82 c_InternalSerializer = 16,
83 c_TerminateInAllProcesses = 32,
84 c_DontCollectStatistics = 64,
85 };
@ c_Output
Output Process.
Definition ProcHelper.h:19
@ c_Input
Input Process.
Definition ProcHelper.h:17

Constructor & Destructor Documentation

◆ PXDUnpackerOTModule()

Constructor defining the parameters.

Definition at line 39 of file PXDUnpackerOTModule.cc.

39 :
40 Module(),
44{
45 //Set module properties
46 setDescription("Unpack Raw PXD Hits from ONSEN data stream");
48
49 addParam("RawPXDsName", m_RawPXDsName, "The name of the StoreArray of RawPXDs to be processed", std::string(""));
50 addParam("PXDRawHitsName", m_PXDRawHitsName, "The name of the StoreArray of generated PXDRawHits", std::string(""));
51 addParam("PXDDAQEvtStatsName", m_PXDDAQEvtStatsName, "The name of the StoreObjPtr of generated PXDDAQEvtStats", std::string(""));
52 addParam("PXDRawAdcsName", m_PXDRawAdcsName, "The name of the StoreArray of generated PXDRawAdcs", std::string(""));
53 addParam("PXDRawROIsName", m_PXDRawROIsName, "The name of the StoreArray of generated PXDRawROIs", std::string(""));
54 addParam("DoNotStore", m_doNotStore, "only unpack and check, but do not store", false);
55// addParam("CriticalErrorMask", m_criticalErrorMask, "Set error mask which stops processing by returning false by task", 0);
56 // m_criticalErrorMask not longer a aparameter
57 // the constructor default to zero anyway
58// addParam("SuppressErrorMask", m_suppressErrorMask, "Set mask for errors msgs which are not printed", getSilenceMask());
59 // m_suppressErrorMask not longer a aparameter
60 m_suppressErrorMask = getSilenceMask();
61 addParam("ForceMapping", m_forceMapping, "Force Mapping even if DHH bit is NOT requesting it", false);
62 addParam("ForceNoMapping", m_forceNoMapping, "Force NO Mapping even if DHH bit is requesting it", false);
63 addParam("CheckPaddingCRC", m_checkPaddingCRC, "Check for susp. padding (debug option, many false positive)", false);
64 addParam("MaxDHPFrameDiff", m_maxDHPFrameDiff, "Maximum DHP Frame Nr Difference w/o reporting error", 2u);
65 addParam("FormatBonnDAQ", m_formatBonnDAQ, "ONSEN or BonnDAQ format", false);
66 addParam("Verbose", m_verbose, "Turn on extra verbosity for log-level debug", false);
67 addParam("ContinueOnError", m_continueOnError, "Continue package depacking on error (for debugging)", false);
68// (
69// /*EPXDErrFlag::c_DHC_END | EPXDErrFlag::c_DHE_START | EPXDErrFlag::c_DATA_OUTSIDE |*/
70// EPXDErrFlag::c_FIX_SIZE | EPXDErrFlag::c_DHE_CRC | EPXDErrFlag::c_DHC_UNKNOWN | /*EPXDErrFlag::c_MERGER_CRC |*/
71// EPXDErrFlag::c_DHP_SIZE | /*EPXDErrFlag::c_DHP_PIX_WO_ROW | EPXDErrFlag::c_DHE_START_END_ID | EPXDErrFlag::c_DHE_START_ID |*/
72// EPXDErrFlag::c_DHE_START_WO_END | EPXDErrFlag::c_DHP_NOT_CONT
73// ));
74
75 // this is not really a parameter, it should be fixed.
76 m_errorSkipPacketMask[c_nrDHE_CRC] = true;
77 m_errorSkipPacketMask[c_nrFIX_SIZE] = true;
78}
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
Module()
Constructor.
Definition Module.cc:30
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
std::string m_PXDRawHitsName
The name of the StoreArray of PXDRawHits to be generated.
bool m_doNotStore
Only unpack, but Do Not Store anything to file.
bool m_forceNoMapping
Force No Mapping even if DHH bit is requesting it.
std::string m_PXDDAQEvtStatsName
The name of the StoreObjPtr of PXDDAQStatus to be generated.
PXDError::PXDErrorFlags m_suppressErrorMask
Mask for suppressing selected error messages.
bool m_formatBonnDAQ
flag ONSEN or BonnDAQ format
StoreArray< PXDRawROIs > m_storeROIs
Output array for Raw ROIs.
std::string m_RawPXDsName
The name of the StoreArray of processed RawPXDs.
StoreArray< PXDRawAdc > m_storeRawAdc
Output array for Raw Adcs.
PXDError::PXDErrorFlags m_errorSkipPacketMask
Mask for error which stop package unpacking directly.
std::string m_PXDRawAdcsName
The name of the StoreArray of PXDRawAdcs to be generated.
bool m_continueOnError
flag continue unpacking of frames even after error (for debugging)
unsigned int m_maxDHPFrameDiff
Maximum DHP frame difference until error is reported.
StoreArray< PXDRawHit > m_storeRawHits
Output array for Raw Hits.
bool m_forceMapping
Force Mapping even if DHH bit is not requesting it.
bool m_verbose
give verbose unpacking information
std::string m_PXDRawROIsName
The name of the StoreArray of PXDRawROIs to be generated.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:559

Member Function Documentation

◆ beginRun()

virtual void beginRun ( void )
inlinevirtualinherited

Called when entering a new run.

Called at the beginning of each run, the method gives you the chance to change run dependent constants like alignment parameters, etc.

This method can be implemented by subclasses.

Reimplemented in AnalysisPhase1StudyModule, ARICHBackgroundModule, arichBtestModule, ARICHDigitizerModule, ARICHDQMModule, ARICHRateCalModule, ARICHReconstructorModule, AWESOMEBasicModule, B2BIIConvertBeamParamsModule, B2BIIConvertMdstModule, B2BIIFixMdstModule, B2BIIMCParticlesMonitorModule, B2BIIMdstInputModule, BeamabortModule, BeamabortStudyModule, BeamDigitizerModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BeamSpotMonitorModule, BelleMCOutputModule, BgoDigitizerModule, BgoModule, BgoStudyModule, BGOverlayInputModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, CalibrationCollectorModule, CaveModule, CDCCosmicAnalysisModule, CDCCRTestModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, CDCDedxDQMModule, CDCDedxValidationModule, cdcDQM7Module, CDCDQMModule, CDCTrigger2DFinderModule, CDCTriggerNDFinderModule, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CDCTriggerTSFModule, CDCTriggerUnpackerModule, CertifyParallelModule, ChargedPidMVAModule, ChargedPidMVAMulticlassModule, ClawDigitizerModule, ClawModule, ClawStudyModule, ClawsDigitizerModule, CLAWSModule, ClawsStudyModule, Convert2RawDetModule, CosmicsAlignmentValidationModule, CreateFieldMapModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, CurlTaggerModule, DAQMonitorModule, DAQPerfModule, DataWriterModule, DelayDQMModule, DeSerializerPXDModule, DetectorOccupanciesDQMModule, DosiDigitizerModule, DosiModule, DosiStudyModule, DQMHistAnalysisARICHModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEpicsOutputModule, DQMHistAnalysisEventT0EfficiencyModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisExampleModule, DQMHistAnalysisHLTModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputRootFileModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLM2Module, DQMHistAnalysisKLMModule, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPeakModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDCMModule, DQMHistAnalysisPXDDAQModule, DQMHistAnalysisPXDEffModule, DQMHistAnalysisPXDERModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisPXDInjectionModule, DQMHistAnalysisPXDReductionModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisRunNrModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTrackingAbortModule, DQMHistAnalysisTrackingHLTModule, DQMHistAnalysisTRGECLModule, DQMHistAnalysisTRGModule, DQMHistAutoCanvasModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DQMHistInjectionModule, DqmHistoManagerModule, DQMHistoModuleBase, DQMHistOutputToEPICSModule, DQMHistReferenceModule, DQMHistSnapshotsModule, Ds2RawFileModule, Ds2RawModule, Ds2RbufModule, Ds2SampleModule, ECLDQMInjectionModule, ECLLOMModule, ECLBackgroundModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLChargedPIDModule, ECLChargedPIDMVAModule, ECLClusterPSDModule, ECLCovarianceMatrixModule, ECLCRFinderModule, ECLDataAnalysisModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMConnectedRegionsModule, ECLDQMEXTENDEDModule, ECLDQMModule, ECLDQMOutOfTimeDigitsModule, ECLExpertModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLocalRunCalibratorModule, ECLPackerModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLUnpackerModule, ECLWaveformFitModule, EffPlotsModule, EKLMDataCheckerModule, ElapsedTimeModule, EnergyBiasCorrectionModule, EventInfoPrinterModule, EventLimiterModule, EventsOfDoomBusterModule, EventT0DQMModule, EventT0ValidationModule, EvReductionModule, EvtGenDecayModule, EvtGenInputModule, ExportGeometryModule, ExtModule, FANGSDigitizerModule, FANGSModule, FANGSStudyModule, FastRbuf2DsModule, FlipQualityModule, FullSimModule, TRGGDLUnpackerModule, GearboxModule, GenRawSendModule, GetEventFromSocketModule, GRLNeuroModule, He3DigitizerModule, He3tubeModule, He3tubeStudyModule, HistoManagerModule, HistoModule, HitXPModule, HLTDQM2ZMQModule, IoVDependentConditionModule, IPDQMModule, KinkFinderModule, KKGenInputModule, KLMClusterAnaModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDigitTimeShifterModule, KLMDQM2Module, KLMDQMModule, KLMExpertModule, KLMMuonIDDNNExpertModule, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMTrackingModule, KLMTriggerModule, KLMUnpackerModule, KlongValidationModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, MaterialScanModule, MCMatcherTRGECLModule, MCTrackCandClassifierModule, MCV0MatcherModule, MicrotpcModule, MicrotpcStudyModule, TpcDigitizerModule, MonitorDataModule, MuidModule, MVAExpertModule, MVAMultipleExpertsModule, MVAPrototypeModule, NtuplePhase1_v6Module, OverrideGenerationFlagsModule, PartialSeqRootReaderModule, ParticleVertexFitterModule, Ph1bpipeModule, Ph1sustrModule, PhotonEfficiencySystematicsModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleEcmsBBModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, PinDigitizerModule, PindiodeModule, PindiodeStudyModule, PlumeDigitizerModule, PlumeModule, ProgressModule, PXDBackgroundModule, PXDBgTupleProducerModule, PXDClusterizerModule, PXDDAQDQMModule, PXDDigitizerModule, PXDGatedDHCDQMModule, PXDGatedModeDQMModule, PXDInjectionDQMModule, PXDMCBgTupleProducerModule, PXDPackerModule, PXDRawDQMChipsModule, PXDRawDQMModule, PXDROIDQMModule, PXDUnpackerModule, PXDclusterFilterModule, PXDClustersFromTracksModule, PXDdigiFilterModule, PXDDQMClustersModule, PXDDQMCorrModule, PXDDQMEfficiencyModule, PXDDQMEfficiencySelftrackModule, PXDDQMExpressRecoModule, PXDPerformanceModule, PXDRawDQMCorrModule, PXDROIFinderAnalysisModule, PXDROIFinderModule, PXDTrackClusterDQMModule, PyModule, QcsmonitorDigitizerModule, QcsmonitorModule, QcsmonitorStudyModule, QualityEstimatorVXDModule, RandomBarrierModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, ReceiveEventModule, ReprocessorModule, RxModule, RxSocketModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, SectorMapBootstrapModule, SegmentNetworkProducerModule, SeqRootInputModule, SeqRootMergerModule, SeqRootOutputModule, SerializerModule, SoftwareTriggerHLTDQMModule, SoftwareTriggerModule, StatisticsTimingHLTDQMModule, SPTCmomentumSeedRetrieverModule, SPTCvirtualIPRemoverModule, SrsensorModule, StatisticsSummaryModule, StorageDeserializerModule, StorageSerializerModule, SubEventModule, SVD3SamplesEmulatorModule, SVDBackgroundModule, SVDClusterizerModule, SVDDigitizerModule, SVDDQMDoseModule, SVDDQMInjectionModule, SVDMissingAPVsClusterCreatorModule, SVDPackerModule, SVDRecoDigitCreatorModule, SVDUnpackerModule, SVDB4CommissioningPlotsModule, SVDClusterCalibrationsMonitorModule, SVDClusterEvaluationModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDCoGTimeEstimatorModule, SVDDataFormatCheckModule, SVDDQMClustersOnTrackModule, SVDDQMExpressRecoModule, SVDDQMHitTimeModule, svdDumpModule, SVDEventInfoSetterModule, SVDEventT0EstimatorModule, SVDHotStripFinderModule, SVDLatencyCalibrationModule, SVDLocalCalibrationsCheckModule, SVDLocalCalibrationsMonitorModule, SVDMaxStripTTreeModule, SVDOccupancyAnalysisModule, SVDPerformanceModule, SVDPerformanceTTreeModule, SVDPositionErrorScaleFactorImporterModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, SVDShaperDigitsFromTracksModule, SVDSpacePointCreatorModule, SVDTimeCalibrationsMonitorModule, SVDTimeGroupingModule, SVDTriggerQualityGeneratorModule, SVDUnpackerDQMModule, SwitchDataStoreModule, TagVertexModule, TOPBackgroundModule, TOPBunchFinderModule, TOPChannelMaskerModule, TOPChannelT0MCModule, TOPDigitizerModule, TOPDoublePulseGeneratorModule, TOPDQMModule, TOPGainEfficiencyCalculatorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPLaserHitSelectorModule, TOPMCTrackMakerModule, TOPModuleT0CalibratorModule, TOPNtupleModule, TOPPackerModule, TOPRawDigitConverterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPTimeRecalibratorModule, TOPTriggerDigitizerModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPXTalkChargeShareSetterModule, TrackAnaModule, TrackCreatorModule, TrackFinderMCTruthRecoTracksModule, TrackFinderVXDBasicPathFinderModule, TrackFinderVXDCellOMatModule, FindletModule< AFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< AxialTrackFinderLegendre >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< FacetCreator >, FindletModule< FacetCreator >, FindletModule< HitBasedT0Extractor >, FindletModule< HitBasedT0Extractor >, FindletModule< HitReclaimer >, FindletModule< HitReclaimer >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackExporter >, FindletModule< TrackFinder >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFindingCDC::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackFindingCDC::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< TrackRejecter >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, FindletModule< WireHitPreparer >, TrackFinderVXDAnalizerModule, TrackingAbortDQMModule, TrackingPerformanceEvaluationModule, TrackQETrainingDataCollectorModule, TrackQualityEstimatorMVAModule, TreeFitterModule, TRGCDCETFUnpackerModule, TRGCDCModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSStreamModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLEventTimingDQMModule, TRGECLFAMModule, TRGECLModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGEFFDQMModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLModule, TRGGDLSummaryModule, TRGGRLDQMModule, TRGGRLInjectionVetoFromOverlayModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLUnpackerModule, TRGRAWDATAModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TTDDQMModule, TxModule, TxSocketModule, V0findingPerformanceEvaluationModule, V0ObjectsDQMModule, VXDMisalignmentModule, vxdDigitMaskingModule, VXDDQMExpressRecoModule, VXDQETrainingDataCollectorModule, VXDQualityEstimatorMVAModule, VXDSimpleClusterizerModule, and VXDTFTrainingDataCollectorModule.

Definition at line 146 of file Module.h.

146{};

◆ clone()

std::shared_ptr< PathElement > clone ( ) const
overridevirtualinherited

Create an independent copy of this module.

Note that parameters are shared, so changing them on a cloned module will also affect the original module.

Implements PathElement.

Definition at line 179 of file Module.cc.

180{
183 newModule->setName(getName());
184 newModule->m_package = m_package;
185 newModule->m_propertyFlags = m_propertyFlags;
186 newModule->m_logConfig = m_logConfig;
187 newModule->m_conditions = m_conditions;
188
189 return newModule;
190}
std::shared_ptr< Module > registerModule(const std::string &moduleName, std::string sharedLibPath="") noexcept(false)
Creates an instance of a module and registers it to the ModuleManager.
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.
void setParameters(const ModuleParamList &params)
Set values for parameters from other parameter list.
const ModuleParamList & getParamList() const
Return module param list.
Definition Module.h:362
const std::string & getName() const
Returns the name of the module.
Definition Module.h:186
const std::string & getType() const
Returns the type of the module (i.e.
Definition Module.cc:41
unsigned int m_propertyFlags
The properties of the module as bitwise or (with |) of EModulePropFlags.
Definition Module.h:511
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
Definition Module.h:515
void setName(const std::string &name)
Set the name of the module.
Definition Module.h:213
LogConfig m_logConfig
The log system configuration of the module.
Definition Module.h:513
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
Definition Module.h:520
std::string m_package
Package this module is found in (may be empty).
Definition Module.h:509
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition Module.h:43

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 425 of file Module.h.

425{ beginRun(); }

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

This method can receive that the current run ends as a call from the Python side.

For regular C++-Modules that forwards the call to the regular endRun() method.

Reimplemented in PyModule.

Definition at line 438 of file Module.h.

438{ endRun(); }

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 431 of file Module.h.

431{ event(); }

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

Wrappers to make the methods without "def_" prefix callable from Python.

Overridden in PyModule. Wrapper method for the virtual function initialize() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 419 of file Module.h.

419{ initialize(); }

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 444 of file Module.h.

444{ terminate(); }

◆ dump_dhp()

void dump_dhp ( void * data,
unsigned int frame_len )
static

dump to a file, helper function for debugging.

Definition at line 407 of file PXDUnpackerOTModule.cc.

408{
409 // called only for debugging purpose, will never be called in normal running
410 unsigned int w = frame_len / 2;
411 ubig16_t* d = (ubig16_t*)data;
412
413 B2WARNING("HEADER -- $" << hex << d[0] << ",$" << hex << d[1] << ",$" << hex << d[2] << ",$" << hex << d[3] << " -- ");
414
415 auto dhp_header_type = (d[2] & 0xE000) >> 13;
416 auto dhp_reserved = (d[2] & 0x1F00) >> 8;
417 auto dhp_dhe_id = (d[2] & 0x00FC) >> 2;
418 auto dhp_dhp_id = d[2] & 0x0003;
419
420 B2WARNING("DHP type | $" << hex << dhp_header_type << " ( " << dec << dhp_header_type << " ) ");
421 B2WARNING("DHP reserved | $" << hex << dhp_reserved << " ( " << dec << dhp_reserved << " ) ");
422 B2WARNING("DHP DHE ID | $" << hex << dhp_dhe_id << " ( " << dec << dhp_dhe_id << " ) ");
423 B2WARNING("DHP DHP ID | $" << hex << dhp_dhp_id << " ( " << dec << dhp_dhp_id << " ) ");
424 for (unsigned int i = 4; i < w; i++) {
425 B2WARNING("DHP DATA $" << hex << d[i]);
426 }
427 B2WARNING("DHP CRC $" << hex << d[w] << ",$" << hex << d[w + 1]);
428}
boost::endian::big_uint16_t ubig16_t
define alias ubig16_t

◆ dump_roi()

void dump_roi ( void * data,
unsigned int frame_len )
static

dump to a file, helper function for debugging.

Definition at line 430 of file PXDUnpackerOTModule.cc.

431{
432 // called only for debugging purpose, will never be called in normal running
433 unsigned int w = frame_len / 4;
434 ubig32_t* d = (ubig32_t*)data;
435
436 B2WARNING("HEADER -- $" << hex << d[0] << ",$" << hex << d[1] << ",$" << hex << d[2] << ",$" << hex << d[3] << " -- Len $" << hex
437 << frame_len);
438
439 for (unsigned int i = 0; i < w; i++) {
440 B2WARNING("ROI DATA $" << hex << d[i]);
441 }
442 B2WARNING("ROI CRC $" << hex << d[w]);
443}
boost::endian::big_uint32_t ubig32_t
define alias ubig32_t

◆ endRun()

virtual void endRun ( void )
inlinevirtualinherited

This method is called if the current run ends.

Use this method to store information, which should be aggregated over one run.

This method can be implemented by subclasses.

Reimplemented in AlignDQMModule, AnalysisPhase1StudyModule, arichBtestModule, ARICHDQMModule, AWESOMEBasicModule, B2BIIConvertMdstModule, B2BIIMCParticlesMonitorModule, B2BIIMdstInputModule, BeamabortModule, BeamabortStudyModule, BeamDigitizerModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BelleMCOutputModule, BgoDigitizerModule, BgoModule, BgoStudyModule, BGOverlayInputModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, CalibrationCollectorModule, CaveModule, CDCCosmicAnalysisModule, CDCCRTestModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, CDCDedxDQMModule, CDCDedxValidationModule, cdcDQM7Module, CDCDQMModule, CDCTriggerNDFinderModule, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CertifyParallelModule, ClawDigitizerModule, ClawModule, ClawStudyModule, ClawsDigitizerModule, CLAWSModule, ClawsStudyModule, Convert2RawDetModule, CosmicsAlignmentValidationModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, CurlTaggerModule, DAQPerfModule, DataWriterModule, DeSerializerPXDModule, DosiDigitizerModule, DosiModule, DosiStudyModule, DQMHistAnalysisARICHModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLOutOfTimeDigitsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEpicsOutputModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisExampleModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLM2Module, DQMHistAnalysisKLMModule, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTRGECLModule, DQMHistAnalysisTRGEFFModule, DQMHistAnalysisTRGGDLModule, DQMHistAnalysisTRGModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DqmHistoManagerModule, DQMHistOutputToEPICSModule, DQMHistReferenceModule, DQMHistSnapshotsModule, Ds2RawFileModule, Ds2RawModule, Ds2RbufModule, Ds2SampleModule, ECLLOMModule, ECLBackgroundModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLChargedPIDModule, ECLClusterPSDModule, ECLCovarianceMatrixModule, ECLCRFinderModule, ECLDataAnalysisModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMEXTENDEDModule, ECLDQMModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLocalRunCalibratorModule, ECLPackerModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLUnpackerModule, ECLWaveformFitModule, EffPlotsModule, EKLMDataCheckerModule, ElapsedTimeModule, EventInfoPrinterModule, EventT0ValidationModule, EvReductionModule, EvtGenDecayModule, ExtModule, FANGSDigitizerModule, FANGSModule, FANGSStudyModule, FastRbuf2DsModule, FullSimModule, TRGGDLUnpackerModule, GenfitVisModule, GenRawSendModule, GetEventFromSocketModule, He3DigitizerModule, He3tubeModule, He3tubeStudyModule, HistoManagerModule, HistoModule, HitXPModule, HLTDQM2ZMQModule, HLTDs2ZMQModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDQM2Module, KLMDQMModule, KLMMuonIDDNNExpertModule, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMTrackingModule, KLMTriggerModule, KLMUnpackerModule, KlongValidationModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, MCMatcherTRGECLModule, MCTrackCandClassifierModule, MCV0MatcherModule, MicrotpcModule, MicrotpcStudyModule, TpcDigitizerModule, TPCStudyModule, MonitorDataModule, MuidModule, NoKickCutsEvalModule, NtuplePhase1_v6Module, OverrideGenerationFlagsModule, PartialSeqRootReaderModule, Ph1bpipeModule, Ph1sustrModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, PinDigitizerModule, PindiodeModule, PindiodeStudyModule, PlumeDigitizerModule, PlumeModule, PrintDataModule, PrintEventRateModule, PXDBackgroundModule, PXDClustersFromTracksModule, PXDPerformanceModule, PXDROIFinderModule, PyModule, QcsmonitorDigitizerModule, QcsmonitorModule, QcsmonitorStudyModule, RandomBarrierModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, ReceiveEventModule, ReprocessorModule, Root2BinaryModule, Root2RawModule, RT2SPTCConverterModule, RxModule, RxSocketModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, SectorMapBootstrapModule, SeqRootInputModule, SeqRootMergerModule, SeqRootOutputModule, SerializerModule, SPTCmomentumSeedRetrieverModule, SPTCvirtualIPRemoverModule, SrsensorModule, StatisticsSummaryModule, StorageDeserializerModule, StorageRootOutputModule, StorageSerializerModule, SubEventModule, SVD3SamplesEmulatorModule, SVDBackgroundModule, SVDClusterizerModule, SVDPackerModule, SVDRecoDigitCreatorModule, SVDUnpackerModule, SVDB4CommissioningPlotsModule, SVDClusterCalibrationsMonitorModule, SVDClusterEvaluationModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDCoGTimeEstimatorModule, SVDDataFormatCheckModule, svdDumpModule, SVDHotStripFinderModule, SVDLatencyCalibrationModule, SVDLocalCalibrationsMonitorModule, SVDOccupancyAnalysisModule, SVDPerformanceModule, SVDPositionErrorScaleFactorImporterModule, SVDROIDQMModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, SVDShaperDigitsFromTracksModule, SVDTimeCalibrationsMonitorModule, SVDTriggerQualityGeneratorModule, SVDUnpackerDQMModule, SwitchDataStoreModule, TOPBackgroundModule, TOPChannelT0MCModule, TOPDoublePulseGeneratorModule, TOPGainEfficiencyCalculatorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPLaserHitSelectorModule, TOPMCTrackMakerModule, TOPNtupleModule, TOPPackerModule, TOPRawDigitConverterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPTriggerDigitizerModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPWaveformQualityPlotterModule, TOPXTalkChargeShareSetterModule, TrackAnaModule, TrackFinderMCTruthRecoTracksModule, FindletModule< AFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< AxialTrackFinderLegendre >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< FacetCreator >, FindletModule< FacetCreator >, FindletModule< HitBasedT0Extractor >, FindletModule< HitBasedT0Extractor >, FindletModule< HitReclaimer >, FindletModule< HitReclaimer >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackExporter >, FindletModule< TrackFinder >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFindingCDC::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackFindingCDC::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< TrackRejecter >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, FindletModule< WireHitPreparer >, TrackFinderVXDAnalizerModule, TrackingPerformanceEvaluationModule, TrackSetEvaluatorHopfieldNNDEVModule, TRGCDCETFUnpackerModule, TRGCDCModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSStreamModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLFAMModule, TRGECLModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGEFFDQMModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLModule, TRGGDLSummaryModule, TRGGRLDQMModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLUnpackerModule, TRGRAWDATAModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TxModule, TxSocketModule, V0findingPerformanceEvaluationModule, vxdDigitMaskingModule, VXDSimpleClusterizerModule, VXDTFTrainingDataCollectorModule, ZMQTxInputModule, and ZMQTxWorkerModule.

Definition at line 165 of file Module.h.

165{};

◆ evalCondition()

bool evalCondition ( ) const
inherited

If at least one condition was set, it is evaluated and true returned if at least one condition returns true.

If no condition or result value was defined, the method returns false. Otherwise, the condition is evaluated and true returned, if at least one condition returns true. To speed up the evaluation, the condition strings were already parsed in the method if_value().

Returns
True if at least one condition and return value exists and at least one condition expression was evaluated to true.

Definition at line 96 of file Module.cc.

97{
98 if (m_conditions.empty()) return false;
99
100 //okay, a condition was set for this Module...
101 if (!m_hasReturnValue) {
102 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
103 }
104
105 for (const auto& condition : m_conditions) {
106 if (condition.evaluate(m_returnValue)) {
107 return true;
108 }
109 }
110 return false;
111}
int m_returnValue
The return value.
Definition Module.h:518
bool m_hasReturnValue
True, if the return value is set.
Definition Module.h:517

◆ event()

void event ( void )
finaloverrideprivatevirtual

do the unpacking

Reimplemented from Module.

Definition at line 127 of file PXDUnpackerOTModule.cc.

128{
129 m_storeDAQEvtStats.create();
130
131 m_errorMask = 0;
133
134 m_meta_event_nr = m_eventMetaData->getEvent();// used for error output below
135
136 if (!m_storeRawPXD) {// if no input, nothing to do
137 m_errorMask[c_nrNO_PXD] = true;
138 } else {
139 int nRaws = m_storeRawPXD.getEntries();
140 if (m_verbose) {
141 B2DEBUG(29, "PXD Unpacker --> RawPXD Objects in event: " << LogVar("Objects", nRaws));
142 };
143
144 m_meta_run_nr = m_eventMetaData->getRun();
145 m_meta_subrun_nr = m_eventMetaData->getSubrun();
146 m_meta_experiment = m_eventMetaData->getExperiment();
147 m_meta_time = m_eventMetaData->getTime();
148 m_meta_ticks = (unsigned int)std::round((m_meta_time % 1000000000ull) * 0.127216); // calculate ticks in 127MHz RF clock
149 m_meta_sec = (unsigned int)(m_meta_time / 1000000000ull) & 0x1FFFF;
150
151 int inx = 0; // count index for output objects
152 for (auto& it : m_storeRawPXD) {
153 if (m_verbose) {
154 B2DEBUG(29, "PXD Unpacker --> Unpack Objects: ");
155 };
156 unpack_rawpxd(it, inx++);
157 }
158
159 if (nRaws == 0) m_errorMask[c_nrNO_PXD] = true;
160 }
163
165 {
166 for (unsigned int i = 0; i < ONSEN_MAX_TYPE_ERR; i++) {
167 if (m_errorMaskEvent[i]) m_errorCounter[i]++;
168 }
169 }
170
171 if ((PXDErrorFlags(m_criticalErrorMask) & m_errorMaskEvent) != PXDErrorFlags(0)) B2ERROR("Error in PXD unpacking" <<
172 LogVar("event nr", m_meta_event_nr));
173 setReturnValue(PXDErrorFlags(0) == (PXDErrorFlags(m_criticalErrorMask) & m_errorMaskEvent));
174}
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition Module.cc:220
unsigned long m_meta_experiment
Experiment from MetaInfo.
PXDError::PXDErrorFlags m_errorMaskEvent
Error Mask set per packet / event.
StoreObjPtr< PXDDAQStatus > m_storeDAQEvtStats
Output array for DAQ Status.
StoreArray< RawPXD > m_storeRawPXD
Input array for PXD Raw.
unsigned int m_errorCounter[PXDError::ONSEN_MAX_TYPE_ERR]
Error counters.
StoreObjPtr< EventMetaData > m_eventMetaData
Input ptr for EventMetaData.
unsigned long m_meta_subrun_nr
Subrun Number from MetaInfo.
unsigned long m_meta_event_nr
Event Number from MetaInfo.
unsigned long m_meta_run_nr
Run Number from MetaInfo.
unsigned int m_meta_sec
Time(Tag) from MetaInfo, seconds (masked to lower bits)
PXDError::PXDErrorFlags m_criticalErrorMask
Critical error mask which defines return value of task.
void unpack_rawpxd(RawPXD &px, int inx)
Unpack one event (several frames) stored in RawPXD object.
unsigned long long int m_meta_time
Time(Tag) from MetaInfo.
PXDError::PXDErrorFlags m_errorMask
Error Mask set per packet / frame.
unsigned int m_unpackedEventsCount
Event counter.
unsigned int m_meta_ticks
Time(Tag) from MetaInfo, Ticks of 127MHz.

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

326{
327 // to avoid confusion between std::arg and boost::python::arg we want a shorthand namespace as well
328 namespace bp = boost::python;
329
330 docstring_options options(true, true, false); //userdef, py sigs, c++ sigs
331
332 void (Module::*setReturnValueInt)(int) = &Module::setReturnValue;
333
334 enum_<Module::EAfterConditionPath>("AfterConditionPath",
335 R"(Determines execution behaviour after a conditional path has been executed:
336
337.. attribute:: END
338
339 End processing of this path after the conditional path. (this is the default for if_value() etc.)
340
341.. attribute:: CONTINUE
342
343 After the conditional path, resume execution after this module.)")
344 .value("END", Module::EAfterConditionPath::c_End)
345 .value("CONTINUE", Module::EAfterConditionPath::c_Continue)
346 ;
347
348 /* Do not change the names of >, <, ... we use them to serialize conditional paths */
349 enum_<Belle2::ModuleCondition::EConditionOperators>("ConditionOperator")
356 ;
357
358 enum_<Module::EModulePropFlags>("ModulePropFlags",
359 R"(Flags to indicate certain low-level features of modules, see :func:`Module.set_property_flags()`, :func:`Module.has_properties()`. Most useful flags are:
360
361.. attribute:: PARALLELPROCESSINGCERTIFIED
362
363 This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)
364
365.. attribute:: HISTOGRAMMANAGER
366
367 This module is used to manage histograms accumulated by other modules
368
369.. attribute:: TERMINATEINALLPROCESSES
370
371 When using parallel processing, call this module's terminate() function in all processes. This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.
372)")
373 .value("INPUT", Module::EModulePropFlags::c_Input)
374 .value("OUTPUT", Module::EModulePropFlags::c_Output)
375 .value("PARALLELPROCESSINGCERTIFIED", Module::EModulePropFlags::c_ParallelProcessingCertified)
376 .value("HISTOGRAMMANAGER", Module::EModulePropFlags::c_HistogramManager)
377 .value("INTERNALSERIALIZER", Module::EModulePropFlags::c_InternalSerializer)
378 .value("TERMINATEINALLPROCESSES", Module::EModulePropFlags::c_TerminateInAllProcesses)
379 ;
380
381 //Python class definition
382 class_<Module, PyModule> module("Module", R"(
383Base class for Modules.
384
385A module is the smallest building block of the framework.
386A typical event processing chain consists of a Path containing
387modules. By inheriting from this base class, various types of
388modules can be created. To use a module, please refer to
389:func:`Path.add_module()`. A list of modules is available by running
390``basf2 -m`` or ``basf2 -m package``, detailed information on parameters is
391given by e.g. ``basf2 -m RootInput``.
392
393The 'Module Development' section in the manual provides detailed information
394on how to create modules, setting parameters, or using return values/conditions:
395https://xwiki.desy.de/xwiki/rest/p/f4fa4/#HModuleDevelopment
396
397)");
398 module
399 .def("__str__", &Module::getPathString)
400 .def("name", &Module::getName, return_value_policy<copy_const_reference>(),
401 "Returns the name of the module. Can be changed via :func:`set_name() <Module.set_name()>`, use :func:`type() <Module.type()>` for identifying a particular module class.")
402 .def("type", &Module::getType, return_value_policy<copy_const_reference>(),
403 "Returns the type of the module (i.e. class name minus 'Module')")
404 .def("set_name", &Module::setName, args("name"), R"(
405Set custom name, e.g. to distinguish multiple modules of the same type.
406
407>>> path.add_module('EventInfoSetter')
408>>> ro = path.add_module('RootOutput', branchNames=['EventMetaData'])
409>>> ro.set_name('RootOutput_metadata_only')
410>>> print(path)
411[EventInfoSetter -> RootOutput_metadata_only]
412
413)")
414 .def("description", &Module::getDescription, return_value_policy<copy_const_reference>(),
415 "Returns the description of this module.")
416 .def("package", &Module::getPackage, return_value_policy<copy_const_reference>(),
417 "Returns the package this module belongs to.")
418 .def("available_params", &_getParamInfoListPython,
419 "Return list of all module parameters as `ModuleParamInfo` instances")
420 .def("has_properties", &Module::hasProperties, (bp::arg("properties")),
421 R"DOCSTRING(Allows to check if the module has the given properties out of `ModulePropFlags` set.
422
423>>> if module.has_properties(ModulePropFlags.PARALLELPROCESSINGCERTIFIED):
424>>> ...
425
426Parameters:
427 properties (int): bitmask of `ModulePropFlags` to check for.
428)DOCSTRING")
429 .def("set_property_flags", &Module::setPropertyFlags, args("property_mask"),
430 "Set module properties in the form of an OR combination of `ModulePropFlags`.");
431 {
432 // python signature is too crowded, make ourselves
433 docstring_options subOptions(true, false, false); //userdef, py sigs, c++ sigs
434 module
435 .def("if_value", &Module::if_value,
436 (bp::arg("expression"), bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
437 R"DOCSTRING(if_value(expression, condition_path, after_condition_path=AfterConditionPath.END)
438
439Sets a conditional sub path which will be executed after this
440module if the return value set in the module passes the given ``expression``.
441
442Modules can define a return value (int or bool) using ``setReturnValue()``,
443which can be used in the steering file to split the Path based on this value, for example
444
445>>> module_with_condition.if_value("<1", another_path)
446
447In case the return value of the ``module_with_condition`` for a given event is
448less than 1, the execution will be diverted into ``another_path`` for this event.
449
450You could for example set a special return value if an error occurs, and divert
451the execution into a path containing :b2:mod:`RootOutput` if it is found;
452saving only the data producing/produced by the error.
453
454After a conditional path has executed, basf2 will by default stop processing
455the path for this event. This behaviour can be changed by setting the
456``after_condition_path`` argument.
457
458Parameters:
459 expression (str): Expression to determine if the conditional path should be executed.
460 This should be one of the comparison operators ``<``, ``>``, ``<=``,
461 ``>=``, ``==``, or ``!=`` followed by a numerical value for the return value
462 condition_path (Path): path to execute in case the expression is fulfilled
463 after_condition_path (AfterConditionPath): What to do once the ``condition_path`` has been executed.
464)DOCSTRING")
465 .def("if_false", &Module::if_false,
466 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
467 R"DOC(if_false(condition_path, after_condition_path=AfterConditionPath.END)
468
469Sets a conditional sub path which will be executed after this module if
470the return value of the module evaluates to False. This is equivalent to
471calling `if_value` with ``expression=\"<1\"``)DOC")
472 .def("if_true", &Module::if_true,
473 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
474 R"DOC(if_true(condition_path, after_condition_path=AfterConditionPath.END)
475
476Sets a conditional sub path which will be executed after this module if
477the return value of the module evaluates to True. It is equivalent to
478calling `if_value` with ``expression=\">=1\"``)DOC");
479 }
480 module
481 .def("has_condition", &Module::hasCondition,
482 "Return true if a conditional path has been set for this module "
483 "using `if_value`, `if_true` or `if_false`")
484 .def("get_all_condition_paths", &_getAllConditionPathsPython,
485 "Return a list of all conditional paths set for this module using "
486 "`if_value`, `if_true` or `if_false`")
487 .def("get_all_conditions", &_getAllConditionsPython,
488 "Return a list of all conditional path expressions set for this module using "
489 "`if_value`, `if_true` or `if_false`")
490 .add_property("logging", make_function(&Module::getLogConfig, return_value_policy<reference_existing_object>()),
491 &Module::setLogConfig)
@ c_GE
Greater or equal than: ">=".
@ c_SE
Smaller or equal than: "<=".
@ c_GT
Greater than: ">".
@ c_NE
Not equal: "!=".
@ c_EQ
Equal: "=" or "==".
@ c_ST
Smaller than: "<".
void if_value(const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
Add a condition to the module.
Definition Module.cc:79
void if_true(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to set the condition of the module.
Definition Module.cc:90
@ c_HistogramManager
This module is used to manage histograms accumulated by other modules.
Definition Module.h:81
@ c_Input
This module is an input module (reads data).
Definition Module.h:78
@ c_InternalSerializer
This module is an internal serializer/deserializer for parallel processing.
Definition Module.h:82
@ c_Output
This module is an output module (writes data).
Definition Module.h:79
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
Definition Module.h:83
void if_false(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to add a condition to the module.
Definition Module.cc:85
ModuleCondition::EAfterConditionPath EAfterConditionPath
Forward the EAfterConditionPath definition from the ModuleCondition.
Definition Module.h:88

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

134{
135 if (m_conditions.empty()) return EAfterConditionPath::c_End;
136
137 //okay, a condition was set for this Module...
138 if (!m_hasReturnValue) {
139 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
140 }
141
142 for (const auto& condition : m_conditions) {
143 if (condition.evaluate(m_returnValue)) {
144 return condition.getAfterConditionPath();
145 }
146 }
147
148 return EAfterConditionPath::c_End;
149}

◆ getAllConditionPaths()

std::vector< std::shared_ptr< Path > > getAllConditionPaths ( ) const
inherited

Return all condition paths currently set (no matter if the condition is true or not).

Definition at line 150 of file Module.cc.

151{
152 std::vector<std::shared_ptr<Path>> allConditionPaths;
153 for (const auto& condition : m_conditions) {
154 allConditionPaths.push_back(condition.getPath());
155 }
156
157 return allConditionPaths;
158}

◆ getAllConditions()

const std::vector< ModuleCondition > & getAllConditions ( ) const
inlineinherited

Return all set conditions for this module.

Definition at line 323 of file Module.h.

324 {
325 return m_conditions;
326 }

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

Return a pointer to the first condition (or nullptr, if none was set)

Definition at line 313 of file Module.h.

314 {
315 if (m_conditions.empty()) {
316 return nullptr;
317 } else {
318 return &m_conditions.front();
319 }
320 }

◆ getConditionPath()

std::shared_ptr< Path > getConditionPath ( ) const
inherited

Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).

Definition at line 113 of file Module.cc.

114{
115 PathPtr p;
116 if (m_conditions.empty()) return p;
117
118 //okay, a condition was set for this Module...
119 if (!m_hasReturnValue) {
120 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
121 }
122
123 for (const auto& condition : m_conditions) {
124 if (condition.evaluate(m_returnValue)) {
125 return condition.getPath();
126 }
127 }
128
129 // if none of the conditions were true, return a null pointer.
130 return p;
131}
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition Path.h:35

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 201 of file Module.h.

201{return m_description;}

◆ getFileNames()

virtual std::vector< std::string > getFileNames ( bool outputFiles)
inlinevirtualinherited

Return a list of output filenames for this modules.

This will be called when basf2 is run with "--dry-run" if the module has set either the c_Input or c_Output properties.

If the parameter outputFiles is false (for modules with c_Input) the list of input filenames should be returned (if any). If outputFiles is true (for modules with c_Output) the list of output files should be returned (if any).

If a module has sat both properties this member is called twice, once for each property.

The module should return the actual list of requested input or produced output filenames (including handling of input/output overrides) so that the grid system can handle input/output files correctly.

This function should return the same value when called multiple times. This is especially important when taking the input/output overrides from Environment as they get consumed when obtained so the finalized list of output files should be stored for subsequent calls.

Reimplemented in RootInputModule, RootOutputModule, and StorageRootOutputModule.

Definition at line 133 of file Module.h.

134 {
135 return std::vector<std::string>();
136 }

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 224 of file Module.h.

224{return m_logConfig;}

◆ getModules()

std::list< ModulePtr > getModules ( ) const
inlineoverrideprivatevirtualinherited

no submodules, return empty list

Implements PathElement.

Definition at line 505 of file Module.h.

505{ return std::list<ModulePtr>(); }

◆ getName()

const std::string & getName ( ) const
inlineinherited

Returns the name of the module.

This can be changed via e.g. set_name() in the steering file to give more useful names if there is more than one module of the same type.

For identifying the type of a module, using getType() (or type() in Python) is recommended.

Definition at line 186 of file Module.h.

186{return m_name;}

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 196 of file Module.h.

196{return m_package;}

◆ getParamInfoListPython()

std::shared_ptr< boost::python::list > getParamInfoListPython ( ) const
inherited

Returns a python list of all parameters.

Each item in the list consists of the name of the parameter, a string describing its type, a python list of all default values and the description of the parameter.

Returns
A python list containing the parameters of this parameter list.

Definition at line 279 of file Module.cc.

280{
282}
std::shared_ptr< boost::python::list > getParamInfoListPython() const
Returns a python list of all parameters.

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 362 of file Module.h.

362{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

193{
194
195 std::string output = getName();
196
197 for (const auto& condition : m_conditions) {
198 output += condition.getString();
199 }
200
201 return output;
202}

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 380 of file Module.h.

380{ return m_returnValue; }

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

42{
43 if (m_type.empty())
44 B2FATAL("Module type not set for " << getName());
45 return m_type;
46}
std::string m_type
The type of the module, saved as a string.
Definition Module.h:508

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

Returns true if at least one condition was set for the module.

Definition at line 310 of file Module.h.

310{ return not m_conditions.empty(); };

◆ hasProperties()

bool hasProperties ( unsigned int propertyFlags) const
inherited

Returns true if all specified property flags are available in this module.

Parameters
propertyFlagsOred EModulePropFlags which should be compared with the module flags.

Definition at line 160 of file Module.cc.

161{
162 return (propertyFlags & m_propertyFlags) == propertyFlags;
163}

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

Return true if this module has a valid return value set.

Definition at line 377 of file Module.h.

377{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.

Definition at line 166 of file Module.cc.

167{
169 std::string allMissing = "";
170 for (const auto& s : missing)
171 allMissing += s + " ";
172 if (!missing.empty())
173 B2ERROR("The following required parameters of Module '" << getName() << "' were not specified: " << allMissing <<
174 "\nPlease add them to your steering file.");
175 return !missing.empty();
176}
std::vector< std::string > getUnsetForcedParams() const
Returns list of unset parameters (if they are required to have a value.

◆ if_false()

void if_false ( const std::shared_ptr< Path > & path,
EAfterConditionPath afterConditionPath = EAfterConditionPath::c_End )
inherited

A simplified version to add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression "<1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is false.
afterConditionPathWhat to do after executing 'path'.

Definition at line 85 of file Module.cc.

86{
87 if_value("<1", path, afterConditionPath);
88}

◆ if_true()

void if_true ( const std::shared_ptr< Path > & path,
EAfterConditionPath afterConditionPath = EAfterConditionPath::c_End )
inherited

A simplified version to set the condition of the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression ">=1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 90 of file Module.cc.

91{
92 if_value(">=1", path, afterConditionPath);
93}

◆ if_value()

void if_value ( const std::string & expression,
const std::shared_ptr< Path > & path,
EAfterConditionPath afterConditionPath = EAfterConditionPath::c_End )
inherited

Add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

See https://xwiki.desy.de/xwiki/rest/p/a94f2 or ModuleCondition for a description of the syntax.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

Parameters
expressionThe expression of the condition.
pathShared pointer to the Path which will be executed if the condition is evaluated to true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 79 of file Module.cc.

80{
81 m_conditions.emplace_back(expression, path, afterConditionPath);
82}

◆ initialize()

void initialize ( void )
finaloverrideprivatevirtual

Initialize the module.

actually, later we do not want to store ROIs and raw ADC into output file ... aside from debugging

Reimplemented from Module.

Definition at line 80 of file PXDUnpackerOTModule.cc.

81{
82 // Required input
83 m_eventMetaData.isRequired();
84 // Optional input
85 m_storeRawPXD.isOptional(m_RawPXDsName);
86
87 //Register output collections
93
94 B2DEBUG(29, "ForceMapping: " << m_forceMapping);
95 B2DEBUG(29, "ForceNoMapping: " << m_forceNoMapping);
96 B2DEBUG(29, "CheckPaddingCRC: " << m_checkPaddingCRC);
97 B2DEBUG(29, "MaxDHPFrameDiff: " << m_maxDHPFrameDiff);
98
100 m_sendrois = 0;
101 m_notaccepted = 0;
103 for (int i = 0; i < ONSEN_MAX_TYPE_ERR; i++) m_errorCounter[i] = 0;
104
105}
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition DataStore.h:72
unsigned int m_sendunfiltered
counter for send unfiltered
unsigned int m_notaccepted
counter for not accepted events... should not happen TODO discussion ongoing with DAQ group
unsigned int m_sendrois
counter for send debug rois

◆ nr5bits()

int nr5bits ( int i)
static

helper function to "count" nr of set bits within lower 5 bits.

It does not need the class object, thus static.

too lazy to count the bits myself, thus using a small lookup table

Definition at line 1468 of file PXDUnpackerOTModule.cc.

1469{
1471 const int lut[32] = {
1472 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1473 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5
1474 };
1475 return lut[i & 0x1F];
1476}

◆ setAbortLevel()

void setAbortLevel ( int abortLevel)
inherited

Configure the abort log level.

Definition at line 67 of file Module.cc.

68{
69 m_logConfig.setAbortLevel(static_cast<LogConfig::ELogLevel>(abortLevel));
70}
ELogLevel
Definition of the supported log levels.
Definition LogConfig.h:26
void setAbortLevel(ELogLevel abortLevel)
Configure the abort level.
Definition LogConfig.h:112

◆ setDebugLevel()

void setDebugLevel ( int debugLevel)
inherited

Configure the debug messaging level.

Definition at line 61 of file Module.cc.

62{
63 m_logConfig.setDebugLevel(debugLevel);
64}
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
Definition LogConfig.h:98

◆ setDescription()

void setDescription ( const std::string & description)
protectedinherited

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

215{
216 m_description = description;
217}
std::string m_description
The description of the module.
Definition Module.h:510

◆ setLogConfig()

void setLogConfig ( const LogConfig & logConfig)
inlineinherited

Set the log system configuration.

Definition at line 229 of file Module.h.

229{m_logConfig = logConfig;}

◆ setLogInfo()

void setLogInfo ( int logLevel,
unsigned int logInfo )
inherited

Configure the printed log information for the given level.

Parameters
logLevelThe log level (one of LogConfig::ELogLevel)
logInfoWhat kind of info should be printed? ORed combination of LogConfig::ELogInfo flags.

Definition at line 73 of file Module.cc.

74{
75 m_logConfig.setLogInfo(static_cast<LogConfig::ELogLevel>(logLevel), logInfo);
76}
void setLogInfo(ELogLevel logLevel, unsigned int logInfo)
Configure the printed log information for the given level.
Definition LogConfig.h:127

◆ setLogLevel()

void setLogLevel ( int logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

56{
57 m_logConfig.setLogLevel(static_cast<LogConfig::ELogLevel>(logLevel));
58}
void setLogLevel(ELogLevel logLevel)
Configure the log level.
Definition LogConfig.cc:25

◆ setName()

void setName ( const std::string & name)
inlineinherited

Set the name of the module.

Note
The module name is set when using the REG_MODULE macro, but the module can be renamed before calling process() using the set_name() function in your steering file.
Parameters
nameThe name of the module

Definition at line 213 of file Module.h.

213{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList & params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 500 of file Module.h.

500{ m_moduleParamList = params; }

◆ setParamPython()

void setParamPython ( const std::string & name,
const boost::python::object & pyObj )
privateinherited

Implements a method for setting boost::python objects.

The method supports the following types: list, dict, int, double, string, bool The conversion of the python object to the C++ type and the final storage of the parameter value is done in the ModuleParam class.

Parameters
nameThe unique name of the parameter.
pyObjThe object which should be converted and stored as the parameter value.

Definition at line 234 of file Module.cc.

235{
236 LogSystem& logSystem = LogSystem::Instance();
237 logSystem.updateModule(&(getLogConfig()), getName());
238 try {
240 } catch (std::runtime_error& e) {
241 throw std::runtime_error("Cannot set parameter '" + name + "' for module '"
242 + m_name + "': " + e.what());
243 }
244
245 logSystem.updateModule(nullptr);
246}
void updateModule(const LogConfig *moduleLogConfig=nullptr, const std::string &moduleName="")
Sets the log configuration to the given module log configuration and sets the module name This method...
Definition LogSystem.h:200
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition LogSystem.cc:28
LogConfig & getLogConfig()
Returns the log system configuration.
Definition Module.h:224
std::string m_name
The name of the module, saved as a string (user-modifiable)
Definition Module.h:507
void setParamPython(const std::string &name, const PythonObject &pyObj)
Implements a method for setting boost::python objects.

◆ setParamPythonDict()

void setParamPythonDict ( const boost::python::dict & dictionary)
privateinherited

Implements a method for reading the parameter values from a boost::python dictionary.

The key of the dictionary has to be the name of the parameter and the value has to be of one of the supported parameter types.

Parameters
dictionaryThe python dictionary from which the parameter values are read.

Definition at line 249 of file Module.cc.

250{
251
252 LogSystem& logSystem = LogSystem::Instance();
253 logSystem.updateModule(&(getLogConfig()), getName());
254
255 boost::python::list dictKeys = dictionary.keys();
256 int nKey = boost::python::len(dictKeys);
257
258 //Loop over all keys in the dictionary
259 for (int iKey = 0; iKey < nKey; ++iKey) {
260 boost::python::object currKey = dictKeys[iKey];
261 boost::python::extract<std::string> keyProxy(currKey);
262
263 if (keyProxy.check()) {
264 const boost::python::object& currValue = dictionary[currKey];
265 setParamPython(keyProxy, currValue);
266 } else {
267 B2ERROR("Setting the module parameters from a python dictionary: invalid key in dictionary!");
268 }
269 }
270
271 logSystem.updateModule(nullptr);
272}
void setParamPython(const std::string &name, const boost::python::object &pyObj)
Implements a method for setting boost::python objects.
Definition Module.cc:234

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ setReturnValue() [1/2]

void setReturnValue ( bool value)
protectedinherited

Sets the return value for this module as bool.

The bool value is saved as an integer with the convention 1 meaning true and 0 meaning false. The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

228{
229 m_hasReturnValue = true;
230 m_returnValue = value;
231}

◆ setReturnValue() [2/2]

void setReturnValue ( int value)
protectedinherited

Sets the return value for this module as integer.

The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

221{
222 m_hasReturnValue = true;
223 m_returnValue = value;
224}

◆ setType()

void setType ( const std::string & type)
protectedinherited

Set the module type.

Only for use by internal modules (which don't use the normal REG_MODULE mechanism).

Definition at line 48 of file Module.cc.

49{
50 if (!m_type.empty())
51 B2FATAL("Trying to change module type from " << m_type << " is not allowed, the value is assumed to be fixed.");
52 m_type = type;
53}

◆ terminate()

void terminate ( void )
finaloverrideprivatevirtual

Terminate the module.

Reimplemented from Module.

Definition at line 107 of file PXDUnpackerOTModule.cc.

108{
109 int flag = 0;
110 string errstr = "Statistic ( ;";
111 errstr += to_string(m_unpackedEventsCount) + ";";
112 for (int i = 0; i < ONSEN_MAX_TYPE_ERR; i++) { errstr += to_string(m_errorCounter[i]) + ";"; flag |= m_errorCounter[i];}
113 if (flag != 0) {
114 B2RESULT("PXD Unpacker --> Error Statistics (counted once per event!) in Events: " << m_unpackedEventsCount);
115 B2RESULT(errstr + " )");
116 for (int i = 0; i < ONSEN_MAX_TYPE_ERR; i++) {
117 if (m_errorCounter[i]) {
118 B2RESULT(getPXDBitErrorName(i) << ": " << m_errorCounter[i]);
119 }
120 }
121 } else {
122 B2RESULT("PXD Unpacker --> No Error found in Events: " << m_unpackedEventsCount);
123 }
124 B2RESULT("Statistic 2: !Accepted: " << m_notaccepted << " SendROIs: " << m_sendrois << " Unfiltered: " << m_sendunfiltered);
125}

◆ unpack_dhc_frame()

void unpack_dhc_frame ( void * data,
const int len,
const int Frame_Number,
const int Frames_in_event,
PXDDAQPacketStatus & daqpktstat )
private

Unpack one frame (within an event).

Parameters
datapointer to frame
lenlength of frame
Frame_Numbercurrent frame number
Frames_in_eventnumber of frames in PxdRaw object (subevent)
daqpktstatDaq Packet Status Object

The following STATIC variables are used to save some state or count some things while depacking the frames. they are in most cases (re)set on the first frame or ONSEN trg frame Most could put in as a class member, but they are only needed within this function

We reset the counters on the first event

invalid

TODO here we should check full(!) Event Number, Run Number, Subrun Nr and Exp Number of this frame against the one from MEta Event Info

referring to BelleII Note Nr 0010, the numbers run from ... to unsigned int layer, ladder, sensor; layer= vxdid.getLayerNumber();/// 1 ... 2 ladder= vxdid.getLadderNumber();/// 1 ... 8 and 1 ... 12 sensor= vxdid.getSensorNumber();/// 1 ... 2 dhe_id = ((layer-1)<<5) | ((ladder)<<1) | (sensor-1);

Attention: Firmware might be changed such, that ghostframe come for all DHPs, not only active ones...

TODO how to handle error flags set in in DHC_END?

invalid

TODO how to handle error flags set in in DHE_END?

invalid

CRC is without the DHC header, see reason in function

Check that ONSEN Trg is first Frame

Check that there is no other DHC Start

Check that DHC Start is first Frame

Check that there is no other DHC Start

Check that DHC End is last Frame

As we now have processed the whole event, we can do some more consistency checks!

Check that there is no other DHC End

Check that (if there is at least one active DHE) the second Frame is DHE Start, actually this is redundant if the other checks work

Definition at line 671 of file PXDUnpackerOTModule.cc.

673{
677 static unsigned int eventNrOfOnsenTrgFrame = 0;
678 static int countedBytesInDHC = 0;
679 static bool cancheck_countedBytesInDHC = false;
680 static int countedBytesInDHE = 0;
681 static bool cancheck_countedBytesInDHE = false;
682 static int countedDHEStartFrames = 0;
683 static int countedDHEEndFrames = 0;
684 static int mask_active_dhe = 0;// DHE mask (5 bit)
685 static int nr_active_dhe =
686 0;// TODO just count the active DHEs. Until now, it is not possible to check for the bit mask. we would need the info on which DHE connects to which DHC at which port from gearbox/geometry?
687 static int mask_active_dhp = 0;// DHP active mask, 4 bit, per current DHE
688 static int found_mask_active_dhp = 0;// mask which DHP send data and check on DHE END frame if it matches
689 static int found_good_mask_active_dhp = 0;// mask which DHP send useful data
690 static unsigned int dhe_first_readout_frame_id_lo = 0;
691 // cppcheck-suppress variableScope
692 static unsigned int dhe_first_triggergate = 0;
693 static unsigned int currentDHCID = 0xFFFFFFFF;
694 static unsigned int currentDHEID = 0xFFFFFFFF;
695 static unsigned int currentVxdId = 0;
696 static bool isFakedData_event = false;
697 static bool isUnfiltered_event = false;
698
699
700 if (Frame_Number == 0) {
701 // We reset the counters on the first event
702 // we do this before any other check is done
703 eventNrOfOnsenTrgFrame = 0;
704 countedDHEStartFrames = 0;
705 countedDHEEndFrames = 0;
706 countedBytesInDHC = 0;
707 cancheck_countedBytesInDHC = false;
708 countedBytesInDHE = 0;
709 cancheck_countedBytesInDHE = false;
710 currentDHCID = 0xFFFFFFFF;
711 currentDHEID = 0xFFFFFFFF;
712 currentVxdId = 0;
713 isUnfiltered_event = false;
714 isFakedData_event = false;
715 mask_active_dhe = 0;
716 nr_active_dhe = 0;
717 mask_active_dhp = 0;
718 found_mask_active_dhp = 0;
719 found_good_mask_active_dhp = 0;
720 }
721
722 dhc_frame_header_word0* hw = (dhc_frame_header_word0*)data;
723
724 dhc_frames dhc;
725 dhc.set(data, hw->getFrameType(), len);
726
727 {
728 // if a fixed size frame has a different length, how can we rely on its content???
729 // AND we could by typecasting access memory beyond end of data (but very unlikely)
730 // for that reason this we have to check before any CRC and stop unpacking the frame
731 int s = dhc.getFixedSize();
732 if (len != s && s != 0) {
733 if (!(m_suppressErrorMask[c_nrFIX_SIZE])) {
734 B2WARNING("Fixed frame type size does not match specs" << LogVar("expected length",
735 len) << LogVar("length in data", s));
736 }
737 m_errorMask[c_nrFIX_SIZE] = true;
738 if (!m_continueOnError) return;
739 }
740 }
741
742 // What do we do with wrong checksum frames? As we do not know WHAT is wrong, we have to skip them altogether.
743 // As they might contain HEADER Info, we might better skip the processing of the full package, too.
744 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
745 if (!m_continueOnError && m_errorMask[c_nrDHE_CRC]) {
746 // if CRC is wrong, we cannot rely on the content of the frame, thus skipping is the best option
747 return;
748 }
749
750 unsigned int eventNrOfThisFrame = dhc.getEventNrLo();
751 int frame_type = dhc.getFrameType();
752
753 if (Frame_Number == 0) {
754 if (m_formatBonnDAQ) {
755 if (frame_type != EDHCFrameHeaderDataType::c_DHC_START) {
756 if (!(m_suppressErrorMask[c_nrEVENT_STRUCT])) B2WARNING("This looks not like BonnDAQ format.");
757 m_errorMask[c_nrEVENT_STRUCT] = true;
758// if (!m_continueOnError) return; // requires more testing
759 }
760 } else {
761 if (frame_type == EDHCFrameHeaderDataType::c_DHC_START) {
762 if (!(m_suppressErrorMask[c_nrEVENT_STRUCT]))
763 B2WARNING("This looks like BonnDAQ or old Desy 2013/14 testbeam format. Please use formatBonnDAQ or the pxdUnpackerDesy1314 module.");
764 m_errorMask[c_nrEVENT_STRUCT] = true;
765// if (!m_continueOnError) return; // requires more testing
766 }
767 }
768 }
769
770 if (!m_formatBonnDAQ) {
771 if (Frame_Number == 1) {
772 if (frame_type == EDHCFrameHeaderDataType::c_DHC_START) {
773 isFakedData_event = dhc.data_dhc_start_frame->isFakedData();
774 }
775 }
776
777 // please check if this mask is suitable. At least here we are limited by the 16 bit trigger number in the DHH packet header.
778 // we can use more bits in the DHC and DHE START Frame
779 if ((eventNrOfThisFrame & 0xFFFF) != (m_meta_event_nr & 0xFFFF)) {
780 if (!isFakedData_event) {
781 if (!(m_suppressErrorMask[c_nrMETA_MM])) {
782 B2WARNING("Event Numbers do not match for this frame");
783 B2DEBUG(29, "Event Numbers do not match for this frame" <<
784 LogVar("Event nr in frame $", static_cast < std::ostringstream
785 && >(std::ostringstream() << hex << eventNrOfThisFrame).str()) <<
786 LogVar("Event nr in MetaInfo (bits masked) $",
787 static_cast < std::ostringstream && >(std::ostringstream() << hex << m_meta_event_nr).str()));
788 }
789 m_errorMask[c_nrMETA_MM] = true;
790// if (!m_continueOnError) return; // requires more testing
791 }
792 }
793
794 if (Frame_Number > 1 && Frame_Number < Frames_in_event - 1) {
795 if (countedDHEStartFrames != countedDHEEndFrames + 1)
796 if (frame_type != EDHCFrameHeaderDataType::c_ONSEN_ROI && frame_type != EDHCFrameHeaderDataType::c_DHE_START) {
797 if (!(m_suppressErrorMask[c_nrDATA_OUTSIDE])) B2WARNING("Data Frame outside a DHE START/END");
798 m_errorMask[c_nrDATA_OUTSIDE] = true;
799// if (!m_continueOnError) return; // requires more testing
800 }
801 }
802 }
803
804 // TODO How do we handle Frames where Error Bit is set in header?
805 // Currently there is no documentation what it actually means... only an error bit is set (below)
806 // the following errors must be "accepted", as all firmware sets it wrong from Ghost frames.
807 if (hw->getErrorFlag()) {
808 if (frame_type != EDHCFrameHeaderDataType::c_GHOST) {
809 // We get ERROR bits in header even if only one module or DHP link is missing... thus
810 // we better filter a bit more ... but how?
811 if (!(m_suppressErrorMask[c_nrHEADER_ERR])) B2WARNING("Error Bit set in DHE Header");
812 m_errorMask[c_nrHEADER_ERR] = true;// TODO this should have some effect ... when does it mean something? documentation missing
813 }
814 } else {
815 if (frame_type == EDHCFrameHeaderDataType::c_GHOST) {
816 m_errorMask[c_nrHEADER_ERR_GHOST] = true;
817 }
818 }
819
820 switch (frame_type) {
821 case EDHCFrameHeaderDataType::c_DHP_RAW: {
822
824 if (currentDHEID != dhc.data_direct_readout_frame_raw->getDHEId()) {
825 if (!(m_suppressErrorMask[c_nrDHE_START_ID])) {
826 B2WARNING("DHE ID from DHE Start and this frame do not match");
827 B2DEBUG(29, "DHE ID from DHE Start and this frame do not match" <<
828 LogVar("DHEID in this frame $", static_cast < std::ostringstream
829 && >(std::ostringstream() << hex << dhc.data_direct_readout_frame_raw->getDHEId()).str()) <<
830 LogVar("DHEID expected $", static_cast < std::ostringstream && >(std::ostringstream() << hex << currentDHEID).str()));
831 }
832 m_errorMask[c_nrDHE_START_ID] = true;
833 }
834 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
835 if ((found_mask_active_dhp & (1 << dhc.data_direct_readout_frame->getDHPPort())) != 0) {
836 B2ERROR("Second DHP data packet (MEMDUMP) for " << LogVar("DHE", currentDHEID) << LogVar("DHP",
838 }
839
840 found_mask_active_dhp |= 1 << dhc.data_direct_readout_frame->getDHPPort();
841
842 unpack_dhp_raw(data, len - 4,
845 currentVxdId);
846
847 break;
848 };
849 case EDHCFrameHeaderDataType::c_ONSEN_DHP:
850 // Set the counted size invalid if negative, needs a large negative value because we are adding up to that
851 cancheck_countedBytesInDHC = false;
852 cancheck_countedBytesInDHE = false;
853 [[fallthrough]];
854 case EDHCFrameHeaderDataType::c_DHP_ZSD: {
855
857 if (isUnfiltered_event) {
858 if (frame_type == EDHCFrameHeaderDataType::c_ONSEN_DHP) m_errorMask[c_nrSENDALL_TYPE] = true;
859 } else {
860 if (frame_type == EDHCFrameHeaderDataType::c_DHP_ZSD) m_errorMask[c_nrNOTSENDALL_TYPE] = true;
861 }
862
863 //m_errorMask |= dhc.data_direct_readout_frame->check_error();
864
865 if (currentDHEID != dhc.data_direct_readout_frame_raw->getDHEId()) {
866 if (!(m_suppressErrorMask[c_nrDHE_START_ID])) {
867 B2WARNING("DHE ID from DHE Start and this frame do not match");
868 B2DEBUG(29, "DHE ID from DHE Start and this frame do not match" <<
869 LogVar("DHEID in this frame $", static_cast < std::ostringstream
870 && >(std::ostringstream() << hex << dhc.data_direct_readout_frame_raw->getDHEId()).str()) <<
871 LogVar("DHEID expected $", static_cast < std::ostringstream && >(std::ostringstream() << hex << currentDHEID).str()));
872 }
873 m_errorMask[c_nrDHE_START_ID] = true;
874 }
875 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
876 if ((found_mask_active_dhp & (1 << dhc.data_direct_readout_frame->getDHPPort())) != 0) {
877 B2ERROR("Second DHP data packet for " << LogVar("DHE", currentDHEID) << LogVar("DHP", dhc.data_direct_readout_frame->getDHPPort()));
878 }
879 found_mask_active_dhp |= 1 << dhc.data_direct_readout_frame->getDHPPort();
880 found_good_mask_active_dhp |= 1 << dhc.data_direct_readout_frame->getDHPPort();// only this frametype has useful data
881 if (m_checkPaddingCRC) dhc.check_padding(m_errorMask); // isUnfiltered_event
882
883
884 unpack_dhp(data, len - 4,
885 dhe_first_readout_frame_id_lo,
889 currentVxdId, daqpktstat);
890
891 break;
892 };
893 case EDHCFrameHeaderDataType::c_ONSEN_FCE:
894 // Set the counted size invalid if negative, needs a large negative value because we are adding up to that
895 cancheck_countedBytesInDHC = false;
896 cancheck_countedBytesInDHE = false;
897 [[fallthrough]];
898 case EDHCFrameHeaderDataType::c_FCE_RAW: {
899 if (!(m_suppressErrorMask[c_nrUNEXPECTED_FRAME_TYPE])) B2WARNING("Unexpected Frame Type (Clustering FCE)");
900 m_errorMask[c_nrUNEXPECTED_FRAME_TYPE] = true;
901 if (m_verbose) hw->print();
902 if (isUnfiltered_event) {
903 if (frame_type == EDHCFrameHeaderDataType::c_ONSEN_FCE) {
904 // TODO add error message
905 m_errorMask[c_nrSENDALL_TYPE] = true;
906 }
907 } else {
908 if (frame_type == EDHCFrameHeaderDataType::c_FCE_RAW) {
909 // TODO add error message
910 m_errorMask[c_nrNOTSENDALL_TYPE] = true;
911 }
912 }
913
914 if (currentDHEID != dhc.data_direct_readout_frame_raw->getDHEId()) {
915 if (!(m_suppressErrorMask[c_nrDHE_START_ID])) {
916 B2WARNING("DHE ID from DHE Start and this frame do not match");
917 B2DEBUG(29, "DHE ID from DHE Start and this frame do not match" <<
918 LogVar("DHEID in this frame $", static_cast < std::ostringstream
919 && >(std::ostringstream() << hex << dhc.data_direct_readout_frame_raw->getDHEId()).str()) <<
920 LogVar("DHEID expected $", static_cast < std::ostringstream && >(std::ostringstream() << hex << currentDHEID).str()));
921 }
922 m_errorMask[c_nrDHE_START_ID] = true;
923 }
924 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
925 if ((found_mask_active_dhp & (1 << dhc.data_direct_readout_frame->getDHPPort())) != 0) {
926 B2ERROR("Second DHP data packet (FCE) for " << LogVar("DHE", currentDHEID) << LogVar("DHP",
928 }
929 found_mask_active_dhp |= 1 << dhc.data_direct_readout_frame->getDHPPort();
930
931 B2DEBUG(29, "UNPACK FCE FRAME with len $" << hex << len);
932 unpack_fce((unsigned short*) data, len - 4, currentVxdId);
933
934 break;
935 };
936 case EDHCFrameHeaderDataType::c_COMMODE: {
937 // this frame type has up to now not been well defined, we do not expect it until
938 // the firmware supports clustering in hardware
939 if (!(m_suppressErrorMask[c_nrUNEXPECTED_FRAME_TYPE])) B2WARNING("Unexpected Frame Type (COMMODE)");
940 m_errorMask[c_nrUNEXPECTED_FRAME_TYPE] = true;
941
942 if (m_verbose) hw->print();
943 if (currentDHEID != dhc.data_commode_frame->getDHEId()) {
944 if (!(m_suppressErrorMask[c_nrDHE_START_ID])) {
945 B2WARNING("DHE ID from DHE Start and this frame do not match");
946 B2DEBUG(29, "DHE ID from DHE Start and this frame do not match" <<
947 LogVar("DHEID in this frame $", static_cast < std::ostringstream
948 && >(std::ostringstream() << hex << dhc.data_commode_frame->getDHEId()).str()) <<
949 LogVar("DHEID expected $", static_cast < std::ostringstream && >(std::ostringstream() << hex << currentDHEID).str()));
950 }
951 m_errorMask[c_nrDHE_START_ID] = true;
952 }
953 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
954 break;
955 };
956 case EDHCFrameHeaderDataType::c_DHC_START: {
957 countedBytesInDHC = 0;
958 cancheck_countedBytesInDHC = true;
959 if (isFakedData_event != dhc.data_dhc_start_frame->isFakedData()) {
960 if (!(m_suppressErrorMask[c_nrFAKE_NO_FAKE_DATA])) B2WARNING("DHC START mixed Fake/no Fake event.");
961 m_errorMask[c_nrFAKE_NO_FAKE_DATA] = true;
962 }
964 if (!(m_suppressErrorMask[c_nrFAKE_NO_DATA_TRIG])) B2WARNING("Faked DHC START Data -> trigger without Data!");
965 m_errorMask[c_nrFAKE_NO_DATA_TRIG] = true;
966 } else {
968 }
969
970// eventNrOfOnsenTrgFrame = eventNrOfThisFrame;
971 currentDHEID = 0xFFFFFFFF;
972 currentVxdId = 0;
973 currentDHCID = dhc.data_dhc_start_frame->get_dhc_id();
974 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
975
976 if (m_formatBonnDAQ) eventNrOfOnsenTrgFrame = eventNrOfThisFrame;
977
978 if (!isFakedData_event) {
982 if (!(m_suppressErrorMask[c_nrMETA_MM_DHC_ERS])) {
983 B2WARNING("DHC-Meta Experiment number mismatch");
984 B2DEBUG(29, "DHC-Meta Experiment number mismatch" <<
985 LogVar("DHC exp nr",
987 LogVar("META exp nr", m_meta_experiment));
988 }
989 m_errorMask[c_nrMETA_MM_DHC_ERS] = true;
990 }
992 if (!(m_suppressErrorMask[c_nrMETA_MM_DHC_ERS])) {
993 B2WARNING("DHC-Meta Run number mismatch");
994 B2DEBUG(29, "DHC-Meta Run number mismatch" <<
995 LogVar("DHC Run nr",
997 LogVar("META run nr", m_meta_run_nr));
998 }
999 m_errorMask[c_nrMETA_MM_DHC_ERS] = true;
1000 }
1002 if (!(m_suppressErrorMask[c_nrMETA_MM_DHC_ERS])) {
1003 B2WARNING("DHC-Meta Sub-Run number mismatch");
1004 B2DEBUG(29, "DHC-Meta Sub-Run number mismatch" <<
1005 LogVar("DHC subrun nr",
1007 LogVar("META subrun nr", m_meta_subrun_nr));
1008 }
1009 m_errorMask[c_nrMETA_MM_DHC_ERS] = true;
1010 }
1011 if ((((unsigned int)dhc.data_dhc_start_frame->getEventNrHi() << 16) | dhc.data_dhc_start_frame->getEventNrLo()) !=
1012 (m_meta_event_nr & 0xFFFFFFFF)) {
1013 if (!(m_suppressErrorMask[c_nrMETA_MM_DHC])) {
1014 B2WARNING("DHC-Meta 32 bit event number mismatch");
1015 B2DEBUG(29, "DHC-Meta 32 bit event number mismatch" <<
1016 LogVar("DHC trigger nr", (((unsigned int) dhc.data_dhc_start_frame->getEventNrHi() << 16) |
1018 LogVar("META trigger nr", (unsigned int)(m_meta_event_nr & 0xFFFFFFFF)));
1019 }
1020 m_errorMask[c_nrMETA_MM_DHC] = true;
1021 }
1022 uint32_t trig_ticks = (((unsigned int)dhc.data_dhc_start_frame->time_tag_mid & 0x7FFF) << 12) | ((unsigned int)
1024 uint32_t trig_sec = (dhc.data_dhc_start_frame->time_tag_hi * 2) ;
1025 if (dhc.data_dhc_start_frame->time_tag_mid & 0x8000) trig_sec++;
1026
1027 if ((trig_ticks - m_meta_ticks) != 0 || (trig_sec - m_meta_sec) != 0) {
1028 m_errorMask[c_nrMETA_MM_DHC_TT] = true;
1029 if (!(m_suppressErrorMask[c_nrMETA_MM_DHC_TT])) {
1030 B2WARNING("DHC-Meta TimeTag mismatch");
1031 B2DEBUG(29, "DHC-Meta TimeTag mismatch" <<
1032 LogVar("Header Time $", static_cast < std::ostringstream && >(std::ostringstream() <<
1033 hex << dhc.data_dhc_start_frame->time_tag_hi << "." <<
1034 dhc.data_dhc_start_frame->time_tag_mid << "." <<
1036 LogVar("Meta Time $", static_cast < std::ostringstream && >(std::ostringstream() << hex << m_meta_time).str()) <<
1037 LogVar("Trigger Type", static_cast < std::ostringstream
1038 && >(std::ostringstream() << hex << (dhc.data_dhc_start_frame->time_tag_lo_and_type & 0xF)).str()) <<
1039 LogVar("Meta seconds: $", static_cast < std::ostringstream && >(std::ostringstream() << hex << m_meta_sec).str()) <<
1040 LogVar("DHC seconds $", static_cast < std::ostringstream && >(std::ostringstream() << hex << trig_sec).str()) <<
1041 LogVar("Seconds difference $", static_cast < std::ostringstream
1042 && >(std::ostringstream() << hex << (trig_sec - m_meta_sec)).str()) <<
1043 LogVar("Meta ticks from 127MHz $", static_cast < std::ostringstream && >(std::ostringstream() << hex << m_meta_ticks).str()) <<
1044 LogVar("DHC ticks from 127MHz $", static_cast < std::ostringstream && >(std::ostringstream() << hex << trig_ticks).str()) <<
1045 LogVar("Tick difference $", static_cast < std::ostringstream
1046 && >(std::ostringstream() << hex << (trig_ticks - m_meta_ticks)).str()));
1047 }
1048 } else {
1049 B2DEBUG(29, "DHC TT: $" << hex << dhc.data_dhc_start_frame->time_tag_hi << "." << dhc.data_dhc_start_frame->time_tag_mid << "." <<
1050 dhc.data_dhc_start_frame->time_tag_lo_and_type << " META " << m_meta_time << " TRG Type " <<
1052 }
1053 }
1054 mask_active_dhe = dhc.data_dhc_start_frame->get_active_dhe_mask();
1055 nr_active_dhe = nr5bits(mask_active_dhe);
1056
1057 m_errorMaskDHC = m_errorMask; // forget about anything before this frame
1058 daqpktstat.newDHC(currentDHCID, m_errorMask);
1061
1062 break;
1063 };
1064 case EDHCFrameHeaderDataType::c_DHE_START: {
1065 countedBytesInDHE = 0;
1066 cancheck_countedBytesInDHE = true;
1072 dhe_first_readout_frame_id_lo = dhc.data_dhe_start_frame->getStartFrameNr();
1073 dhe_first_triggergate = dhc.data_dhe_start_frame->getTriggerGate();
1074 if (currentDHEID != 0xFFFFFFFF && (currentDHEID & 0xFFFF) >= dhc.data_dhe_start_frame->getDHEId()) {
1075 if (!(m_suppressErrorMask[c_nrDHE_WRONG_ID_SEQ])) {
1076 B2WARNING("DHH IDs are not in expected order");
1077 B2DEBUG(29, "DHH IDs are not in expected order" <<
1078 LogVar("Previous ID", (currentDHEID & 0xFFFF)) <<
1079 LogVar("Current ID", dhc.data_dhe_start_frame->getDHEId()));
1080 }
1081 m_errorMask[c_nrDHE_WRONG_ID_SEQ] = true;
1082 }
1083 currentDHEID = dhc.data_dhe_start_frame->getDHEId();
1084 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
1085
1086 if (countedDHEStartFrames > countedDHEEndFrames) {
1087 if (!(m_suppressErrorMask[c_nrDHE_START_WO_END])) B2WARNING("DHE_START without DHE_END");
1088 m_errorMask[c_nrDHE_START_WO_END] = true;
1089 }
1090 countedDHEStartFrames++;
1091
1092 found_mask_active_dhp = 0;
1093 found_good_mask_active_dhp = 0;
1094 mask_active_dhp = dhc.data_dhe_start_frame->getActiveDHPMask();
1095
1096 if ((((unsigned int)dhc.data_dhe_start_frame->getEventNrHi() << 16) | dhc.data_dhe_start_frame->getEventNrLo()) != (unsigned int)(
1097 m_meta_event_nr & 0xFFFFFFFF)) {
1098 if (!(m_suppressErrorMask[c_nrMETA_MM_DHE])) {
1099 B2WARNING("DHE START trigger mismatch in EVT32b/HI WORD");
1100 B2DEBUG(29, "DHE START trigger mismatch in EVT32b/HI WORD" <<
1101 LogVar("DHE Start trigger nr", (dhc.data_dhe_start_frame->getEventNrHi() << 16) | dhc.data_dhe_start_frame->getEventNrLo()) <<
1102 LogVar("Meta trigger nr", (m_meta_event_nr & 0xFFFFFFFF)));
1103 }
1104 m_errorMask[c_nrMETA_MM_DHE] = true;
1105 }
1106// B2WARNING("DHE TT: $" << hex << dhc.data_dhe_start_frame->dhe_time_tag_hi << "." << dhc.data_dhe_start_frame->dhe_time_tag_lo <<
1107// " META " << m_meta_time);
1108
1109 if (currentDHEID == 0) {
1110 if (!(m_suppressErrorMask[c_nrDHE_ID_INVALID])) B2WARNING("DHE ID is invalid=0 (not initialized)");
1111 m_errorMask[c_nrDHE_ID_INVALID] = true;
1112 }
1113 // calculate the VXDID for DHE and save them for DHP unpacking
1114 {
1121 unsigned short sensor, ladder, layer;
1122 sensor = (currentDHEID & 0x1) + 1;
1123 ladder = (currentDHEID & 0x1E) >> 1; // no +1
1124 layer = ((currentDHEID & 0x20) >> 5) + 1;
1125 currentVxdId = VxdID(layer, ladder, sensor);
1126 if (ladder == 0 || (layer == 1 && ladder > 8) || (layer == 2 && ladder > 12)) {
1127 if (!(m_suppressErrorMask[c_nrDHE_ID_INVALID])) {
1128 B2WARNING("DHE ID is invalid");
1129 B2DEBUG(29, "DHE ID is invalid" <<
1130 LogVar("DHE ID", currentDHEID) <<
1131 LogVar("Layer", layer) <<
1132 LogVar("Ladder", ladder) <<
1133 LogVar("Sensor", sensor));
1134 }
1135 m_errorMask[c_nrDHE_ID_INVALID] = true;
1136 }
1137 }
1138
1139 m_errorMaskDHE = m_errorMask; // forget about anything before this frame
1140 if (daqpktstat.dhc_size() > 0) {
1141 // if no DHC has been defined yet, do nothing!
1142 daqpktstat.dhc_back().newDHE(currentVxdId, currentDHEID, m_errorMask, dhe_first_triggergate, dhe_first_readout_frame_id_lo);
1143 }
1144 break;
1145 };
1146 case EDHCFrameHeaderDataType::c_GHOST:
1147 if (m_verbose) dhc.data_ghost_frame->print();
1148 if (currentDHEID != dhc.data_ghost_frame->getDHEId()) {
1149 if (!(m_suppressErrorMask[c_nrDHE_START_ID])) {
1150 B2WARNING("DHE ID from DHE Start and this frame do not match");
1151 B2DEBUG(29, "Start ID $" << hex << currentDHEID << " != $" << dhc.data_ghost_frame->getDHEId());
1152 }
1153 m_errorMask[c_nrDHE_START_ID] = true;
1154 }
1156 if ((found_mask_active_dhp & (1 << dhc.data_ghost_frame->getDHPPort())) != 0) {
1157 B2ERROR("Second DHP data packet (GHOST) for " << LogVar("DHE", currentDHEID) << LogVar("DHP", dhc.data_ghost_frame->getDHPPort()));
1158 }
1159 found_mask_active_dhp |= 1 << dhc.data_ghost_frame->getDHPPort();
1160
1161 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
1162
1163 break;
1164 case EDHCFrameHeaderDataType::c_DHC_END: {
1165 if (dhc.data_dhc_end_frame->isFakedData() != isFakedData_event) {
1166 if (!(m_suppressErrorMask[c_nrFAKE_NO_FAKE_DATA])) B2WARNING("DHC END mixed Fake/no Fake event.");
1167 m_errorMask[c_nrFAKE_NO_FAKE_DATA] = true;
1168 }
1169 if (dhc.data_dhc_end_frame->isFakedData()) {
1170 if (!(m_suppressErrorMask[c_nrFAKE_NO_DATA_TRIG])) B2WARNING("Faked DHC END Data -> trigger without Data!");
1171 m_errorMask[c_nrFAKE_NO_DATA_TRIG] = true;
1172 } else {
1174 }
1175
1176 if (!isFakedData_event) {
1177 if (dhc.data_dhc_end_frame->get_dhc_id() != currentDHCID) {
1178 if (!(m_suppressErrorMask[c_nrDHC_DHCID_START_END_MM])) {
1179 B2WARNING("DHC ID Mismatch between Start and End");
1180 B2DEBUG(29, "DHC ID Mismatch between Start and End $" << std::hex <<
1181 currentDHCID << "!=$" << dhc.data_dhc_end_frame->get_dhc_id());
1182 }
1183 m_errorMask[c_nrDHC_DHCID_START_END_MM] = true;
1184 }
1185 int w;
1186 w = dhc.data_dhc_end_frame->get_words() * 4;
1187 if (cancheck_countedBytesInDHC) {
1188 if (countedBytesInDHC != w) {
1189 if (!(m_suppressErrorMask[c_nrDHC_WIE])) {
1190 B2WARNING("Number of Words in DHC END does not match");
1191 B2DEBUG(29, "Number of Words in DHC END does not match: WIE $" << hex << countedBytesInDHC << " != DHC END $" << hex << w);
1192 }
1193 m_errorMask[c_nrDHC_WIE] = true;
1194 } else {
1195 if (m_verbose)
1196 B2DEBUG(29, "EVT END: WIE $" << hex << countedBytesInDHC << " == DHC END $" << hex << w);
1197 }
1198 // else ... processed data -> length invalid
1199 }
1200 }
1202 if (dhc.data_dhc_end_frame->getErrorInfo() != 0) {
1203 if (!(m_suppressErrorMask[c_nrDHH_END_ERRORBITS])) B2ERROR("DHC END Error Info set to $" << hex <<
1205 m_errorMask[c_nrDHH_END_ERRORBITS] = true;
1206 }
1207 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
1208 m_errorMaskDHC |= m_errorMask; // do latest updates
1209
1210 if (daqpktstat.dhc_size() > 0) {
1211 // only is we have a DHC object... or back() is undefined
1212 // Remark, if we have a broken data (DHC_START/END) structure, we might fill the
1213 // previous DHC object ... but then the data is junk anyway
1214 daqpktstat.dhc_back().setErrorMask(m_errorMaskDHC);
1215 //B2DEBUG(98,"** DHC "<<currentDHCID<<" Raw"<<dhc.data_dhc_end_frame->get_words() * 4 <<" Red"<<countedBytesInDHC);
1216 daqpktstat.dhc_back().setCounters(dhc.data_dhc_end_frame->get_words() * 4, countedBytesInDHC);
1218 }
1219 m_errorMaskDHC = 0;
1220 currentDHEID = 0xFFFFFFFF;
1221 currentDHCID = 0xFFFFFFFF;
1222 currentVxdId = 0;
1223 break;
1224 };
1225 case EDHCFrameHeaderDataType::c_DHE_END: {
1227 if (currentDHEID != dhc.data_dhe_end_frame->getDHEId()) {
1228 if (!(m_suppressErrorMask[c_nrDHE_START_END_ID])) {
1229 B2WARNING("DHE ID from DHE Start and this frame do not match");
1230 B2DEBUG(29, "DHE ID from DHE Start and this frame do not match $" << hex << currentDHEID << " != $" <<
1232 }
1233 m_errorMask[c_nrDHE_START_END_ID] = true;
1234 }
1236 if (dhc.data_dhe_end_frame->getErrorInfo() != 0) {
1237 if (!(m_suppressErrorMask[c_nrDHH_END_ERRORBITS])) {
1238 B2ERROR("DHE END Error Info set to $" << hex << dhc.data_dhe_end_frame->getErrorInfo());
1239 }
1240 m_errorMask[c_nrDHH_END_ERRORBITS] = true;
1241 }
1242 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
1243 if (found_mask_active_dhp != mask_active_dhp) {
1244 if (!(m_suppressErrorMask[c_nrDHP_ACTIVE])) {
1245 B2WARNING("DHE_END: DHP active mask differs from found data");
1246 B2DEBUG(29, "DHE_END: DHP active mask differs from found data $" << hex << mask_active_dhp << " != $" << hex <<
1247 found_mask_active_dhp
1248 << " mask of found dhp/ghost frames");
1249 }
1250 m_errorMask[c_nrDHP_ACTIVE] = true;
1251 }
1252 countedDHEEndFrames++;
1253 if (countedDHEStartFrames < countedDHEEndFrames) {
1254 // the other case is checked in Start
1255 if (!(m_suppressErrorMask[c_nrDHE_END_WO_START])) B2WARNING("DHE_END without DHE_START");
1256 m_errorMask[c_nrDHE_END_WO_START] = true;
1257 }
1258 {
1259 int w;
1260 w = dhc.data_dhe_end_frame->get_words() * 2;
1261 if (cancheck_countedBytesInDHE) {
1262 if (countedBytesInDHE != w) {
1263 if (!(m_suppressErrorMask[c_nrDHE_WIE])) {
1264 B2WARNING("Number of Words in DHE END does not match");
1265 B2DEBUG(29, "Number of Words in DHE END does not match: WIE $" << hex << countedBytesInDHE << " != DHE END $" << hex << w);
1266 }
1267 m_errorMask[c_nrDHE_WIE] = true;
1268 } else {
1269 if (m_verbose)
1270 B2DEBUG(29, "EVT END: WIE $" << hex << countedBytesInDHE << " == DHE END $" << hex << w);
1271 }
1272 // else ... processed data -> length invalid
1273 }
1274 }
1275 m_errorMaskDHE |= m_errorMask; // do latest updates
1276
1277 if (daqpktstat.dhc_size() > 0) {
1278 if (daqpktstat.dhc_back().dhe_size() > 0) {
1279 // only is we have a DHC and DHE object... or back() is undefined
1280 // Remark, if we have a broken data (DHE_START/END) structure, we might fill the
1281 // previous DHE object ... but then the data is junk anyway
1283 // B2DEBUG(98,"** DHC "<<currentDHEID<<" Raw "<<dhc.data_dhe_end_frame->get_words() * 2 <<" Red"<<countedBytesInDHE);
1284 daqpktstat.dhc_back().dhe_back().setCounters(dhc.data_dhe_end_frame->get_words() * 2, countedBytesInDHE);
1285 daqpktstat.dhc_back().dhe_back().setDHPFoundMask(found_good_mask_active_dhp);
1287 }
1288 }
1289 m_errorMaskDHE = 0;
1290 currentDHEID |= 0xFF000000;// differentiate from 0xFFFFFFFFF as initial value
1291 currentVxdId = 0;
1292 break;
1293 };
1294 case EDHCFrameHeaderDataType::c_ONSEN_ROI:
1296 dhc.data_onsen_roi_frame->check_error(m_errorMask, len, m_suppressErrorMask[c_nrROI_PACKET_INV_SIZE]);
1298 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
1299 if (!m_doNotStore) {
1300 //dhc.data_onsen_roi_frame->save(m_storeROIs, len, (unsigned int*) data);
1301 // void save(StoreArray<PXDRawROIs>& sa, unsigned int length, unsigned int* data) const
1302 // 4 byte header, ROIS (n*8), 4 byte copy of inner CRC, 4 byte outer CRC
1303 if (len >= dhc.data_onsen_roi_frame->getMinSize()) {
1304 //if ((len - dhc.data_onsen_roi_frame->getMinSize()) % 8 != 0) {
1305 // error checking in check_error() above, this is only for dump-ing
1306 // dump_roi(data, len - 4); // dump ROI payload, minus CRC
1307 //}
1308 unsigned int l;
1309 l = (len - dhc.data_onsen_roi_frame->getMinSize()) / 8;
1310 // Endian swapping is done in Constructor of RawRoi object
1311 m_storeROIs.appendNew(l, &((unsigned int*) data)[1]);
1312 }
1313 }
1314 break;
1315 case EDHCFrameHeaderDataType::c_ONSEN_TRG:
1316 eventNrOfOnsenTrgFrame = eventNrOfThisFrame;
1317 if (dhc.data_onsen_trigger_frame->get_trig_nr1() != (unsigned int)(m_meta_event_nr & 0xFFFFFFFF)) {
1318 if (!(m_suppressErrorMask[c_nrMETA_MM_ONS_HLT])) {
1319 B2WARNING("Trigger Frame HLT Trigger Nr mismatch");
1320 B2DEBUG(29, "Trigger Frame HLT Trigger Nr mismatch: HLT $" <<
1321 dhc.data_onsen_trigger_frame->get_trig_nr1() << " META " << (m_meta_event_nr & 0xFFFFFFFF));
1322 }
1323 m_errorMask[c_nrMETA_MM_ONS_HLT] = true;
1324 }
1328 if (!(m_suppressErrorMask[c_nrMETA_MM_ONS_HLT])) {
1329 B2WARNING("Trigger Frame HLT Exp/Run/Subrun Nr mismatch");
1330 B2DEBUG(29, "Trigger Frame HLT Exp/Run/Subrun Nr mismatch: Exp HLT $" <<
1332 " Run HLT $" << dhc.data_onsen_trigger_frame->get_run1() << " META " << m_meta_run_nr <<
1333 " Subrun HLT $" << dhc.data_onsen_trigger_frame->get_subrun1() << " META " << m_meta_subrun_nr);
1334 }
1335 m_errorMask[c_nrMETA_MM_ONS_HLT] = true;
1336 }
1337
1339 if (dhc.data_onsen_trigger_frame->get_trig_nr2() != (unsigned int)(m_meta_event_nr & 0xFFFFFFFF)) {
1340 if (!(m_suppressErrorMask[c_nrMETA_MM_ONS_DC])) {
1341 B2WARNING("Trigger Frame DATCON Trigger Nr mismatch");
1342 B2DEBUG(29, "Trigger Frame DATCON Trigger Nr mismatch: DC $" <<
1343 dhc.data_onsen_trigger_frame->get_trig_nr2() << " META " << (m_meta_event_nr & 0xFFFFFFFF));
1344 }
1345 m_errorMask[c_nrMETA_MM_ONS_DC] = true;
1346 }
1350 if (!(m_suppressErrorMask[c_nrMETA_MM_ONS_DC])) {
1351 B2WARNING("Trigger Frame DATCON Exp/Run/Subrun Nr mismatch");
1352 B2DEBUG(29, "Trigger Frame DATCON Exp/Run/Subrun Nr mismatch: Exp DC $" <<
1354 " Run DC $" << dhc.data_onsen_trigger_frame->get_run2() << " META " << m_meta_run_nr <<
1355 " Subrun DC $" << dhc.data_onsen_trigger_frame->get_subrun2() << " META " << m_meta_subrun_nr);
1356 }
1357 m_errorMask[c_nrMETA_MM_ONS_DC] = true;
1358 }
1359 }
1360
1361// B2WARNING("TRG TAG HLT: $" << hex << dhc.data_onsen_trigger_frame->get_trig_tag1() << " DATCON $" << dhc.data_onsen_trigger_frame->get_trig_tag2() << " META " << m_meta_time);
1362
1365 m_suppressErrorMask[c_nrMERGER_TRIGNR]);
1366 dhc.check_crc(m_errorMask, m_suppressErrorMask[c_nrDHE_CRC]);
1367 if (Frame_Number != 0) {
1368 if (!(m_suppressErrorMask[c_nrEVENT_STRUCT])) B2WARNING("ONSEN TRG Frame must be the first one.");
1369 m_errorMask[c_nrEVENT_STRUCT] = true;
1370 }
1371 isUnfiltered_event = dhc.data_onsen_trigger_frame->is_SendUnfiltered();
1372 if (isUnfiltered_event) m_sendunfiltered++;
1375 break;
1376 default:
1377 if (!(m_suppressErrorMask[c_nrDHC_UNKNOWN])) B2WARNING("UNKNOWN DHC frame type");
1378 m_errorMask[c_nrDHC_UNKNOWN] = true;
1379 if (m_verbose) hw->print();
1380 break;
1381 }
1382
1383 if (eventNrOfThisFrame != eventNrOfOnsenTrgFrame && !isFakedData_event) {
1384 if (!(m_suppressErrorMask[c_nrFRAME_TNR_MM])) {
1385 B2WARNING("Frame TrigNr != ONSEN Trig Nr");
1386 B2DEBUG(29, "Frame TrigNr != ONSEN Trig Nr $" << hex << eventNrOfThisFrame << " != $" << eventNrOfOnsenTrgFrame);
1387 }
1388 m_errorMask[c_nrFRAME_TNR_MM] = true;
1389 }
1390
1391 if (Frame_Number == 0) {
1393 if (frame_type != EDHCFrameHeaderDataType::c_ONSEN_TRG) {
1394 if (!m_formatBonnDAQ) {
1395 if (!(m_suppressErrorMask[c_nrONSEN_TRG_FIRST])) B2WARNING("First frame is not a ONSEN Trigger frame");
1396 m_errorMask[c_nrONSEN_TRG_FIRST] = true;
1397 }
1398 }
1399 } else { // (Frame_Number != 0 &&
1401 if (frame_type == EDHCFrameHeaderDataType::c_ONSEN_TRG) {
1402 if (!(m_suppressErrorMask[c_nrONSEN_TRG_FIRST])) B2WARNING("More than one ONSEN Trigger frame");
1403 m_errorMask[c_nrONSEN_TRG_FIRST] = true;
1404 }
1405 }
1406
1407 if (!m_formatBonnDAQ) {
1408 if (Frame_Number == 1) {
1410 if (frame_type != EDHCFrameHeaderDataType::c_DHC_START) {
1411 if (!(m_suppressErrorMask[c_nrDHC_START_SECOND])) B2WARNING("Second frame is not a DHC start of subevent frame");
1412 m_errorMask[c_nrDHC_START_SECOND] = true;
1413 }
1414 } else { // (Frame_Number != 0 &&
1416 if (frame_type == EDHCFrameHeaderDataType::c_DHC_START) {
1417 if (!(m_suppressErrorMask[c_nrDHC_START_SECOND])) B2WARNING("More than one DHC start of subevent frame");
1418 m_errorMask[c_nrDHC_START_SECOND] = true;
1419 }
1420 }
1421 }
1422
1423 if (Frame_Number == Frames_in_event - 1) {
1425 if (frame_type != EDHCFrameHeaderDataType::c_DHC_END) {
1426 if (!(m_suppressErrorMask[c_nrDHC_END_MISS])) B2WARNING("Last frame is not a DHC end of subevent frame");
1427 m_errorMask[c_nrDHC_END_MISS] = true;
1428 }
1429
1431 if (countedDHEStartFrames != countedDHEEndFrames || countedDHEStartFrames != nr_active_dhe) {
1432 if (!(m_suppressErrorMask[c_nrDHE_ACTIVE]) || !(m_suppressErrorMask[c_nrDHE_START_WO_END])
1433 || !(m_suppressErrorMask[c_nrDHE_END_WO_START])) {
1434 B2WARNING("The number of DHE Start/End does not match the number of active DHE in DHC Header!");
1435 B2DEBUG(29, "The number of DHE Start/End does not match the number of active DHE in DHC Header! Header: " << nr_active_dhe <<
1436 " Start: " << countedDHEStartFrames << " End: " << countedDHEEndFrames << " Mask: $" << hex << mask_active_dhe << " in Event Nr " <<
1437 eventNrOfThisFrame);
1438 }
1439 if (countedDHEStartFrames == countedDHEEndFrames) m_errorMask[c_nrDHE_ACTIVE] = true;
1440 if (countedDHEStartFrames > countedDHEEndFrames) m_errorMask[c_nrDHE_START_WO_END] = true;
1441 if (countedDHEStartFrames < countedDHEEndFrames) m_errorMask[c_nrDHE_END_WO_START] = true;
1442 }
1443
1444 } else { // (Frame_Number != Frames_in_event - 1 &&
1446 if (frame_type == EDHCFrameHeaderDataType::c_DHC_END) {
1447 if (!(m_suppressErrorMask[c_nrDHC_END_DBL])) B2WARNING("More than one DHC end of subevent frame");
1448 m_errorMask[c_nrDHC_END_DBL] = true;
1449 }
1450 }
1451
1452 if (!m_formatBonnDAQ) {
1454 if (Frame_Number == 2 && nr_active_dhe != 0 && frame_type != EDHCFrameHeaderDataType::c_DHE_START) {
1455 if (!(m_suppressErrorMask[c_nrDHE_START_THIRD])) B2WARNING("Third frame is not a DHE start frame");
1456 m_errorMask[c_nrDHE_START_THIRD] = true;
1457 }
1458 }
1459
1460 if (frame_type != EDHCFrameHeaderDataType::c_ONSEN_ROI && frame_type != EDHCFrameHeaderDataType::c_ONSEN_TRG) {
1461 // actually, they should not be within Start and End, but better be sure.
1462 countedBytesInDHC += len;
1463 countedBytesInDHE += len;
1464 }
1465 B2DEBUG(29, "DHC/DHE $" << hex << countedBytesInDHC << ", $" << hex << countedBytesInDHE);
1466}
void setErrorMask(const PXDErrorFlags &mask)
Set Error bit mask This should be the OR of error masks of all sub-objects (DHC, DHE)
void setGatedFlag(bool gm)
set gating info from the DHC END
PXDDAQDHEStatus & newDHE(Args &&... params)
Add new DHE information.
void setGatedHER(bool isher)
set HER/LER gating info from the DHC END
PXDDAQDHEStatus & dhe_back()
Returns PXDDAQDHEStatus for last DHE.
void setEndErrorInfo(uint32_t e)
set errorinfo from the DHC END
size_t dhe_size() const
Returns number of DHEs.
void setCounters(uint32_t raw, uint32_t red)
Set Data counters for reduction calculation.
void setDHPFoundMask(unsigned short dhpmask)
set Mask for found DHPs with valid data
void setErrorMask(const PXDErrorFlags &mask)
Set Error bit mask.
void setEndErrorInfo(uint32_t e)
set erroinfo from the DHE END
void setCounters(uint32_t raw, uint32_t red)
Set Data counters for reduction calculation.
size_t dhc_size() const
Returns number of DHCs.
PXDDAQDHCStatus & dhc_back()
Returns PXDDAQDHCStatus for last DHC.
PXDDAQDHCStatus & newDHC(Args &&... params)
Add new DHC information.
PXDError::PXDErrorFlags m_errorMaskDHC
Error Mask set per packet / DHC.
void unpack_dhp(void *data, unsigned int len, unsigned int dhe_first_readout_frame_lo, unsigned int dhe_ID, unsigned dhe_DHPport, unsigned dhe_reformat, VxdID vxd_id, PXDDAQPacketStatus &daqpktstat)
Unpack DHP data within one DHE frame.
int m_last_dhp_readout_frame_lo[4]
some workaround check for continouous frame ids
static int nr5bits(int i)
helper function to "count" nr of set bits within lower 5 bits.
void unpack_fce(unsigned short *data, unsigned int length, VxdID vxd_id)
Unpack DHP/FCE data within one DHE frame Not fully implemented as cluster format not 100% fixed.
void unpack_dhp_raw(void *data, unsigned int len, unsigned int dhe_ID, unsigned dhe_DHPport, VxdID vxd_id)
Unpack DHP RAW data within one DHE frame (pedestals, etc)
PXDError::PXDErrorFlags m_errorMaskDHE
Error Mask set per packet / DHE.
const dhc_ghost_frame * data_ghost_frame
data_ghost_frame
unsigned int getEventNrLo(void) const
get event nr lo (from data)
const dhc_end_frame * data_dhc_end_frame
data_dhc_end_frame
unsigned int getFixedSize(void)
get fixed size
int getFrameType(void)
get type of frame
const dhc_dhe_start_frame * data_dhe_start_frame
data_dhe_start_frame
void set(const void *d, unsigned int t)
set data and type (and length to 0)
const dhc_start_frame * data_dhc_start_frame
data_dhc_start_frame
const dhc_direct_readout_frame * data_direct_readout_frame
data_direct_readout_frame
const dhc_dhe_end_frame * data_dhe_end_frame
data_dhe_end_frame
void check_padding(PXDErrorFlags &errormask)
check padding and return it
const dhc_onsen_roi_frame * data_onsen_roi_frame
data_onsen_roi_frame
const dhc_direct_readout_frame_raw * data_direct_readout_frame_raw
data_direct_readout_frame_raw
const dhc_commode_frame * data_commode_frame
data_commode_frame
void check_crc(PXDErrorFlags &errormask, bool ignore_crc_flag=false)
check crc and return it
const dhc_onsen_trigger_frame * data_onsen_trigger_frame
data_onsen_trigger_frame
unsigned int getDHEId(void) const
get DHE Id (from word0)
unsigned int get_words(void) const
get words
unsigned int getDHEId(void) const
get DHE Id
unsigned int getErrorInfo(void) const
get error info
unsigned int getDHEId(void) const
get DHE Id (from word0)
unsigned short getEventNrLo(void) const
get trigger_nr_lo
unsigned short getTriggerGate(void) const
trigger gate (updated to 8 bit, before 10!)
unsigned short getStartFrameNr(void) const
last DHP frame before trigger
unsigned short getEventNrHi(void) const
get trigger_nr_hi
unsigned int getActiveDHPMask(void) const
get Active DHP Mask (from word0)
bool getDataReformattedFlag(void) const
get DataReformattedFlag (from word0)
unsigned short getDHEId(void) const
get DHE Id (from word0)
unsigned short getDHPPort(void) const
get DHP Port (from word0)
void print(void) const
print
unsigned int get_words(void) const
get words
bool isFakedData(void) const
is faked data
unsigned int get_dhc_id(void) const
get dhc id (from word0)
unsigned int getErrorInfo(void) const
get error info
unsigned short getFrameType(void) const
get type of frame
unsigned short getErrorFlag(void) const
get error flag
unsigned short getDHEId(void) const
get DHE Id (from word0)
unsigned short getDHPPort(void) const
get DDHP port (from word0)
unsigned int check_inner_crc(PXDErrorFlags &, unsigned int) const
check inner crc (currently not implemented/needed)
void check_error(PXDErrorFlags &errormask, int length, bool ignore_inv_size_flag=false) const
check error and return error mask
int getMinSize(void) const
4 byte header, ROIS (n*8), 4 byte copy of inner CRC, 4 byte outer CRC
unsigned short get_subrun1(void) const
get subrun1 (from trigtag1)
unsigned int get_trig_nr1(void) const
get trignr1
bool is_SendUnfiltered(void) const
is sendUnfiltered
bool is_SendROIs(void) const
is sendROIs
void check_error(PXDErrorFlags &errormask, bool ignore_datcon_flag=false, bool ignore_hltroi_magic_flag=false, bool ignore_merger_mm_flag=false) const
check error and return error mask
unsigned short get_run2(void) const
get run2 (from trigtag2)
bool is_fake_datcon(void) const
is fake datcon
unsigned short get_experiment1(void) const
get experiment1 (from trigtag1)
unsigned int get_trig_nr2(void) const
get trignr2
unsigned short get_experiment2(void) const
get experiment2
unsigned short get_subrun2(void) const
get subrun2 (from trigtag2)
bool is_Accepted(void) const
is accepted
unsigned short get_run1(void) const
get run1 (from trigtag1)
unsigned short get_gated_isher(void) const
get gated_isher (from word0)
unsigned short get_subrun(void) const
get subrun (from run_subrun)
unsigned short get_run(void) const
get run (from run_subrun)
unsigned short get_dhc_id(void) const
get dhc_id (from word0)
const ubig16_t time_tag_hi
time_tag_hi
const ubig16_t time_tag_mid
time_tag_mid
bool isFakedData(void) const
isFakedData
unsigned short getEventNrLo(void) const
get trigger_nr_lo
unsigned short get_experiment(void) const
get experiment (from exp_run)
unsigned short get_gated_flag(void) const
get gated_flag (from word0)
unsigned short get_active_dhe_mask(void) const
get active_dhe_mask (from word0)
const ubig16_t time_tag_lo_and_type
time_tag_lo_and_type
unsigned short getEventNrHi(void) const
get trigger_nr_hi

◆ unpack_dhp()

void unpack_dhp ( void * data,
unsigned int len,
unsigned int dhe_first_readout_frame_lo,
unsigned int dhe_ID,
unsigned dhe_DHPport,
unsigned dhe_reformat,
VxdID vxd_id,
PXDDAQPacketStatus & daqpktstat )
private

Unpack DHP data within one DHE frame.

Parameters
datapointer to dhp data
lenlength of dhp data
dhe_first_readout_frame_lo16 bit of the first readout frame from DHE Start
dhe_IDraw DHE ID from DHC frame
dhe_DHPportraw DHP port from DHC frame
dhe_reformatflag if DHE did reformatting
vxd_idvertex Detector ID
daqpktstatDaq Packet Status Object

FIXME TODO set an error bit ... but define one first

Definition at line 445 of file PXDUnpackerOTModule.cc.

448{
449 unsigned int nr_words = frame_len / 2; // frame_len in bytes (excl. CRC)!!!
450 ubig16_t* dhp_pix = (ubig16_t*)data;
451
452 unsigned int dhp_readout_frame_lo = 0;
453 unsigned int dhp_header_type = 0;
454 unsigned int dhp_reserved = 0;
455 unsigned int dhp_dhe_id = 0;
456 unsigned int dhp_dhp_id = 0;
457 unsigned int wrap = 0; // workaround to recalc a relative frame number
458 int last_gate = -1; // workaround to recalc a relative frame number
459
460 // cppcheck-suppress unreadVariable
461 unsigned int dhp_row = 0, dhp_col = 0, dhp_cm = 0;
462// unsigned int dhp_offset = 0;
463 bool rowflag = false;
464 bool pixelflag = true; // just for first row start
465
466 if (nr_words < 4) {
467 if (!(m_suppressErrorMask[c_nrDHP_SIZE])) B2WARNING("DHP frame size error (too small)" << LogVar("Nr words", nr_words));
468 m_errorMask[c_nrDHP_SIZE] = true;
469 return;
470 }
471
472 B2DEBUG(29, "HEADER -- $" << hex << dhp_pix[0] << hex << dhp_pix[1] << hex << dhp_pix[2] << hex << dhp_pix[3] << " -- ");
473
474 B2DEBUG(29, "DHP Header | $" << hex << dhp_pix[2] << " ( " << dec << dhp_pix[2] << " ) ");
475 dhp_header_type = (dhp_pix[2] & 0xE000) >> 13;
476 dhp_reserved = (dhp_pix[2] & 0x1F00) >> 8;
477 dhp_dhe_id = (dhp_pix[2] & 0x00FC) >> 2;
478 dhp_dhp_id = dhp_pix[2] & 0x0003;
479
480 B2DEBUG(29, "DHP type | $" << hex << dhp_header_type << " ( " << dec << dhp_header_type << " ) ");
481 B2DEBUG(29, "DHP reserved | $" << hex << dhp_reserved << " ( " << dec << dhp_reserved << " ) ");
482 B2DEBUG(29, "DHP DHE ID | $" << hex << dhp_dhe_id << " ( " << dec << dhp_dhe_id << " ) ");
483 B2DEBUG(29, "DHP DHP ID | $" << hex << dhp_dhp_id << " ( " << dec << dhp_dhp_id << " ) ");
484
485 if (dhe_ID != dhp_dhe_id) {
486 if (!(m_suppressErrorMask[c_nrDHE_DHP_DHEID])) {
487 B2WARNING("DHE ID in DHE and DHP header differ");
488 B2DEBUG(29, "DHE ID in DHE and DHP header differ $" << hex << dhe_ID << " != $" << dhp_dhe_id);
489 }
490 m_errorMask[c_nrDHE_DHP_DHEID] = true;
491 }
492 if (dhe_DHPport != dhp_dhp_id) {
493 if (!(m_suppressErrorMask[c_nrDHE_DHP_PORT])) {
494 B2WARNING("DHP ID (Chip/Port) in DHE and DHP header differ");
495 B2DEBUG(29, "DHP ID (Chip/Port) in DHE and DHP header differ $" << hex << dhe_DHPport << " != $" << dhp_dhp_id);
496 }
497 m_errorMask[c_nrDHE_DHP_PORT] = true;
498 }
499
500 if (dhp_header_type != EDHPFrameHeaderDataType::c_ZSD) {
501 if (!(m_suppressErrorMask[c_nrHEADERTYPE_INV])) {
502 B2WARNING("Header type invalid for this kind of DHE frame");
503 B2DEBUG(29, "Header type invalid for this kind of DHE frame: $" << hex << dhp_header_type);
504 }
505 m_errorMask[c_nrHEADERTYPE_INV] = true;
506 return;
507 }
508
509// static int offtab[4] = {0, 64, 128, 192};
510// dhp_offset = offtab[dhp_dhp_id];
511
512 dhp_readout_frame_lo = dhp_pix[3] & 0xFFFF;
513 B2DEBUG(29, "DHP Frame Nr | $" << hex << dhp_readout_frame_lo << " ( " << dec << dhp_readout_frame_lo << " ) ");
514
515 /* // TODO removed because data format error is not to be fixed soon
516 if (((dhp_readout_frame_lo - dhe_first_readout_frame_id_lo) & 0x3F) > m_maxDHPFrameDiff) {
517 if(!m_suppressErrorMask&c_DHP_DHE_FRAME_DIFFER ) B2WARNING("DHP Frame Nr differ from DHE Frame Nr by >1 DHE " << dhe_first_readout_frame_id_lo << " != DHP " << (dhp_readout_frame_lo & 0x3F) << " delta "<< ((dhp_readout_frame_lo - dhe_first_readout_frame_id_lo) & 0x3F) );
518 m_errorMask[c_nrDHP_DHE_FRAME_DIFFER] = true;
519 }
520 */
521 /* // TODO removed because data format error is not to be fixed soon
522 if (m_last_dhp_readout_frame_lo[dhp_dhp_id] != -1) {
523 if (((dhp_readout_frame_lo - m_last_dhp_readout_frame_lo[dhp_dhp_id]) & 0xFFFF) > m_maxDHPFrameDiff) {
524 if(!m_suppressErrorMask&c_DHP_NOT_CONT ) B2WARNING("Two DHP Frames per sensor which frame number differ more than one! " << m_last_dhp_readout_frame_lo[dhp_dhp_id] << ", " <<
525 dhp_readout_frame_lo);
526 m_errorMask[c_nrDHP_NOT_CONT] = true;
527 }
528 }
529 */
530
531 if (daqpktstat.dhc_size() > 0) {
532 if (daqpktstat.dhc_back().dhe_size() > 0) {
533 // only is we have a DHC and DHE object... or back() is undefined
534 // Remark, if we have a broken data (DHE_START/END) structure, we might fill the
535 // previous DHE object ... but then the data is junk anyway
536 daqpktstat.dhc_back().dhe_back().newDHP(dhp_dhp_id, dhp_readout_frame_lo);
537 }
538 }
539
540 /* // TODO removed because the data is not ordered as expected in current firmware
541 for (auto j = 0; j < 4; j++) {
542 if (m_last_dhp_readout_frame_lo[j] != -1) {
543 if (((dhp_readout_frame_lo - m_last_dhp_readout_frame_lo[j]) & 0xFFFF) > m_maxDHPFrameDiff) {
544 if(!m_suppressErrorMask&c_DHP_DHP_FRAME_DIFFER ) B2WARNING("Two DHP Frames (different DHP) per sensor which frame number differ more than one! " << m_last_dhp_readout_frame_lo[j] <<
545 ", " <<
546 dhp_readout_frame_lo);
547 m_errorMask[c_nrDHP_DHP_FRAME_DIFFER] = true;
548 break;// give msg only once
549 }
550 }
551 }
552 */
553 m_last_dhp_readout_frame_lo[dhp_dhp_id] = dhp_readout_frame_lo;
554
555// TODO Please check if this can happen by accident with valid data!
556 if (dhp_pix[2] == dhp_pix[4] && dhp_pix[3] + 1 == dhp_pix[5]) {
557 // We see a second "header" with framenr+1 ...
558 if (!(m_suppressErrorMask[c_nrDHP_DBL_HEADER])) {
559 B2WARNING("DHP data: seems to be double header! skipping.");
560 B2DEBUG(29, "DHP data: seems to be double header! skipping." << LogVar("Length",
561 frame_len));
562 }
563 m_errorMask[c_nrDHP_DBL_HEADER] = true;
564 // dump_dhp(data, frame_len); print out guilty dhp packet
565 return;
566 }
567
568 // Start with offset 4, thus skipping header words
569 for (unsigned int i = 4; i < nr_words ; i++) {
570
571 B2DEBUG(29, "-- $" << hex << dhp_pix[i] << " -- " << dec << i);
572 {
573 if (((dhp_pix[i] & 0x8000) >> 15) == 0) {
574 rowflag = true;
575 if (!pixelflag) {
576 if (!(m_suppressErrorMask[c_nrDHP_ROW_WO_PIX])) B2WARNING("DHP Unpacking: Row w/o Pix");
577 m_errorMask[c_nrDHP_ROW_WO_PIX] = true;
578 }
579 pixelflag = false;
580 dhp_row = (dhp_pix[i] & 0xFFC0) >> 5;
581 dhp_cm = dhp_pix[i] & 0x3F;
582 if (last_gate != -1 && (int)dhp_row / 4 < last_gate) {
583 // B2DEBUF(29,"Wrap " << LogVar("last", last_gate) << LogVar("curr", dhp_row / 4) << LogVar("DHE", dhe_ID) << LogVar("DHP", dhp_dhp_id));
584 wrap++; // relies on the order of data before mapping and the fact that OT firmware delivers only one frame
585 }
586 last_gate = dhp_row / 4;
587
588 if (dhp_cm == 63) { // fifo overflow
589 B2WARNING("DHP data loss (CM=63) in " << LogVar("DHE", dhe_ID) << LogVar("DHP", dhp_dhp_id));
591 m_errorMask[c_nrDHH_MISC_ERROR] = true;
592 }
593 if (daqpktstat.dhc_size() > 0) {
594 if (daqpktstat.dhc_back().dhe_size() > 0) {
595 PXDDAQDHPComMode cm(dhp_dhp_id, dhp_row, dhp_cm);
596 // only is we have a DHC and DHE object... or back() is undefined
597 // Remark, if we have a broken data (DHE_START/END) structure, we might fill the
598 // previous DHE object ... but then the data is junk anyway
599 daqpktstat.dhc_back().dhe_back().addCM(cm);
600 }
601 }
602 B2DEBUG(29, "SetRow: $" << hex << dhp_row << " CM $" << hex << dhp_cm);
603 } else {
604 if (!rowflag) {
605 if (!(m_suppressErrorMask[c_nrDHP_PIX_WO_ROW])) B2WARNING("DHP Unpacking: Pix without Row!!! skip dhp data ");
606 m_errorMask[c_nrDHP_PIX_WO_ROW] = true;
607 // dump_dhp(data, frame_len);// print out faulty dhp frame
608 return;
609 } else {
610 pixelflag = true;
611 dhp_row = (dhp_row & 0xFFE) | ((dhp_pix[i] & 0x4000) >> 14);
612 dhp_col = ((dhp_pix[i] & 0x3F00) >> 8);
613 unsigned int v_cellID, u_cellID;
614 v_cellID = dhp_row;// defaults for no mapping
615 if (dhp_row >= 768) {
616 if (!(m_suppressErrorMask[c_nrROW_OVERFLOW])) B2WARNING("DHP ROW Overflow " << LogVar("Row", dhp_row));
617 m_errorMask[c_nrROW_OVERFLOW] = true;
618 }
619 // we cannot do col overflow check before mapping :-(
620
621 if ((dhe_reformat == 0 && !m_forceNoMapping) || m_forceMapping) {
622 u_cellID = dhp_col;// defaults for no mapping
623 // data has not been pre-processed by DHH, thus we have to do the mapping ourselves
624 if ((dhe_ID & 0x21) == 0x00 || (dhe_ID & 0x21) == 0x21) {
625 // if IFOB
626 PXDMappingLookup::map_rc_to_uv_IF_OB(v_cellID, u_cellID, dhp_dhp_id, dhe_ID);
627 } else { // else OFIB
628 PXDMappingLookup::map_rc_to_uv_IB_OF(v_cellID, u_cellID, dhp_dhp_id, dhe_ID);
629 }
630 } else {
631 u_cellID = dhp_col + 64 * dhp_dhp_id; // defaults for already mapped
632 }
633 if (u_cellID >= 250) {
634 if (!(m_suppressErrorMask[c_nrCOL_OVERFLOW])) {
635 B2WARNING("DHP COL Overflow (unconnected drain lines)");
636 B2DEBUG(29, "DHP COL Overflow (unconnected drain lines) " << u_cellID << ", reformat " << dhe_reformat << ", dhpcol " << dhp_col <<
637 ", id " << dhp_dhp_id);
638 }
639 m_errorMask[c_nrCOL_OVERFLOW] = true;
640 }
641 auto dhp_adc = dhp_pix[i] & 0xFF;
642 B2DEBUG(29, "SetPix: Row $" << hex << dhp_row << " Col $" << hex << dhp_col << " ADC $" << hex << dhp_adc
643 << " CM $" << hex << dhp_cm);
644
645 if (dhp_adc == 0) {
646 // if !suppress error flag
647 B2WARNING("DHE Event truncation in DHE " << dhe_ID << " DHP " << dhp_dhp_id);
648 // m_errorMask |= c_DHE_EVENT_TRUNC;
649 daqpktstat.dhc_back().dhe_back().dhp_back().setTruncated();
650 } else {
651 // in new firmware, (dhp_readout_frame_lo - dhe_first_readout_frame_id_lo) would always been 0
652 if (!m_doNotStore) m_storeRawHits.appendNew(vxd_id, v_cellID, u_cellID, dhp_adc,
653 (dhp_readout_frame_lo - dhe_first_readout_frame_id_lo + wrap) & 0x3F);
654 }
655 }
656 }
657 }
658 }
659
660 B2DEBUG(29, "(DHE) DHE_ID $" << hex << dhe_ID << " (DHE) DHP ID $" << hex << dhe_DHPport << " (DHP) DHE_ID $" << hex << dhp_dhe_id
661 << " (DHP) DHP ID $" << hex << dhp_dhp_id);
662 /*for (int i = 0; i < raw_nr_words ; i++) {
663 B2DEBUG(29, "RAW | " << hex << p_pix[i]);
664 printf("raw %08X | ", p_pix[i]);
665 B2DEBUG(29, "row " << hex << ((p_pix[i] >> 20) & 0xFFF) << dec << " ( " << ((p_pix[i] >> 20) & 0xFFF) << " ) " << " col " << hex << ((p_pix[i] >> 8) & 0xFFF)
666 << " ( " << dec << ((p_pix[i] >> 8) & 0xFFF) << " ) " << " adc " << hex << (p_pix[i] & 0xFF) << " ( " << (p_pix[i] & 0xFF) << " ) "
667 );
668 }*/
669}
PXDDAQDHPStatus & newDHP(Args &&... params)
New DHP information.
auto addCM(PXDDAQDHPComMode &daqcm)
Add Common Mode information.
PXDDAQDHPStatus & dhp_back()
Returns PXDDAQDHPStatus for the last DHP.
void setTruncated(void)
set Truncation
static void map_rc_to_uv_IF_OB(unsigned int &row_u, unsigned int &col_v, const unsigned int dhp_id, const unsigned int dhe_ID)
Maps row/col of inner forward (IF) and outer backward (OB) modules of the PXD to U/V cell.
static void map_rc_to_uv_IB_OF(unsigned int &row_u, unsigned int &col_v, const unsigned int dhp_id, const unsigned int dhe_ID)
Maps row/cols of inner backward (IB) and outer forward (OF) modules of the PXD to U/V cell.
std::tuple< uint8_t, uint16_t, uint8_t > PXDDAQDHPComMode
tuple of Chip ID (2 bit), Row (10 bit), Common Mode (6 bit)

◆ unpack_dhp_raw()

void unpack_dhp_raw ( void * data,
unsigned int len,
unsigned int dhe_ID,
unsigned dhe_DHPport,
VxdID vxd_id )
private

Unpack DHP RAW data within one DHE frame (pedestals, etc)

Parameters
datapointer to dhp data
lenlength of dhp data
dhe_IDraw DHE ID from DHC frame
dhe_DHPportraw DHP port from DHC frame
vxd_idvertex Detector ID

Important Remark: Up to now the format for Raw frames as well as size etc is not well defined. It will most likely change! E.g. not the whole mem is dumped, but only a part of it.


Endian Swapping is done in Constructors of Raw Objects!

Definition at line 301 of file PXDUnpackerOTModule.cc.

303{
304// unsigned int nr_words = frame_len / 2; // frame_len in bytes (excl. CRC)!!!
305 ubig16_t* dhp_pix = (ubig16_t*)data;
306
313
314 // Size: 64*768 + 8 bytes for a full frame readout
315 if (frame_len != 0xC008) {
316 if (!(m_suppressErrorMask[c_nrFIX_SIZE])) B2WARNING("Frame size unsupported for RAW ADC frame! $" <<
317 LogVar("size [bytes] $", static_cast < std::ostringstream && >(std::ostringstream() << hex << frame_len).str())
318 << LogVar("DHE", dhe_ID) << LogVar("DHP", dhe_DHPport));
319 m_errorMask[c_nrFIX_SIZE] = true;
320 return;
321 }
322 unsigned int dhp_header_type = 0;
323// unsigned int dhp_reserved = 0;
324 unsigned int dhp_dhe_id = 0;
325 unsigned int dhp_dhp_id = 0;
326
327 dhp_header_type = (dhp_pix[2] & 0xE000) >> 13;
328// dhp_reserved = (dhp_pix[2] >> 8) & 0x1F;
329 dhp_dhe_id = (dhp_pix[2] & 0x00FC) >> 2;
330 dhp_dhp_id = dhp_pix[2] & 0x0003;
331
332 if (dhe_ID != dhp_dhe_id) {
333 if (!(m_suppressErrorMask[c_nrDHE_DHP_DHEID])) {
334 B2WARNING("DHE ID in DHE and DHP header differ");
335 B2DEBUG(29, "DHE ID in DHE and DHP header differ $" << hex << dhe_ID << " != $" << dhp_dhe_id);
336 }
337 m_errorMask[c_nrDHE_DHP_DHEID] = true;
338 }
339 if (dhe_DHPport != dhp_dhp_id) {
340 if (!(m_suppressErrorMask[c_nrDHE_DHP_PORT])) {
341 B2WARNING("DHP ID (Chip/Port) in DHE and DHP header differ");
342 B2DEBUG(29, "DHP ID (Chip/Port) in DHE and DHP header differ $" << hex << dhe_DHPport << " != $" << dhp_dhp_id);
343 }
344 m_errorMask[c_nrDHE_DHP_PORT] = true;
345 }
346
347 if (dhp_header_type != EDHPFrameHeaderDataType::c_RAW) {
348 if (!(m_suppressErrorMask[c_nrHEADERTYPE_INV])) {
349 B2WARNING("Header type invalid for this kind of DHE frame");
350 B2DEBUG(29, "Header type invalid for this kind of DHE frame: $" << hex << dhp_header_type);
351 }
352 m_errorMask[c_nrHEADERTYPE_INV] = true;
353 return;
354 }
355
357 B2DEBUG(29, "Raw ADC Data");
358 // size checked already above
359 m_storeRawAdc.appendNew(vxd_id, data, frame_len);
360};

◆ unpack_fce()

void unpack_fce ( unsigned short * data,
unsigned int length,
VxdID vxd_id )
private

Unpack DHP/FCE data within one DHE frame Not fully implemented as cluster format not 100% fixed.

Parameters
datapointer to dhp data
lengthlength of dhp data
vxd_idvertex Detector ID

Important Remark: Up to now the format for cluster is not well defined. We need to wait for the final hardware implementation. Then the following code must be re-checked TODO


Definition at line 362 of file PXDUnpackerOTModule.cc.

364{
371
372 B2WARNING("FCE (Cluster) Packet have not yet been tested with real HW clusters. Dont assume that this code is working!");
373 return;
374
375 // implement the unpacking here and not as a separate module ... when it is available in HW
376// ubig16_t* cluster = (ubig16_t*)data;
377// int nr_words; //words in dhp frame
378// unsigned int words_in_cluster = 0; //counts 16bit words in cluster
379// nr_words = length / 2;
380// ubig16_t sor;
381// sor = 0x0000;
382//
383// for (int i = 2 ; i < nr_words ; i++) {
384// if (i != 2) { //skip header
385// if ((((cluster[i] & 0x8000) == 0)
386// && ((cluster[i] & 0x4000) >> 14) == 1)) { //searches for start of row frame with start of cluster flag = 1 => new cluster
387// if (!m_doNotStore) m_storeRawCluster.appendNew(&data[i - words_in_cluster], words_in_cluster, vxd_id);
388// words_in_cluster = 0;
389// }
390// }
391// if ((cluster[i] & 0x8000) == 0) {
392// sor = cluster[i];
393// }
394// words_in_cluster++;
395//
396// if ((cluster[nr_words - 1] & 0xFFFF) == (sor &
397// 0xFFFF)) {//if frame is not 32bit aligned last word will be the last start of row word
398// cluster[nr_words - 1] = 0x0000;//overwrites the last redundant word with zero to make checking easier in PXDHardwareClusterUnpacker
399// }
400//
401// if (i == nr_words - 1) {
402// if (!m_doNotStore) m_storeRawCluster.appendNew(&data[i - words_in_cluster + 1], words_in_cluster, vxd_id);
403// }
404// }
405}

◆ unpack_rawpxd()

void unpack_rawpxd ( RawPXD & px,
int inx )
private

Unpack one event (several frames) stored in RawPXD object.

Parameters
pxRawPXD data object
inxIndex of RawPXD packet

in bytes ... rounded up to next 32bit boundary

NEW format

len of frame in bytes

round up to next 32 bit boundary

no rounding needed

Definition at line 176 of file PXDUnpackerOTModule.cc.

177{
178 int Frames_in_event;
179 int fullsize;
180 int datafullsize;
181
182 m_errorMaskDHE = 0;
183 m_errorMaskDHC = 0;
185 PXDDAQPacketStatus& daqpktstat = m_storeDAQEvtStats->newPacket(inx);
186
187 if (px.size() <= 0 || px.size() > 16 * 1024 * 1024) {
188 if (!(m_suppressErrorMask[c_nrPACKET_SIZE])) {
189 B2WARNING("PXD Unpacker --> invalid packet size" <<
190 LogVar("size [32bit words] $", static_cast < std::ostringstream && >(std::ostringstream() << hex << px.size()).str()));
191 }
192 m_errorMask[c_nrPACKET_SIZE] = true;
193 return;
194 }
195 std::vector<unsigned int> data(px.size());
196 fullsize = px.size() * 4;
197 std::copy_n(px.data(), px.size(), data.begin());
198
199 if (fullsize < 8) {
200 if (!(m_suppressErrorMask[c_nrPACKET_SIZE])) {
201 B2WARNING("Data is to small to hold a valid Header! Will not unpack anything." << LogVar("size [32bit words] $",
202 static_cast < std::ostringstream && >(std::ostringstream() << hex << fullsize).str()));
203 }
204 m_errorMask[c_nrPACKET_SIZE] = true;
205 return;
206 }
207
208 if (data[0] != 0xCAFEBABE && data[0] != 0xBEBAFECA) {
209 if (!(m_suppressErrorMask[c_nrMAGIC])) {
210 B2WARNING("Magic invalid: Will not unpack anything. Header corrupted." <<
211 LogVar("Header Magic $", static_cast < std::ostringstream && >(std::ostringstream() << hex << data[0]).str()));
212 }
213 m_errorMask[c_nrMAGIC] = true;
214 return;
215 }
216
217
218 Frames_in_event = ((ubig32_t*)data.data())[1];
219 if (Frames_in_event < 0 || Frames_in_event > 256) {
220 if (!(m_suppressErrorMask[c_nrFRAME_NR])) {
221 B2WARNING("Number of Frames invalid: Will not unpack anything. Header corrupted!" << LogVar("Frames in event", Frames_in_event));
222 }
223 m_errorMask[c_nrFRAME_NR] = true;
224 return;
225 }
226 if (Frames_in_event < 3) {
227 if (!(m_suppressErrorMask[c_nrNR_FRAMES_TO_SMALL])) {
228 B2WARNING("Number of Frames too small: It cannot contain anything useful." << LogVar("Frames in event", Frames_in_event));
229 }
230 m_errorMask[c_nrNR_FRAMES_TO_SMALL] = true;
231 }
232
234 if (m_verbose) {
235 B2DEBUG(29, "PXD Unpacker --> data[0]: <-- Magic $" << hex << data[0]);
236 B2DEBUG(29, "PXD Unpacker --> data[1]: <-- #Frames $" << hex << data[1]);
237 if (data[1] >= 1 && fullsize < 12) B2DEBUG(29, "PXD Unpacker --> data[2]: <-- Frame 1 len $" << hex << data[2]);
238 if (data[1] >= 2 && fullsize < 16) B2DEBUG(29, "PXD Unpacker --> data[3]: <-- Frame 2 len $" << hex << data[3]);
239 if (data[1] >= 3 && fullsize < 20) B2DEBUG(29, "PXD Unpacker --> data[4]: <-- Frame 3 len $" << hex << data[4]);
240 if (data[1] >= 4 && fullsize < 24) B2DEBUG(29, "PXD Unpacker --> data[5]: <-- Frame 4 len $" << hex << data[5]);
241 };
242
243 unsigned int* tableptr;
244 tableptr = &data[2]; // skip header!!!
245
246 unsigned int* dataptr;
247 dataptr = &tableptr[Frames_in_event];
248 datafullsize = fullsize - 2 * 4 - Frames_in_event * 4; // Size is fullsize minus header minus table
249
250 int ll = 0; // Offset in dataptr in bytes
251 for (int j = 0; j < Frames_in_event; j++) {
252 int lo;
253
254 lo = ((ubig32_t*)tableptr)[j];
255 if (lo <= 0) {
256 if (!(m_suppressErrorMask[c_nrFRAME_SIZE])) {
257 B2WARNING("size of frame invalid");
258 B2DEBUG(29, "size of frame invalid: " << j << "size " << lo << " at byte offset in dataptr " << ll);
259 }
260 m_errorMask[c_nrFRAME_SIZE] = true;
261 return;
262 }
263 if (ll + lo > datafullsize) {
264 if (!(m_suppressErrorMask[c_nrFRAME_SIZE])) {
265 B2WARNING("Frames exceed packet size");
266 B2DEBUG(29, "Frames exceed packet size: " << j << " size " << lo << " at byte offset in dataptr " << ll << " of datafullsize " <<
267 datafullsize << " of fullsize " << fullsize);
268 }
269 m_errorMask[c_nrFRAME_SIZE] = true;
270 return;
271 }
272 if (lo & 0x3) {
273 if (!(m_suppressErrorMask[c_nrFRAME_SIZE])) {
274 B2WARNING("SKIP Frame with Data with not MOD 4 length");
275 B2DEBUG(29, "SKIP Frame with Data with not MOD 4 length " << " ( $" << hex << lo << " ) ");
276 }
277 ll += (lo + 3) & 0xFFFFFFFC;
278 m_errorMask[c_nrFRAME_SIZE] = true;
279 } else {
280 B2DEBUG(29, "unpack DHE(C) frame: " << j << " with size " << lo << " at byte offset in dataptr " << ll);
281 unpack_dhc_frame(ll + (char*)dataptr, lo, j, Frames_in_event, daqpktstat);
282 ll += lo;
283 }
288 m_errorMask = 0;
289
290 if (!m_continueOnError && (m_errorMaskPacket & PXDErrorFlags(m_errorSkipPacketMask)) != PXDErrorFlags(0)) {
291 // skip full package on error, recovery to next DHC/DHE Start might be possible in some cases
292 // But that's to hard to implement
293 // Remark: PXD data for broken events is removed in next PXDPostChecker module, thus skipping the
294 // unpacking is not strictly necessary here.
295 break;
296 }
297 }
299}
void setErrorMask(const PXDErrorFlags &mask)
Set Error bit mask This should be the OR of error masks of all sub-objects (DHC, DHE)
PXDError::PXDErrorFlags m_errorMaskPacket
Error Mask set per packet / packet.
void unpack_dhc_frame(void *data, const int len, const int Frame_Number, const int Frames_in_event, PXDDAQPacketStatus &daqpktstat)
Unpack one frame (within an event).
virtual int * data(void)
get pointer to data
Definition RawPXD.cc:81
virtual int size() const
get size of buffer in 32 Bit words
Definition RawPXD.cc:76

Member Data Documentation

◆ m_checkPaddingCRC

bool m_checkPaddingCRC {false}
private

Check for susp.

Padding/CRC, default off because of many false positive

Definition at line 62 of file PXDUnpackerOTModule.h.

62{false};

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 520 of file Module.h.

◆ m_continueOnError

bool m_continueOnError {false}
private

flag continue unpacking of frames even after error (for debugging)

Definition at line 99 of file PXDUnpackerOTModule.h.

99{false};

◆ m_criticalErrorMask

PXDError::PXDErrorFlags m_criticalErrorMask {}
private

Critical error mask which defines return value of task.

Definition at line 71 of file PXDUnpackerOTModule.h.

71{};

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 510 of file Module.h.

◆ m_doNotStore

bool m_doNotStore {false}
private

Only unpack, but Do Not Store anything to file.

Definition at line 60 of file PXDUnpackerOTModule.h.

60{false};

◆ m_errorCounter

unsigned int m_errorCounter[PXDError::ONSEN_MAX_TYPE_ERR] {}
private

Error counters.

Definition at line 95 of file PXDUnpackerOTModule.h.

95{};

◆ m_errorMask

PXDError::PXDErrorFlags m_errorMask {0}
private

Error Mask set per packet / frame.

Definition at line 160 of file PXDUnpackerOTModule.h.

160{0};

◆ m_errorMaskDHC

PXDError::PXDErrorFlags m_errorMaskDHC {0}
private

Error Mask set per packet / DHC.

Definition at line 164 of file PXDUnpackerOTModule.h.

164{0};

◆ m_errorMaskDHE

PXDError::PXDErrorFlags m_errorMaskDHE {0}
private

Error Mask set per packet / DHE.

Definition at line 162 of file PXDUnpackerOTModule.h.

162{0};

◆ m_errorMaskEvent

PXDError::PXDErrorFlags m_errorMaskEvent {0}
private

Error Mask set per packet / event.

Definition at line 168 of file PXDUnpackerOTModule.h.

168{0};

◆ m_errorMaskPacket

PXDError::PXDErrorFlags m_errorMaskPacket {0}
private

Error Mask set per packet / packet.

Definition at line 166 of file PXDUnpackerOTModule.h.

166{0};

◆ m_errorSkipPacketMask

PXDError::PXDErrorFlags m_errorSkipPacketMask {}
private

Mask for error which stop package unpacking directly.

Definition at line 75 of file PXDUnpackerOTModule.h.

75{};

◆ m_eventMetaData

StoreObjPtr<EventMetaData> m_eventMetaData
private

Input ptr for EventMetaData.

Definition at line 104 of file PXDUnpackerOTModule.h.

◆ m_forceMapping

bool m_forceMapping {false}
private

Force Mapping even if DHH bit is not requesting it.

Definition at line 64 of file PXDUnpackerOTModule.h.

64{false};

◆ m_forceNoMapping

bool m_forceNoMapping {false}
private

Force No Mapping even if DHH bit is requesting it.

Definition at line 66 of file PXDUnpackerOTModule.h.

66{false};

◆ m_formatBonnDAQ

bool m_formatBonnDAQ {false}
private

flag ONSEN or BonnDAQ format

Definition at line 177 of file PXDUnpackerOTModule.h.

177{false};

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 517 of file Module.h.

◆ m_last_dhp_readout_frame_lo

int m_last_dhp_readout_frame_lo[4] { -1}
private

some workaround check for continouous frame ids

Definition at line 180 of file PXDUnpackerOTModule.h.

180{ -1}; // signed because -1 means undefined

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 513 of file Module.h.

◆ m_maxDHPFrameDiff

unsigned int m_maxDHPFrameDiff {0}
private

Maximum DHP frame difference until error is reported.

Definition at line 68 of file PXDUnpackerOTModule.h.

68{0};

◆ m_meta_event_nr

unsigned long m_meta_event_nr {0}
private

Event Number from MetaInfo.

Definition at line 78 of file PXDUnpackerOTModule.h.

78{0};

◆ m_meta_experiment

unsigned long m_meta_experiment {0}
private

Experiment from MetaInfo.

Definition at line 84 of file PXDUnpackerOTModule.h.

84{0};

◆ m_meta_run_nr

unsigned long m_meta_run_nr {0}
private

Run Number from MetaInfo.

Definition at line 80 of file PXDUnpackerOTModule.h.

80{0};

◆ m_meta_sec

unsigned int m_meta_sec {0}
private

Time(Tag) from MetaInfo, seconds (masked to lower bits)

Definition at line 88 of file PXDUnpackerOTModule.h.

88{0};

◆ m_meta_subrun_nr

unsigned long m_meta_subrun_nr {0}
private

Subrun Number from MetaInfo.

Definition at line 82 of file PXDUnpackerOTModule.h.

82{0};

◆ m_meta_ticks

unsigned int m_meta_ticks {0}
private

Time(Tag) from MetaInfo, Ticks of 127MHz.

Definition at line 90 of file PXDUnpackerOTModule.h.

90{0};

◆ m_meta_time

unsigned long long int m_meta_time {0}
private

Time(Tag) from MetaInfo.

Definition at line 86 of file PXDUnpackerOTModule.h.

86{0};

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 515 of file Module.h.

◆ m_name

std::string m_name
privateinherited

The name of the module, saved as a string (user-modifiable)

Definition at line 507 of file Module.h.

◆ m_notaccepted

unsigned int m_notaccepted {0}
private

counter for not accepted events... should not happen TODO discussion ongoing with DAQ group

Definition at line 171 of file PXDUnpackerOTModule.h.

171{0};

◆ m_package

std::string m_package
privateinherited

Package this module is found in (may be empty).

Definition at line 509 of file Module.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

The properties of the module as bitwise or (with |) of EModulePropFlags.

Definition at line 511 of file Module.h.

◆ m_PXDDAQEvtStatsName

std::string m_PXDDAQEvtStatsName
private

The name of the StoreObjPtr of PXDDAQStatus to be generated.

Definition at line 54 of file PXDUnpackerOTModule.h.

◆ m_PXDRawAdcsName

std::string m_PXDRawAdcsName
private

The name of the StoreArray of PXDRawAdcs to be generated.

Definition at line 56 of file PXDUnpackerOTModule.h.

◆ m_PXDRawHitsName

std::string m_PXDRawHitsName
private

The name of the StoreArray of PXDRawHits to be generated.

Definition at line 55 of file PXDUnpackerOTModule.h.

◆ m_PXDRawROIsName

std::string m_PXDRawROIsName
private

The name of the StoreArray of PXDRawROIs to be generated.

Definition at line 57 of file PXDUnpackerOTModule.h.

◆ m_RawPXDsName

std::string m_RawPXDsName
private

The name of the StoreArray of processed RawPXDs.

Definition at line 53 of file PXDUnpackerOTModule.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 518 of file Module.h.

◆ m_sendrois

unsigned int m_sendrois {0}
private

counter for send debug rois

Definition at line 173 of file PXDUnpackerOTModule.h.

173{0};

◆ m_sendunfiltered

unsigned int m_sendunfiltered {0}
private

counter for send unfiltered

Definition at line 175 of file PXDUnpackerOTModule.h.

175{0};

◆ m_storeDAQEvtStats

StoreObjPtr<PXDDAQStatus> m_storeDAQEvtStats
private

Output array for DAQ Status.

Definition at line 110 of file PXDUnpackerOTModule.h.

◆ m_storeRawAdc

StoreArray<PXDRawAdc> m_storeRawAdc
private

Output array for Raw Adcs.

Definition at line 112 of file PXDUnpackerOTModule.h.

◆ m_storeRawHits

StoreArray<PXDRawHit> m_storeRawHits
private

Output array for Raw Hits.

Definition at line 106 of file PXDUnpackerOTModule.h.

◆ m_storeRawPXD

StoreArray<RawPXD> m_storeRawPXD
private

Input array for PXD Raw.

Definition at line 102 of file PXDUnpackerOTModule.h.

◆ m_storeROIs

StoreArray<PXDRawROIs> m_storeROIs
private

Output array for Raw ROIs.

Definition at line 108 of file PXDUnpackerOTModule.h.

◆ m_suppressErrorMask

PXDError::PXDErrorFlags m_suppressErrorMask {}
private

Mask for suppressing selected error messages.

Definition at line 73 of file PXDUnpackerOTModule.h.

73{};

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 508 of file Module.h.

◆ m_unpackedEventsCount

unsigned int m_unpackedEventsCount {0}
private

Event counter.

Definition at line 93 of file PXDUnpackerOTModule.h.

93{0};

◆ m_verbose

bool m_verbose {false}
private

give verbose unpacking information

Definition at line 97 of file PXDUnpackerOTModule.h.

97{false};

The documentation for this class was generated from the following files: