Belle II Software release-09-00-07
HLTPrefilter.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#pragma once
9
10/* HLT headers */
11#include <hlt/softwaretrigger/core/utilities.h>
12
13/* basf2 headers */
14#include <cdc/dataobjects/CDCHit.h>
15#include <ecl/dataobjects/ECLDigit.h>
16#include <framework/database/DBObjPtr.h>
17#include <framework/datastore/StoreArray.h>
18#include <framework/datastore/StoreObjPtr.h>
19#include <framework/dbobjects/BunchStructure.h>
20#include <framework/dbobjects/HardwareClockSettings.h>
21#include <mdst/dataobjects/EventLevelTriggerTimeInfo.h>
22
23/* C++ headers */
24#include <cstdint>
25
26namespace Belle2::HLTPrefilter {
27
32 private:
33
36
43 public:
62 unsigned int prescale = 1000;
63
65 {
66 if (m_TTDInfo.isValid()) {
68 const double revolutionTime = m_bunchStructure->getRFBucketsPerRevolution() * 1e-3 /
69 m_clockSettings->getAcceleratorRF(); // [microsecond]
71 const double globalClock = m_clockSettings->getGlobalClockFrequency() * 1e3; // [microsecond]
72 // Calculate time since last injection
73 const double timeSinceLastInj = m_TTDInfo->getTimeSinceLastInjection() / globalClock; // [microsecond]
74 // Calculate time in beam cycle
75 const double timeInBeamCycle = timeSinceLastInj - (int)(timeSinceLastInj / revolutionTime) * revolutionTime; // [microsecond]
76
77 // Check if events are in injection strip of LER
78 const bool LER_strip = (LERtimeSinceLastInjectionMin < timeSinceLastInj &&
79 timeSinceLastInj < LERtimeSinceLastInjectionMax &&
80 LERtimeInBeamCycleMin < timeInBeamCycle &&
81 timeInBeamCycle < LERtimeInBeamCycleMax);
82
83 // Check if events are in injection strip of HER
84 const bool HER_strip = (HERtimeSinceLastInjectionMin < timeSinceLastInj &&
85 timeSinceLastInj < HERtimeSinceLastInjectionMax &&
86 HERtimeInBeamCycleMin < timeInBeamCycle &&
87 timeInBeamCycle < HERtimeInBeamCycleMax);
88
89 // Tag events inside injection strip with a prescale
90 return (LER_strip || HER_strip) && !SoftwareTrigger::makePreScale(prescale);
91 } else
92 return false;
93 }
94 };
95
100 private:
101
104
107
108 public:
111 uint32_t nCDCHitsMax = 0.0;
113 uint32_t nECLDigitsMax = 0.0;
115 unsigned int prescale = 1000;
116
118 {
120 const uint32_t nCDCHits = m_cdcHits.isOptional() ? m_cdcHits.getEntries() : 0;
122 const uint32_t nECLDigits = m_eclDigits.isOptional() ? m_eclDigits.getEntries() : 0;
123
124 // Tag events having a large CDC and ECL occupancy with a prescale
125 return (nCDCHits > nCDCHitsMax && nECLDigits > nECLDigitsMax) && !SoftwareTrigger::makePreScale(prescale);
126 }
127
128 };
129
130}
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Helper for CDCECLCut state.
Definition: HLTPrefilter.h:99
uint32_t nECLDigitsMax
Maximum threshold for ECL Digits.
Definition: HLTPrefilter.h:113
StoreArray< ECLDigit > m_eclDigits
ECLDigits StoreArray.
Definition: HLTPrefilter.h:106
uint32_t nCDCHitsMax
Define thresholds for variables.
Definition: HLTPrefilter.h:111
StoreArray< CDCHit > m_cdcHits
CDChits StoreArray.
Definition: HLTPrefilter.h:103
unsigned int prescale
Prescale for accepting HLTPrefilter lines, by default we randomly accept 1 out of every 1000 events.
Definition: HLTPrefilter.h:115
Helper for TimingCut state.
Definition: HLTPrefilter.h:31
double LERtimeSinceLastInjectionMin
Define thresholds for variables.
Definition: HLTPrefilter.h:46
double HERtimeInBeamCycleMax
Maximum threshold of timeInBeamCycle for LER injection.
Definition: HLTPrefilter.h:60
StoreObjPtr< EventLevelTriggerTimeInfo > m_TTDInfo
Store array object for injection time info.
Definition: HLTPrefilter.h:35
DBObjPtr< HardwareClockSettings > m_clockSettings
Define object for HardwareClockSettings class.
Definition: HLTPrefilter.h:41
double HERtimeSinceLastInjectionMin
Minimum threshold of timeSinceLastInjection for HER injection.
Definition: HLTPrefilter.h:50
double HERtimeSinceLastInjectionMax
Maximum threshold of timeSinceLastInjection for HER injection.
Definition: HLTPrefilter.h:52
double LERtimeSinceLastInjectionMax
Maximum threshold of timeSinceLastInjection for LER injection.
Definition: HLTPrefilter.h:48
double HERtimeInBeamCycleMin
Minimum threshold of timeInBeamCycle for HER injection.
Definition: HLTPrefilter.h:58
DBObjPtr< BunchStructure > m_bunchStructure
Define object for BunchStructure class.
Definition: HLTPrefilter.h:38
double LERtimeInBeamCycleMax
Maximum threshold of timeInBeamCycle for LER injection.
Definition: HLTPrefilter.h:56
unsigned int prescale
Prescale for accepting HLTPrefilter lines, by default we randomly accept 1 out of every 1000 events.
Definition: HLTPrefilter.h:62
double LERtimeInBeamCycleMin
Minimum threshold of timeInBeamCycle for LER injection.
Definition: HLTPrefilter.h:54
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96