|
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include "CLHEP/Units/SystemOfUnits.h"
12 #include "Identifier/Identifier.h"
23 #include "GaudiKernel/ThreadLocalContext.h"
30 using namespace std::complex_literals;
47 constexpr
unsigned numberOfSlotsPerFeedthrough(int8_t
det) {
61 ISvcLocator *pSvcLocator)
64 static_assert(std::tuple_size_v<T> >= ::NDETECTORS);
66 static_assert(std::tuple_size_v<U> >= ::NDETECTORS);
86 auto get_detector = [&](
auto hwid) {
104 auto det = get_detector(*itr);
116 for (; citr != citr_end; ++citr) {
118 auto det = get_detector(*citr);
123 std::vector<std::string> det2str(::NDETECTORS);
143 auto toolmap = Monitored::buildToolMap<int>(
144 m_tools,
"LArRawChannelMon", det2str);
150 "will now initialize base class <=== ");
162 if (!raw_channels.isValid()) {
165 return StatusCode::SUCCESS;
168 const bool is_atlas_ready = std::all_of(
171 [](
auto &
f) { return f->accept(); });
174 int bcid{0}, lumi_block{0};
175 bool larNoisyROAlg_flag{
false};
176 bool larNoisyROAlgInTimeW_flag{
false};
177 bool larNoisyROAlg_W_flag{
false};
178 bool noisy_event{
false};
179 if (event_info.isValid()) {
180 auto checkEventFlag = [&](
auto bitinfo,
const char *txt) {
181 bool flag = event_info->isEventFlagBitSet(
185 larNoisyROAlg_flag = checkEventFlag(
187 larNoisyROAlg_W_flag = checkEventFlag(
189 larNoisyROAlgInTimeW_flag = checkEventFlag(
190 3,
"by LArNoisyROAlg in Time window of 500ms");
191 bcid = event_info->bcid();
192 lumi_block = event_info->lumiBlock();
194 const auto &
tags = event_info->streamTags();
197 || std::any_of(
tags.begin(),
tags.end(), inSet);
202 std::array<uint32_t, ::NDETECTORS> det_n_noisy_channels{};
203 std::array<uint32_t, ::NDETECTORS> det_n_noisy_channels_Neg{};
204 std::array<uint32_t, ::NDETECTORS> det_n_badQ_channels{};
205 using wsum_t = std::complex<double>;
206 wsum_t event_mean_time{};
207 std::array<wsum_t, ::NDETECTORS> mean_detector_times;
209 std::array<double, ::NDETECTORS> per_detector_total_energy{};
211 ToolHandle<GenericMonitoringTool> monitoring{
nullptr};
230 HWIdentifier hardware_id{
chan.hardwareID()};
232 HWIdentifier feb_id{0};
233 IdentifierHash feb_hash{0};
235 int slot_number{-1}, feedthrough_number{-1};
242 if (!cablingH->isOnlineConnected(hardware_id))
continue;
259 if (
det != lastdet) {
260 if (
det >= 0 &&
det < ::NDETECTORS) {
263 monitoring =
nullptr;
274 noise = noiseH->getNoise(offline_id,
gain);
282 catch (
const std::out_of_range &
err) {
296 per_detector_total_energy[
det] +=
energy;
297 det_n_noisy_channels[
det] += noisy_pos;
298 det_n_noisy_channels_Neg[
det] += noisy_neg;
299 det_n_badQ_channels[
det] += bad_quality;
300 dqm_superslot = feedthrough_number * ::numberOfSlotsPerFeedthrough(
det)
305 && is_atlas_ready && !larNoisyROAlgInTimeW_flag;
308 dqm_posn = 100 * (noisy_event && !larNoisyROAlgInTimeW_flag
309 && noisy_pos && is_atlas_ready);
310 dqm_negn = 100 * (noisy_event && !larNoisyROAlgInTimeW_flag
311 && noisy_neg && is_atlas_ready);
312 dqm_qual = 100 * (bad_quality && is_atlas_ready
313 && !larNoisyROAlgInTimeW_flag);
314 fill(monitoring, dqm_superslot, dqm_channel,
315 dqmf_occ, dqmf_sig, dqm_energy, dqm_gain,
316 dqm_posn, dqm_negn, dqm_qual);
322 if (significance != 0.) {
327 event_mean_time += datapoint;
328 mean_detector_times[
det] += datapoint;
329 mean_feb_times[feb_hash] += datapoint;
347 "quietITW", !larNoisyROAlgInTimeW_flag};
350 float percent_noisy = scaling * det_n_noisy_channels[
det];
351 float percent_bad_quality = scaling * det_n_badQ_channels[
det];
353 dqmf_burst_timevetoed = dqmf_burst && !larNoisyROAlgInTimeW_flag;
354 dqm_percent_noisy = percent_noisy;
355 dqm_percent_neg_noisy = scaling * det_n_noisy_channels_Neg[
det];
356 dqm_qnChan = det_n_badQ_channels[
det];
358 dqm_total_energy = per_detector_total_energy[
det];
362 dqm_percent_noisy, dqm_percent_neg_noisy,
363 dqmf_noNoisyRO, dqmf_noNoisyRO_W, dqmf_noNoisyRO_ITW,
364 dqmf_burst, dqmf_burst_timevetoed, dqmf_qburst,
369 dqmf_noNoisyRO_W, dqm_total_energy);
376 double t{event_mean_time.real() / event_mean_time.imag()};
377 for (
uint32_t h = 0;
h < mean_feb_times.size(); ++
h) {
378 wsum_t
w{mean_feb_times[
h]};
379 if (
w.imag() == 0.)
continue;
381 double t_feb =
w.real() /
w.imag();
387 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
virtual ~LArRawChannelMonAlg()
Gaudi::Property< bool > m_db_and_ofc_only
SG::ReadDecorHandleKey< xAOD::EventInfo > m_larFlagKey
size_type febHashMax(void) const
define feb hash tables max size
Gaudi::Property< std::vector< double > > m_occupancy_thresholds
LArBadChannelMask m_bcMask
ToolHandleArray< IDQFilterTool > m_atlasReady_tools
Gaudi::Property< std::vector< int > > m_pos_noise_thresholds
Gaudi::Property< bool > m_monitor_time
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
StatusCode buildBitMask(const std::vector< std::string > &problemsToMask, MsgStream &msg)
bool msgLvl(const MSG::Level lvl) const
id_iterator feb_begin() const
Returns an iterator pointing to a feb identifier collection.
Gaudi::Property< std::vector< double > > m_signal_thresholds
const std::string & key() const
Return the StoreGate ID for the referenced object.
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
bool cellShouldBeMasked(const LArBadChannelCont *bcCont, const HWIdentifier &hardwareId) const
@ LAr
The LAr calorimeter.
id_iterator channel_end() const
Definition of CaloDetDescrManager.
virtual StatusCode initialize() override
initialize
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Base class for Athena Monitoring Algorithms.
bool isFCALchannel(const HWIdentifier id) const
std::vector< std::string > tags
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
const LArOnlineID * m_lar_online_id_ptr
bool isEMECchannel(const HWIdentifier id) const override final
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Liquid Argon ROD output object base class.
::StatusCode StatusCode
StatusCode definition for legacy code.
Exception class for LAr online Identifiers.
Gaudi::Property< bool > m_monitor_detectors
Gaudi::Property< short > m_time_threshold
std::array< int, 8 > m_monitoring_tool_index
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
std::set< std::string > m_noise_streams_set
Gaudi::Property< unsigned short > m_quality_threshold
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
Gaudi::Property< bool > m_monitor_signal
Gaudi::Property< bool > m_monitor_burst
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
unsigned constexpr int sideA
Gaudi::Property< std::vector< std::string > > m_problemsToMask
void fill(H5::Group &out_file, size_t iterations)
id_iterator feb_end() const
ToolHandleArray< GenericMonitoringTool > m_tools
Array of Generic Monitoring Tools.
Gaudi::Property< std::vector< std::string > > m_noise_streams
std::vector< int8_t > m_feb_hash_to_detector
bool test(const uint16_t prov, const LArProvenance check)
Gaudi::Property< std::vector< double > > m_noise_burst_percent_thresholds
StatusCode initialize(bool used=true)
setEventNumber setTimeStamp bcid
Wrapper to avoid constant divisions when using units.
bool isEMBchannel(const HWIdentifier id) const
LArRawChannelMonAlg(const std::string &, ISvcLocator *)
virtual StatusCode initialize() override
initialize
Gaudi::Property< std::vector< int > > m_neg_noise_thresholds
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
#define ATH_MSG_WARNING(x)
SG::ReadCondHandleKey< CaloNoise > m_noiseKey
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
bool isHECchannel(const HWIdentifier id) const override final
Declare a monitored scalar variable.
std::array< uint32_t, 8 > m_det_to_nchannels
constexpr int pow(int base, int exp) noexcept
SG::ReadHandleKey< LArRawChannelContainer > m_LArRawChannel_container_key
id_iterator channel_begin() const
Returns an iterator pointing to a channel identifier collection.
Exception class for LAr Identifiers.
IdentifierHash feb_Hash(HWIdentifier febId) const
Create feb hash identifiers from feb identifiers.