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

Deleting files

parent 9ff1abf7
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 AFPHITSMONITORALGORITHM_H
#define AFPHITSMONITORALGORITHM_H
#include "AthenaMonitoring/AthMonitorAlgorithm.h"
#include "AthenaMonitoringKernel/Monitored.h"
#include "TRandom3.h"
class AFPHitsMonitorAlgorithm : public AthMonitorAlgorithm {
public:
AFPHitsMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
virtual ~AFPHitsMonitorAlgorithm();
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
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "Run3AFPMonitoring/AFPHitsMonitorAlgorithm.h"
AFPHitsMonitorAlgorithm::AFPHitsMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
:AthMonitorAlgorithm(name,pSvcLocator)
,m_doRandom(true)
{}
AFPHitsMonitorAlgorithm::~AFPHitsMonitorAlgorithm() {}
StatusCode AFPHitsMonitorAlgorithm::initialize() {
using namespace Monitored;
m_abGroups1 = buildToolMap<int>(m_tools,"ExampleMonitor",2);
m_abGroups2 = buildToolMap<std::vector<int>>(m_tools,"ExampleMonitor",4,2);
std::vector<std::string> layers = {"layer1","layer2"};
std::vector<std::string> clusters = {"clusterX","clusterB"};
m_cGroups1 = buildToolMap<int>(m_tools,"ExampleMonitor",layers);
m_cGroups2 = buildToolMap<std::map<std::string,int>>(m_tools,"ExampleMonitor",layers,clusters);
return AthMonitorAlgorithm::initialize();
}
StatusCode AFPHitsMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const {
using namespace Monitored;
// Declare the quantities which should be monitored
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
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("ExampleMonitor",lumiPerBCID,lb,random,pT,pT_passed,testweight);
// Alternative fill method. Get the group yourself, and pass it to the fill function.
auto tool = getGroup("ExampleMonitor");
fill(tool,run);
// Fill with a vector; useful in some circumstances.
std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> varVec = {lumiPerBCID,pT};
fill("ExampleMonitor",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("ExampleMonitor_"+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;
}
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