ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigBunchCrossingTool
Root
StaticBunchCrossingTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id: StaticBunchCrossingTool.cxx 749252 2016-05-24 09:30:51Z krasznaa $
6
7
// Local include(s):
8
#include "
TrigBunchCrossingTool/StaticBunchCrossingTool.h
"
9
#include "
StaticConfigs.h
"
10
11
namespace
Trig
{
12
17
StaticBunchCrossingTool::StaticBunchCrossingTool
(
const
std::string& name )
18
:
BunchCrossingToolBase
( name ),
19
m_knownBGKeys
() {
20
21
// Declare the property of the tool:
22
declareProperty
(
"BGKey"
,
m_bgkey
= 0 );
23
24
//
25
// Learn the static bunch group configurations:
26
//
27
for
(
int
i = 0; i <
BGK_CONF_N
; ++i ) {
28
for
(
int
j = 0; j <
BGK_CONF_NUM
[ i ]; ++j ) {
29
m_knownBGKeys
[
BGK_CONF_KEY
[ i ] ].push_back(
BGK_CONF
[ i ][ j ] );
30
}
31
}
32
}
33
34
StatusCode
StaticBunchCrossingTool::initialize
() {
35
36
// Let the user know what's happening:
37
ATH_MSG_INFO
(
"Initialising tool"
);
38
ATH_MSG_INFO
(
" Bunch group config : "
<<
m_bgkey
);
39
40
// Load the configuration specified by the tool's property:
41
ATH_CHECK
(
loadConfig
(
m_bgkey
) );
42
43
// Return gracefully:
44
return
StatusCode::SUCCESS;
45
}
46
56
StatusCode
StaticBunchCrossingTool::loadConfig
(
int
bgkey ) {
57
58
//
59
// Check if we have this configuration:
60
//
61
std::map< int, std::vector< int > >
::const_iterator
bgset;
62
if
( ( bgset =
m_knownBGKeys
.find( bgkey ) ) ==
m_knownBGKeys
.end() ) {
63
ATH_MSG_ERROR
(
"Couldn't find configuration for bunch group key: "
64
<< bgkey );
65
return
StatusCode::FAILURE;
66
}
67
68
//
69
// Now let the base class interpret the configuration:
70
//
71
ATH_CHECK
(
loadSingleBunches
( bgset->second ) );
72
ATH_CHECK
(
loadBunchTrains
( bgset->second ) );
73
ATH_CHECK
(
loadUnpairedBunches
( std::vector< int >(),
74
std::vector< int >() ) );
75
76
// Print the configuration to give some feedback to the user:
77
printConfig
();
78
79
return
StatusCode::SUCCESS;
80
}
81
94
StatusCode
StaticBunchCrossingTool::
95
loadConfig
(
const
std::vector< int >& filledBunches,
96
const
std::vector< float >& filledIntensities,
97
const
std::vector< int >& unpairedBunches,
98
const
std::vector< float >& unpairedIntensities ) {
99
100
//
101
// Let the base class interpret the configuration:
102
//
103
ATH_CHECK
(
loadSingleBunches
( filledBunches, filledIntensities ) );
104
ATH_CHECK
(
loadBunchTrains
( filledBunches, filledIntensities ) );
105
ATH_CHECK
(
loadUnpairedBunches
( unpairedBunches, unpairedBunches,
106
unpairedIntensities,
107
unpairedIntensities ) );
108
109
// Print the configuration to give some feedback to the user:
110
printConfig
();
111
112
return
StatusCode::SUCCESS;
113
}
114
128
StatusCode
StaticBunchCrossingTool::
129
loadConfig
(
const
std::vector< float >& bunches ) {
130
131
// Check that the user specified something useful:
132
if
( ! bunches.size() ) {
133
ATH_MSG_ERROR
(
"Empty container received"
);
134
return
StatusCode::FAILURE;
135
}
136
137
// Translate it into vectors of filled bunches and intensities:
138
std::vector< int > filled_bunches;
139
std::vector< float > filled_intensities;
140
141
// Minimum bunch intensity to consider a bunch filled:
142
static
const
float
MIN_BUNCH_INTENSITY = 0.1;
143
144
// Check if the pattern "fits into" the LHC:
145
if
(
BunchCrossing::MAX_BCID
% bunches.size() ) {
146
147
ATH_MSG_INFO
(
"Bunch pattern doesn't \"fit into\" "
148
<<
BunchCrossing::MAX_BCID
);
149
// The loop doesn't go all the way up to MAX_BCID/2 in order not
150
// to produce "weird" patterns half way. This should be pretty safe
151
// to do, because the MC BCIDs will only be in the range defined by
152
// the pattern from the metadata.
153
for
(
int
i = 0; i < (
BunchCrossing::MAX_BCID
/ 2 - 20 ); ++i ) {
154
const
int
pos1 = i % bunches.size();
155
const
int
pos2 = bunches.size() - 1 - ( i % bunches.size() );
156
if
( bunches[ pos1 ] > MIN_BUNCH_INTENSITY ) {
157
filled_bunches.push_back( i );
158
filled_intensities.push_back( bunches[ pos1 ] );
159
}
160
if
( bunches[ pos2 ] > MIN_BUNCH_INTENSITY ) {
161
filled_bunches.push_back(
BunchCrossing::MAX_BCID
- 1 - i );
162
filled_intensities.push_back( bunches[ pos2 ] );
163
}
164
}
165
166
}
else
{
167
168
// If the sample size fits into the number of available bunches,
169
// the algorithm is pretty simple:
170
ATH_MSG_INFO
(
"Bunch pattern \"fits into\" "
171
<<
BunchCrossing::MAX_BCID
);
172
for
(
int
i = 0; i <
BunchCrossing::MAX_BCID
; ++i ) {
173
const
int
pos = i % bunches.size();
174
if
( bunches[ pos ] > MIN_BUNCH_INTENSITY ) {
175
filled_bunches.push_back( i );
176
filled_intensities.push_back( bunches[ pos ] );
177
}
178
}
179
180
}
181
182
//
183
// Now let the base class interpret the information:
184
//
185
ATH_CHECK
(
loadSingleBunches
( filled_bunches, filled_intensities ) );
186
ATH_CHECK
(
loadBunchTrains
( filled_bunches, filled_intensities ) );
187
ATH_CHECK
(
loadUnpairedBunches
( std::vector< int >(),
188
std::vector< int >() ) );
189
190
// Print the configuration to give some feedback to the user:
191
printConfig
();
192
193
// Return gracefully:
194
return
StatusCode::SUCCESS;
195
}
196
197
}
// namespace Trig
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
StaticBunchCrossingTool.h
StaticConfigs.h
BGK_CONF_KEY
static const int BGK_CONF_KEY[BGK_CONF_N]
Definition
StaticConfigs.h:2583
BGK_CONF_NUM
static const int BGK_CONF_NUM[BGK_CONF_N]
Definition
StaticConfigs.h:2572
BGK_CONF
static const int *const BGK_CONF[BGK_CONF_N]
Definition
StaticConfigs.h:2592
BGK_CONF_N
static const int BGK_CONF_N
Definition
StaticConfigs.h:2571
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
const_iterator
Trig::BunchCrossingToolBase::loadBunchTrains
StatusCode loadBunchTrains(const std::vector< int > &bunches, const std::vector< float > &bunch_int1=std::vector< float >(), const std::vector< float > &bunch_int2=std::vector< float >())
Interpret the configuration for bunch trains.
Definition
BunchCrossingToolBase.cxx:954
Trig::BunchCrossingToolBase::BunchCrossingToolBase
BunchCrossingToolBase(const std::string &name="BunchCrossingToolBase")
Default constructor.
Definition
BunchCrossingToolBase.cxx:23
Trig::BunchCrossingToolBase::loadSingleBunches
StatusCode loadSingleBunches(const std::vector< int > &bunches, const std::vector< float > &bunch_int1=std::vector< float >(), const std::vector< float > &bunch_int2=std::vector< float >())
Interpret the configuration for single bunches.
Definition
BunchCrossingToolBase.cxx:838
Trig::BunchCrossingToolBase::printConfig
void printConfig() const
Function printing the configuration of the tool.
Definition
BunchCrossingToolBase.cxx:1166
Trig::BunchCrossingToolBase::loadUnpairedBunches
StatusCode loadUnpairedBunches(const std::vector< int > &beam1, const std::vector< int > &beam2, const std::vector< float > &bunch_int1=std::vector< float >(), const std::vector< float > &bunch_int2=std::vector< float >())
Interpret the configuration for unpaired bunches.
Definition
BunchCrossingToolBase.cxx:1085
Trig::BunchCrossing::MAX_BCID
static const int MAX_BCID
The maximum number of bunches that can be in the LHC.
Definition
BunchCrossing.h:50
Trig::StaticBunchCrossingTool::m_bgkey
int m_bgkey
Default key to be loaded.
Definition
StaticBunchCrossingTool.h:63
Trig::StaticBunchCrossingTool::m_knownBGKeys
std::map< int, std::vector< int > > m_knownBGKeys
All the hard-coded configs.
Definition
StaticBunchCrossingTool.h:66
Trig::StaticBunchCrossingTool::initialize
virtual StatusCode initialize()
Function initialising the tool.
Definition
StaticBunchCrossingTool.cxx:34
Trig::StaticBunchCrossingTool::StaticBunchCrossingTool
StaticBunchCrossingTool(const std::string &name="StaticBunchCrossingTool")
Create a proper constructor for Athena.
Definition
StaticBunchCrossingTool.cxx:17
Trig::StaticBunchCrossingTool::loadConfig
StatusCode loadConfig(int bgkey)
Load a hard-coded bunch group key.
Definition
StaticBunchCrossingTool.cxx:56
Trig
The common trigger namespace for trigger analysis tools.
Definition
LArCellMonAlg.h:33
Generated on
for ATLAS Offline Software by
1.17.0