ATLAS Offline Software
Loading...
Searching...
No Matches
LArCompactSubset.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4*/
79
80
81#ifndef LARRAWCONDITIONS_LARCOMPACTSUBSET_H
82#define LARRAWCONDITIONS_LARCOMPACTSUBSET_H
83
86#include <cstddef>
87
88
90class LAr2DWaveBase;
91
92
93//==========================================================================
94
95
100{
101public:
106
107
114 const LArCompactSubsetVector& subset);
115
116
120 bool isValid() const;
121
122
126 float timeOffset() const;
127
128
132 float timeBinWidth() const;
133
134
138 size_t getSize () const;
139
140
146 LArVectorProxy getData (unsigned int which, size_t tbin) const;
147
148
149 //=== LArShapeP2 interface. The two wave types are shape and derivative.
150
151 size_t shapeSize() const;
152 size_t shapeDerSize() const;
153 ILArShape::ShapeRef_t shape (size_t tbin) const;
154 ILArShape::ShapeRef_t shapeDer (size_t tbin) const;
155
156 //=== LArOFCP1 interface. The two wave types are OFC A and B coeffiecients.
157
158 size_t OFC_aSize() const;
159 size_t OFC_bSize() const;
160 ILArOFC::OFCRef_t OFC_a (size_t tbin) const;
161 ILArOFC::OFCRef_t OFC_b (size_t tbin) const;
162
163
164protected:
166 unsigned int m_chan;
167
170};
171
172
178{
179public:
184
185
192 LArCompactSubsetVector& subset);
193
194
200
201
206 void assign (const LAr2DWaveBase& other);
207
208
209private:
212};
213
214
215//==========================================================================
216
217
247
248
249//==========================================================================
250
251
259{
260public:
264 {
265 public:
270
271
275 const_iterator (unsigned int chan, const LArCompactSubsetVector& subset);
276
277
283
284
288 bool operator== (const const_iterator& other) const;
289
290
294 bool operator!= (const const_iterator& other) const;
295
296
301
302
307 const_iterator operator- (size_t delta) const;
308
309
314 long operator- (const const_iterator& other) const;
315
316
317 private:
319 unsigned int m_chan;
320
323 };
324
325
328
329
336 LArCompactSubsetVector* subset);
337
338
342 size_t size() const;
343
344
350
351
357
358
361
362
365
366
374 void resize (size_t sz);
375
376
377protected:
380
383};
384
385
393{
394public:
401 const LArCompactSubsetVector* subset);
402
403
407 size_t size() const;
408
409
415
416
417protected:
420
423};
424
425
426//==========================================================================
427
428
470
471
472//==========================================================================
473
474
479{
480public:
481 typedef unsigned int FebId;
482
483
489 LArCompactSubsetFebPair (size_t febIndex,
490 LArCompactSubsetVector& subset);
491
492
495};
496
497
502{
503public:
504 typedef unsigned int FebId;
505
506
513 const LArCompactSubsetVector& subset);
514
515
516 const FebId& first;
518};
519
520
521//==========================================================================
522
523
530{
531public:
533 static const unsigned int nWaves = 2;
534
536 typedef unsigned int FebId;
537
538
545 {
546 public:
547 typedef long difference_type;
548
549
555 iterator (size_t febIndex,
556 LArCompactSubsetVector& subset);
557
558
563
564
568 bool operator== (const iterator& other) const;
569
570
574 bool operator!= (const iterator& other) const;
575
576
581
582
587 iterator operator+ (size_t delta);
588
589
595
596
597 private:
600
603 };
604
605
612 {
613 public:
614 typedef long difference_type;
615
616
622 const_iterator (size_t febIndex,
623 const LArCompactSubsetVector& subset);
624
625
630
631
635 bool operator== (const const_iterator& other) const;
636
637
641 bool operator!= (const const_iterator& other) const;
642
643
648
649
654 const_iterator operator+ (size_t delta) const;
655
656
662
663
664 private:
667
670 };
671
672
677 LArCompactSubsetVector (size_t nfeb = 0);
678
679
680
684 size_t size() const;
685
686
692
693
699
700
703
704
707
708
711
712
715
716
723 void resize (size_t sz);
724
725
726 //======
727 // Functions used by P->T conversion.
728
733 void shrink_to_fit();
734
735
736 //======
737 // Functions used by LArCompactSubsetFebPair
738
743 FebId& febIdRef (size_t febIndex);
744
745
750 const FebId& febIdRef (size_t febIndex) const;
751
752
753 //======
754 // Functions used by LArCompactSubsetChannelVector
755
760 size_t febSize (unsigned int febIndex) const;
761
762
770 unsigned int chanIndex (unsigned int febIndex) const;
771
772
780 void resizeChanVec (size_t febIndex, size_t sz);
781
782
783 //======
784 // Functions used by LArCompactSubsetChannelProxy.
785
786
790 size_t getChanSize() const;
791
792
800 size_t getSize (unsigned int chan) const;
801
802
810 float timeOffset (unsigned int chan) const;
811
812
820 float timeBinWidth (unsigned int chan) const;
821
822
829 LArVectorProxy getData (unsigned int which, unsigned int chan, size_t tbin)
830 const;
831
832
843 void setTimings (unsigned int chan, float timeOffset, float timeBinWidth);
844
845
858 void setData (unsigned int which,
859 unsigned int chan,
860 size_t tbin,
861 size_t chanSize,
862 const LArVectorProxy& from);
863
864
872 template <class T, class OTHERIT, class COPIER>
873 static void copySubset (OTHERIT otherBeg,
874 OTHERIT otherEnd,
876 COPIER copier);
877
878
879private:
881 unsigned int m_chanSize;
882
884 unsigned int m_nSamples;
885
890
892 // The length of this gives the length of the subset `vector'.
893 // Indexed by febIndex.
894 std::vector<FebId> m_febids;
895
897 // Channel index of the start of data for the corresponding FebId.
898 // An extra entry at the end gives the total channel count.
899 std::vector<unsigned int> m_indices;
900
902 // Indexed by channel and time bin numbers, chan*m_chanSize + tbin.
903 // Gives the slot corresponding to this channel/time bin, or -1 if
904 // it's empty.
905 std::vector<int> m_slots;
906
908 // This is divided into slots, each containing nWaves * m_nSamples words.
909 // (All wave types for one time bin for one channel.)
910 std::vector<float> m_data;
911};
912
913
915
916
917#endif // not LARRAWCONDITIONS_LARCOMPACTSUBSET_H
LArVectorProxy OFCRef_t
This class defines the interface for accessing Optimal Filtering coefficients for each channel provid...
Definition ILArOFC.h:26
LArVectorProxy ShapeRef_t
This class defines the interface for accessing Shape (Nsample variable, Dt = 25 ns fixed) @stereotype...
Definition ILArShape.h:26
Per-channel class holding wave information in time bins.
LArCompactSubsetChannelPointer(const LArCompactSubsetChannelProxy *p)
Constructor.
LArCompactSubsetChannelProxy operator*() const
‘Dereference’ the pointer.
A more compact way of storing shape/ofc data — non-const portion.
LArCompactSubsetVector * m_subset_nc
Subset within which we live (non-const). Null for an invalid proxy.
LArCompactSubsetChannelProxy & operator=(const LAr2DWaveBase &other)
Initialize the referenced data from a standalone object.
LArCompactSubsetChannelProxy()
Default constructor.
LArCompactSubsetChannelProxy(unsigned int chan, LArCompactSubsetVector &subset)
Constructor.
void assign(const LAr2DWaveBase &other)
Initialize the referenced data from a standalone object.
LArCompactSubsetChannelVectorPointer()
Default constructor.
const LArCompactSubsetChannelVector * operator->() const
‘Dereference’ the pointer.
LArCompactSubsetChannelVector operator*()
‘Dereference’ the pointer.
LArCompactSubsetChannelVectorPointer(const LArCompactSubsetChannelVector *p)
Constructor.
LArCompactSubsetConstChannelVector operator*() const
‘Dereference’ the pointer.
Iterator for LArCompactSubsetChannelVector.
const_iterator operator-(size_t delta) const
Adjust iterator backwards.
bool operator!=(const const_iterator &other) const
Iterator inequality test.
const_iterator & operator++()
Iterator increment.
unsigned int m_chan
Channel index at which we're currently pointing.
LArCompactSubsetConstChannelProxy operator*() const
Iterator dereference.
const_iterator(unsigned int chan, const LArCompactSubsetVector &subset)
Constructor from channel index and subset reference.
bool operator==(const const_iterator &other) const
Iterator equality test.
const LArCompactSubsetVector * m_subset
Subset within which we live.
This acts like a vector of channel objects.
size_t size() const
Return the size of this vector (number of channels for this FEB).
const_iterator end() const
End iterator.
LArCompactSubsetVector * m_subset
The subset within which we live.
size_t m_febIndex
The index of the FEB with which this vector is associated.
LArCompactSubsetChannelProxy operator[](size_t i)
Vector indexing.
LArCompactSubsetChannelVector(size_t febIndex, LArCompactSubsetVector *subset)
Constructor.
const_iterator iterator
No separate non-const iterator.
const_iterator begin() const
Begin iterator.
void resize(size_t sz)
Resize this vector.
A more compact way of storing shape/ofc data — const portion.
size_t getSize() const
Return the number of time bins for this channel.
unsigned int m_chan
Channel index to which we're referring.
LArCompactSubsetConstChannelProxy(unsigned int chan, const LArCompactSubsetVector &subset)
Constructor.
LArCompactSubsetConstChannelProxy()
Default constructor.
float timeBinWidth() const
Return the time bin width for this channel.
ILArOFC::OFCRef_t OFC_b(size_t tbin) const
ILArShape::ShapeRef_t shapeDer(size_t tbin) const
ILArShape::ShapeRef_t shape(size_t tbin) const
bool isValid() const
Test to see if the proxy is valid.
const LArCompactSubsetVector * m_subset
Subset within which we live. Null for an invalid proxy.
float timeOffset() const
Return the time offset for this channel.
LArVectorProxy getData(unsigned int which, size_t tbin) const
Return one set of wave data from this channel.
ILArOFC::OFCRef_t OFC_a(size_t tbin) const
This acts like a vector of channel objects — const version.
const LArCompactSubsetVector * m_subset
The subset within which we live.
LArCompactSubsetConstChannelProxy operator[](size_t i) const
Vector indexing.
LArCompactSubsetConstChannelVector(size_t febIndex, const LArCompactSubsetVector *subset)
Constructor.
size_t m_febIndex
The index of the FEB with which this vector is associated.
size_t size() const
Return the size of this vector (number of channels for this FEB).
This acts like a FEB ID/channel vector pair.
LArCompactSubsetConstChannelVector second
LArCompactSubsetConstFebPair(size_t febIndex, const LArCompactSubsetVector &subset)
Constructor.
This acts like a FEB ID/channel vector pair.
LArCompactSubsetFebPair(size_t febIndex, LArCompactSubsetVector &subset)
Constructor.
LArCompactSubsetChannelVector second
bool operator!=(const const_iterator &other) const
Compare iterators for inequality.
const_iterator operator+(size_t delta) const
Adjust iterator.
const_iterator & operator++()
Advance iterator.
size_t m_febIndex
Index we're currently referencing.
const LArCompactSubsetVector & m_subset
The subset within which we live.
difference_type operator-(const const_iterator &other) const
Iterator difference.
LArCompactSubsetConstFebPair operator*()
‘Dereference’ the iterator.
bool operator==(const const_iterator &other) const
Compare iterators for equality.
const_iterator(size_t febIndex, const LArCompactSubsetVector &subset)
Constructor.
LArCompactSubsetVector & m_subset
The subset within which we live.
iterator(size_t febIndex, LArCompactSubsetVector &subset)
Constructor.
iterator operator+(size_t delta)
Adjust iterator.
bool operator==(const iterator &other) const
Compare iterators for equality.
bool operator!=(const iterator &other) const
Compare iterators for inequality.
size_t m_febIndex
Index we're currently referencing.
difference_type operator-(const iterator &other)
Iterator difference.
iterator & operator++()
Advance iterator.
LArCompactSubsetFebPair operator*()
‘Dereference’ the iterator.
This acts like a vector of FEB ID / channel vector pairs.
unsigned int FebId
Type for FEB IDs. Would be better to get this from somewhere common...
size_t febSize(unsigned int febIndex) const
Return the number of channels for a given FEB index.
size_t getSize(unsigned int chan) const
Return the number of time bins for channel index CHAN.
std::vector< int > m_slots
Map from channel indices to wave slots.
size_t size() const
Return the size of this vector.
float timeBinWidth(unsigned int chan) const
Return the time bin width for channel index CHAN.
float m_timeOffset
Time parameters.
void shrink_to_fit()
Release any allocated but unused storage.
unsigned int chanIndex(unsigned int febIndex) const
Return the index of the first channel for a FEB index.
const_iterator end() const
End iterator.
std::vector< float > m_data
The wave data.
void resize(size_t sz)
Change the size of the vector.
const_iterator begin() const
Begin iterator.
size_t getChanSize() const
Return the number of time bins used in this subset.
void setData(unsigned int which, unsigned int chan, size_t tbin, size_t chanSize, const LArVectorProxy &from)
Set wave data for a channel.
unsigned int m_chanSize
Number of time bins per channels. 0 before any waves have been added.
std::vector< FebId > m_febids
Vector of stored FebIds.
iterator begin()
Begin iterator.
std::vector< unsigned int > m_indices
Map from FEB indices to channel indices.
void resizeChanVec(size_t febIndex, size_t sz)
Resize one channel vector.
iterator end()
End iterator.
float timeOffset(unsigned int chan) const
Return the time offset for channel index CHAN.
LArCompactSubsetFebPair operator[](size_t i)
Vector indexing.
static const unsigned int nWaves
Number of wave types we store.
FebId & febIdRef(size_t febIndex)
Return a reference to a FEB ID variable.
const FebId & febIdRef(size_t febIndex) const
Return a reference to a FEB ID variable.
LArVectorProxy getData(unsigned int which, unsigned int chan, size_t tbin) const
Retrieve wave data.
unsigned int m_nSamples
Number of samples per wave. 0 before any waves have been added.
void setTimings(unsigned int chan, float timeOffset, float timeBinWidth)
Set timing information for a channel.
LArCompactSubsetVector(size_t nfeb=0)
Constructor.
static void copySubset(OTHERIT otherBeg, OTHERIT otherEnd, LArCompactSubsetVector &to, COPIER copier)
Helper used by LArConditionsSubset::assign.
Proxy for accessing a range of float values like a vector.