Skip to content
Snippets Groups Projects
Commit f1c2f685 authored by Julien Maurer's avatar Julien Maurer
Browse files

Merge branch 'cherry-pick-e1336264-22.0' into '22.0'

Sweeping !57131 from master to 22.0.
LArRawConditions: Fix thread-safety checker warnings.

See merge request !57181
parents 6aa3162e 494da7b2
4 merge requests!69091Fix correlated smearing bug in JER in JetUncertainties in 22.0,!58791DataQualityConfigurations: Modify L1Calo config for web display,!572112022-10-03: daily merge of 22.0 into master,!57181Sweeping !57131 from master to 22.0. LArRawConditions: Fix thread-safety checker warnings.
// This file's extension implies that it's C, but it's really -*- C++ -*-. // This file's extension implies that it's C, but it's really -*- C++ -*-.
/* /*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/ */
/** /**
* @file LArRawConditions/LArCompactSubset.h * @file LArRawConditions/LArCompactSubset.h
...@@ -272,14 +272,14 @@ public: ...@@ -272,14 +272,14 @@ public:
/** /**
* @brief Constructor from channel index and subset reference. * @brief Constructor from channel index and subset reference.
*/ */
const_iterator (unsigned int chan, LArCompactSubsetVector& subset); const_iterator (unsigned int chan, const LArCompactSubsetVector& subset);
/** /**
* @brief Iterator dereference. * @brief Iterator dereference.
* Yields a channel proxy. * Yields a channel proxy.
*/ */
LArCompactSubsetChannelProxy operator*() const; LArCompactSubsetConstChannelProxy operator*() const;
/** /**
...@@ -319,7 +319,7 @@ public: ...@@ -319,7 +319,7 @@ public:
unsigned int m_chan; unsigned int m_chan;
/// Subset within which we live. /// Subset within which we live.
LArCompactSubsetVector* m_subset; const LArCompactSubsetVector* m_subset;
}; };
...@@ -346,7 +346,14 @@ public: ...@@ -346,7 +346,14 @@ public:
* @brief Vector indexing. Returns a channel proxy. * @brief Vector indexing. Returns a channel proxy.
* @param i Channel index within the vector. * @param i Channel index within the vector.
*/ */
LArCompactSubsetChannelProxy operator[] (size_t i) const; LArCompactSubsetChannelProxy operator[] (size_t i);
/**
* @brief Vector indexing. Returns a channel proxy.
* @param i Channel index within the vector.
*/
LArCompactSubsetConstChannelProxy operator[] (size_t i) const;
/// Begin iterator. /// Begin iterator.
...@@ -446,7 +453,13 @@ public: ...@@ -446,7 +453,13 @@ public:
/** /**
* @brief `Dereference' the pointer. * @brief `Dereference' the pointer.
*/ */
LArCompactSubsetChannelVector operator*() const; LArCompactSubsetChannelVector operator*();
/**
* @brief `Dereference' the pointer.
*/
LArCompactSubsetConstChannelVector operator*() const;
/** /**
...@@ -571,14 +584,14 @@ public: ...@@ -571,14 +584,14 @@ public:
* @brief Adjust iterator. * @brief Adjust iterator.
* @param delta Amount by which to advance the iterator. * @param delta Amount by which to advance the iterator.
*/ */
iterator operator+ (size_t delta) const; iterator operator+ (size_t delta);
/** /**
* @brief Iterator difference. * @brief Iterator difference.
* @param other Other iterator for difference. * @param other Other iterator for difference.
*/ */
difference_type operator- (const iterator& other) const; difference_type operator- (const iterator& other);
private: private:
......
/* /*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/ */
/** /**
* @file LArRawConditions/LArCompactSubset.icc * @file LArRawConditions/LArCompactSubset.icc
...@@ -276,7 +276,7 @@ LArCompactSubsetChannelVector::const_iterator::const_iterator() ...@@ -276,7 +276,7 @@ LArCompactSubsetChannelVector::const_iterator::const_iterator()
*/ */
inline inline
LArCompactSubsetChannelVector::const_iterator::const_iterator LArCompactSubsetChannelVector::const_iterator::const_iterator
(unsigned int chan, LArCompactSubsetVector& subset) (unsigned int chan, const LArCompactSubsetVector& subset)
: m_chan (chan), : m_chan (chan),
m_subset (&subset) m_subset (&subset)
{ {
...@@ -300,10 +300,10 @@ LArCompactSubsetChannelVector::const_iterator::operator++() ...@@ -300,10 +300,10 @@ LArCompactSubsetChannelVector::const_iterator::operator++()
* Yields a channel proxy. * Yields a channel proxy.
*/ */
inline inline
LArCompactSubsetChannelProxy LArCompactSubsetConstChannelProxy
LArCompactSubsetChannelVector::const_iterator::operator*() const LArCompactSubsetChannelVector::const_iterator::operator*() const
{ {
return LArCompactSubsetChannelProxy (m_chan, *m_subset); return LArCompactSubsetConstChannelProxy (m_chan, *m_subset);
} }
...@@ -385,7 +385,7 @@ size_t LArCompactSubsetChannelVector::size() const ...@@ -385,7 +385,7 @@ size_t LArCompactSubsetChannelVector::size() const
*/ */
inline inline
LArCompactSubsetChannelProxy LArCompactSubsetChannelProxy
LArCompactSubsetChannelVector::operator[] (size_t i) const LArCompactSubsetChannelVector::operator[] (size_t i)
{ {
unsigned int chan = m_subset->chanIndex (m_febIndex) + i; unsigned int chan = m_subset->chanIndex (m_febIndex) + i;
assert (chan <= m_subset->chanIndex (m_febIndex+1)); assert (chan <= m_subset->chanIndex (m_febIndex+1));
...@@ -393,6 +393,20 @@ LArCompactSubsetChannelVector::operator[] (size_t i) const ...@@ -393,6 +393,20 @@ LArCompactSubsetChannelVector::operator[] (size_t i) const
} }
/**
* @brief Vector indexing. Returns a channel proxy.
* @param i Channel index within the vector.
*/
inline
LArCompactSubsetConstChannelProxy
LArCompactSubsetChannelVector::operator[] (size_t i) const
{
unsigned int chan = m_subset->chanIndex (m_febIndex) + i;
assert (chan <= m_subset->chanIndex (m_febIndex+1));
return LArCompactSubsetConstChannelProxy (chan, *m_subset);
}
/** /**
* @brief Begin iterator. * @brief Begin iterator.
*/ */
...@@ -499,12 +513,23 @@ LArCompactSubsetChannelVectorPointer::LArCompactSubsetChannelVectorPointer ...@@ -499,12 +513,23 @@ LArCompactSubsetChannelVectorPointer::LArCompactSubsetChannelVectorPointer
*/ */
inline inline
LArCompactSubsetChannelVector LArCompactSubsetChannelVector
LArCompactSubsetChannelVectorPointer::operator*() const LArCompactSubsetChannelVectorPointer::operator*()
{ {
return LArCompactSubsetChannelVector (m_febIndex, m_subset); return LArCompactSubsetChannelVector (m_febIndex, m_subset);
} }
/**
* @brief `Dereference' the pointer.
*/
inline
LArCompactSubsetConstChannelVector
LArCompactSubsetChannelVectorPointer::operator*() const
{
return LArCompactSubsetConstChannelVector (m_febIndex, m_subset);
}
/** /**
* @brief `Dereference' the pointer. * @brief `Dereference' the pointer.
*/ */
...@@ -616,7 +641,7 @@ LArCompactSubsetVector::iterator::operator++() ...@@ -616,7 +641,7 @@ LArCompactSubsetVector::iterator::operator++()
*/ */
inline inline
LArCompactSubsetVector::iterator LArCompactSubsetVector::iterator
LArCompactSubsetVector::iterator::operator+ (size_t delta) const LArCompactSubsetVector::iterator::operator+ (size_t delta)
{ {
return iterator (m_febIndex + delta, m_subset); return iterator (m_febIndex + delta, m_subset);
} }
...@@ -628,7 +653,7 @@ LArCompactSubsetVector::iterator::operator+ (size_t delta) const ...@@ -628,7 +653,7 @@ LArCompactSubsetVector::iterator::operator+ (size_t delta) const
*/ */
inline inline
LArCompactSubsetVector::iterator::difference_type LArCompactSubsetVector::iterator::difference_type
LArCompactSubsetVector::iterator::operator- (const iterator& other) const LArCompactSubsetVector::iterator::operator- (const iterator& other)
{ {
return m_febIndex - other.m_febIndex; return m_febIndex - other.m_febIndex;
} }
......
//Dear emacs, this is -*- c++ -*- //Dear emacs, this is -*- c++ -*-
/* /*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/ */
...@@ -51,6 +51,7 @@ public: ...@@ -51,6 +51,7 @@ public:
typedef LArConditionsSubsetTraits<T> Traits; typedef LArConditionsSubsetTraits<T> Traits;
typedef typename Traits::FebId FebId; typedef typename Traits::FebId FebId;
typedef typename Traits::ChannelVector ChannelVector; typedef typename Traits::ChannelVector ChannelVector;
typedef typename Traits::ConstChannelVector ConstChannelVector;
typedef typename Traits::ChannelVectorPointer ChannelVectorPointer; typedef typename Traits::ChannelVectorPointer ChannelVectorPointer;
typedef typename std::map<FebId, ChannelVectorPointer > ConditionsMap; typedef typename std::map<FebId, ChannelVectorPointer > ConditionsMap;
typedef typename std::unordered_map<FebId, ChannelVectorPointer > ConditionsHashMap; typedef typename std::unordered_map<FebId, ChannelVectorPointer > ConditionsHashMap;
...@@ -594,7 +595,7 @@ LArConditionsContainerDB<T>::get(const FebId febId, const int channel) const ...@@ -594,7 +595,7 @@ LArConditionsContainerDB<T>::get(const FebId febId, const int channel) const
return Traits::empty(); return Traits::empty();
} }
const ChannelVector& vec = *it->second; const ConstChannelVector& vec = *it->second;
// First check the size - channel vec may be empty // First check the size - channel vec may be empty
if (channel < static_cast<int>(vec.size())) { if (channel < static_cast<int>(vec.size())) {
return vec[channel]; return vec[channel];
......
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