Belle II Software development
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 {
39
40 public:
41
42 // see TOPDatabaseImporter and TOPRawDigitConverterModule
43 static constexpr int numberOfWindows[] = {0, 428, 852, 1280, 1708, 2132, 2560, 2988, 3412};
44
45 // *64*0.375/8 = 8 * 0.375 = 3
46 static constexpr int timeOfWindows[] = {0, 428 * 3, 852 * 3, 1280 * 3, 1708 * 3, 2132 * 3, 2560 * 3, 2988 * 3, 3412 * 3};
47
48 // L1 latency in FTSW clock cycles
49 static constexpr int latencyL1 = 611;
50
51 // time correction in ns (estimated by comparing trigger readout with main readout
52 static constexpr int timeCorrection = 14;
53
54 // max number of FTSW clocks in revo9 cycle
55 static constexpr int revo9CounterMax = 1280 * 9;
56
61
63 virtual ~TRGTOPTRD2TTSConverterModule() override;
64
66 virtual void initialize() override;
67
69 virtual void beginRun() override;
70
72 virtual void event() override;
73
75 virtual void endRun() override;
76
78 virtual void terminate() override;
79
81 std::string version() const;
82
83 protected:
84
85 int m_eventNumber;
87 private:
88
90 int slot;
91 int value;
92 const Belle2::TOPDigit* refDigit;
93 };
94
95 std::vector<interimTimeStamp> m_interimTimeStamps[NUMBER_OF_TOP_SLOTS];
96
97 struct timeOrder {
98 inline bool operator()(interimTimeStamp const& a, interimTimeStamp const& b)
99 {
100 double i = a.value;
101 double j = b.value;
102 return i < j;
103 }
104 };
105
106
112 bool m_addRelations = false;
116 int m_minNumberOfTimeStamps;
117
121 StoreArray<TRGTOPTimeStampsSlot> m_TRGTOPTimeStampsSlots;
122 StoreArray<TRGTOPTimeStamp> m_TRGTOPTimeStamps;
123
124 };
126}
127
128#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.