Belle II Software  release-08-01-10
TTDUnpackerModule.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <rawdata/modules/TTDUnpacker/TTDUnpackerModule.h>
10 #include <TDirectory.h>
11 
12 using namespace std;
13 using namespace Belle2;
14 
15 //-----------------------------------------------------------------
16 // Register the Module
17 //-----------------------------------------------------------------
18 REG_MODULE(TTDUnpacker);
19 
20 //-----------------------------------------------------------------
21 // Implementation
22 //-----------------------------------------------------------------
23 
24 TTDUnpackerModule::TTDUnpackerModule() : Module(), m_EventLevelTriggerTimeInfo()
25 {
26  //Set module properties
27  setDescription("TTD Unpacker, unpacks first RawFTSW object");
29 
30 }
31 
33 {
34  m_rawTTD.isOptional();
35  m_EventLevelTriggerTimeInfo.registerInDataStore(DataStore::EStoreFlags::c_ErrorIfAlreadyRegistered);
36 }
37 
39 {
40  m_EventLevelTriggerTimeInfo.create();// defaults to be invalid
41  for (auto& it : m_rawTTD) {
42  it.SetVersion();
43  if (it.m_version >= 2) {
44  // attention, accessing a non supported variable results in B2FATAL :-/
45  B2DEBUG(29, "TTD FTSW : " << hex << it.GetTTUtime(0) << " " << it.GetTTCtime(0) << " EvtNr " << it.GetEveNo(0) << " Type " <<
46  (it.GetTTCtimeTRGType(0) & 0xF) << " TimeSincePrev " << it.GetTimeSincePrevTrigger(0) << " TimeSinceInj " <<
47  it.GetTimeSinceLastInjection(0) << " IsHER " << it.GetIsHER(0) << " Bunch " << it.GetBunchNumber(0));
48 
49  m_EventLevelTriggerTimeInfo->setIsHER(it.GetIsHER(0));
50  m_EventLevelTriggerTimeInfo->setRevo2((it.GetFrameCount(0) & 0x1) != 0);
51  m_EventLevelTriggerTimeInfo->setTimeSinceLastInjection(it.GetTimeSinceLastInjection(0));
52  m_EventLevelTriggerTimeInfo->setTimeSincePrevTrigger(it.GetTimeSincePrevTrigger(0));
53  m_EventLevelTriggerTimeInfo->setBunchNumber(it.GetBunchNumber(0));
54  m_EventLevelTriggerTimeInfo->setValid();
55  }
56  break;
57  }
58 }
Base class for Modules.
Definition: Module.h:72
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
@ 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
void initialize() override final
initialize function
StoreArray< RawFTSW > m_rawTTD
Input array for TTD/FTSW.
void event() override final
event function
StoreObjPtr< EventLevelTriggerTimeInfo > m_EventLevelTriggerTimeInfo
Output object for TTD mdst object.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.