Belle II Software release-09-00-00
trgtopTRD2TTSConverterModule.h
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#ifndef TRGTOPTRD2TTSCONVERTER_H
9#define TRGTOPTRD2TTSCONVERTER_H
10
11//#pragma once
12
13#include <framework/core/Module.h>
14#include <string>
15
16#include "trg/top/dataobjects/TRGTOPTimeStampsSlot.h"
17#include "top/dataobjects/TOPDigit.h"
18#include "top/dataobjects/TOPRawDigit.h"
19
20#include <framework/datastore/StoreArray.h>
21
22#define NUMBER_OF_TOP_SLOTS 16
23#define MIN_NUMBER_OF_TIMESTAMPS 5
24
25namespace Belle2 {
42
43 public:
44
45 // see TOPDatabaseImporter and TOPRawDigitConverterModule
46 static constexpr int numberOfWindows[] = {0, 428, 852, 1280, 1708, 2132, 2560, 2988, 3412};
47
48 // *64*0.375/8 = 8 * 0.375 = 3
49 static constexpr int timeOfWindows[] = {0, 428 * 3, 852 * 3, 1280 * 3, 1708 * 3, 2132 * 3, 2560 * 3, 2988 * 3, 3412 * 3};
50
51 // L1 latency in FTSW clock cycles
52 static constexpr int latencyL1 = 611;
53
54 // time correction in ns (estimated by comparing trigger readout with main readout
55 static constexpr int timeCorrection = 14;
56
57 // max number of FTSW clocks in revo9 cycle
58 static constexpr int revo9CounterMax = 1280 * 9;
59
64
66 virtual ~TRGTOPTRD2TTSConverterModule() override;
67
69 virtual void initialize() override;
70
72 virtual void beginRun() override;
73
75 virtual void event() override;
76
78 virtual void endRun() override;
79
81 virtual void terminate() override;
82
84 std::string version() const;
85
86 protected:
87
88 int m_eventNumber;
90 private:
91
93 int slot;
94 int value;
95 const Belle2::TOPDigit* refDigit;
96 };
97
98 std::vector<interimTimeStamp> m_interimTimeStamps[NUMBER_OF_TOP_SLOTS];
99
100 struct timeOrder {
101 inline bool operator()(interimTimeStamp const& a, interimTimeStamp const& b)
102 {
103 double i = a.value;
104 double j = b.value;
105 return i < j;
106 }
107 };
108
109
115 bool m_addRelations = false;
119 int m_minNumberOfTimeStamps;
120
124 StoreArray<TRGTOPTimeStampsSlot> m_TRGTOPTimeStampsSlots;
125 StoreArray<TRGTOPTimeStamp> m_TRGTOPTimeStamps;
126
127 };
129}
130
131#endif
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Class to store TOP digitized hits (output of TOPDigitizer or raw data unpacker) relations to TOPSimHi...
Definition: TOPDigit.h:24
TRG TOP Raw Digits to TimeStamps Converter.
StoreArray< TOPRawDigit > m_rawDigits
collection of raw digits
std::string m_outputTimeStampsSlotName
name of TOPTRGTimeStampsSlot store array
bool m_requireMinNumberOfTimeStamps
switch ON/OFF min number of timestamps requirement for individual slots
virtual void initialize() override
Initialize the Module.
std::string m_outputTimeStampName
name of TOPTRGTimeStamp store array
virtual void event() override
This method is the core of the module.
virtual void endRun() override
This method is called if the current run ends.
virtual void terminate() override
This method is called at the end of the event processing.
TRGTOPTRD2TTSConverterModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::string m_inputRawDigitsName
name of TOPRawDigit store array
virtual void beginRun() override
Called when entering a new run.
StoreArray< TOPDigit > m_convertedDigits
collection of raw digits
bool m_addRelations
switch ON/OFF relations to TOPRawDigits
std::string m_inputConvertedDigitsName
name of TOPRawDigit store array
std::string version() const
returns version of TRGTOPTRD2TTSConverterModule.
Abstract base class for different kinds of events.