ATLAS Offline Software
Loading...
Searching...
No Matches
LArCellMonAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4// based on LArCellMonTool by W.Lampl (Spring 2017: Major re-design, early 2020: migration to AthenaMT)
5
6#ifndef CALOMONITORING_LARCELLMONALG_H
7#define CALOMONITORING_LARCELLMONALG_H
8
9#include "CaloMonAlgBase.h"
10
13
16
21
23
24#include "LArCellBinning.h"
25
26#include <vector>
27#include <string>
28#include <bitset>
29#include <array>
30#include <map>
31#include <unordered_map>
32
33namespace Trig {
34 class ChainGroup;
35}
36
37class CaloCell;
38class TileID;
39
40
42
43 public:
44
45 LArCellMonAlg(const std::string& name, ISvcLocator* pSvcLocator);
47
48 virtual StatusCode initialize() override final;
49 virtual StatusCode fillHistograms(const EventContext& ctx) const override final;
50
51
53
54 // Job properties
55 SG::ReadHandleKey<CaloCellContainer> m_cellContainerKey{this,"CaloCellContainer","AllCalo","SG key of the input cell container"};
56
57 Gaudi::Property<std::string> m_MonGroupName {this, "MonGroupName", "LArCellMonGroup"};
58 Gaudi::Property<std::string> m_MonGroupNamePerJob {this, "MonGroupName_perJob"};
59 Gaudi::Property<std::string> m_groupnameTotalOccupancyEtaPhi {this, "MonGroupName_OccupancyEtaPhi"};
60 Gaudi::Property<std::string> m_groupnamePercentageOccupancyEtaPhi {this, "MonGroupName_PercentageOccupancyEtaPhi"};
61 Gaudi::Property<std::string> m_groupnameOccupancyEta {this, "MonGroupName_OccupancyEta"};
62 Gaudi::Property<std::string> m_groupnameOccupancyPhi {this, "MonGroupName_OccupancyPhi"};
63 Gaudi::Property<std::string> m_groupnameTotEnergyEtaPhi {this, "MonGroupName_TotEnergyEtaPhi"};
64 Gaudi::Property<std::string> m_groupnameTotQualityEtaPhi {this, "MonGroupName_AvgQualityEtaPhi"};
65 Gaudi::Property<std::string> m_groupnameFractionOverQthEtaPhi {this, "MonGroupName_FractionOverQthEtaPhi"};
66 Gaudi::Property<std::string> m_groupnameTotTimeEtaPhi {this, "MonGroupName_AvgTimeEtaPhi"};
67 Gaudi::Property<std::string> m_groupnameFractionPastTthEtaPhi {this, "MonGroupName_FractionPastTthEtaPhi"};
68
69 SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","totalNoise","SG Key of CaloNoise data object"};
70
71 //Tool maps, for thr. histograms
72 std::map<std::string,std::map<std::string,int>> m_toolmapAll;
73
74 //Histogram path in root file:
75
76 // Thresholds for time and Time vs Energy plots:
77 // Energy thresholds hardcoded following official timing analysis. See for example:
78 // https://indico.cern.ch/event/522351/
79 FloatArrayProperty m_eCutForTiming {this, "EcutForTiming",
80 //EMBPNS=0, EMB1NS, EMB2NS, EMB3NS, HEC0NS, HEC1NS, HEC2NS, HEC3NS,EMECPNS,EMEC1NS,EMEC2NS,EMEC3NS,FCAL1NS,FCAL2NS,FCAL3NS
81 {1000., 1000., 3000., 1500., 3500., 3500., 3500., 3500., 1500., 3000., 3000., 2000., 10000., 10000., 10000.}
82 };
83
84 StringArrayProperty m_layerNames{this, "LayerNames", {"EMBPA", "EMBPC", "EMB1A", "EMB1C", "EMB2A", "EMB2C", "EMB3A", "EMB3C",
85 "HEC0A", "HEC0C", "HEC1A", "HEC1C", "HEC2A", "HEC2C", "HEC3A", "HEC3C",
86 "EMECPA", "EMECPC", "EMEC1A", "EMEC1C", "EMEC2A", "EMEC2C", "EMEC3A", "EMEC3C",
87 "FCAL1A", "FCAL1C", "FCAL2A", "FCAL2C", "FCAL3A", "FCAL3C"},
88 "Names of individual layers to monitor"};
89 IntegerArrayProperty m_layerNcells{this,"LayerNcells",{ 3905, 3905, 29376, 29376, 14595, 14595, 6912, 6912,
90 768, 768, 736, 736, 672, 672, 640, 640,
91 768, 768, 14272, 14272, 11712, 11712, 5120, 5120,
92 1008, 1008, 500, 500, 254, 254},
93 "Number of expected cells per layer"};
94
95 StringArrayProperty m_partitionNames{this, "PartitionNames", {"EMBA","EMBC","EMECA","EMECC","HECA","HECC","FCALA","FCALC"}};
96
97 // Trigger Awareness:
98 //Enumerations of possible threshold directions and trigger types:
101
102 BooleanProperty m_useTrigger{this, "useTrigger", true};
103 StringProperty m_triggerNames[NOTA];
104
105 BooleanProperty m_ignoreKnownBadChannels{this, "MaskBadChannels", false, "Do not fill histograms with values from known bad channels"};
106 BooleanProperty m_maskNoCondChannels{this, "MaskNoCondChannels", false, "Do not fill histograms with values from cells reco'ed w/o conditions database"};
107
108 BooleanArrayProperty m_doBeamBackgroundRemovalProp{this, "DoBeamBackgroundRemoval"};
109 BooleanProperty m_doKnownBadChannelsVsEtaPhi{this, "doKnownBadChannelsVsEtaPhi", true};
110 BooleanProperty m_doDatabaseNoiseVsEtaPhi{this, "doDatabaseNoiseVsEtaPhi", true};
111 // Switch on/off additional (non thresholded) histograms:
112 BooleanProperty m_doEnergyVsTime{this, "doEnergyVsTime", true};
113 BooleanProperty m_doUnnormalized1DEnergy{this, "doUnnormalized1DEnergy", false};
114
115 //threshold for sporadic plots
116 BooleanProperty m_sporadic_switch{this, "Sporadic_switch", false};
117 FloatProperty m_threshold_em_S0S1{this, "Threshold_EM_S0S1", 5000.};
118 FloatProperty m_threshold_HECFCALEMS2S3{this, "Threshold_HECFCALEMS2S3", 15000.};
119 UnsignedIntegerProperty m_sporadicPlotLimit{this, "NsporadicPlotLimit", 300};
120 UnsignedIntegerProperty m_sporadic_protc{this, "Sporadic_protection", 4000};
121 UnsignedIntegerProperty m_minSporadicNoiseEventsPerCell{this, "minSporadicEvents", 10};
122
123 // Switch on/off thresholded histograms for each threshold:
124 StringArrayProperty m_thresholdNameProp{this, "ThresholdType", {},"Vector of threshold names"};
125 StringArrayProperty m_thresholdColumnType{this, "ThresholdColumnType",{}};
126 StringArrayProperty m_thresholdDirectionProp{this, "ThresholdDirection", {}, "Vector of threshold directions"};
127 StringArrayProperty m_triggersToIncludeProp{this, "TriggersToInclude", {}};
128 StringArrayProperty m_triggersToExcludeProp{this, "TriggersToExclude", {}};
129 StringArrayProperty m_thresholdTitleTemplates{this, "ThresholdTitleTemplates", {}};
130 FloatArrayProperty m_defaultThresholds{this, "DefaultThresholds", {}};
131 BooleanArrayProperty m_inSigNoise{this, "ThresholdinSigNoise", {}};
132
133 FloatArrayProperty m_timeThresholdProp{this, "TimeThreshold"};
134 FloatArrayProperty m_qualityFactorThresholdProp{this, "QualityFactorThreshold",{}};
135 //string arrays for histogram filling
136 StringArrayProperty m_doEtaPhiTotalOccupancyNames{this, "DoEtaPhiTotalOccupancyNames", {}};
137 StringArrayProperty m_doEtaPhiPercentageOccupancyNames{this, "DoEtaPhiPercentageOccupancyNames", {}};
138 StringArrayProperty m_doEtaOccupancyNames{this, "DoEtaOccupancyNames", {}};
139 StringArrayProperty m_doPhiOccupancyNames{this, "DoPhiOccupancyNames", {}};
140 StringArrayProperty m_doEtaPhiTotEnergyNames{this, "DoEtaPhiTotEnergyNames", {}};
141 StringArrayProperty m_doEtaPhiAvgQualityNames{this, "DoEtaPhiAvgQualityNames", {},"Turns on 'totQuality' and total 'Occupancy' plots. The ratio will be computed at post-processing stage"};
142 StringArrayProperty m_doEtaPhiFractionOverQthNames{this, "DoEtaPhiFractionOverQthNames", {}};
143 StringArrayProperty m_doEtaPhiAvgTimeNames{this, "DoEtaPhiAvgTimeNames", {},"Turns on 'totTime' and total 'Occupancy' plots. The ratio will be computed at post-processing stage"};
144 StringArrayProperty m_doEtaPhiFractionPastTthNames{this, "DoEtaPhiFractionPastTthNames", {}};
145
146
147
148
149 FloatArrayProperty m_thresholdsProp[MAXLYRNS];
150
151 //Enumerate partitions
153
154
155 //Private methods: Initialization and job-option interpretation
156 StatusCode initThresh();
157 void setLArCellBinning();
158 static bool isThrListed(const std::vector<std::string>& vec, const std::string& s) ;
159 //void resetInternals();
160
161 static std::string strToLower(const std::string& input) ;
162
163 //The threshold-related variables and histograms are grouped in the following struct
164 //one instance per threshold-type
165
166 struct threshold_t {
167 //Configuration variables
168 std::string m_threshName;
170 std::array<float,MAXLYRNS> m_threshValue{{}};
171 std::array<std::string,MAXLYRNS> m_threshTitles;
172 size_t m_thrIndex;
173
174 bool m_inSigNoise=false;
175 Direction m_threshDirection=OVER;
179
180 //Variables related to trigger-filtering
181 std::bitset<MAXTRIGTYPE> m_triggersToInclude;
182 std::bitset<MAXTRIGTYPE> m_triggersToExclude;
184
185 //Switch histograms on/off
190
192 // bool m_doEtaPhiAverageEnergy=false;
193
196
199
200 };
201
202
203
204 //Mapping of layers to the partition the layer belongs to
205 const std::array<PartitionEnum,MAXLAYER> m_layerEnumtoPartitionEnum{{
210 }};
211
212 //Private methods: Histogram filling
213 StatusCode createPerJobHistograms(const CaloCellContainer* cellcont, const CaloNoise *noisep) const;
214 void checkTriggerAndBeamBackground(bool passBeamBackgroundRemoval, std::vector<threshold_t> &thresholds) const;
215 void sporadicNoiseCandidate(const CaloCell* cell, const LArCellMonAlg::LayerEnum iLyr,const float threshold, const LArOnOffIdMapping* cabling) const;
216
217 // bad channel mask
219 Gaudi::Property<std::vector<std::string> > m_problemsToMask{this,"ProblemsToMask",{}, "Bad-Channel categories to mask"};
220
221 std::vector<threshold_t> m_thresholds;
222
223 // Identifer helpers and such
224
226
227 SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
228 SG::ReadCondHandleKey<LArBadChannelCont> m_BCKey {this, "BadChanKey", "LArBadChannel", "SG key for LArBadChan object"};
229
230 std::array<CaloMonitoring::LArCellBinning,MAXLAYER> m_binning;
231
232 //Sporadic monitoring related variables and structs
233
234};
235
236#endif
237
238//Histograms dropped during the redesign in spring 2017:
239// * All inverse-masking
240// * Cell Occupancy Eta/Phi Vs LumiBlock
241// * DBNoiseNormalizedEnergy per layer
242// * doEtaPhiEnergyRMS per layer and threshold
243// * DoEtaPhiRMSvsDBnoise per layer and threshold
244
std::vector< size_t > vec
Container class for CaloCell.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
std::map< std::string, std::map< std::string, int > > m_toolmapAll
Gaudi::Property< std::string > m_groupnameTotTimeEtaPhi
Gaudi::Property< std::string > m_groupnameFractionPastTthEtaPhi
virtual StatusCode fillHistograms(const EventContext &ctx) const override final
adds event to the monitoring histograms
BooleanProperty m_doEnergyVsTime
StringArrayProperty m_thresholdNameProp
BooleanProperty m_doUnnormalized1DEnergy
Gaudi::Property< std::vector< std::string > > m_problemsToMask
BooleanProperty m_useTrigger
const std::array< PartitionEnum, MAXLAYER > m_layerEnumtoPartitionEnum
FloatArrayProperty m_timeThresholdProp
BooleanProperty m_doDatabaseNoiseVsEtaPhi
StringArrayProperty m_doEtaOccupancyNames
std::vector< threshold_t > m_thresholds
Gaudi::Property< std::string > m_groupnamePercentageOccupancyEtaPhi
StringArrayProperty m_doEtaPhiAvgTimeNames
BooleanProperty m_ignoreKnownBadChannels
StringArrayProperty m_doEtaPhiTotalOccupancyNames
BooleanProperty m_doKnownBadChannelsVsEtaPhi
FloatArrayProperty m_eCutForTiming
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Gaudi::Property< std::string > m_groupnameTotalOccupancyEtaPhi
Gaudi::Property< std::string > m_MonGroupNamePerJob
FloatProperty m_threshold_em_S0S1
std::array< CaloMonitoring::LArCellBinning, MAXLAYER > m_binning
BooleanArrayProperty m_inSigNoise
StringArrayProperty m_thresholdColumnType
StringArrayProperty m_doEtaPhiAvgQualityNames
BooleanProperty m_maskNoCondChannels
void sporadicNoiseCandidate(const CaloCell *cell, const LArCellMonAlg::LayerEnum iLyr, const float threshold, const LArOnOffIdMapping *cabling) const
Gaudi::Property< std::string > m_groupnameTotEnergyEtaPhi
Gaudi::Property< std::string > m_groupnameFractionOverQthEtaPhi
UnsignedIntegerProperty m_sporadic_protc
UnsignedIntegerProperty m_minSporadicNoiseEventsPerCell
StringArrayProperty m_doEtaPhiTotEnergyNames
StringArrayProperty m_doEtaPhiFractionPastTthNames
Gaudi::Property< std::string > m_groupnameTotQualityEtaPhi
BooleanProperty m_sporadic_switch
StringArrayProperty m_thresholdTitleTemplates
LArBadChannelMask m_bcMask
FloatArrayProperty m_defaultThresholds
StringArrayProperty m_thresholdDirectionProp
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
StringArrayProperty m_triggersToIncludeProp
StringArrayProperty m_doEtaPhiFractionOverQthNames
Gaudi::Property< std::string > m_groupnameOccupancyEta
BooleanArrayProperty m_doBeamBackgroundRemovalProp
StringProperty m_triggerNames[NOTA]
StringArrayProperty m_layerNames
Gaudi::Property< std::string > m_groupnameOccupancyPhi
FloatArrayProperty m_qualityFactorThresholdProp
SG::ReadCondHandleKey< LArBadChannelCont > m_BCKey
Gaudi::Property< std::string > m_MonGroupName
IntegerArrayProperty m_layerNcells
StringArrayProperty m_partitionNames
UnsignedIntegerProperty m_sporadicPlotLimit
SG::ReadHandleKey< CaloCellContainer > m_cellContainerKey
const LArOnlineID * m_LArOnlineIDHelper
StringArrayProperty m_doEtaPhiPercentageOccupancyNames
FloatProperty m_threshold_HECFCALEMS2S3
StringArrayProperty m_doPhiOccupancyNames
StringArrayProperty m_triggersToExcludeProp
FloatArrayProperty m_thresholdsProp[MAXLYRNS]
Helper class for TileCal offline identifiers.
Definition TileID.h:67
Definition MET.py:1
Forward declaration.
The common trigger namespace for trigger analysis tools.
void initialize()
std::array< float, MAXLYRNS > m_threshValue
Histogram title template.
std::string m_threshTitleTemplate
Name of this threshold.
std::array< std::string, MAXLYRNS > m_threshTitles
The actual threshold (per layer)
size_t m_thrIndex
Part of the histogram title (containing the threshold value, so per-layer)
std::bitset< MAXTRIGTYPE > m_triggersToExclude
bool m_inSigNoise
for filling in the eventCount plot
Direction m_threshDirection
Absolute threshold or in sigma noise?
std::bitset< MAXTRIGTYPE > m_triggersToInclude
#define private