Commit 58a6a7f8 authored by Elemer Nagy's avatar Elemer Nagy
Browse files

Completed Elin's recipe

parent bdc204b8
......@@ -42,4 +42,6 @@ atlas_add_component( TrigBjetMonitoring
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_headers( TrigBjetMonitoring )
atlas_install_joboptions( share/*.py )
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
@author E. Nagy
@date 2019-04-16
@brief Example trigger python configuration for the Run III AthenaMonitoring package (old jobOptions), based on the example by C Burton and P Onyisi
# The following class will make a sequence, configure algorithms, and link
# them to GenericMonitoringTools
from AthenaMonitoring import AthMonitorCfgHelperOld
helper = AthMonitorCfgHelperOld(DQMonFlags, "TrigBjetMonitor")
### STEP 2 ###
# Adding an algorithm to the helper. Here, we will use the example
# algorithm in the AthenaMonitoring package. Just pass the type to the
# helper. Then, the helper will instantiate an instance and set up the
# base class configuration following the inputFlags. The returned object
# is the algorithm.
from TrigBjetMonitoring.TrigBjetMonitoringConf import TrigBjetMonitorAlgorithm
trigBjetMonAlg = helper.addAlgorithm(TrigBjetMonitorAlgorithm,'TrigBjetMonAlg')
# Examples of setting a trigger, or of running with debug messages on
#trigBjetMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
#trigBjetMonAlg.OutputLevel = DEBUG
myGroup = helper.addGroup( trigBjetMonAlg,
myGroup.defineHistogram("lumiPerBCID;lumiPerBCID", title="Luminosity;L/BCID;Events",
myGroup.defineHistogram("lb;lb", title="Luminosity Block;lb;Events",
myGroup.defineHistogram("random;random", title="LB;x;Events",
topSequence += helper.result()
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
#include "TrigBjetMonitorAlgorithm.h"
TrigBjetMonitorAlgorithm::TrigBjetMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
: AthMonitorAlgorithm(name,pSvcLocator)
TrigBjetMonitorAlgorithm::~TrigBjetMonitorAlgorithm() {}
StatusCode TrigBjetMonitorAlgorithm::initialize() {
return AthMonitorAlgorithm::initialize();
StatusCode TrigBjetMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const {
using namespace Monitored;
// Declare the quantities which should be monitored
//NB! The variables and histograms defined here must match the ones in the py file exactly!
auto lumiPerBCID = Monitored::Scalar<float>("lumiPerBCID",0.0);
auto lb = Monitored::Scalar<int>("lb",0);
auto run = Monitored::Scalar<int>("run",0);
// Two variables (value and passed) needed for TEfficiency
auto pT = Monitored::Scalar<float>("pT",0.0);
auto pT_passed = Monitored::Scalar<float>("pT_passed",false);
//// Set the values of the monitored variables for the event
lumiPerBCID = lbAverageInteractionsPerCrossing();
lb = GetEventInfo(ctx)->lumiBlock();
run = GetEventInfo(ctx)->runNumber();
// Fill. First argument is the tool (GMT) name as defined in the py file,
// all others are the variables to be saved.
// Alternative fill method. Get the group yourself, and pass it to the fill function.
auto tool = getGroup("TrigBjetMonitor");
return StatusCode::SUCCESS;
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
#include "AthenaMonitoring/AthMonitorAlgorithm.h"
#include "AthenaMonitoring/Monitored.h"
class TrigBjetMonitorAlgorithm : public AthMonitorAlgorithm {
TrigBjetMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
virtual ~TrigBjetMonitorAlgorithm();
virtual StatusCode initialize() override;
virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment