ATLAS Offline Software
|
Iterator over a rectangular window of towers. More...
#include <CaloTowerSeg.h>
Public Member Functions | |
SubSegIterator (const TOWER_ITERATOR &it, size_t nphi, size_t nphi_skip, size_t phipos) | |
Constructor. More... | |
SubSegIterator & | operator++ () |
Advance to the next tower in the window. More... | |
size_t | itower () const |
The tower index to which the iterator is referring. More... | |
Static Public Member Functions | |
static SubSegIterator | make (TOWER_ITERATOR beg, const SubSeg &subseg) |
Construct a new iterator for iterating over a window. More... | |
Private Attributes | |
size_t | m_nphi |
size_t | m_nphi_skip |
size_t | m_phipos |
size_t | m_phipos2 |
size_t | m_itower |
Iterator over a rectangular window of towers.
This is based on an existing iterator over all towers, TOWER_ITERATOR. This iterator should supply operator++ and operator+=.
There is no end iterator defined; you need to count the iterations up to the size of the window.
This is a little complicated; we need to take phi wrapping into account too.
Here's some bad ascii art to help illustrate:
*...............* * ! ! ! ! ! ! ! * *...*******.....* * ! *0|1|2* ! ! * phi -> *...*-----*.....* * ! *3|4|5* ! ! * eta *...*******.....* | * ! ! ! ! ! ! ! * v ***.........***** *2* ! ! ! ! *0|1* *-*.........***** *5* ! ! ! ! *3|4* ***.........***** * *
Consider the upper window first. We initialize the base TOWER_ITERATOR pointing at the proper tower. Then m_phipos counts the phi index within the window; here from 0 to 2. When m_phipos reaches the window size, m_nphi, then we need go to the next row. We add m_nphi_skip to the tower iterator, reset the entries iterator appropriately, and reset m_phipos to 0.
For the case of phi-wrapping, this mostly still works: we just need to initialize m_phipos appropriately. In the example here of the lower window, m_phipos should start at 2. Then we apply the skip when we go across to the right half of the window, and we just wrap around at the right edge; here, we go from the tower numbered 1 to 5.
But this means that in this case, we don't visit the towers in order, so we need some way of getting the tower number within the window from the iterator, so that we can apply the mapping to the correct tower. That's done by m_itower and m_phipos2. m_phipos2 is similar to m_phipos, except that it always starts at 0. Thus, then m_phipos reaches m_nphi, we need to skip; when m_phipos2 reaches m_nphi, we're shifting down to the next eta row.
Definition at line 335 of file CaloTowerSeg.h.
CaloTowerSeg::SubSegIterator< TOWER_ITERATOR >::SubSegIterator | ( | const TOWER_ITERATOR & | it, |
size_t | nphi, | ||
size_t | nphi_skip, | ||
size_t | phipos | ||
) |
Constructor.
it | Iterator of the starting tower. |
entry | Iterator of the corresponding starting entry. |
store | The CaloTowerStore within which we're iterating. |
nphi | The phi size of the window. |
nphi_skip | The number of towers to skip to go from the right edge of the window to the left. Should be (phi-size of store) - (phi-size of window) + 1 |
phipos | The starting phi position for the iteration. Should be 0 if there's no phi wrapping. Otherwise, it's the phi index (0-based) of the window tower at the left side of the store. |
Definition at line 652 of file CaloTowerSeg.h.
|
inline |
The tower index to which the iterator is referring.
This is the index within the window. 0-based.
Definition at line 710 of file CaloTowerSeg.h.
|
static |
Construct a new iterator for iterating over a window.
beg | Tower iterator pointing at the start of the segmentation within which this window is defined. |
subseg | The window over which we want to iterate. |
Definition at line 608 of file CaloTowerSeg.h.
|
inline |
Advance to the next tower in the window.
Note: The iteration may not visit the towers in index order. Use itower() to find the index of the tower to which the iterator is currently referring.
Definition at line 677 of file CaloTowerSeg.h.
|
private |
Definition at line 394 of file CaloTowerSeg.h.
|
private |
Definition at line 390 of file CaloTowerSeg.h.
|
private |
Definition at line 391 of file CaloTowerSeg.h.
|
private |
Definition at line 392 of file CaloTowerSeg.h.
|
private |
Definition at line 393 of file CaloTowerSeg.h.