Skip to content
Snippets Groups Projects
Commit be802017 authored by Kristin Lohwasser's avatar Kristin Lohwasser
Browse files

added 3d monitoring group for the hits

parent 1ba343b3
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
...@@ -24,9 +24,9 @@ private: ...@@ -24,9 +24,9 @@ private:
std::vector<int> m_abGroups1; std::vector<int> m_abGroups1;
std::vector<std::vector<int>> m_abGroups2; std::vector<std::vector<int>> m_abGroups2;
std::map<std::string,int> m_cGroups1; std::map<std::string,int> m_cGroups1;
std::map<std::string,std::map<std::string,int>> m_cGroups2; std::map<std::string,std::map<std::string,std::map<std::string,int>>> m_HitmapGroups;
SG::ReadHandleKey<xAOD::AFPSiHitContainer> m_afpHitContainerKey; SG::ReadHandleKey<xAOD::AFPSiHitContainer> m_afpHitContainerKey;
// m_HitmapGroups = buildToolMap<std::string,std::map<std::string,int>>
protected: protected:
static const int s_cNearStationIndex; static const int s_cNearStationIndex;
static const int s_cFarStationIndex; static const int s_cFarStationIndex;
......
...@@ -32,11 +32,11 @@ def Run3AFPExampleMonitoringConfig(inputFlags): ...@@ -32,11 +32,11 @@ def Run3AFPExampleMonitoringConfig(inputFlags):
# base class configuration following the inputFlags. The returned object # base class configuration following the inputFlags. The returned object
# is the algorithm. # is the algorithm.
from Run3AFPMonitoring.Run3AFPMonitoringConf import AFPSiLayerAlgorithm from Run3AFPMonitoring.Run3AFPMonitoringConf import AFPSiLayerAlgorithm
afpSiLayerAlgorithm = helper.addAlgorithm(AFPSiLayerAlgorithm,'AFPSiLayer') afpSiLayerAlgorithm = helper.addAlgorithm(AFPSiLayerAlgorithm,'AFPSiLayerAlg')
# You can actually make multiple instances of the same algorithm and give # You can actually make multiple instances of the same algorithm and give
# them different configuration # them different configuration
anotherExampleMonAlg = helper.addAlgorithm(AFPSiLayerAlgorithm,'AnotherExampleMonAlg') #anotherExampleMonAlg = helper.addAlgorithm(AFPSiLayerAlgorithm,'AnotherExampleMonAlg')
# # If for some really obscure reason you need to instantiate an algorithm # # If for some really obscure reason you need to instantiate an algorithm
# # yourself, the AddAlgorithm method will still configure the base # # yourself, the AddAlgorithm method will still configure the base
...@@ -62,65 +62,33 @@ def Run3AFPExampleMonitoringConfig(inputFlags): ...@@ -62,65 +62,33 @@ def Run3AFPExampleMonitoringConfig(inputFlags):
# Add a generic monitoring tool (a "group" in old language). The returned # Add a generic monitoring tool (a "group" in old language). The returned
# object here is the standard GenericMonitoringTool. # object here is the standard GenericMonitoringTool.
station0_1 = helper.addGroup(afpSiLayerAlgorithm, 'AFPSiLayer','Station0/') AFPGroup = helper.addGroup( afpSiLayerAlgorithm, 'AFPSiLayerTool', 'AFP/' )
# station0_1 = helper.addGroup(afpSiLayerAlgorithm, 'AFPSiLayer','Station0/')
# Add a GMT for the other example monitor algorithm # Add a GMT for the other example monitor algorithm
anotherGroup = helper.addGroup(anotherExampleMonAlg,'AFPSiLayer') # anotherGroup = helper.addGroup(anotherExampleMonAlg,'AFPSiLayer')
### STEP 5 ### ### STEP 5 ###
# 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. # 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)
station0_1.defineHistogram('lb', title='Luminosity Block;lb;Events',
path='ToFindThem',xbins=1000,xmin=-0.5,xmax=999.5,weight='testweight')
station0_1.defineHistogram('random', title='LB;x;Events',
path='ToBringThemAll',xbins=30,xmin=0,xmax=1,opt='kLBNHistoryDepth=10')
station0_1.defineHistogram('random', title='title;x;y',path='ToBringThemAll',
xbins=[0,.1,.2,.4,.8,1.6])
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)
anotherGroup.defineHistogram('lbWithFilter',title='Lumi;lb;Events',
path='top',xbins=1000,xmin=-0.5,xmax=999.5)
anotherGroup.defineHistogram('run',title='Run Number;run;Events',
path='top',xbins=1000000,xmin=-0.5,xmax=999999.5)
# Example defining an array of histograms. This is useful if one seeks to create a # Example defining an array of histograms. This is useful if one seeks to create a
# number of histograms in an organized manner. (For instance, one plot for each ASIC # 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, # 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]. # one might have an array of TH1's such as quantity[etaIndex][phiIndex][layerIndex].
for alg in [afpSiLayerAlgorithm,anotherExampleMonAlg]: for alg in [afpSiLayerAlgorithm]:
# Using an array of groups
array = helper.addArray([2],alg,'AFPSiLayer') # Using a map of groups
array.defineHistogram('a,b',title='AB',type='TH2F',path='Eta', layerList = ['P0','P1', 'P2', 'P3'] ## TODO XXX adapt to the enum/xAOD namespace names
xbins=10,xmin=0.0,xmax=10.0, stationList = ['FarStation','NearStation'] # TODO XXX
ybins=10,ymin=0.0,ymax=10.0) sideList = ['Aside' , 'Cside' ]
array.defineHistogram('c',title='C',path='Eta', array = helper.addArray([sideList,stationList,layerList],alg,'AFPSiLayer')
xbins=10,xmin=0.0,xmax=10.0) array.defineHistogram( 'h_hitMap', title='Map of hits', type='TH2F', path='AFPSiLayer',
array = helper.addArray([4,2],alg,'AFPSiLayer') xbins=80,xmin=0.5,xmax=80.5,
array.defineHistogram('a',title='A',path='EtaPhi', ybins=336,ymin=0.5,ymax=336.5)
xbins=10,xmin=0.0,xmax=10.0)
# Using a map of groups
layerList = ['layer1','layer2']
clusterList = ['clusterX','clusterB']
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,'AFPSiLayer')
array.defineHistogram('c',title='C',path='LayerCluster',
xbins=10,xmin=0,xmax=10.0)
### STEP 6 ### ### STEP 6 ###
# Finalize. The return value should be a tuple of the ComponentAccumulator # Finalize. The return value should be a tuple of the ComponentAccumulator
...@@ -146,8 +114,17 @@ if __name__=='__main__': ...@@ -146,8 +114,17 @@ if __name__=='__main__':
# Set the Athena configuration flags # Set the Athena configuration flags
from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaConfiguration.AllConfigFlags import ConfigFlags
nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/' nightly = ''#/eos/atlas/atlastier0/tzero/prod/data18_13TeV/physics_Main/00348618/data18_13TeV.00348618.physics_Main.recon.AOD.v220/'
file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1' #file = 'data18_13TeV.00348618.physics_Main.recon.AOD.v220._lb0295._0009.1'
file = '/afs/cern.ch/work/k/kristin/dataAFP/data17_13TeV.00337176.physics_Main.merge.AOD.r10258_p3399_tid13243079_00/AOD.13243079._000005.pool.root.1'
#/afs/cern.ch/work/k/kristin/dataAFP/data17_13TeV.00337176.physics_Main.deriv.DAOD_STDM7.r10258_p3399_p4030/DAOD_STDM7.20036794._000007.pool.root.1'
#/afs/cern.ch/work/k/kristin/dataAFP/data17_13TeV.00337176.physics_Main.recon.AOD.r10258_p3412_r11501/AOD.18508508._000007.pool.root.1'
#/eos/atlas/atlastier0/tzero/prod/data18_13TeV/physics_Main/00354309/data18_13TeV.00354309.physics_Main.recon.AOD.f946/data18_13TeV.00354309.physics_Main.recon.AOD.f946._lb0130._0001.1'
# nightly = '/eos/atlas/atlastier0/tzero/prod/data18_13TeV/physics_Main/00357750/data18_13TeV.00357750.physics_Main.recon.AOD.f1041/'
# file = 'data18_13TeV.00357750.physics_Main.recon.AOD.f1041._lb0105._SFO-7._0103.1'
#nightly = '/eos/atlas/atlastier0/tzero/prod/data17_13TeV/physics_Main/00337176/data17_13TeV.00337176.physics_Main.recon.AOD.f871/'
#file = 'data17_13TeV.00337176.physics_Main.recon.AOD.f871._lb0142._0006.1'
ConfigFlags.Input.Files = [nightly+file] ConfigFlags.Input.Files = [nightly+file]
ConfigFlags.Input.isMC = False ConfigFlags.Input.isMC = False
ConfigFlags.Output.HISTFileName = 'AFPOutput.root' ConfigFlags.Output.HISTFileName = 'AFPOutput.root'
...@@ -167,4 +144,4 @@ if __name__=='__main__': ...@@ -167,4 +144,4 @@ if __name__=='__main__':
# exampleMonitorAcc.getEventAlgo('ExampleMonAlg').OutputLevel = 2 # DEBUG # exampleMonitorAcc.getEventAlgo('ExampleMonAlg').OutputLevel = 2 # DEBUG
cfg.printConfig(withDetails=False) # set True for exhaustive info cfg.printConfig(withDetails=False) # set True for exhaustive info
cfg.run(10) #use cfg.run(20) to only run on first 20 events cfg.run(10000) #use cfg.run(20) to only run on first 20 events
...@@ -35,20 +35,17 @@ AFPSiLayerAlgorithm::~AFPSiLayerAlgorithm() {} ...@@ -35,20 +35,17 @@ AFPSiLayerAlgorithm::~AFPSiLayerAlgorithm() {}
StatusCode AFPSiLayerAlgorithm::initialize() { StatusCode AFPSiLayerAlgorithm::initialize() {
using namespace Monitored; using namespace Monitored;
m_abGroups1 = buildToolMap<int>(m_tools,"AFPSiLayer",2); std::vector<std::string> layers = { "P0","P1", "P2", "P3"};
m_abGroups2 = buildToolMap<std::vector<int>>(m_tools,"AFPSiLayer",4,2); std::vector<std::string> stations = { "FarStation","NearStation"};
/* std::vector<std::string> sides = { "Aside","Cside"};
std::vector<std::string> layers = {"layer1","layer2"};
std::vector<std::string> clusters = {"clusterX","clusterB"}; m_HitmapGroups = buildToolMap<std::map<std::string,std::map<std::string,int>>>(m_tools,"AFPSiLayerTool",sides,stations,layers);
m_cGroups1 = buildToolMap<int>(m_tools,"AFPSiLayer",layers);
m_cGroups2 = buildToolMap<std::map<std::string,int>>(m_tools,"AFPSiLayer",layers,clusters);
return AthMonitorAlgorithm::initialize();
*/
// We must declare to the framework in initialize what SG objects we are going to use
//SG::ReadHandleKey<xAOD::AFPSiHitContainer> afpHitContainerKey("AFPSiHits");
ATH_CHECK(m_afpHitContainerKey.initialize()); // std::map<std::string,std::map<std::string,int>> <std::map<std::string,int>>
// We must declare to the framework in initialize what SG objects we are going to use
//SG::ReadHandleKey<xAOD::AFPSiHitContainer> afpHitContainerKey("AFPSiHits");
// ATH_CHECK(m_afpHitContainerKey.initialize());
// ... // ...
return AthMonitorAlgorithm::initialize(); return AthMonitorAlgorithm::initialize();
} }
...@@ -59,8 +56,8 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const ...@@ -59,8 +56,8 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const
// Declare the quantities which should be monitored // Declare the quantities which should be monitored
// My histograms: // My histograms:
auto h_hitMultiplicity = Monitored::Scalar<int>("h_hitMultiplicity", 0); // auto h_hitMultiplicity = Monitored::Scalar<int>("h_hitMultiplicity", 0);
auto h_timeOverThreshold = Monitored::Scalar<int>("h_timeOverThreshold", 0); // auto h_timeOverThreshold = Monitored::Scalar<int>("h_timeOverThreshold", 0);
//auto h_hitMap = Monitored::Scalar<int>("h_hitMap", 0); //auto h_hitMap = Monitored::Scalar<int>("h_hitMap", 0);
// End // End
/* /*
...@@ -76,8 +73,8 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const ...@@ -76,8 +73,8 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const
auto pT_passed = Monitored::Scalar<bool>("pT_passed",false); auto pT_passed = Monitored::Scalar<bool>("pT_passed",false);
*/ */
// Set the values of the monitored variables for the event // Set the values of the monitored variables for the event
h_timeOverThreshold = lbAverageInteractionsPerCrossing(ctx); // h_timeOverThreshold = lbAverageInteractionsPerCrossing(ctx);
h_hitMultiplicity = lbAverageInteractionsPerCrossing(ctx); // h_hitMultiplicity = lbAverageInteractionsPerCrossing(ctx);
// h_hitMap = lbAverageInteractionsPerCrossing(ctx); // h_hitMap = lbAverageInteractionsPerCrossing(ctx);
/* /*
lumiPerBCID = lbAverageInteractionsPerCrossing(ctx); lumiPerBCID = lbAverageInteractionsPerCrossing(ctx);
...@@ -145,7 +142,7 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const ...@@ -145,7 +142,7 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const
//ATH_CHECK( afpHitContainerKey.initialize() ); //ATH_CHECK( afpHitContainerKey.initialize() );
//for (const auto& muonItr : *muons) { //for (const auto& muonItr : *muons) {
for(const xAOD::AFPSiHit *hitsItr: *afpHitContainer) /* for(const xAOD::AFPSiHit *hitsItr: *afpHitContainer)
{ {
std::cout << hitsItr->stationID() << std::endl; std::cout << hitsItr->stationID() << std::endl;
...@@ -162,7 +159,7 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const ...@@ -162,7 +159,7 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const
} }
} }
*/
//m_cNearStation.eventEnd(); //m_cNearStation.eventEnd();
//m_cFarStation.eventEnd(); //m_cFarStation.eventEnd();
......
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