Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
8 #ifndef LARRAWCONDITIONS_LARCONDITIONSCONTAINERDB_H
9 #define LARRAWCONDITIONS_LARCONDITIONSCONTAINERDB_H
43 #include <unordered_map>
62 typedef typename ConditionsMap::size_type
size_type;
70 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
77 MAP_ITERATOR febendit,
81 MAP_ITERATOR febendit,
197 if (m_febMap.size()==0) {
198 return m_dummyConstIt;
202 m_febMap.begin()->second->begin(),
212 if (m_febMap.size()==0) {
217 m_febMap.begin()->second->begin(),
228 if (m_febMap.size()==0) {
229 return m_dummyConstIt;
232 if(febIds.size()==0)
return end(onlineHelper);
235 for (
FebId id : febIds) {
236 it2 = m_febMap.find(
id);
237 if( it2 != m_febMap.end())
break;
239 if( it2 == m_febMap.end())
return end(onlineHelper);
242 it2->second->begin(),
256 if (m_febMap.size()==0) {
260 if(febIds.size()==0)
return end(onlineHelper);
263 for (
FebId id : febIds) {
264 it2 = m_febMap.find(
id);
265 if( it2 != m_febMap.end())
break;
267 if( it2 == m_febMap.end())
return end(onlineHelper);
270 it2->second->begin(),
284 if (m_febMap.size()==0) {
285 return m_dummyConstIt;
292 last_feb_it->second->end(),
304 if (m_febMap.size()==0) {
312 last_feb_it->second->end(),
320 #define ITERATORT iteratorT<MAP_ITERATOR, CHAN_ITERATOR, POINTER, REFERENCE>
323 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
333 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
337 CHAN_ITERATOR chanit,
338 MAP_ITERATOR febendit,
342 m_lastFebIt(febendit),
343 m_onlineHelper(onlineHelper),
348 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
352 CHAN_ITERATOR chanit,
353 MAP_ITERATOR febendit,
355 const FebIdVec& febIds)
359 m_lastFebIt(febendit),
360 m_onlineHelper(onlineHelper),
361 m_febIds(febIds.
size()),
365 MAP_ITERATOR lastFeb = m_lastFebIt;
373 if (febIds.size() && m_febIt != lastFeb) {
374 typename FebIdVec::const_iterator
it = febIds.begin();
375 typename FebIdVec::const_iterator last = febIds.end();
376 std::set<FebId> febIdsSet;
377 for (;
it != last; ++
it) febIdsSet.insert(*
it);
378 typename std::set<FebId>::const_iterator itSet = febIdsSet.begin();
379 typename std::set<FebId>::const_iterator lastSet = febIdsSet.end();
380 for (
unsigned int i = 0; itSet != lastSet; ++itSet, ++
i) m_febIds[
i] = (*itSet);
383 m_febIdsIndex = std::lower_bound(m_febIds.begin(), m_febIds.end(), m_febIt->first)
389 while (m_febIt != lastFeb && m_febIdsIndex < m_febIds.size() &&
390 m_febIds[m_febIdsIndex] != m_febIt->first) {
393 if (m_febIt->first < m_febIds[m_febIdsIndex]) {
402 if (m_febIt == lastFeb || m_febIdsIndex == m_febIds.size()) {
404 m_channelIt = m_lastFebIt->second->end();
405 m_febIt = m_lastFebIt;
408 if (m_febIds[m_febIdsIndex] != m_febIt->first) {
409 std::cout <<
"LArConditionsContainerDB<T>::iteratorT constructor - ERROR: NO MATCH FOUND"
417 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
421 {
return *m_channelIt; }
424 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
429 auto&
ref = *m_channelIt;
434 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
442 if (m_channelIt == m_febIt->second->end() && m_febIt != m_lastFebIt) {
448 if (m_febIds.size()) {
450 MAP_ITERATOR lastFeb = m_lastFebIt;
457 while (m_febIt != lastFeb && m_febIdsIndex < m_febIds.size() &&
458 m_febIds[m_febIdsIndex] != m_febIt->first) {
461 if (m_febIt->first < m_febIds[m_febIdsIndex]) {
469 if (m_febIt == lastFeb || m_febIdsIndex == m_febIds.size()) {
471 m_channelIt = m_lastFebIt->second->end();
472 m_febIt = m_lastFebIt;
477 if (m_febIds[m_febIdsIndex] != m_febIt->first) {
478 std::cout <<
"LArConditionsContainerDB<T>::iteratorT constructor - ERROR: NO MATCH FOUND"
486 m_channelIt = m_febIt->second->begin();
492 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
497 iteratorT
tmp = *
this;
503 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
507 (
const iteratorT&
a)
const
508 {
return (m_channelIt==
a.m_channelIt) && (m_febIt==
a.m_febIt); }
511 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
515 (
const iteratorT&
a)
const
516 {
return !(*
this ==
a); }
519 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
523 return m_febIt->first;
527 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
531 return (m_channelIt - m_febIt->second->begin());
535 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
544 template <
class MAP_ITERATOR,
class CHAN_ITERATOR,
class POINTER,
class REFERENCE>
550 if (m_onlineHelper) {
551 int chan = m_channelIt - m_febIt->second->begin();
552 return (m_onlineHelper->channel_Id(febId(),
chan));
568 if (
it == m_febHashMap.end()) {
570 std::cout <<
"LArConditionsContainerDB<T>::set ERROR could not find FEB ID "
571 << febId << std::endl;
592 typename ConditionsHashMap::const_iterator
it = m_febHashMap.find (febId);
593 if (
it == m_febHashMap.end()) {
595 return Traits::empty();
604 return Traits::empty();
614 if (
it == m_febHashMap.end()) {
615 throw std::runtime_error (
"Unknown FEB");
628 return m_febHashMap.find (
id) != m_febHashMap.end();
644 return (m_febMap.size());
662 for (
const auto& pp :
p->m_febMap) {
663 m_febMap[pp.first] = pp.second;
664 m_febHashMap[pp.first] = pp.second;
673 m_febMap[
id] = channelVec;
674 m_febHashMap[
id] = channelVec;
683 m_febHashMap.erase(
id);
JetConstituentVector::iterator iterator
std::vector< T > ChannelVector
bool operator!=(const iteratorT &a) const
Traits::ChannelVector ChannelVector
CHAN_ITERATOR m_channelIt
ConditionsMap::const_iterator ConstConditionsMapIterator
HWIdentifier channelId() const
ConditionsHashMap m_febHashMap
size_type size() const
Size of map.
iteratorT(MAP_ITERATOR febit, CHAN_ITERATOR chanit, MAP_ITERATOR febendit, const LArOnlineID_Base *onlineHelper)
const LArOnlineID_Base * m_onlineHelper
const_iterator end(const LArOnlineID_Base *onlineHelper) const
Declaration of const iterator.
ChannelVector * ChannelVectorPointer
std::vector< size_t > vec
std::unordered_map< FebId, ChannelVectorPointer > ConditionsHashMap
ChannelVector::iterator ChannelIt
void setGain(int g)
set gain
bool operator==(const iteratorT &a) const
std::map< FebId, ChannelVectorPointer > ConditionsMap
LArConditionsSubsetTraits< T > Traits
void set(const FebId id, const int channel, const T &payload)
Setter.
ConditionsMap::iterator ConditionsMapIterator
std::vector< FebId > FebIdVec
iteratorT operator++(int)
SiLocalPosition operator*(const SiLocalPosition &position, const double factor)
Reference getNonConst(const FebId id, const int channel)
non-const get function (might extend FEB map)
void add(const LArConditionsContainerDB< T > *p)
const ConditionsMap& getConditionsMap()const { return m_febMap ;} ;
unsigned int m_febIdsIndex
const std::vector< T > ConstChannelVector
LArConditionsContainerDB template class Author: Walter Lampl Initial Version: April,...
TGCHBChip operator++(TGCHBChip &rs, int)
ConstReference get(const FebId id, const int channel) const
Getter.
Helper for the Liquid Argon Calorimeter cell identifiers.
const_iterator begin(const LArOnlineID_Base *onlineHelper) const
Iterator over all channels.
ChannelVector::const_iterator ConstChannelIt
POINTER operator->() const
This file defines the template class used for I/O of conditions data.
iteratorT< ConditionsMapIterator, ChannelIt, Pointer, Reference > iterator
Traits::ConstReference ConstReference
Traits::ChannelVectorPointer ChannelVectorPointer
iteratorT< ConstConditionsMapIterator, ConstChannelIt, ConstPointer, ConstReference > const_iterator
const boost::regex ref(r_ef)
Traits::Reference Reference
LArConditionsContainerDB(unsigned int gain=0)
Constructor with gain.
HWIdentifier febId() const
void erase(FebId id)
erase element for this FebId
Traits::ConstChannelVector ConstChannelVector
bool exist(FebId id) const
Do conditions for FebId? Used by writers to check whether add is needed.
Traits::ConstPointer ConstPointer
const const_iterator m_dummyConstIt
REFERENCE operator*() const
ConditionsMap::size_type size_type
Traits class giving the types to use for the objects contained within the subset.
int getGain() const
access to gain
iteratorT(MAP_ITERATOR febit, CHAN_ITERATOR chanit, MAP_ITERATOR febendit, const LArOnlineID_Base *onlineHelper, const FebIdVec &febIds)