Skip to content
Snippets Groups Projects
Commit 8ee5f2de authored by Nikola Dikic's avatar Nikola Dikic
Browse files

Setting up new environment

parent 8b72f99c
9 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!36664AFP DQM [rel 22],!36035AFP Run3 merge request - added automatic check,!32548AFP Run3 Monitoring DQ Data Quality - changes in python file,!28689First template for AFP Run3 Monitoring DQ Data Quality
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef AFPSILAYERALGORITHM_H
#define AFPSILAYERALGORITHM_H
#include "AthenaMonitoring/AthMonitorAlgorithm.h"
#include "AthenaMonitoringKernel/Monitored.h"
#include "TRandom3.h"
class AFPSiLayerAlgorithm : public AthMonitorAlgorithm {
public:
AFPSiLayerAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
virtual ~AFPSiLayerAlgorithm();
virtual StatusCode initialize() override;
virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
private:
Gaudi::Property<bool> m_doRandom {this,"RandomHist",false};
std::vector<int> m_abGroups1;
std::vector<std::vector<int>> m_abGroups2;
std::map<std::string,int> m_cGroups1;
std::map<std::string,std::map<std::string,int>> m_cGroups2;
};
#endif
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!-- Edited By POOL -->
<!DOCTYPE POOLFILECATALOG SYSTEM "InMemory">
<POOLFILECATALOG>
<File ID="23288CC6-5921-944B-BF66-F99ACC97ABBB">
<physical>
<pfn filetype="ROOT_All" name="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1"/>
</physical>
<logical/>
</File>
</POOLFILECATALOG>
......@@ -2,7 +2,7 @@
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
#
'''@file ExampleMonitorAlgorithm.py kristin
'''@file Run3AFPExampleMonitorAlgorithm.py
@author C. D. Burton
@author P. Onyisi
@date 2018-01-11
......@@ -31,12 +31,12 @@ def Run3AFPExampleMonitoringConfig(inputFlags):
# 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 Run3AFPMonitoring.Run3AFPMonitoringConf import AFPHitsMonitorAlgorithm
exampleMonAlg = helper.addAlgorithm(AFPHitsMonitorAlgorithm,'exampleMonAlg')
from Run3AFPMonitoring.Run3AFPMonitoringConf import AFPSiLayerAlgorithm
afpSiLayerAlgorithm = helper.addAlgorithm(AFPSiLayerAlgorithm,'AFPSiLayer')
# You can actually make multiple instances of the same algorithm and give
# them different configurations
anotherExampleMonAlg = helper.addAlgorithm(AFPHitsMonitorAlgorithm,'AnotherExampleMonAlg')
# them different configuration
anotherExampleMonAlg = helper.addAlgorithm(AFPSiLayerAlgorithm,'AnotherExampleMonAlg')
# # If for some really obscure reason you need to instantiate an algorithm
# # yourself, the AddAlgorithm method will still configure the base
......@@ -62,27 +62,32 @@ def Run3AFPExampleMonitoringConfig(inputFlags):
# Add a generic monitoring tool (a "group" in old language). The returned
# object here is the standard GenericMonitoringTool.
myGroup = helper.addGroup(
exampleMonAlg,
'ExampleMonitor',
'OneRing/'
)
station0_1 = helper.addGroup(afpSiLayerAlgorithm, 'AFPSiLayer','Station0/')
# Add a GMT for the other example monitor algorithm
anotherGroup = helper.addGroup(anotherExampleMonAlg,'ExampleMonitor')
anotherGroup = helper.addGroup(anotherExampleMonAlg,'AFPSiLayer')
### STEP 5 ###
# Configure histograms
myGroup.defineHistogram('lumiPerBCID',title='Luminosity,WithCommaInTitle;L/BCID;Events',
# Configure histogramsIf you want to create histograms with variable bin widths, ROOT provides another constructor suited for this purpose. Instead of passing the data interval and the number of bins, you have to pass an array (single or double precision) of bin edges. When the histogram has n bins, then there are n+1 distinct edges, so the array you pass must be of size n+1.
# My histograms
station0_1.defineHistogram('h_hitMultiplicity', title='Number of hits per event', path='AFPSiLayerPath',xbins=40, xmin=-0.5, xmax=39.5)
station0_1.defineHistogram('h_timeOverThreshold', title='Time over threshold', path='AFPSiLayerPath', xbins=16, xmin=-0.5, xmax=15.5)
# nRows = 80, nColumns = 336.
# station0_1.defineHistogram('h_hitMap', title='Map of hits', type='TH2F', path='AFPSiLayer', xbins=80,xmin=0.5,xmax=80+0.5, ybins=336,ymin=0.5,ymax=336+0.5)
# end My histograms
station0_1.defineHistogram('lumiPerBCID',title='Luminosity,WithCommaInTitle;L/BCID;Events',
path='ToRuleThemAll',xbins=40,xmin=0.0,xmax=80.0)
myGroup.defineHistogram('lb', title='Luminosity Block;lb;Events',
station0_1.defineHistogram('lb', title='Luminosity Block;lb;Events',
path='ToFindThem',xbins=1000,xmin=-0.5,xmax=999.5,weight='testweight')
myGroup.defineHistogram('random', title='LB;x;Events',
station0_1.defineHistogram('random', title='LB;x;Events',
path='ToBringThemAll',xbins=30,xmin=0,xmax=1,opt='kLBNHistoryDepth=10')
myGroup.defineHistogram('random', title='title;x;y',path='ToBringThemAll',
station0_1.defineHistogram('random', title='title;x;y',path='ToBringThemAll',
xbins=[0,.1,.2,.4,.8,1.6])
myGroup.defineHistogram('random,pT', type='TH2F', title='title;x;y',path='ToBringThemAll',
station0_1.defineHistogram('random,pT', type='TH2F', title='title;x;y',path='ToBringThemAll',
xbins=[0,.1,.2,.4,.8,1.6],ybins=[0,10,30,40,60,70,90])
# myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff',
# path='AndInTheDarkness',xbins=100,xmin=0.0,xmax=50.0)
......@@ -96,24 +101,24 @@ def Run3AFPExampleMonitoringConfig(inputFlags):
# number of histograms in an organized manner. (For instance, one plot for each ASIC
# in the subdetector, and these components are mapped in eta, phi, and layer.) Thus,
# one might have an array of TH1's such as quantity[etaIndex][phiIndex][layerIndex].
for alg in [exampleMonAlg,anotherExampleMonAlg]:
for alg in [afpSiLayerAlgorithm,anotherExampleMonAlg]:
# Using an array of groups
array = helper.addArray([2],alg,'ExampleMonitor')
array = helper.addArray([2],alg,'AFPSiLayer')
array.defineHistogram('a,b',title='AB',type='TH2F',path='Eta',
xbins=10,xmin=0.0,xmax=10.0,
ybins=10,ymin=0.0,ymax=10.0)
array.defineHistogram('c',title='C',path='Eta',
xbins=10,xmin=0.0,xmax=10.0)
array = helper.addArray([4,2],alg,'ExampleMonitor')
array = helper.addArray([4,2],alg,'AFPSiLayer')
array.defineHistogram('a',title='A',path='EtaPhi',
xbins=10,xmin=0.0,xmax=10.0)
# Using a map of groups
layerList = ['layer1','layer2']
clusterList = ['clusterX','clusterB']
array = helper.addArray([layerList],alg,'ExampleMonitor')
array = helper.addArray([layerList],alg,'AFPSiLayer')
array.defineHistogram('c',title='C',path='Layer',
xbins=10,xmin=0,xmax=10.0)
array = helper.addArray([layerList,clusterList],alg,'ExampleMonitor')
array = helper.addArray([layerList,clusterList],alg,'AFPSiLayer')
array.defineHistogram('c',title='C',path='LayerCluster',
xbins=10,xmin=0,xmax=10.0)
......@@ -145,7 +150,7 @@ if __name__=='__main__':
file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1'
ConfigFlags.Input.Files = [nightly+file]
ConfigFlags.Input.isMC = False
ConfigFlags.Output.HISTFileName = 'ExampleMonitorOutput.root'
ConfigFlags.Output.HISTFileName = 'AFPOutput.root'
ConfigFlags.lock()
......
done processing event #779703711, run #311321 10 events read so far <<<===
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "Run3AFPMonitoring/AFPSiLayerAlgorithm.h"
/* Old constructor:
AFPHitsMonitorAlgorithm::AFPHitsMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
:AthMonitorAlgorithm(name,pSvcLocator)
,m_doRandom(true)
{}
*/
AFPSiLayerAlgorithm::AFPSiLayerAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
:AthMonitorAlgorithm(name,pSvcLocator)
,m_doRandom(true)
{}
AFPSiLayerAlgorithm::~AFPSiLayerAlgorithm() {}
StatusCode AFPSiLayerAlgorithm::initialize() {
using namespace Monitored;
m_abGroups1 = buildToolMap<int>(m_tools,"AFPSiLayer",2);
m_abGroups2 = buildToolMap<std::vector<int>>(m_tools,"AFPSiLayer",4,2);
std::vector<std::string> layers = {"layer1","layer2"};
std::vector<std::string> clusters = {"clusterX","clusterB"};
m_cGroups1 = buildToolMap<int>(m_tools,"AFPSiLayer",layers);
m_cGroups2 = buildToolMap<std::map<std::string,int>>(m_tools,"AFPSiLayer",layers,clusters);
return AthMonitorAlgorithm::initialize();
}
StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const {
using namespace Monitored;
// Declare the quantities which should be monitored
// My histograms:
auto h_hitMultiplicity = Monitored::Scalar<int>("h_hitMultiplicity", 0);
auto h_timeOverThreshold = Monitored::Scalar<int>("h_timeOverThreshold", 0);
//auto h_hitMap = Monitored::Scalar<int>("h_hitMap", 0);
// End
auto lumiPerBCID = Monitored::Scalar<float>("lumiPerBCID",0.0);
auto lb = Monitored::Scalar<int>("lb",0);
auto run = Monitored::Scalar<int>("run",0);
auto random = Monitored::Scalar<float>("random",0.0);
auto testweight = Monitored::Scalar<float>("testweight",1.0);
// Two variables (value and passed) needed for TEfficiency
auto pT = Monitored::Scalar<float>("pT",0.0);
auto pT_passed = Monitored::Scalar<bool>("pT_passed",false);
// Set the values of the monitored variables for the event
h_timeOverThreshold = lbAverageInteractionsPerCrossing(ctx);
h_hitMultiplicity = lbAverageInteractionsPerCrossing(ctx);
// h_hitMap = lbAverageInteractionsPerCrossing(ctx);
lumiPerBCID = lbAverageInteractionsPerCrossing(ctx);
lb = GetEventInfo(ctx)->lumiBlock();
run = GetEventInfo(ctx)->runNumber();
testweight = 2.0;
TRandom3 r(ctx.eventID().event_number());
// Example of using flags
if (m_doRandom) {
random = r.Rndm();
}
// Fake efficiency calculator
pT = r.Landau(15);
pT_passed = pT>r.Poisson(15);
// Fill. First argument is the tool name, all others are the variables to be saved.
fill("AFPSiLayer", h_timeOverThreshold, h_hitMultiplicity,lumiPerBCID,lb,random,pT,pT_passed,testweight);
//fill("AFPSiLayerAlgorithm",h_hitMultiplicity,lb,random,pT,pT_passed,testweight);
// Alternative fill method. Get the group yourself, and pass it to the fill function.
auto tool = getGroup("AFPSiLayer");
fill(tool,run);
// Fill with a vector; useful in some circumstances.
std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> varVec = {lumiPerBCID,pT};
fill("AFPSiLayer",varVec);
fill(tool,varVec);
// Filling using a pre-defined array of groups.
auto a = Scalar<float>("a",0.0);
auto b = Scalar<float>("b",1.0);
auto c = Scalar<float>("c",2.0);
for ( auto iEta : {0,1} ) {
// 1) Valid but inefficient fill
fill("AFPSiLayer_"+std::to_string(iEta),a,b,c);
// 2) Faster way to fill a vector of histograms
fill(m_tools[m_abGroups1[iEta]],a,b,c);
for ( auto iPhi : {0,1} ) {
// Same efficient method for 2D array
fill(m_tools[m_abGroups2[iEta][iPhi]],a,b);
}
}
// Filling using a pre-defined map of groups.
for ( auto& layer : std::vector<std::string>({"layer1","layer2"}) ) {
fill(m_tools[m_cGroups1.at(layer)],c);
for ( auto& cluster : std::vector<std::string>({"clusterX","clusterB"}) ) {
// Same efficient method for 2D map
fill(m_tools[m_cGroups2.at(layer).at(cluster)],c);
}
}
return StatusCode::SUCCESS;
}
......@@ -2,6 +2,6 @@
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "Run3AFPMonitoring/AFPHitsMonitorAlgorithm.h"
#include "Run3AFPMonitoring/AFPSiLayerAlgorithm.h"
DECLARE_COMPONENT( AFPHitsMonitorAlgorithm )
DECLARE_COMPONENT( AFPSiLayerAlgorithm )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment