ATLAS Offline Software
Loading...
Searching...
No Matches
SCTErrMonAlg.h
Go to the documentation of this file.
1// -*- C++ -*-
2
3/*
4 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef SCTERRMONALG_H
8#define SCTERRMONALG_H
9
11
13
20
21#include "TH2F.h"
22
23#include <array>
24#include <atomic>
25#include <mutex>
26#include <utility>
27#include <vector>
28
29class SCT_ID;
30
32 public:
33 SCTErrMonAlg(const std::string& name, ISvcLocator* pSvcLocator);
34 virtual ~SCTErrMonAlg() = default;
35 virtual StatusCode initialize() override final;
36 virtual StatusCode fillHistograms(const EventContext& ctx) const override final;
37 virtual StatusCode stop() override final;
38
39 private:
40 // First pair is eta and second pair is phi.
41 // First element of pair is minimum second is maximum.
42 typedef std::pair<std::pair<double, double>, std::pair<double, double>> moduleGeo_t;
43 class categoryErrorMap_t : public std::array<std::array<std::array<std::array<std::array<bool,
44 SCT_Monitoring::N_PHI_BINS>, SCT_Monitoring::N_ETA_BINS>, SCT_Monitoring::N_ENDCAPSx2>,
45 SCT_Monitoring::N_REGIONS>, SCT_Monitoring::N_ERRCATEGORY> {
46 // N_PHI_BINS=56 > N_PHI_BINS_EC=52, N_ETA_BINS=13 > N_ETA_BINS_EC=3, N_ENDCAPSx2=18 > N_BARRELSx2=8 defined in SCT_MonitoringNumbers.h
47 public:
49 for (int iCat{0}; iCat<SCT_Monitoring::N_ERRCATEGORY; iCat++) {
50 for (int iReg{0}; iReg<SCT_Monitoring::N_REGIONS; iReg++) {
51 for (int iLay{0}; iLay<SCT_Monitoring::N_ENDCAPSx2; iLay++) {
52 for (int iEta{0}; iEta<SCT_Monitoring::N_ETA_BINS; iEta++) {
53 (*this)[iCat][iReg][iLay][iEta].fill(false);
54 }
55 }
56 }
57 }
58 };
59 int count(int errCate) {
60 int cnt{0};
61 for (int iReg{0}; iReg<SCT_Monitoring::N_REGIONS; iReg++) {
62 for (int iLay{0}; iLay<SCT_Monitoring::N_ENDCAPSx2; iLay++) {
63 for (int iEta{0}; iEta<SCT_Monitoring::N_ETA_BINS; iEta++) {
64 for (int iPhi{0}; iPhi<SCT_Monitoring::N_PHI_BINS; iPhi++) {
65 if ((*this)[errCate][iReg][iLay][iEta][iPhi]) cnt++;
66 }
67 }
68 }
69 }
70 return cnt;
71 }
72 };
73
74 struct CacheEntry {
75 EventContext::ContextEvt_t m_evt{EventContext::INVALID_CONTEXT_EVT};
76 std::vector<TH2F> m_mapSCT;
77 };
78
79 static const unsigned int s_nBinsEta;
80 static const double s_rangeEta;
81 static const unsigned int s_nBinsPhi;
82 static const double s_wafersThreshold;
83
84 std::vector<moduleGeo_t> m_geo{};
85
86 mutable std::atomic_bool m_isFirstConfigurationDetails{true};
87 mutable std::mutex m_mutex{};
88 mutable SG::SlotSpecificObj<CacheEntry> m_cache ATLAS_THREAD_SAFE; // Guarded by m_mutex
89 mutable std::array<std::atomic_int, SCT_Monitoring::N_REGIONS_INC_GENERAL> m_nMaskedLinks ATLAS_THREAD_SAFE {};
90 // For coverage check because it is time consuming and run at the first event of each lumi block.
91 mutable std::set<uint32_t> m_procLB ATLAS_THREAD_SAFE;//Used to find new LB, and fill only once per LB
92
93 BooleanProperty m_makeConfHisto{this, "MakeConfHisto", true};
94 BooleanProperty m_coverageCheck{this, "CoverageCheck", true};
95 BooleanProperty m_coverageCheckOnlyFirtsEventOfLB{this, "CoverageCheckOnlyFirtsEventOfLB", true};
96 BooleanProperty m_useDCS{this, "UseDCS", true};
97 BooleanProperty m_doPerLumiErrors{this, "DoPerLumiErrors", true, "Do lumi block 2D error histos"};
98 BooleanProperty m_doOnline{this, "doOnlineMon", false};
99
100 ToolHandle<ISCT_ByteStreamErrorsTool> m_byteStreamErrTool{this, "SCT_ByteStreamErrorsTool", "SCT_ByteStreamErrorsTool/SCT_ByteStreamErrorsTool", "Tool to retrieve SCT ByteStream Errors"};
101 ToolHandle<ISCT_ConfigurationConditionsTool> m_configurationTool{this, "conditionsTool", "SCT_ConfigurationConditionsTool/InDetSCT_ConfigurationConditionsTool", "Tool to retrieve SCT Configuration Tool"};
102 ToolHandle<ISCT_DCSConditionsTool> m_dcsTool{this, "SCT_DCSConditionsTool", "SCT_DCSConditionsTool/InDetSCT_DCSConditionsTool", "Tool to retrieve SCT DCS information"};
103 ToolHandle<IInDetConditionsTool> m_pSummaryTool{this, "SCT_ConditionsSummaryTool", "SCT_ConditionsSummaryTool/InDetSCT_ConditionsSummaryTool", "Tool to retrieve SCT Conditions summary"};
104 ToolHandle<ISCT_FlaggedConditionTool> m_flaggedTool{this, "SCT_FlaggedConditionTool", "SCT_FlaggedConditionTool/InDetSCT_FlaggedConditionTool", "Tool to retrieve bad wafers with many fired strips"};
105 ToolHandle<IDQFilterTool> m_atlasReadyFilter{this,"ReadyFilterTool","DQAtlasReadyFilterTool/DQAtlasReadyFilterTool", "Tool to retrieve R4P flag"};
106
107 const SCT_ID* m_pSCTHelper{nullptr};
108
110 StatusCode fillConfigurationDetails(const EventContext& ctx) const;
111 StatusCode fillByteStreamErrors(const EventContext& ctx) const;
113 int fillByteStreamErrorsHelper(const std::set<IdentifierHash>& errors,
114 int err_type,
115 categoryErrorMap_t& categoryErrorMap,
116 std::array<int, SCT_Monitoring::N_REGIONS_INC_GENERAL>& nMaskedLinks) const;
117 void numByteStreamErrors(const std::set<IdentifierHash>& errors, int& ntot) const;
118 bool disabledSCT(std::set<IdentifierHash>& sctHashDisabled) const;
119 bool errorSCT(std::set<IdentifierHash>& sctHashBadLinkError,
120 std::set<IdentifierHash>& sctHashBadRODError,
121 std::set<IdentifierHash>& sctHashBadError) const;
122 bool summarySCT(std::set<IdentifierHash>& sctHashAll, std::set<IdentifierHash>& sctHashSummary) const;
123 bool psTripDCSSCT(std::set<IdentifierHash>& sctHashPSTripDCS, float& PSTripModules) const;
124 void fillWafer(moduleGeo_t module, TH2F& histo) const;
125 double calculateDetectorCoverage(const TH2F& histo, const TH2F& histoAll) const;
126};
127
128#endif // SCTERRMONALG_H
Maintain a set of objects, one per slot.
interface file for tool that keeps track of errors in the bytestream.
interface file for service that keeps track of configuration conditions
interface file for service that keeps track of errors in the bytestream.
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
std::atomic_bool m_isFirstConfigurationDetails
ToolHandle< ISCT_ByteStreamErrorsTool > m_byteStreamErrTool
BooleanProperty m_coverageCheck
ToolHandle< IInDetConditionsTool > m_pSummaryTool
BooleanProperty m_useDCS
ToolHandle< IDQFilterTool > m_atlasReadyFilter
static const double s_wafersThreshold
ToolHandle< ISCT_DCSConditionsTool > m_dcsTool
static const double s_rangeEta
static const unsigned int s_nBinsPhi
BooleanProperty m_doOnline
std::mutex m_mutex
BooleanProperty m_makeConfHisto
SG::SlotSpecificObj< CacheEntry > m_cache ATLAS_THREAD_SAFE
ToolHandle< ISCT_ConfigurationConditionsTool > m_configurationTool
BooleanProperty m_doPerLumiErrors
virtual StatusCode stop() override final
std::pair< std::pair< double, double >, std::pair< double, double > > moduleGeo_t
std::vector< moduleGeo_t > m_geo
BooleanProperty m_coverageCheckOnlyFirtsEventOfLB
ToolHandle< ISCT_FlaggedConditionTool > m_flaggedTool
virtual StatusCode fillHistograms(const EventContext &ctx) const override final
adds event to the monitoring histograms
const SCT_ID * m_pSCTHelper
static const unsigned int s_nBinsEta
virtual ~SCTErrMonAlg()=default
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
Maintain a set of objects, one per slot.
STL class.
STL namespace.
void initialize()
EventContext::ContextEvt_t m_evt
std::vector< TH2F > m_mapSCT
#define private