ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
LArConditionsSubset< T > Class Template Reference

template class for use for I/O of conditions data More...

#include <LArConditionsSubset.h>

Collaboration diagram for LArConditionsSubset< T >:

Classes

class  PairSort
 

Public Types

typedef LArConditionsSubsetTraits< T > Traits
 Public typedefs for FEB id and channel vector - Subset. More...
 
typedef Traits::FebId FebId
 
typedef Traits::ChannelVector ChannelVector
 
typedef Traits::ConstChannelVector ConstChannelVector
 
typedef Traits::FebPair FebPair
 
typedef Traits::FebPairReference FebPairReference
 
typedef Traits::SubsetVector SubsetVector
 
typedef SubsetVector::const_iterator ConstSubsetIt
 
typedef SubsetVector::iterator SubsetIt
 
typedef Traits::Reference Reference
 
typedef Traits::ConstReference ConstReference
 
typedef Traits::Pointer Pointer
 
typedef Traits::ConstPointer ConstPointer
 
typedef T Payload
 Public typedefs for channel id and T vector - CorrectionSet. More...
 
typedef unsigned int ChannelId
 
typedef std::pair< ChannelId, T > CorrectionPair
 
typedef std::vector< CorrectionPairCorrectionVec
 
typedef CorrectionVec::const_iterator ConstCorrectionVecIt
 
typedef CorrectionVec::iterator CorrectionVecIt
 
typedef CorrectionVec::size_type size_type
 

Public Member Functions

 LArConditionsSubset ()
 Default constructor. More...
 
 LArConditionsSubset (unsigned int gain)
 Constructor for corrections - only need gain. More...
 
 LArConditionsSubset (const std::vector< FebId > &ids, unsigned int gain)
 Constructor with initializing set of FEB ids. More...
 
template<class U , class COPIER >
void assign (const LArConditionsSubset< U > &other, COPIER copier)
 Copy from another subset object. More...
 
virtual ~LArConditionsSubset ()
 destructor More...
 
ConstSubsetIt findChannelVector (FebId febId) const
 Access to a channel vector of a given FEB. More...
 
SubsetIt findChannelVector (FebId febId)
 Access to a channel vector of a given FEB. More...
 
ConstSubsetIt subsetBegin () const
 Iterators over subset. More...
 
ConstSubsetIt subsetEnd () const
 
SubsetIt subsetBegin ()
 
SubsetIt subsetEnd ()
 
size_type subsetSize () const
 Size of subset. More...
 
ConstCorrectionVecIt findConditionsObj (ChannelId id) const
 Access to a conditions object for a given channel id - searches channel set ONLY. More...
 
ConstCorrectionVecIt correctionVecBegin () const
 Iterators over channel set. More...
 
ConstCorrectionVecIt correctionVecEnd () const
 
size_type correctionVecSize () const
 Size of channel set. More...
 
unsigned int gain () const
 Access to gain. More...
 
unsigned int channel () const
 Access to the COOL channel number. More...
 
unsigned int groupingType () const
 Type of grouping - defined in LArConditionsContainerBase.h. More...
 
unsigned int nConditions () const
 Number of conditions objects in this subset. More...
 
void initialize (const std::vector< FebId > &ids, unsigned int gain)
 Initialize with set of FEB ids. More...
 
void shrink_to_fit ()
 Reallocate to match size actually used. More...
 
void setGain (unsigned int gain)
 set gain More...
 
void setChannel (unsigned int channel)
 set the COOL channel number More...
 
void setGroupingType (unsigned int type)
 set the type of grouping - defined in LArConditionsContainerBase.h More...
 
void insertCorrection (ChannelId id, const T &cond)
 Insert a new channel id / T pair correction. More...
 
void insertCorrections (CorrectionVec &&corrs)
 Insert a group of corrections. More...
 
unsigned channelVectorSize () const
 
void fillMap ()
 Fill map from vector. More...
 

Private Types

typedef std::map< FebId, unsigned int > SubsetMap
 

Private Attributes

SubsetMap m_subsetMap
 
SubsetVector m_subset
 
unsigned int m_gain
 
unsigned int m_channel
 
unsigned int m_groupingType
 
CorrectionVec m_correctionVec
 

Detailed Description

template<class T>
class LArConditionsSubset< T >

template class for use for I/O of conditions data

This class contains conditions objects of type T. There are two ways that conditions objects may be stored:

1) as a vector of FEB ID, vector<T> pairs where T is the conditions data for each channel in a FEB of a particular ID. 2) as a vector of Channel ID, T pairs, where T is the conditions data for a particular channel id

The first way is labelled "subset" and is how the bulk of conditions data is stored. It is efficient in access and storage. The second way is labelled "channel set" and is used for storing a correction set for individual channels.

LArConditionsContainer uses this class to store conditions in different groupings where each group is a different LArConditionsSubset. And as well, the "correction set" is another LArConditionsSubset.

For some types of payload, we want to allow for alternate storage layouts, to save memory. This is allowed by the LArConditionsSubsetTraits class; using this, one can substitute alternate classes for the types contained in the subset. (This is used for LArShapeP2/LArOFCP1, to collect all the data together to reduce overhead; the contained types then become proxies that access that data.)

Definition at line 121 of file LArConditionsSubset.h.

Member Typedef Documentation

◆ ChannelId

template<class T >
typedef unsigned int LArConditionsSubset< T >::ChannelId

Definition at line 142 of file LArConditionsSubset.h.

◆ ChannelVector

template<class T >
typedef Traits::ChannelVector LArConditionsSubset< T >::ChannelVector

Definition at line 128 of file LArConditionsSubset.h.

◆ ConstChannelVector

Definition at line 129 of file LArConditionsSubset.h.

◆ ConstCorrectionVecIt

template<class T >
typedef CorrectionVec::const_iterator LArConditionsSubset< T >::ConstCorrectionVecIt

Definition at line 145 of file LArConditionsSubset.h.

◆ ConstPointer

template<class T >
typedef Traits::ConstPointer LArConditionsSubset< T >::ConstPointer

Definition at line 138 of file LArConditionsSubset.h.

◆ ConstReference

template<class T >
typedef Traits::ConstReference LArConditionsSubset< T >::ConstReference

Definition at line 136 of file LArConditionsSubset.h.

◆ ConstSubsetIt

template<class T >
typedef SubsetVector::const_iterator LArConditionsSubset< T >::ConstSubsetIt

Definition at line 133 of file LArConditionsSubset.h.

◆ CorrectionPair

template<class T >
typedef std::pair<ChannelId, T> LArConditionsSubset< T >::CorrectionPair

Definition at line 143 of file LArConditionsSubset.h.

◆ CorrectionVec

template<class T >
typedef std::vector<CorrectionPair> LArConditionsSubset< T >::CorrectionVec

Definition at line 144 of file LArConditionsSubset.h.

◆ CorrectionVecIt

template<class T >
typedef CorrectionVec::iterator LArConditionsSubset< T >::CorrectionVecIt

Definition at line 146 of file LArConditionsSubset.h.

◆ FebId

template<class T >
typedef Traits::FebId LArConditionsSubset< T >::FebId

Definition at line 127 of file LArConditionsSubset.h.

◆ FebPair

template<class T >
typedef Traits::FebPair LArConditionsSubset< T >::FebPair

Definition at line 130 of file LArConditionsSubset.h.

◆ FebPairReference

Definition at line 131 of file LArConditionsSubset.h.

◆ Payload

template<class T >
typedef T LArConditionsSubset< T >::Payload

Public typedefs for channel id and T vector - CorrectionSet.

Definition at line 141 of file LArConditionsSubset.h.

◆ Pointer

template<class T >
typedef Traits::Pointer LArConditionsSubset< T >::Pointer

Definition at line 137 of file LArConditionsSubset.h.

◆ Reference

template<class T >
typedef Traits::Reference LArConditionsSubset< T >::Reference

Definition at line 135 of file LArConditionsSubset.h.

◆ size_type

template<class T >
typedef CorrectionVec::size_type LArConditionsSubset< T >::size_type

Definition at line 147 of file LArConditionsSubset.h.

◆ SubsetIt

template<class T >
typedef SubsetVector::iterator LArConditionsSubset< T >::SubsetIt

Definition at line 134 of file LArConditionsSubset.h.

◆ SubsetMap

template<class T >
typedef std::map<FebId, unsigned int> LArConditionsSubset< T >::SubsetMap
private

Definition at line 255 of file LArConditionsSubset.h.

◆ SubsetVector

template<class T >
typedef Traits::SubsetVector LArConditionsSubset< T >::SubsetVector

Definition at line 132 of file LArConditionsSubset.h.

◆ Traits

template<class T >
typedef LArConditionsSubsetTraits<T> LArConditionsSubset< T >::Traits

Public typedefs for FEB id and channel vector - Subset.

Definition at line 126 of file LArConditionsSubset.h.

Constructor & Destructor Documentation

◆ LArConditionsSubset() [1/3]

template<class T >
LArConditionsSubset< T >::LArConditionsSubset
inline

Default constructor.

Definition at line 292 of file LArConditionsSubset.h.

293  :
294  m_gain(0),
295  m_channel(0),
296  m_groupingType(0)
297 {}

◆ LArConditionsSubset() [2/3]

template<class T >
LArConditionsSubset< T >::LArConditionsSubset ( unsigned int  gain)
inline

Constructor for corrections - only need gain.

Definition at line 301 of file LArConditionsSubset.h.

302  :
303  m_gain(gain),
304  m_channel(0),
305  m_groupingType(0)
306 {}

◆ LArConditionsSubset() [3/3]

template<class T >
LArConditionsSubset< T >::LArConditionsSubset ( const std::vector< FebId > &  ids,
unsigned int  gain 
)
inline

Constructor with initializing set of FEB ids.

Definition at line 310 of file LArConditionsSubset.h.

312  :
313  m_subset(ids.size()),
314  m_gain(gain),
315  m_channel(0),
316  m_groupingType(0)
317 
318 {
319 
320 // std::cout << "LArConditionsSubset: ids size, gain "
321 // << ids.size() << " " << gain
322 // << std::endl;
323 
324  // Loop over fed id list, insert id and resize channel vector
325  for (unsigned int i = 0; i < ids.size(); ++i) {
326  m_subset[i].first = ids[i];
327  // NOTE: we move the resize of the channel vector for each feb
328  // to the non-const find method below. This allows to keep the
329  // overall subset size to a minimum for non-full subsets..
330  //m_subset[i].second.resize(channelVectorSize());
331  }
332  // Fill map for future lookups
333  fillMap();
334 }

◆ ~LArConditionsSubset()

template<class T >
LArConditionsSubset< T >::~LArConditionsSubset
inlinevirtual

destructor

Definition at line 363 of file LArConditionsSubset.h.

364 {}

Member Function Documentation

◆ assign()

template<class T >
template<class U , class COPIER >
void LArConditionsSubset< T >::assign ( const LArConditionsSubset< U > &  other,
COPIER  copier 
)

Copy from another subset object.

COPIER is a functional to copy the payload, with signature (const T&, T*)

Definition at line 339 of file LArConditionsSubset.h.

341 {
342  m_subsetMap.clear();
343  m_gain = other.gain();
344  m_channel = other.channel();
345  m_groupingType = other.groupingType();
346 
347  Traits::copySubset (other.subsetBegin(), other.subsetEnd(), m_subset, copier);
348 
349  size_t corrsz = other.correctionVecSize();
350  auto otherCorr = other.correctionVecBegin();
351  m_correctionVec.resize (corrsz);
352  for (size_t i = 0; i < corrsz; i++) {
353  m_correctionVec[i].first = otherCorr[i].first;
354  copier (otherCorr[i].second, m_correctionVec[i].second);
355  }
356 
357  fillMap();
358 }

◆ channel()

template<class T >
unsigned int LArConditionsSubset< T >::channel
inline

Access to the COOL channel number.

Definition at line 498 of file LArConditionsSubset.h.

499 {
500  return (m_channel);
501 }

◆ channelVectorSize()

template<class T >
unsigned LArConditionsSubset< T >::channelVectorSize
inline

Definition at line 608 of file LArConditionsSubset.h.

609 {
610  //SuperCells have 320 channels per FEB, the regular readout has 128.
612 }

◆ correctionVecBegin()

template<class T >
LArConditionsSubset< T >::ConstCorrectionVecIt LArConditionsSubset< T >::correctionVecBegin

Iterators over channel set.

Definition at line 465 of file LArConditionsSubset.h.

466 {
467  return (m_correctionVec.begin());
468 }

◆ correctionVecEnd()

template<class T >
LArConditionsSubset< T >::ConstCorrectionVecIt LArConditionsSubset< T >::correctionVecEnd

Definition at line 472 of file LArConditionsSubset.h.

473 {
474  return (m_correctionVec.end());
475 }

◆ correctionVecSize()

template<class T >
LArConditionsSubset< T >::size_type LArConditionsSubset< T >::correctionVecSize

Size of channel set.

Definition at line 481 of file LArConditionsSubset.h.

482 {
483  return (m_correctionVec.size());
484 }

◆ fillMap()

template<class T >
void LArConditionsSubset< T >::fillMap
inline

Fill map from vector.

Definition at line 271 of file LArConditionsSubset.h.

272 {
273  // Fill map from subset
274  m_subsetMap.clear();
275 
276 // std::cout << "fillMap: subset size, map size "
277 // << m_subset.size() << " " << m_subsetMap.size()
278 // << std::endl;
279 
280  for (unsigned int i = 0; i < m_subset.size(); ++i) {
281  m_subsetMap[m_subset[i].first] = i;
282  }
283 
284 // std::cout << "fillMap: subset size, map size "
285 // << m_subset.size() << " " << m_subsetMap.size()
286 // << std::endl;
287 }

◆ findChannelVector() [1/2]

template<class T >
LArConditionsSubset< T >::SubsetIt LArConditionsSubset< T >::findChannelVector ( FebId  febId)
inline

Access to a channel vector of a given FEB.

Definition at line 370 of file LArConditionsSubset.h.

371 {
372 
373 // std::cout << "findChannelVector: febid, size "
374 // << febID << " " << m_subsetMap.size()
375 // << std::endl;
376 
377 
378  typename SubsetMap::const_iterator it = m_subsetMap.find(febID);
379  if (it != m_subsetMap.end()) {
380  unsigned int index = (*it).second;
381  if (index < m_subset.size()) {
382  // check that channel vector has been resized already
383  if (m_subset[index].second.size() == 0) {
384  m_subset[index].second.resize(channelVectorSize());
385  }
386  return (m_subset.begin() + index);
387  }
388  }
389  return (m_subset.end());
390 }

◆ findChannelVector() [2/2]

template<class T >
LArConditionsSubset< T >::ConstSubsetIt LArConditionsSubset< T >::findChannelVector ( FebId  febId) const
inline

Access to a channel vector of a given FEB.

Definition at line 396 of file LArConditionsSubset.h.

397 {
398  typename SubsetMap::const_iterator it = m_subsetMap.find(febID);
399  if (it != m_subsetMap.end()) {
400  unsigned int index = (*it).second;
401  if (index < m_subset.size()) {
402  return (m_subset.begin() + index);
403  }
404  }
405  return (m_subset.end());
406 }

◆ findConditionsObj()

template<class T >
LArConditionsSubset< T >::ConstCorrectionVecIt LArConditionsSubset< T >::findConditionsObj ( ChannelId  id) const

Access to a conditions object for a given channel id - searches channel set ONLY.

Definition at line 451 of file LArConditionsSubset.h.

452 {
453  ConstCorrectionVecIt result = (std::lower_bound(m_correctionVec.begin(),
454  m_correctionVec.end(),
455  CorrectionPair(id, T()),
456  PairSort()));
457  if ( m_correctionVec.end() != result && id != result->first ) {
458  result = m_correctionVec.end();
459  }
460  return (result);
461 }

◆ gain()

template<class T >
unsigned int LArConditionsSubset< T >::gain
inline

Access to gain.

Definition at line 490 of file LArConditionsSubset.h.

491 {
492  return (m_gain);
493 }

◆ groupingType()

template<class T >
unsigned int LArConditionsSubset< T >::groupingType
inline

Type of grouping - defined in LArConditionsContainerBase.h.

Definition at line 507 of file LArConditionsSubset.h.

508 {
509  return (m_groupingType);
510 }

◆ initialize()

template<class T >
void LArConditionsSubset< T >::initialize ( const std::vector< FebId > &  ids,
unsigned int  gain 
)
inline

Initialize with set of FEB ids.

Definition at line 529 of file LArConditionsSubset.h.

530 {
531  m_correctionVec.clear();
532 
533  // resize the subset
534  m_subset.resize(ids.size());
535  m_gain = gain;
536 
537  // Loop over fed id list, insert id and resize channel vector
538  for (unsigned int i = 0; i < ids.size(); ++i) {
539  m_subset[i].first = ids[i];
540  m_subset[i].second.resize(channelVectorSize());
541  }
542 
543  // Fill map for future lookups
544  fillMap();
545 }

◆ insertCorrection()

template<class T >
void LArConditionsSubset< T >::insertCorrection ( ChannelId  id,
const T &  cond 
)
inline

Insert a new channel id / T pair correction.

If new channel id is the same as an existing one, the new T replaces the old T

Definition at line 583 of file LArConditionsSubset.h.

584 {
585  m_correctionVec.push_back(CorrectionPair(id,cond));
586  std::sort(m_correctionVec.begin(), m_correctionVec.end(), PairSort());
587 }

◆ insertCorrections()

template<class T >
void LArConditionsSubset< T >::insertCorrections ( CorrectionVec &&  corrs)
inline

Insert a group of corrections.

They must be properly sorted.

Definition at line 593 of file LArConditionsSubset.h.

594 {
595  if (m_correctionVec.empty()) {
596  m_correctionVec = std::move (corrs);
597  }
598  else {
599  m_correctionVec.insert (m_correctionVec.end(), corrs.begin(), corrs.end());
600  std::sort(m_correctionVec.begin(), m_correctionVec.end(), PairSort());
601  }
602 }

◆ nConditions()

template<class T >
unsigned int LArConditionsSubset< T >::nConditions
inline

Number of conditions objects in this subset.

Definition at line 515 of file LArConditionsSubset.h.

516 {
517  unsigned int tot = 0;
518  for (unsigned int i = 0; i < m_subset.size(); ++i) {
519  tot += m_subset[i].second.size();
520  }
521  return (tot);
522 }

◆ setChannel()

template<class T >
void LArConditionsSubset< T >::setChannel ( unsigned int  channel)
inline

set the COOL channel number

Definition at line 567 of file LArConditionsSubset.h.

568 {
569  m_channel = channel;
570 }

◆ setGain()

template<class T >
void LArConditionsSubset< T >::setGain ( unsigned int  gain)
inline

set gain

Definition at line 559 of file LArConditionsSubset.h.

560 {
561  m_gain = gain;
562 }

◆ setGroupingType()

template<class T >
void LArConditionsSubset< T >::setGroupingType ( unsigned int  type)
inline

set the type of grouping - defined in LArConditionsContainerBase.h

Definition at line 575 of file LArConditionsSubset.h.

576 {
578 }

◆ shrink_to_fit()

template<class T >
void LArConditionsSubset< T >::shrink_to_fit
inline

Reallocate to match size actually used.

Definition at line 550 of file LArConditionsSubset.h.

551 {
552  m_subset.shrink_to_fit();
553 }

◆ subsetBegin() [1/2]

template<class T >
LArConditionsSubset< T >::SubsetIt LArConditionsSubset< T >::subsetBegin
inline

Definition at line 428 of file LArConditionsSubset.h.

429 {
430  return (m_subset.begin());
431 }

◆ subsetBegin() [2/2]

template<class T >
LArConditionsSubset< T >::ConstSubsetIt LArConditionsSubset< T >::subsetBegin
inline

Iterators over subset.

Definition at line 412 of file LArConditionsSubset.h.

413 {
414  return (m_subset.begin());
415 }

◆ subsetEnd() [1/2]

template<class T >
LArConditionsSubset< T >::SubsetIt LArConditionsSubset< T >::subsetEnd
inline

Definition at line 436 of file LArConditionsSubset.h.

437 {
438  return (m_subset.end());
439 }

◆ subsetEnd() [2/2]

template<class T >
LArConditionsSubset< T >::ConstSubsetIt LArConditionsSubset< T >::subsetEnd
inline

Definition at line 420 of file LArConditionsSubset.h.

421 {
422  return (m_subset.end());
423 }

◆ subsetSize()

template<class T >
LArConditionsSubset< T >::size_type LArConditionsSubset< T >::subsetSize
inline

Size of subset.

Definition at line 444 of file LArConditionsSubset.h.

445 {
446  return (m_subset.size());
447 }

Member Data Documentation

◆ m_channel

template<class T >
unsigned int LArConditionsSubset< T >::m_channel
private

Definition at line 260 of file LArConditionsSubset.h.

◆ m_correctionVec

template<class T >
CorrectionVec LArConditionsSubset< T >::m_correctionVec
private

Definition at line 262 of file LArConditionsSubset.h.

◆ m_gain

template<class T >
unsigned int LArConditionsSubset< T >::m_gain
private

Definition at line 259 of file LArConditionsSubset.h.

◆ m_groupingType

template<class T >
unsigned int LArConditionsSubset< T >::m_groupingType
private

Definition at line 261 of file LArConditionsSubset.h.

◆ m_subset

template<class T >
SubsetVector LArConditionsSubset< T >::m_subset
private

Definition at line 258 of file LArConditionsSubset.h.

◆ m_subsetMap

template<class T >
SubsetMap LArConditionsSubset< T >::m_subsetMap
private

Definition at line 257 of file LArConditionsSubset.h.


The documentation for this class was generated from the following file:
LArConditionsContainerBase::SuperCells
@ SuperCells
Definition: LArConditionsContainerBase.h:51
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
get_generator_info.result
result
Definition: get_generator_info.py:21
LArConditionsSubset::m_gain
unsigned int m_gain
Definition: LArConditionsSubset.h:259
index
Definition: index.py:1
LArConditionsSubset::m_channel
unsigned int m_channel
Definition: LArConditionsSubset.h:260
LArConditionsSubset::channelVectorSize
unsigned channelVectorSize() const
Definition: LArConditionsSubset.h:608
skel.it
it
Definition: skel.GENtoEVGEN.py:423
LArConditionsSubset::m_subset
SubsetVector m_subset
Definition: LArConditionsSubset.h:258
LArConditionsSubset::ConstCorrectionVecIt
CorrectionVec::const_iterator ConstCorrectionVecIt
Definition: LArConditionsSubset.h:145
LArConditionsSubset::fillMap
void fillMap()
Fill map from vector.
Definition: LArConditionsSubset.h:271
LArConditionsSubset::m_correctionVec
CorrectionVec m_correctionVec
Definition: LArConditionsSubset.h:262
lumiFormat.i
int i
Definition: lumiFormat.py:92
LArConditionsSubset::channel
unsigned int channel() const
Access to the COOL channel number.
Definition: LArConditionsSubset.h:498
LArConditionsSubset::m_subsetMap
SubsetMap m_subsetMap
Definition: LArConditionsSubset.h:257
LB_AnalMapSplitter.tot
tot
Definition: LB_AnalMapSplitter.py:46
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
LArConditionsSubset::CorrectionPair
std::pair< ChannelId, T > CorrectionPair
Definition: LArConditionsSubset.h:143
LArConditionsSubset::m_groupingType
unsigned int m_groupingType
Definition: LArConditionsSubset.h:261
LArConditionsSubset::gain
unsigned int gain() const
Access to gain.
Definition: LArConditionsSubset.h:490
DeMoScan.index
string index
Definition: DeMoScan.py:362
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArConditionsSubsetTraits::copySubset
static void copySubset(OTHERIT otherBeg, OTHERIT otherEnd, SubsetVector &to, COPIER copier)
Helper used by LArConditionsSubset::assign.
Definition: LArConditionsSubset.h:104
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35