ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
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 More...
 
 ~LArFCalTowerStore ()
 destructor More...
 
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. More...
 
cell_iterator firstCellofTower (tower_iterator t) const
 iterators: cells More...
 
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 More...
 
size_t size () const
 size of internal data store More...
 

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

Definition at line 51 of file LArFCalTowerStore.h.

◆ 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  }

◆ ~LArFCalTowerStore()

LArFCalTowerStore::~LArFCalTowerStore ( )

destructor

Definition at line 59 of file LArFCalTowerStore.cxx.

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

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 }

◆ 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 }

◆ 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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
beamspotman.r
def r
Definition: beamspotman.py:676
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
CaloPhiRange
This class defines the phi convention for Calorimeters.
Definition: CaloPhiRange.h:28
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloDetDescrElement::y
float y() const
cell y
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:365
CaloTowerSeg::SubSegIterator::make
static SubSegIterator make(TOWER_ITERATOR beg, const SubSeg &subseg)
Construct a new iterator for iterating over a window.
Definition: CaloTowerSeg.h:609
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
LArFCalTowerStore::towers
tower_iterator towers() const
Definition: LArFCalTowerStore.h:53
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
LArFCAL_Base_ID::module
int module(const Identifier id) const
module [1,3]
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
x
#define x
CaloTowerContainer::getTowerIndex
index_t getTowerIndex(const CaloTower *aTower) const
Returns the combined index of a tower on the grid.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloTowerContainer.h:598
LArFCalTowerStore::m_TTCmatrix
tower_table_t m_TTCmatrix
Definition: LArFCalTowerStore.h:90
CaloDetDescrElement::identify
Identifier identify() const override final
cell identifier
Definition: CaloDetDescrElement.cxx:64
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloCell_Base_ID::calo_cell_hash_range
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
CaloTowerContainer::getTowerIndices
bool getTowerIndices(const CaloTower *aTower, index_t &indexEta, index_t &indexPhi) const
Returns both and indices for a given tower.
Definition: CaloTowerContainer.cxx:235
LArFCalTowerStore::m_indxOffset
size_t m_indxOffset
Definition: LArFCalTowerStore.h:87
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
CaloPhiRange::fix
static double fix(double phi)
Definition: CaloPhiRange.cxx:14
LArFCalTowerStore::m_indxBound
size_t m_indxBound
Definition: LArFCalTowerStore.h:88
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
LArFCalTowerStore::m_ndxFCal
std::vector< unsigned int > m_ndxFCal
Definition: LArFCalTowerStore.h:84
CaloDetDescrElement::x
float x() const
cell x
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:363
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
CaloTowerContainer::index_t
size_t index_t
Tower map index type.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloTowerContainer.h:82
y
#define y
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
CaloDetDescrElement::dx
float dx() const
cell dx
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:375
CaloDetDescrElement::z
float z() const
cell z
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:367
LArFCalTowerStore::m_ndyFCal
std::vector< unsigned int > m_ndyFCal
Definition: LArFCalTowerStore.h:85
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
LArFCAL_ID
Helper class for LArFCAL offline identifiers.
Definition: LArFCAL_ID.h:60
CaloDetDescrElement::dy
float dy() const
cell dy
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:377
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
CaloCell_ID::fcal_idHelper
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
Definition: CaloCell_ID.h:75
CaloTowerContainer::flagOutOfRange
index_t flagOutOfRange() const
Returns the index out-of-range indicator.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloTowerContainer.h:651