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

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

template<class T>
typedef Traits::ConstChannelVector LArConditionsSubset< T >::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

template<class T>
typedef Traits::FebPairReference LArConditionsSubset< T >::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),
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),
306{}
unsigned int gain() const
Access to gain.

◆ 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),
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}
template class for use for I/O of conditions data
void fillMap()
Fill map from vector.

◆ ~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();
346
348
349 size_t corrsz = other.correctionVecSize();
351 m_correctionVec.resize (corrsz);
352 for (size_t i = 0; i < corrsz; i++) {
353 m_correctionVec[i].first = otherCorr[i].first;
355 }
356
357 fillMap();
358}
static void copySubset(OTHERIT otherBeg, OTHERIT otherEnd, SubsetVector &to, COPIER copier)
Helper used by LArConditionsSubset::assign.
ConstSubsetIt subsetEnd() const
ConstCorrectionVecIt correctionVecBegin() const
Iterators over channel set.
unsigned int groupingType() const
Type of grouping - defined in LArConditionsContainerBase.h.
ConstSubsetIt subsetBegin() const
Iterators over subset.
size_type correctionVecSize() const
Size of channel set.
unsigned int channel() const
Access to the COOL channel number.

◆ channel()

template<class T>
unsigned int LArConditionsSubset< T >::channel ( ) const
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 ( ) const
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 ( ) const

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 ( ) const

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 ( ) const

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}
unsigned channelVectorSize() const

◆ 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{
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}
CorrectionVec::const_iterator ConstCorrectionVecIt
std::pair< ChannelId, T > CorrectionPair

◆ gain()

template<class T>
unsigned int LArConditionsSubset< T >::gain ( ) const
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 ( ) const
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));
587}
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ 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()) {
597 }
598 else {
599 m_correctionVec.insert (m_correctionVec.end(), corrs.begin(), corrs.end());
601 }
602}

◆ nConditions()

template<class T>
unsigned int LArConditionsSubset< T >::nConditions ( ) const
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{
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 ( ) const
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 ( ) const
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 ( ) const
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: