26 TH1::AddDirectory(kFALSE);
31 for (
size_t idx = 0; idx <
m_tools.size(); ++idx) {
34 return StatusCode::FAILURE;
36 std::string name(
m_tools[idx].name());
49 if ( !
sc.isSuccess() ) {
50 ATH_MSG_WARNING(
"Error parsing trigger chain list, using empty list instead.");
54 }
else sc = StatusCode::SUCCESS;
72 ATH_MSG_DEBUG(
"Exiting AthMonitorAlgorithm::initialize() successfully.");
82 if (!filterItr->accept(ctx)) {
84 return StatusCode::SUCCESS;
91 return StatusCode::SUCCESS;
118 std::string lowerCaseStr =
str;
119 std::transform(lowerCaseStr.begin(), lowerCaseStr.end(), lowerCaseStr.begin(),
::tolower);
122 if( lowerCaseStr ==
"user" ) {
124 }
else if( lowerCaseStr ==
"online" ) {
126 }
else if( lowerCaseStr ==
"tier0" ) {
128 }
else if( lowerCaseStr ==
"tier0raw" ) {
130 }
else if( lowerCaseStr ==
"tier0esd" ) {
132 }
else if( lowerCaseStr ==
"aod" ) {
134 }
else if( lowerCaseStr ==
"altprod" ) {
137 ATH_MSG_WARNING(
"AthMonitorAlgorithm::envStringToEnum(): Unknown environment "
138 <<
str<<
", returning user.");
146 std::string lowerCaseStr =
str;
147 std::transform(lowerCaseStr.begin(), lowerCaseStr.end(), lowerCaseStr.begin(),
::tolower);
150 if( lowerCaseStr ==
"userdefined" ) {
152 }
else if( lowerCaseStr ==
"montecarlo" ) {
154 }
else if( lowerCaseStr ==
"collisions" ) {
156 }
else if( lowerCaseStr ==
"cosmics" ) {
158 }
else if( lowerCaseStr ==
"heavyioncollisions" ) {
161 ATH_MSG_WARNING(
"AthMonitorAlgorithm::dataTypeStringToEnum(): Unknown data type "
162 <<
str<<
", returning userDefined.");
178 ATH_MSG_FATAL(
"The m_toolLookupMap is empty. The tool " << name <<
" cannot be found in an empty map.");
183 std::string available = std::accumulate(
185 [](
const std::string& s,
auto h) { return s +
"," + h.first; });
186 ATH_MSG_FATAL(
"The tool " << name <<
" could not be found in the tool array of the "
187 <<
"monitoring algorithm " <<
m_name <<
". This probably reflects a discrepancy between "
188 <<
"your python configuration and c++ filling code. Note: your available groups are {"
189 << available <<
"}.");
193 if (!isInitialized()) {
195 "It seems that the AthMonitorAlgorithm::initialize was not called "
196 "in derived class initialize method, group name: " << name);
212 if (vTrigNames.empty())
return true;
231 return group->isPassed();
240 return lumi->lbAverageInteractionsPerCrossing();
242 ATH_MSG_DEBUG(
"AthMonitorAlgorithm::lbAverageInteractionsPerCrossing() - luminosity tools are not retrieved.");
252 float muToLumi = lumi->muToLumi();
254 return lumi->lbLuminosityPerBCIDVector().at (ctx.eventID().bunch_crossing_id()) / muToLumi;
258 ATH_MSG_DEBUG(
"AthMonitorAlgorithm::lbInteractionsPerCrossing() - luminosity tools are not retrieved.");
268 return lumi->lbAverageLuminosity();
270 ATH_MSG_DEBUG(
"AthMonitorAlgorithm::lbAverageLuminosity() - luminosity tools are not retrieved.");
280 return lumi->lbLuminosityPerBCIDVector().at (ctx.eventID().bunch_crossing_id());
282 ATH_MSG_DEBUG(
"AthMonitorAlgorithm::lbLuminosityPerBCID() - luminosity tools are not retrieved.");
297 return live->lbAverageLiveFraction();
299 ATH_MSG_DEBUG(
"AthMonitorAlgorithm::lbAverageLivefraction() - luminosity not available.");
314 return live->l1LiveFractionVector().at (ctx.eventID().bunch_crossing_id());
316 ATH_MSG_DEBUG(
"AthMonitorAlgorithm::livefractionPerBCID() - luminosity not available.");
327 ATH_MSG_DEBUG(
"AthMonitorAlgorithm::lbLumiWeight() - luminosity tools are not retrieved.");
342 return dur->lbDuration();
344 ATH_MSG_DEBUG(
"AthMonitorAlgorithm::lbDuration() - luminosity tools are not retrieved.");
352 std::stringstream
ss(line);
356 while ( std::getline(
ss, item,
',') ) {
357 std::stringstream iss(item);
359 result.push_back(item);
362 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
void tolower(std::string &s)
static const Attributes_t empty
Header file for AthHistogramAlgorithm.
virtual StatusCode fillHistograms(const EventContext &ctx) const =0
adds event to the monitoring histograms
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
bool trigChainsArePassed(const std::vector< std::string > &vTrigNames) const
Check whether triggers are passed.
AthMonitorAlgorithm::DataType_t m_dataType
Instance of the DataType_t enum.
DataType_t dataTypeStringToEnum(const std::string &str) const
Convert the data type string from the python configuration to an enum object.
Environment_t envStringToEnum(const std::string &str) const
Convert the environment string from the python configuration to an enum object.
Gaudi::Property< std::string > m_triggerChainString
Trigger chain string pulled from the job option and parsed into a vector.
Gaudi::Property< bool > m_useLumi
Allows use of various luminosity functions.
std::unordered_map< std::string, size_t > m_toolLookupMap
virtual StatusCode parseList(const std::string &line, std::vector< std::string > &result) const
Parse a string into a vector.
virtual StatusCode initialize() override
initialize
Environment_t
Specifies the processing environment.
const ToolHandle< Trig::TrigDecisionTool > & getTrigDecisionTool() const
Get the trigger decision tool member.
std::vector< std::string > m_vTrigChainNames
Vector of trigger chain names parsed from trigger chain string.
Gaudi::Property< float > m_defaultLBDuration
Default duration of one lumi block.
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.).
const ToolHandle< GenericMonitoringTool > m_dummy
PublicToolHandle< Trig::TrigDecisionTool > m_trigDecTool
Tool to tell whether a specific trigger is passed.
DataType_t
Specifies what type of input data is being monitored.
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SG::ReadCondHandleKey< TrigLiveFractionCondData > m_trigLiveFractionDataKey
virtual ~AthMonitorAlgorithm()
Destructor.
Gaudi::Property< bool > m_enforceExpressTriggers
ToolHandleArray< GenericMonitoringTool > m_tools
Array of Generic Monitoring Tools.
SG::ReadCondHandleKey< LBDurationCondData > m_lbDurationDataKey
std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > MonVarVec_t
ToolHandleArray< IDQFilterTool > m_DQFilterTools
Array of Data Quality filter tools.
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
Key for retrieving EventInfo from StoreGate.
AthMonitorAlgorithm::Environment_t m_environment
Instance of the Environment_t enum.
Gaudi::Property< std::string > m_environmentStr
Environment string pulled from the job option and converted to enum.
Gaudi::Property< std::string > m_dataTypeStr
DataType string pulled from the job option and converted to enum.
SG::ReadCondHandleKey< LuminosityCondData > m_lumiDataKey
virtual StatusCode execute(const EventContext &ctx) const override
Applies filters and trigger requirements.
An algorithm that can be simultaneously executed in multiple threads.
Group of local monitoring quantities and retain correlation when filling histograms
void fill()
Explicitly fill the monitoring histograms and disable autoFill.
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &&variables) const
Fills a vector of variables to a group by reference.
virtual float lbLuminosityPerBCID(const EventContext &ctx) const
Calculate the instantaneous luminosity per bunch crossing.
virtual float lbAverageLuminosity(const EventContext &ctx) const
Calculate average luminosity (in ub-1 s-1 => 10^30 cm-2 s-1).
virtual float lbAverageLivefraction(const EventContext &ctx) const
Calculate the average luminosity livefraction.
virtual float lbInteractionsPerCrossing(const EventContext &ctx) const
Calculate instantaneous number of interactions, i.e.
virtual float lbAverageInteractionsPerCrossing(const EventContext &ctx) const
Calculate the average mu, i.e.
virtual double lbLumiWeight(const EventContext &ctx) const
Calculate the average integrated luminosity multiplied by the live fraction.
virtual double lbDuration(const EventContext &ctx) const
Calculate the duration of the luminosity block (in seconds).
virtual float livefractionPerBCID(const EventContext &ctx) const
Calculate the live fraction per bunch crossing ID.
static const unsigned int Express_passed