ATLAS Offline Software
Loading...
Searching...
No Matches
LArFCalTowerStore Class Reference

Intermediate store for cell/tower maps. More...

#include <LArFCalTowerStore.h>

Collaboration diagram for LArFCalTowerStore:

Public Types

typedef std::vector< std::pair< unsigned int, double > > tower_data_t
typedef tower_data_t::const_iterator cell_iterator
typedef std::vector< tower_data_ttower_table_t
typedef tower_table_t::const_iterator tower_iterator
typedef CaloTowerSeg::SubSegIterator< tower_iteratortower_subseg_iterator

Public Member Functions

 LArFCalTowerStore ()
 constructor
 ~LArFCalTowerStore ()
 destructor
tower_iterator towers () const
tower_subseg_iterator towers (const CaloTowerSeg::SubSeg &subseg) const
 Return an iterator for looping over all towers defined by the window subseg.
cell_iterator firstCellofTower (tower_iterator t) const
 iterators: cells
cell_iterator lastCellofTower (tower_iterator t) const
unsigned int towerSize (tower_iterator t) const
bool buildLookUp (const CaloCell_ID &cellIdHelper, const CaloDetDescrManager &theManager, CaloTowerContainer *theTowers)
 setup trigger
size_t size () const
 size of internal data store

Private Attributes

std::vector< unsigned int > m_ndxFCal
std::vector< unsigned int > m_ndyFCal
size_t m_indxOffset
size_t m_indxBound
tower_table_t m_TTCmatrix

Detailed Description

Intermediate store for cell/tower maps.

      This is NOT to be confused with CaloTowerContainer, even though
      it is a container class for CaloTower objects. In particular, 
      this class is NOT inherited from CaloTowerContainer classes. 
      This class is for exclusive use within LArFCalTowerBuilder.

PACKAGE: offline/LArCalorimeter/LArClusterRec

Author
P. Loch
Date
May 2001

Definition at line 37 of file LArFCalTowerStore.h.

Member Typedef Documentation

◆ cell_iterator

typedef tower_data_t::const_iterator LArFCalTowerStore::cell_iterator

Definition at line 41 of file LArFCalTowerStore.h.

◆ tower_data_t

typedef std::vector<std::pair<unsigned int,double> > LArFCalTowerStore::tower_data_t

Definition at line 40 of file LArFCalTowerStore.h.

◆ tower_iterator

typedef tower_table_t::const_iterator LArFCalTowerStore::tower_iterator

Definition at line 50 of file LArFCalTowerStore.h.

◆ tower_subseg_iterator

◆ tower_table_t

Definition at line 42 of file LArFCalTowerStore.h.

Constructor & Destructor Documentation

◆ LArFCalTowerStore()

LArFCalTowerStore::LArFCalTowerStore ( )

constructor

Definition at line 41 of file LArFCalTowerStore.cxx.

42 : m_indxOffset (0),
43 m_indxBound (0)
44{
45 // some parameters
46 m_ndxFCal.resize(3);
47 m_ndyFCal.resize(3);
48 // set default
49 m_ndxFCal[0] = 4;
50 m_ndxFCal[1] = 4;
51 m_ndxFCal[2] = 6;
52 m_ndyFCal[0] = 4;
53 m_ndyFCal[1] = 6;
54 m_ndyFCal[2] = 6;
55
56 }
std::vector< unsigned int > m_ndxFCal
std::vector< unsigned int > m_ndyFCal

◆ ~LArFCalTowerStore()

LArFCalTowerStore::~LArFCalTowerStore ( )

destructor

Definition at line 59 of file LArFCalTowerStore.cxx.

59 {
60// m_dataMatrix.clear();
61 m_TTCmatrix.clear();
62}
tower_table_t m_TTCmatrix

Member Function Documentation

◆ buildLookUp()

bool LArFCalTowerStore::buildLookUp ( const CaloCell_ID & cellIdHelper,
const CaloDetDescrManager & theManager,
CaloTowerContainer * theTowers )

setup trigger

Definition at line 68 of file LArFCalTowerStore.cxx.

71{
73 // Store Preparation //
75
76 // get cell id helper
77 const LArFCAL_ID& fcalIdHelper = *cellIdHelper.fcal_idHelper();
78
79 // find numerical ranges
80 IdentifierHash firstIndex, lastIndex;
81 cellIdHelper.calo_cell_hash_range((int)CaloCell_ID::LARFCAL, firstIndex, lastIndex);
82 m_indxOffset = (size_t)firstIndex;
83 m_indxBound = (size_t)lastIndex;
84
85 // check
86 if ( m_indxBound <= m_indxOffset ){
87 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "LArFCalTowerStore")
88 << "cannot initialize internal store properly, index offset = "
89 << m_indxOffset << ", index boundary = " << m_indxBound<< " -> module inactivated!"
90 << endmsg;
91 return false;
92 }
93
94 // calculate number of rows in store matrix an initialize
95// m_rowsMatrix = m_indxBound - m_indxOffset + 1;
96// for ( size_t iRow=0; iRow < m_rowsMatrix; iRow++ ){
97// m_dataMatrix.push_back(tower_data_store());
98// }
99
100 // report data store size
101// msg << MSG::INFO << "internal matrix set up with " << m_dataMatrix.size()
102 // << " rows: Index Offset: " << m_indxOffset << " Index Boundary: "<< m_indxBound << endmsg;
103
104// m_weightInModule.resize(m_rowsMatrix);
105// m_binDescriptor.resize(m_rowsMatrix);
106
107 m_TTCmatrix.clear();
108 m_TTCmatrix.resize(theTowers->size());
109
111 // Cell Loop //
113
114 // consistent phi convention
115 CaloPhiRange correctPhi;
116
117 // some stats
118/* unsigned int aveTowers = 0;
119 unsigned int maxTowers = 0;
120 unsigned int minTowers = size_t(-1); */
121
122 for( size_t cellIndex = m_indxOffset; cellIndex <= m_indxBound; cellIndex++){
123
124
125 // get cell geometry
126 const CaloDetDescrElement* theElement = theManager.get_element(cellIndex);
127 if (!theElement) {
128 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "LArFCalTowerStore")
129 << "Can't find element for index " << cellIndex << endmsg;
130 return false;
131 }
132 double xCell = theElement->x();
133 double yCell = theElement->y();
134 double zCell = theElement->z();
135 double dxCell = theElement->dx();
136 double dyCell = theElement->dy();
137
138 // get cell logical location
139 int thisModule = fcalIdHelper.module(theElement->identify());
140 // get cell splitting
141 thisModule--;
142 double theXBin = dxCell / (double)m_ndxFCal[thisModule];
143 double theYBin = dyCell / (double)m_ndyFCal[thisModule];
144 double theWeight = 1. / ((double) m_ndxFCal[thisModule] * m_ndyFCal[thisModule]);
145
146// std::pair<size_t,double> wMod(thisModule,theWeight);
147// m_weightInModule[anIndex] = wMod;
148// std::pair<size_t,size_t> iBin(m_ndxFCal[thisModule],m_ndyFCal[thisModule]);
149// m_binDescriptor[anIndex] = iBin;
150
151 // loop the cell fragments
152 for ( double x = xCell-dxCell/2.; x < xCell+(dxCell-theXBin/8.)/2.; x += theXBin ){
153 for ( double y = yCell-dyCell/2.;y < yCell+(dyCell-theYBin/8.)/2.;y += theYBin ){
154 // eta,phi of fragment
155 double r = sqrt( x * x + y * y + zCell * zCell );
156 double eta = -0.5 * log((r-zCell)/(r+zCell));
157 double phi = correctPhi.fix(atan2(y,x));
158 // get indices
159 // cppcheck-suppress duplicateAssignExpression
160 CaloTowerContainer::index_t etaIndex = theTowers->flagOutOfRange();
162 if ( theTowers->getTowerIndices(eta,phi,etaIndex,phiIndex) ){
163
164 CaloTowerContainer::index_t towerIndex = theTowers->getTowerIndex(etaIndex,phiIndex);
165 std::vector<std::pair<unsigned int,double> >::iterator i = m_TTCmatrix[towerIndex].begin();
166 std::vector<std::pair<unsigned int,double> >::iterator e = m_TTCmatrix[towerIndex].end();
167 bool found=false;
168 for (;i<e;++i){
169 if (i->first==cellIndex){
170 i->second+=theWeight;
171 found=true;
172 break;
173 }
174 }
175 if (!found)
176 m_TTCmatrix[towerIndex].push_back(std::make_pair(cellIndex,theWeight));
177
178 /*
179 // check indices in look-up
180 if ( (m_dataMatrix[anIndex]).find(towerIndex) != (m_dataMatrix[anIndex]).end() ){
181 (m_dataMatrix[anIndex])[towerIndex] += theWeight;
182 }
183 else{
184 (m_dataMatrix[anIndex])[towerIndex] = theWeight;
185 }
186 */
187
188 } // index retrieval check
189
190 } // cell y loop
191 } // cell x loop
192
193/* // collect some stats
194 if ( (m_dataMatrix[anIndex]).size() < minTowers ) minTowers = (m_dataMatrix[anIndex]).size();
195 if ( (m_dataMatrix[anIndex]).size() > maxTowers )maxTowers = (m_dataMatrix[anIndex]).size();
196 aveTowers += (m_dataMatrix[anIndex]).size(); */
197
198 } // cell index loop
199
200/* // report
201 double cellTowers = (double)aveTowers / (double)m_dataMatrix.size();
202 msg << MSG::INFO
203 << "FCal cell/tower lookup done - min/ave/max towers/cell: "
204 << minTowers << "/" << cellTowers << "/" << maxTowers
205 << ", total number of cell fragments "
206 << aveTowers
207 << endmsg; */
208
209
210
211 return 1;
212
213}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define endmsg
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
#define y
#define x
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
Definition CaloCell_ID.h:75
Identifier identify() const override final
cell identifier
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
static double fix(double phi)
index_t getTowerIndex(const CaloTower *aTower) const
Returns the combined index of a tower on the grid.
index_t flagOutOfRange() const
Returns the index out-of-range indicator.
bool getTowerIndices(const CaloTower *aTower, index_t &indexEta, index_t &indexPhi) const
Returns both and indices for a given tower.
size_type size() const noexcept
Returns the number of elements in the collection.
int r
Definition globals.cxx:22
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition EtaPhiLUT.cxx:23

◆ firstCellofTower()

cell_iterator LArFCalTowerStore::firstCellofTower ( tower_iterator t) const
inline

iterators: cells

Definition at line 70 of file LArFCalTowerStore.h.

70{ return t->begin(); }

◆ lastCellofTower()

cell_iterator LArFCalTowerStore::lastCellofTower ( tower_iterator t) const
inline

Definition at line 71 of file LArFCalTowerStore.h.

71{ return t->end(); }

◆ size()

size_t LArFCalTowerStore::size ( ) const
inline

size of internal data store

Definition at line 80 of file LArFCalTowerStore.h.

80{ return m_TTCmatrix.size(); }

◆ towers() [1/2]

tower_iterator LArFCalTowerStore::towers ( ) const
inline

Definition at line 53 of file LArFCalTowerStore.h.

53{ return m_TTCmatrix.begin(); }

◆ towers() [2/2]

LArFCalTowerStore::tower_subseg_iterator LArFCalTowerStore::towers ( const CaloTowerSeg::SubSeg & subseg) const

Return an iterator for looping over all towers defined by the window subseg.

xxx

No end iterator is defined; use subseg.size() to tell when to stop the iteration.

The iteration may not be in tower index order. Use the itower() method of the iterator to find the current tower index.

Definition at line 218 of file LArFCalTowerStore.cxx.

219{
220 return tower_subseg_iterator::make (towers(), subseg);
221}
static SubSegIterator make(tower_iterator beg, const SubSeg &subseg)
tower_iterator towers() const

◆ towerSize()

unsigned int LArFCalTowerStore::towerSize ( tower_iterator t) const
inline

Definition at line 72 of file LArFCalTowerStore.h.

72{return t->size();}

Member Data Documentation

◆ m_indxBound

size_t LArFCalTowerStore::m_indxBound
private

Definition at line 88 of file LArFCalTowerStore.h.

◆ m_indxOffset

size_t LArFCalTowerStore::m_indxOffset
private

Definition at line 87 of file LArFCalTowerStore.h.

◆ m_ndxFCal

std::vector<unsigned int> LArFCalTowerStore::m_ndxFCal
private

Definition at line 84 of file LArFCalTowerStore.h.

◆ m_ndyFCal

std::vector<unsigned int> LArFCalTowerStore::m_ndyFCal
private

Definition at line 85 of file LArFCalTowerStore.h.

◆ m_TTCmatrix

tower_table_t LArFCalTowerStore::m_TTCmatrix
private

Definition at line 90 of file LArFCalTowerStore.h.


The documentation for this class was generated from the following files: