ATLAS Offline Software
Loading...
Searching...
No Matches
MbtsHypoTool Class Reference

#include <MbtsHypoTool.h>

Inheritance diagram for MbtsHypoTool:
Collaboration diagram for MbtsHypoTool:

Classes

struct  Counts
struct  MbtsHypoInfo

Public Member Functions

 MbtsHypoTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override
StatusCode decide (MbtsHypoInfo &decisions) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

bool applyCut (const Gaudi::Property< int > &threshold, const xAOD::TrigComposite *composit) const
Counts calculateMultiplicities (const xAOD::TrigT2MbtsBits *t2mbtsBits) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

HLT::Identifier m_decisionId
Gaudi::Property< bool > m_acceptAll {this, "AcceptAll", false, "Accept all events"}
Gaudi::Property< unsigned int > m_mbtsCounters {this, "MbtsCounters", 2, "The number of MBTS counters required to be above threshold"}
Gaudi::Property< bool > m_coincidence {this, "Coincidence", false, "A flag to control if this is a coincidence requirement or not"}
Gaudi::Property< bool > m_or {this, "Or", false, "Flag extending above choice to do Or between the two sides of MBTS"}
Gaudi::Property< bool > m_veto {this, "Veto", false, "Flag to select lower than threshold multiplicities"}
Gaudi::Property< int > m_mbtsmode {this, "MBTSMode", 0, "Flag to count multiplicities only on inner or outer MBTS modules (1, inner, 2 outer, 0 all) "}
Gaudi::Property< float > m_threshold {this, "Threshold", 40.0 / 222.0, "Energy threshold in pC"}
Gaudi::Property< float > m_timeCut {this, "TimeCut", -1.0, "A time cut in ns. Values <= 0 disable the time cut"}
Gaudi::Property< float > m_globalTimeOffset {this, "GlobalTimeOffset", 0, "A global time offset in ns about which the time window cuts"}
Gaudi::Property< std::vector< float > > m_timeOffsets {this, "TimeOffset", std::vector<float>(32), "Offsets with respect to the global offset of all counters. (A0-15 then C0-C15) "}
ToolHandle< GenericMonitoringToolm_monTool {this, "MonTool", "", "Monitoring tool"}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 14 of file MbtsHypoTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MbtsHypoTool()

MbtsHypoTool::MbtsHypoTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 12 of file MbtsHypoTool.cxx.

13 : AthAlgTool(type, name, parent),
AthAlgTool()
Default constructor:
static HLT::Identifier fromToolName(const std::string &tname)
HLT::Identifier m_decisionId

Member Function Documentation

◆ applyCut()

bool MbtsHypoTool::applyCut ( const Gaudi::Property< int > & threshold,
const xAOD::TrigComposite * composit ) const
private

◆ calculateMultiplicities()

MbtsHypoTool::Counts MbtsHypoTool::calculateMultiplicities ( const xAOD::TrigT2MbtsBits * t2mbtsBits) const
private

Definition at line 93 of file MbtsHypoTool.cxx.

94{
95
96 if (!t2mbtsBits)
97 {
98 return {0, 0};
99 }
100
101 ATH_MSG_DEBUG("Getting energy and time values.");
102
103 std::vector<float> triggerEnergies = t2mbtsBits->triggerEnergies();
104 std::vector<float> triggerTimes = t2mbtsBits->triggerTimes();
105
106 if (triggerEnergies.size() != xAOD::TrigT2MbtsBits::NUM_MBTS || triggerTimes.size() != xAOD::TrigT2MbtsBits::NUM_MBTS)
107 {
108 ATH_MSG_WARNING("Vector sizes are not equal to number of MBTS counters.");
109 return {0, 0};
110 }
111
112 ATH_MSG_DEBUG("Forming hit multiplicities.");
113
114 std::bitset<16> ebaTriggerBits;
115 std::bitset<16> ebcTriggerBits;
116
117
118 unsigned ibit;
119 int ebaCounters = 0, ebcCounters = 0;
120
121 // Initialize monitoring variables.
122 double timeDiff_A_C = 0.;
123 double timeMean_A = 0.;
124 double timeMean_C = 0.;
125
126 // Loop over each counter and form bit sets from time and energy (optional).
127 for (ibit = 0; ibit < xAOD::TrigT2MbtsBits::NUM_MBTS; ibit++)
128 {
129 if (m_mbtsmode == 1 && !(ibit < 8 || (ibit >= 16 && ibit < 24)))
130 continue; // count only inner
131 if (m_mbtsmode == 2 && !((ibit >= 8 && ibit < 16) || (ibit >= 24 && ibit < 32)))
132 continue; // count only outer
133
134 // Check the energy threshold.
135 if (triggerEnergies[ibit] <= m_threshold)
136 continue;
137
138 // Calculate the mean time for this side;
139 if (ibit < 16)
140 {
141 timeMean_A += triggerTimes[ibit];
142 ebaCounters++;
143 }
144 else
145 {
146 timeMean_C += triggerTimes[ibit];
147 ebcCounters++;
148 }
149
150 // Check the time cut if it is active.
151 if (m_timeCut >= 0 && std::abs(triggerTimes[ibit] - m_timeOffsets[ibit] - m_globalTimeOffset) >= m_timeCut)
152 continue;
153
154 // Set the bits for this side;
155 if (ibit < 16)
156 {
157 ebaTriggerBits.set(ibit);
158 }
159 else
160 {
161 ebcTriggerBits.set(ibit - 16);
162 }
163 }
164
165 if (ebaCounters > 0)
166 {
167 timeMean_A /= ebaCounters;
168 }
169 else
170 {
171 timeMean_A = -999.0;
172 }
173
174 if (ebcCounters > 0)
175 {
176 timeMean_C /= ebcCounters;
177 }
178 else
179 {
180 timeMean_C = -999.0;
181 }
182
183 if (ebaCounters > 0 && ebcCounters > 0)
184 {
185 timeDiff_A_C = timeMean_A - timeMean_C;
186 }
187 else
188 {
189 timeDiff_A_C = -999.0;
190 }
191 ATH_MSG_DEBUG("average MBTS trigger time"
192 << " side A: " << timeMean_A
193 << ", side C: " << timeMean_C
194 << ", difference A-C: " << timeDiff_A_C);
195
196 ATH_MSG_DEBUG("MBTS EBA trigger bits: " << ebaTriggerBits);
197 ATH_MSG_DEBUG("MBTS EBC trigger bits: " << ebcTriggerBits);
198 if ( ! m_monTool.empty() ) {
199 std::vector<int> counts;
200 counts.reserve(ebaTriggerBits.size() + ebcTriggerBits.size());
201
202 for ( size_t bit = 0; bit < ebaTriggerBits.size(); ++bit )
203 counts.push_back( ebaTriggerBits[bit] ? bit : -1 );
204 for ( size_t bit = 0; bit < ebcTriggerBits.size(); ++bit )
205 counts.push_back( ebcTriggerBits[bit] ? bit+ebaTriggerBits.size() : -1 );
206 auto mon_counts = Monitored::Collection("Counts", counts);
207 Monitored::Group(m_monTool, mon_counts);
208 }
209 return {ebaTriggerBits.count(), ebcTriggerBits.count()};
210}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Gaudi::Property< int > m_mbtsmode
Gaudi::Property< float > m_timeCut
Gaudi::Property< float > m_threshold
Gaudi::Property< std::vector< float > > m_timeOffsets
Gaudi::Property< float > m_globalTimeOffset
ToolHandle< GenericMonitoringTool > m_monTool
const std::vector< float > & triggerEnergies() const
Return the trigger energies of each counter.
const std::vector< float > & triggerTimes() const
Return the relative times of the triggers.
static const unsigned int NUM_MBTS
Prints out data members to MsgStream.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.

◆ decide()

StatusCode MbtsHypoTool::decide ( MbtsHypoInfo & decisions) const

Definition at line 22 of file MbtsHypoTool.cxx.

23{
24 ATH_MSG_DEBUG("Executing this T2MbtsHypo " << name());
25
26 if (info.previousDecisionIDs.count(m_decisionId.numeric()) == 0)
27 {
28 ATH_MSG_DEBUG("Already rejected");
29 return StatusCode::SUCCESS;
30 }
31
32 // Calculate MBTS counter multiplicities after energy and an optional time cut.
34 if (counts.sideA == 0 && counts.sideC == 0)
35 {
36 ATH_MSG_DEBUG("calculateMultiplicities failed, no multiplicities");
37 return StatusCode::SUCCESS;
38 }
39 bool pass = m_acceptAll;
40 if (m_coincidence)
41 { // Coincidence logic
42 if (!m_veto)
43 {
44 if (counts.sideA >= m_mbtsCounters && counts.sideC >= m_mbtsCounters)
45 pass = true;
46 }
47 else
48 {
49 if (counts.sideA < m_mbtsCounters && counts.sideC < m_mbtsCounters)
50 pass = true;
51 }
52 }
53 else
54 {
55 if (m_or)
56 { // Or logic
57 if (!m_veto)
58 {
59 if ((counts.sideA >= m_mbtsCounters || counts.sideC >= m_mbtsCounters))
60 pass = true;
61 }
62 else
63 {
64 if ((counts.sideA < m_mbtsCounters || counts.sideC < m_mbtsCounters))
65 pass = true;
66 }
67 }
68 else
69 { // Sum logic
70 if (!m_veto)
71 {
72 if ((counts.sideA + counts.sideC) >= m_mbtsCounters)
73 pass = true;
74 }
75 else
76 {
77 if ((counts.sideA + counts.sideC) < m_mbtsCounters)
78 pass = true;
79 }
80 }
81 }
82
83 ATH_MSG_DEBUG("REGTEST: event " << (pass ? "accepted" : "failed") << " with EBA(" << counts.sideA << ") + EBC(" << counts.sideC << ") hits above threshold.");
84
85 if (pass)
86 {
87 addDecisionID(m_decisionId.numeric(), info.decision);
88 ATH_MSG_DEBUG("REGTEST event accepted");
89 }
90 return StatusCode::SUCCESS;
91}
Gaudi::Property< bool > m_or
Gaudi::Property< bool > m_acceptAll
Gaudi::Property< bool > m_coincidence
Gaudi::Property< bool > m_veto
Gaudi::Property< unsigned int > m_mbtsCounters
Counts calculateMultiplicities(const xAOD::TrigT2MbtsBits *t2mbtsBits) const
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode MbtsHypoTool::initialize ( )
overridevirtual

Definition at line 16 of file MbtsHypoTool.cxx.

17{
18 if (! m_monTool.empty() ) ATH_CHECK( m_monTool.retrieve() );
19 return StatusCode::SUCCESS;
20}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_acceptAll

Gaudi::Property<bool> MbtsHypoTool::m_acceptAll {this, "AcceptAll", false, "Accept all events"}
private

Definition at line 35 of file MbtsHypoTool.h.

35{this, "AcceptAll", false, "Accept all events"};

◆ m_coincidence

Gaudi::Property<bool> MbtsHypoTool::m_coincidence {this, "Coincidence", false, "A flag to control if this is a coincidence requirement or not"}
private

Definition at line 39 of file MbtsHypoTool.h.

39{this, "Coincidence", false, "A flag to control if this is a coincidence requirement or not"};

◆ m_decisionId

HLT::Identifier MbtsHypoTool::m_decisionId
private

Definition at line 34 of file MbtsHypoTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_globalTimeOffset

Gaudi::Property<float> MbtsHypoTool::m_globalTimeOffset {this, "GlobalTimeOffset", 0, "A global time offset in ns about which the time window cuts"}
private

Definition at line 51 of file MbtsHypoTool.h.

51{this, "GlobalTimeOffset", 0, "A global time offset in ns about which the time window cuts"};

◆ m_mbtsCounters

Gaudi::Property<unsigned int> MbtsHypoTool::m_mbtsCounters {this, "MbtsCounters", 2, "The number of MBTS counters required to be above threshold"}
private

Definition at line 37 of file MbtsHypoTool.h.

37{this, "MbtsCounters", 2, "The number of MBTS counters required to be above threshold"};

◆ m_mbtsmode

Gaudi::Property<int> MbtsHypoTool::m_mbtsmode {this, "MBTSMode", 0, "Flag to count multiplicities only on inner or outer MBTS modules (1, inner, 2 outer, 0 all) "}
private

Definition at line 45 of file MbtsHypoTool.h.

45{this, "MBTSMode", 0, "Flag to count multiplicities only on inner or outer MBTS modules (1, inner, 2 outer, 0 all) "};

◆ m_monTool

ToolHandle<GenericMonitoringTool> MbtsHypoTool::m_monTool {this, "MonTool", "", "Monitoring tool"}
private

Definition at line 55 of file MbtsHypoTool.h.

55{this, "MonTool", "", "Monitoring tool"};

◆ m_or

Gaudi::Property<bool> MbtsHypoTool::m_or {this, "Or", false, "Flag extending above choice to do Or between the two sides of MBTS"}
private

Definition at line 41 of file MbtsHypoTool.h.

41{this, "Or", false, "Flag extending above choice to do Or between the two sides of MBTS"};

◆ m_threshold

Gaudi::Property<float> MbtsHypoTool::m_threshold {this, "Threshold", 40.0 / 222.0, "Energy threshold in pC"}
private

Definition at line 47 of file MbtsHypoTool.h.

47{this, "Threshold", 40.0 / 222.0, "Energy threshold in pC"};

◆ m_timeCut

Gaudi::Property<float> MbtsHypoTool::m_timeCut {this, "TimeCut", -1.0, "A time cut in ns. Values <= 0 disable the time cut"}
private

Definition at line 49 of file MbtsHypoTool.h.

49{this, "TimeCut", -1.0, "A time cut in ns. Values <= 0 disable the time cut"};

◆ m_timeOffsets

Gaudi::Property<std::vector<float> > MbtsHypoTool::m_timeOffsets {this, "TimeOffset", std::vector<float>(32), "Offsets with respect to the global offset of all counters. (A0-15 then C0-C15) "}
private

Definition at line 53 of file MbtsHypoTool.h.

53{this, "TimeOffset", std::vector<float>(32), "Offsets with respect to the global offset of all counters. (A0-15 then C0-C15) "};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_veto

Gaudi::Property<bool> MbtsHypoTool::m_veto {this, "Veto", false, "Flag to select lower than threshold multiplicities"}
private

Definition at line 43 of file MbtsHypoTool.h.

43{this, "Veto", false, "Flag to select lower than threshold multiplicities"};

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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