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
#
'''@file TrigBjetMonitorAlgorithm_jobOptions.py
@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,
"TrigBjetMonitor",
"HLT/BjetMon/Expert"
)
myGroup.defineHistogram("lumiPerBCID;lumiPerBCID", title="Luminosity;L/BCID;Events",
path='lumi',xbins=10,xmin=0.0,xmax=10.0)
myGroup.defineHistogram("lb;lb", title="Luminosity Block;lb;Events",
path='lbpath',xbins=1000,xmin=-0.5,xmax=999.5)
myGroup.defineHistogram("random;random", title="LB;x;Events",
path='randompath',xbins=30,xmin=0,xmax=1)
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.
fill("TrigBjetMonitor",lumiPerBCID,lb);
// Alternative fill method. Get the group yourself, and pass it to the fill function.
auto tool = getGroup("TrigBjetMonitor");
fill(tool,run);
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGBJETMONITORING_TRIGBJETMONITORALGORITHM_H
#define TRIGBJETMONITORING_TRIGBJETMONITORALGORITHM_H
#include "AthenaMonitoring/AthMonitorAlgorithm.h"
#include "AthenaMonitoring/Monitored.h"
class TrigBjetMonitorAlgorithm : public AthMonitorAlgorithm {
public:
TrigBjetMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
virtual ~TrigBjetMonitorAlgorithm();
virtual StatusCode initialize() override;
virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
};
#endif
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