ATLAS Offline Software
LArCompactSubset.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 /**
5  * @file LArRawConditions/LArCompactSubset.icc
6  * @author scott snyder <snyder@bnl.gov>
7  * @date Apr, 2011
8  * @brief A more compact way of storing shape/ofc data.
9  *
10  */
11 
12 
13 //=========================================================================
14 
15 
16 /**
17  * @brief Default constructor. Makes an invalid proxy.
18  */
19 inline
20 LArCompactSubsetConstChannelProxy::LArCompactSubsetConstChannelProxy()
21  : m_chan (0),
22  m_subset (nullptr)
23 {
24 }
25 
26 
27 /**
28  * @brief Constructor.
29  * @brief chan The channel index we reference.
30  * @brief subset The subset object within which we live.
31  */
32 inline
33 LArCompactSubsetConstChannelProxy::LArCompactSubsetConstChannelProxy
34  (unsigned int chan,
35  const LArCompactSubsetVector& subset)
36  : m_chan (chan),
37  m_subset (&subset)
38 {
39 }
40 
41 
42 /**
43  * @brief Test to see if the proxy is valid.
44  */
45 inline
46 bool LArCompactSubsetConstChannelProxy::isValid() const
47 {
48  return m_subset != 0;
49 }
50 
51 
52 /**
53  * @brief Return the time offset for this channel.
54  */
55 inline
56 float LArCompactSubsetConstChannelProxy::timeOffset() const
57 {
58  return m_subset->timeOffset (m_chan);
59 }
60 
61 
62 /**
63  * @brief Return the time bin width for this channel.
64  */
65 inline
66 float LArCompactSubsetConstChannelProxy::timeBinWidth() const
67 {
68  return m_subset->timeBinWidth (m_chan);
69 }
70 
71 
72 /**
73  * @brief Return the number of time bins for this channel.
74  */
75 inline
76 size_t LArCompactSubsetConstChannelProxy::getSize () const
77 {
78  return m_subset->getSize (m_chan);
79 }
80 
81 
82 /**
83  * @brief Return one set of wave data from this channel.
84  * @param which Index of the wave type to return.
85  * @param tbin Time bin index.
86  */
87 inline
88 LArVectorProxy
89 LArCompactSubsetConstChannelProxy::getData (unsigned int which,
90  size_t tbin) const
91 {
92  return m_subset->getData (which, m_chan, tbin);
93 }
94 
95 
96 /**
97  * @brief Return number of shape time bins.
98  */
99 inline
100 size_t LArCompactSubsetConstChannelProxy::shapeSize() const
101 {
102  return m_subset->getSize (m_chan);
103 }
104 
105 
106 /**
107  * @brief Return number of shape derivative time bins.
108  */
109 inline
110 size_t LArCompactSubsetConstChannelProxy::shapeDerSize() const
111 {
112  return m_subset->getSize (m_chan);
113 }
114 
115 
116 /**
117  * @brief Return shape data.
118  * @param tbin Time bin index.
119  */
120 inline
121 ILArShape::ShapeRef_t
122 LArCompactSubsetConstChannelProxy::shape (size_t tbin) const
123 {
124  return m_subset->getData (0, m_chan, tbin);
125 }
126 
127 
128 /**
129  * @brief Return shape derivative data.
130  * @param tbin Time bin index.
131  */
132 inline
133 ILArShape::ShapeRef_t
134 LArCompactSubsetConstChannelProxy::shapeDer (size_t tbin) const
135 {
136  return m_subset->getData (1, m_chan, tbin);
137 }
138 
139 
140 /**
141  * @brief Return number of time bins for OFC A coefficients.
142  */
143 inline
144 size_t
145 LArCompactSubsetConstChannelProxy::OFC_aSize () const
146 {
147  return m_subset->getSize (m_chan);
148 }
149 
150 
151 /**
152  * @brief Return number of time bins for OFC B coefficients.
153  */
154 inline
155 size_t
156 LArCompactSubsetConstChannelProxy::OFC_bSize () const
157 {
158  return m_subset->getSize (m_chan);
159 }
160 
161 
162 /**
163  * @brief Return OFC A coefficients.
164  * @param tbin Time bin index.
165  */
166 inline
167 ILArOFC::OFCRef_t
168 LArCompactSubsetConstChannelProxy::OFC_a (size_t tbin) const
169 {
170  return m_subset->getData (0, m_chan, tbin);
171 }
172 
173 
174 /**
175  * @brief Return OFC B coefficients.
176  * @param tbin Time bin index.
177  */
178 inline
179 ILArOFC::OFCRef_t
180 LArCompactSubsetConstChannelProxy::OFC_b (size_t tbin) const
181 {
182  return m_subset->getData (1, m_chan, tbin);
183 }
184 
185 
186 /**
187  * @brief Default constructor. Makes an invalid proxy.
188  */
189 inline
190 LArCompactSubsetChannelProxy::LArCompactSubsetChannelProxy()
191  : m_subset_nc (nullptr)
192 {
193 }
194 
195 
196 /**
197  * @brief Constructor.
198  * @brief chan The channel index we reference.
199  * @brief subset The subset object within which we live.
200  */
201 inline
202 LArCompactSubsetChannelProxy::LArCompactSubsetChannelProxy
203  (unsigned int chan,
204  LArCompactSubsetVector& subset)
205  : LArCompactSubsetConstChannelProxy (chan, subset),
206  m_subset_nc (&subset)
207 {
208 }
209 
210 
211 /**
212  * @brief Initialize the referenced data from a standalone object.
213  * @param other The object from which to initialize.
214  */
215 inline
216 LArCompactSubsetChannelProxy&
217 LArCompactSubsetChannelProxy::operator= (const LAr2DWaveBase& other)
218 {
219  assign (other);
220  return *this;
221 }
222 
223 
224 //=========================================================================
225 
226 
227 /**
228  * @brief Constructor.
229  * @param p Pointer to a channel proxy.
230  */
231 inline
232 LArCompactSubsetChannelPointer::LArCompactSubsetChannelPointer
233  (const LArCompactSubsetChannelProxy* p)
234  : LArCompactSubsetChannelProxy (*p)
235 {
236 }
237 
238 
239 /**
240  * @brief `Dereference' the pointer.
241  */
242 inline
243 LArCompactSubsetChannelProxy
244 LArCompactSubsetChannelPointer::operator*() const
245 {
246  return *this;
247 }
248 
249 
250 /**
251  * @brief Test for a valid pointer.
252  */
253 inline
254 LArCompactSubsetChannelPointer::operator bool() const
255 {
256  return isValid();
257 }
258 
259 
260 //=========================================================================
261 
262 
263 /**
264  * @brief Default constructor.
265  */
266 inline
267 LArCompactSubsetChannelVector::const_iterator::const_iterator()
268  : m_chan(0),
269  m_subset(0)
270 {
271 }
272 
273 
274 /**
275  * @brief Constructor from channel index and subset reference.
276  */
277 inline
278 LArCompactSubsetChannelVector::const_iterator::const_iterator
279  (unsigned int chan, const LArCompactSubsetVector& subset)
280  : m_chan (chan),
281  m_subset (&subset)
282 {
283 }
284 
285 
286 /**
287  * @brief Iterator increment.
288  */
289 inline
290 LArCompactSubsetChannelVector::const_iterator&
291 LArCompactSubsetChannelVector::const_iterator::operator++()
292 {
293  ++m_chan;
294  return *this;
295 }
296 
297 
298 /**
299  * @brief Iterator dereference.
300  * Yields a channel proxy.
301  */
302 inline
303 LArCompactSubsetConstChannelProxy
304 LArCompactSubsetChannelVector::const_iterator::operator*() const
305 {
306  return LArCompactSubsetConstChannelProxy (m_chan, *m_subset);
307 }
308 
309 
310 /**
311  * @brief Iterator equality test.
312  */
313 inline
314 bool LArCompactSubsetChannelVector::const_iterator::operator==
315  (const const_iterator& other) const
316 {
317  return m_chan == other.m_chan;
318 }
319 
320 
321 /**
322  * @brief Iterator inequality test.
323  */
324 inline
325 bool LArCompactSubsetChannelVector::const_iterator::operator!=
326  (const const_iterator& other) const
327 {
328  return m_chan != other.m_chan;
329 }
330 
331 
332 /**
333 * @brief Adjust iterator backwards.
334 * @param delta Amount by which to adjust.
335 */
336 inline
337 LArCompactSubsetChannelVector::const_iterator
338 LArCompactSubsetChannelVector::const_iterator::operator-
339  (size_t delta) const
340 {
341  return const_iterator (m_chan - delta, *m_subset);
342 }
343 
344 
345 /**
346  * @brief Iterator difference.
347  * @param other Other iterator for difference.
348  */
349 inline
350 long
351 LArCompactSubsetChannelVector::const_iterator::operator-
352  (const const_iterator& other) const
353 {
354  return m_chan - other.m_chan;
355 }
356 
357 
358 /**
359  * @brief Constructor.
360  * @param febIndex FEB index with which we're associated.
361  * @param subset Subset within which we live.
362  */
363 inline
364 LArCompactSubsetChannelVector::LArCompactSubsetChannelVector
365  (size_t febIndex, LArCompactSubsetVector* subset)
366  : m_febIndex (febIndex),
367  m_subset (subset)
368 {
369 }
370 
371 
372 /**
373  * @brief Return the size of this vector (number of channels for this FEB).
374  */
375 inline
376 size_t LArCompactSubsetChannelVector::size() const
377 {
378  return m_subset->febSize (m_febIndex);
379 }
380 
381 
382 /**
383  * @brief Vector indexing. Returns a channel proxy.
384  * @param i Channel index within the vector.
385  */
386 inline
387 LArCompactSubsetChannelProxy
388 LArCompactSubsetChannelVector::operator[] (size_t i)
389 {
390  unsigned int chan = m_subset->chanIndex (m_febIndex) + i;
391  assert (chan <= m_subset->chanIndex (m_febIndex+1));
392  return LArCompactSubsetChannelProxy (chan, *m_subset);
393 }
394 
395 
396 /**
397  * @brief Vector indexing. Returns a channel proxy.
398  * @param i Channel index within the vector.
399  */
400 inline
401 LArCompactSubsetConstChannelProxy
402 LArCompactSubsetChannelVector::operator[] (size_t i) const
403 {
404  unsigned int chan = m_subset->chanIndex (m_febIndex) + i;
405  assert (chan <= m_subset->chanIndex (m_febIndex+1));
406  return LArCompactSubsetConstChannelProxy (chan, *m_subset);
407 }
408 
409 
410 /**
411  * @brief Begin iterator.
412  */
413 inline
414 LArCompactSubsetChannelVector::const_iterator
415 LArCompactSubsetChannelVector::begin() const
416 {
417  return const_iterator (m_subset->chanIndex (m_febIndex), *m_subset);
418 }
419 
420 
421 /**
422  * @brief End iterator.
423  */
424 inline
425 LArCompactSubsetChannelVector::const_iterator
426 LArCompactSubsetChannelVector::end() const
427 {
428  return const_iterator (m_subset->chanIndex (m_febIndex+1), *m_subset);
429 }
430 
431 
432 /**
433  * @brief Resize this vector.
434  * @param sz The desired new size.
435  *
436  * Restriction: Only the vector associated with the last FEB index
437  * in the subset may be resized.
438  */
439 inline
440 void LArCompactSubsetChannelVector::resize (size_t sz)
441 {
442  m_subset->resizeChanVec (m_febIndex, sz);
443 }
444 
445 
446 
447 /**
448  * @brief Constructor.
449  * @param febIndex FEB index with which we're associated.
450  * @param subset Subset within which we live.
451  */
452 inline
453 LArCompactSubsetConstChannelVector::LArCompactSubsetConstChannelVector
454  (size_t febIndex, const LArCompactSubsetVector* subset)
455  : m_febIndex (febIndex),
456  m_subset (subset)
457 {
458 }
459 
460 
461 /**
462  * @brief Return the size of this vector (number of channels for this FEB).
463  */
464 inline
465 size_t LArCompactSubsetConstChannelVector::size() const
466 {
467  return m_subset->febSize (m_febIndex);
468 }
469 
470 
471 /**
472  * @brief Vector indexing. Returns a channel proxy.
473  * @param i Channel index within the vector.
474  */
475 inline
476 LArCompactSubsetConstChannelProxy
477 LArCompactSubsetConstChannelVector::operator[] (size_t i) const
478 {
479  unsigned int chan = m_subset->chanIndex (m_febIndex) + i;
480  assert (chan <= m_subset->chanIndex (m_febIndex+1));
481  return LArCompactSubsetConstChannelProxy (chan, *m_subset);
482 }
483 
484 
485 //=========================================================================
486 
487 
488 /**
489  * @brief Default constructor. Makes an invalid `pointer'.
490  */
491 inline
492 LArCompactSubsetChannelVectorPointer::
493 LArCompactSubsetChannelVectorPointer()
494  : LArCompactSubsetChannelVector (0, 0)
495 {
496 }
497 
498 
499 /**
500  * @brief Constructor.
501  * @param p Pointer to a channel vector proxy.
502  */
503 inline
504 LArCompactSubsetChannelVectorPointer::LArCompactSubsetChannelVectorPointer
505  (const LArCompactSubsetChannelVector* p)
506  : LArCompactSubsetChannelVector (*p)
507 {
508 }
509 
510 
511 /**
512  * @brief `Dereference' the pointer.
513  */
514 inline
515 LArCompactSubsetChannelVector
516 LArCompactSubsetChannelVectorPointer::operator*()
517 {
518  return LArCompactSubsetChannelVector (m_febIndex, m_subset);
519 }
520 
521 
522 /**
523  * @brief `Dereference' the pointer.
524  */
525 inline
526 LArCompactSubsetConstChannelVector
527 LArCompactSubsetChannelVectorPointer::operator*() const
528 {
529  return LArCompactSubsetConstChannelVector (m_febIndex, m_subset);
530 }
531 
532 
533 /**
534  * @brief `Dereference' the pointer.
535  */
536 inline
537 const LArCompactSubsetChannelVector*
538 LArCompactSubsetChannelVectorPointer::operator->() const
539 {
540  return this;
541 }
542 
543 
544 //=========================================================================
545 
546 
547 /**
548  * @brief Constructor.
549  * @param febIndex The index of the pair.
550  * @param subset The subset within which we live.
551  */
552 inline
553 LArCompactSubsetFebPair::LArCompactSubsetFebPair
554  (size_t febIndex,
555  LArCompactSubsetVector& subset)
556  : first (subset.febIdRef (febIndex)),
557  second (febIndex, &subset)
558 {
559 }
560 
561 
562 /**
563  * @brief Constructor.
564  * @param febIndex The index of the pair.
565  * @param subset The subset within which we live.
566  */
567 inline
568 LArCompactSubsetConstFebPair::LArCompactSubsetConstFebPair
569  (size_t febIndex,
570  const LArCompactSubsetVector& subset)
571  : first (subset.febIdRef (febIndex)),
572  second (febIndex, &subset)
573 {
574 }
575 
576 
577 //=========================================================================
578 
579 
580 /**
581  * @brief Constructor.
582  * @param febIndex The FEB index to which we point.
583  * @param subset The subset within which we live.
584  */
585 inline
586 LArCompactSubsetVector::iterator::iterator (size_t febIndex,
587  LArCompactSubsetVector& subset)
588  : m_febIndex (febIndex),
589  m_subset (subset)
590 {
591 }
592 
593 /**
594  * @brief `Dereference' the iterator.
595  */
596 inline
597 LArCompactSubsetFebPair
598 LArCompactSubsetVector::iterator::operator*()
599 {
600  return LArCompactSubsetFebPair (m_febIndex, m_subset);
601 }
602 
603 
604 /**
605  * @brief Compare iterators for equality.
606  */
607 inline
608 bool
609 LArCompactSubsetVector::iterator::operator== (const iterator& other) const
610 {
611  return m_febIndex == other.m_febIndex;
612 }
613 
614 
615 /**
616  * @brief Compare iterators for inequality.
617  */
618 inline
619 bool
620 LArCompactSubsetVector::iterator::operator!= (const iterator& other) const
621 {
622  return m_febIndex != other.m_febIndex;
623 }
624 
625 
626 /**
627  * @brief Advance iterator.
628  */
629 inline
630 LArCompactSubsetVector::iterator&
631 LArCompactSubsetVector::iterator::operator++()
632 {
633  ++m_febIndex;
634  return *this;
635 }
636 
637 
638 /**
639  * @brief Adjust iterator.
640  * @param delta Amount by which to advance the iterator.
641  */
642 inline
643 LArCompactSubsetVector::iterator
644 LArCompactSubsetVector::iterator::operator+ (size_t delta)
645 {
646  return iterator (m_febIndex + delta, m_subset);
647 }
648 
649 
650 /**
651  * @brief Iterator difference.
652  * @param other Other iterator for difference.
653  */
654 inline
655 LArCompactSubsetVector::iterator::difference_type
656 LArCompactSubsetVector::iterator::operator- (const iterator& other)
657 {
658  return m_febIndex - other.m_febIndex;
659 }
660 
661 
662 /**
663  * @brief Constructor.
664  * @param febIndex The FEB index to which we point.
665  * @param subset The subset within which we live.
666  */
667 inline
668 LArCompactSubsetVector::const_iterator::const_iterator (size_t febIndex,
669  const LArCompactSubsetVector& subset)
670  : m_febIndex (febIndex),
671  m_subset (subset)
672 {
673 }
674 
675 /**
676  * @brief `Dereference' the iterator.
677  */
678 inline
679 LArCompactSubsetConstFebPair
680 LArCompactSubsetVector::const_iterator::operator*()
681 {
682  return LArCompactSubsetConstFebPair (m_febIndex, m_subset);
683 }
684 
685 
686 /**
687  * @brief Compare iterators for equality.
688  */
689 inline
690 bool
691 LArCompactSubsetVector::const_iterator::operator== (const const_iterator& other) const
692 {
693  return m_febIndex == other.m_febIndex;
694 }
695 
696 
697 /**
698  * @brief Compare iterators for inequality.
699  */
700 inline
701 bool
702 LArCompactSubsetVector::const_iterator::operator!= (const const_iterator& other) const
703 {
704  return m_febIndex != other.m_febIndex;
705 }
706 
707 
708 /**
709  * @brief Advance iterator.
710  */
711 inline
712 LArCompactSubsetVector::const_iterator&
713 LArCompactSubsetVector::const_iterator::operator++()
714 {
715  ++m_febIndex;
716  return *this;
717 }
718 
719 
720 /**
721  * @brief Adjust iterator.
722  * @param delta Amount by which to advance the iterator.
723  */
724 inline
725 LArCompactSubsetVector::const_iterator
726 LArCompactSubsetVector::const_iterator::operator+ (size_t delta) const
727 {
728  return const_iterator (m_febIndex + delta, m_subset);
729 }
730 
731 
732 /**
733  * @brief Iterator difference.
734  * @param other Other iterator for difference.
735  */
736 inline
737 LArCompactSubsetVector::const_iterator::difference_type
738 LArCompactSubsetVector::const_iterator::operator- (const const_iterator& other) const
739 {
740  return m_febIndex - other.m_febIndex;
741 }
742 
743 
744 /**
745  * @brief Return the size of this vector.
746  */
747 inline
748 size_t LArCompactSubsetVector::size() const
749 {
750  return m_febids.size();
751 }
752 
753 
754 /**
755  * @brief Vector indexing.
756  * @param i Index to look up.
757  */
758 inline
759 LArCompactSubsetFebPair
760 LArCompactSubsetVector::operator[] (size_t i)
761 {
762  assert (i < m_febids.size());
763  return LArCompactSubsetFebPair (i, *this);
764 }
765 
766 
767 /**
768  * @brief Vector indexing.
769  * @param i Index to look up.
770  */
771 inline
772 const LArCompactSubsetConstFebPair
773 LArCompactSubsetVector::operator[] (size_t i) const
774 {
775  assert (i < m_febids.size());
776  return LArCompactSubsetConstFebPair (i, *(LArCompactSubsetVector*)this);
777 }
778 
779 
780 /**
781  * @brief Begin iterator.
782  */
783 inline
784 LArCompactSubsetVector::iterator LArCompactSubsetVector::begin()
785 {
786  return iterator (0, *this);
787 }
788 
789 
790 /**
791  * @brief End iterator.
792  */
793 inline
794 LArCompactSubsetVector::iterator LArCompactSubsetVector::end()
795 {
796  return iterator (m_febids.size(), *this);
797 }
798 
799 
800 /**
801  * @brief Begin iterator.
802  */
803 inline
804 LArCompactSubsetVector::const_iterator LArCompactSubsetVector::begin() const
805 {
806  return const_iterator (0, *this);
807 }
808 
809 
810 /**
811  * @brief End iterator.
812  */
813 inline
814 LArCompactSubsetVector::const_iterator LArCompactSubsetVector::end() const
815 {
816  return const_iterator (m_febids.size(), *this);
817 }
818 
819 
820 /**
821  * @brief Return a reference to a FEB ID variable.
822  * @param febIndex Index of the desired FEB ID.
823  */
824 inline
825 LArCompactSubsetVector::FebId&
826 LArCompactSubsetVector::febIdRef (size_t febIndex)
827 {
828  return m_febids[febIndex];
829 }
830 
831 
832 /**
833  * @brief Return a reference to a FEB ID variable.
834  * @param febIndex Index of the desired FEB ID.
835  */
836 inline
837 const LArCompactSubsetVector::FebId&
838 LArCompactSubsetVector::febIdRef (size_t febIndex) const
839 {
840  return m_febids[febIndex];
841 }
842 
843 
844 /**
845  * @brief Return the number of channels for a given FEB index.
846  * @param febIndex The index of the FEB to query.
847  */
848 inline
849 size_t LArCompactSubsetVector::febSize (unsigned int febIndex) const
850 {
851  assert (febIndex+1 < m_indices.size());
852  return m_indices[febIndex+1] - m_indices[febIndex];
853 }
854 
855 
856 /**
857  * @brief Return the index of the first channel for a FEB index.
858  * @param febIndex The index of the FEB to query.
859  *
860  * If febIndex is the number of FEBs, then this returns
861  * the total number of channels.
862  */
863 inline
864 unsigned int
865 LArCompactSubsetVector::chanIndex (unsigned int febIndex) const
866 {
867  assert (febIndex < m_indices.size());
868  return m_indices[febIndex];
869 }
870 
871 
872 /**
873  * @brief Return the number of time bins used in this subset.
874  */
875 inline
876 size_t LArCompactSubsetVector::getChanSize() const
877 {
878  return m_chanSize;
879 }
880 
881 
882 /**
883  * @brief Return the number of time bins for channel index CHAN.
884  * @param chan The channel index to query.
885  *
886  * This is either the same as getChanSize(), or 0 if this channel
887  * is empty.
888  */
889 inline
890 size_t LArCompactSubsetVector::getSize (unsigned int chan) const
891 {
892  if (m_chanSize == 0)
893  return 0;
894  int slot = m_slots[chan * m_chanSize];
895  if (slot >= 0)
896  return m_chanSize;
897  return 0;
898 }
899 
900 
901 /**
902  * @brief Return the time offset for channel index CHAN.
903  * @param chan The channel index to query.
904  *
905  * We currently assume that this is the same for all channels,
906  * so CHAN is ignored.
907  */
908 inline
909 float LArCompactSubsetVector::timeOffset (unsigned int /*chan*/) const
910 {
911  return m_timeOffset;
912 }
913 
914 
915 /**
916  * @brief Return the time bin width for channel index CHAN.
917  * @param chan The channel index to query.
918  *
919  * We currently assume that this is the same for all channels,
920  * so CHAN is ignored.
921  */
922 inline
923 float LArCompactSubsetVector::timeBinWidth (unsigned int /*chan*/) const
924 {
925  return m_timeBinWidth;
926 }
927 
928 
929 /**
930  * @brief Helper used by LArConditionsSubset::assign.
931  * @param otherBeg Start of the range to copy.
932  * @param otherEnd End of the range to copy.
933  * @param to The subset to which to copy.
934  * @param copier Helper to copy a single payload object.
935  */
936 template <class T, class OTHERIT, class COPIER>
937 void LArCompactSubsetVector::copySubset (OTHERIT otherBeg,
938  OTHERIT otherEnd,
939  LArCompactSubsetVector& to,
940  COPIER copier)
941 {
942  to.resize (otherEnd - otherBeg);
943  size_t ndx = 0;
944  for (; otherBeg != otherEnd; ++otherBeg, ++ndx) {
945  to[ndx].first = (*otherBeg).first;
946  unsigned int nChannels = (*otherBeg).second.size();
947  to[ndx].second.resize(nChannels);
948  for (size_t i = 0; i < nChannels; i++) {
949  T tmp;
950  copier ((*otherBeg).second[i], tmp);
951  to[ndx].second[i] = tmp;
952  }
953  }
954 }