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 40 of file LArFCalTowerStore.cxx.

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

◆ ~LArFCalTowerStore()

LArFCalTowerStore::~LArFCalTowerStore ( )

destructor

Definition at line 58 of file LArFCalTowerStore.cxx.

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

Member Function Documentation

◆ buildLookUp()

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

setup trigger

Definition at line 67 of file LArFCalTowerStore.cxx.

70 {
72  // Store Preparation //
74 
75  // messaging
76  IMessageSvc* theMsgSvc;
77  StatusCode sc = Gaudi::svcLocator()->service("MessageSvc",theMsgSvc);
78  if(sc.isFailure()){
79  std::cout << "LArFCalTowerStore: could not initialize the MessageSvc " << std::endl;
80  }
81  MsgStream msg(theMsgSvc,"LArFCalTowerStore");
82 
83  // get cell id helper
84  const LArFCAL_ID& fcalIdHelper = *cellIdHelper.fcal_idHelper();
85 
86  // find numerical ranges
87  IdentifierHash firstIndex, lastIndex;
88  cellIdHelper.calo_cell_hash_range((int)CaloCell_ID::LARFCAL, firstIndex, lastIndex);
89  m_indxOffset = (size_t)firstIndex;
90  m_indxBound = (size_t)lastIndex;
91 
92  // check
93  if ( m_indxBound <= m_indxOffset ){
94  msg << MSG::ERROR << "cannot initialize internal store properly, index offset = " << m_indxOffset << ", index boundary = "
95  << m_indxBound<< " -> module inactivated!"<< endmsg;
96  return false;
97  }
98 
99  // calculate number of rows in store matrix an initialize
100 // m_rowsMatrix = m_indxBound - m_indxOffset + 1;
101 // for ( size_t iRow=0; iRow < m_rowsMatrix; iRow++ ){
102 // m_dataMatrix.push_back(tower_data_store());
103 // }
104 
105  // report data store size
106 // msg << MSG::INFO << "internal matrix set up with " << m_dataMatrix.size()
107  // << " rows: Index Offset: " << m_indxOffset << " Index Boundary: "<< m_indxBound << endmsg;
108 
109 // m_weightInModule.resize(m_rowsMatrix);
110 // m_binDescriptor.resize(m_rowsMatrix);
111 
112  m_TTCmatrix.clear();
113  m_TTCmatrix.resize(theTowers->size());
114 
116  // Cell Loop //
118 
119  // consistent phi convention
120  CaloPhiRange correctPhi;
121 
122  // some stats
123 /* unsigned int aveTowers = 0;
124  unsigned int maxTowers = 0;
125  unsigned int minTowers = size_t(-1); */
126 
127  for( size_t cellIndex = m_indxOffset; cellIndex <= m_indxBound; cellIndex++){
128 
129 
130  // get cell geometry
131  const CaloDetDescrElement* theElement = theManager.get_element(cellIndex);
132  if (!theElement) {
133  msg << MSG::ERROR<< "Can't find element for index " << cellIndex
134  << endmsg;
135  return false;
136  }
137  double xCell = theElement->x();
138  double yCell = theElement->y();
139  double zCell = theElement->z();
140  double dxCell = theElement->dx();
141  double dyCell = theElement->dy();
142 
143  // get cell logical location
144  int thisModule = fcalIdHelper.module(theElement->identify());
145  // get cell splitting
146  thisModule--;
147  double theXBin = dxCell / (double)m_ndxFCal[thisModule];
148  double theYBin = dyCell / (double)m_ndyFCal[thisModule];
149  double theWeight = 1. / ((double) m_ndxFCal[thisModule] * m_ndyFCal[thisModule]);
150 
151 // std::pair<size_t,double> wMod(thisModule,theWeight);
152 // m_weightInModule[anIndex] = wMod;
153 // std::pair<size_t,size_t> iBin(m_ndxFCal[thisModule],m_ndyFCal[thisModule]);
154 // m_binDescriptor[anIndex] = iBin;
155 
156  // loop the cell fragments
157  for ( double x = xCell-dxCell/2.; x < xCell+(dxCell-theXBin/8.)/2.; x += theXBin ){
158  for ( double y = yCell-dyCell/2.;y < yCell+(dyCell-theYBin/8.)/2.;y += theYBin ){
159  // eta,phi of fragment
160  double r = sqrt( x * x + y * y + zCell * zCell );
161  double eta = -0.5 * log((r-zCell)/(r+zCell));
162  double phi = correctPhi.fix(atan2(y,x));
163  // get indices
164  // cppcheck-suppress duplicateAssignExpression
165  CaloTowerContainer::index_t etaIndex = theTowers->flagOutOfRange();
167  if ( theTowers->getTowerIndices(eta,phi,etaIndex,phiIndex) ){
168 
169  CaloTowerContainer::index_t towerIndex = theTowers->getTowerIndex(etaIndex,phiIndex);
170  std::vector<std::pair<unsigned int,double> >::iterator i = m_TTCmatrix[towerIndex].begin();
171  std::vector<std::pair<unsigned int,double> >::iterator e = m_TTCmatrix[towerIndex].end();
172  bool found=false;
173  for (;i<e;++i){
174  if (i->first==cellIndex){
175  i->second+=theWeight;
176  found=true;
177  break;
178  }
179  }
180  if (!found)
181  m_TTCmatrix[towerIndex].push_back(std::make_pair(cellIndex,theWeight));
182 
183  /*
184  // check indices in look-up
185  if ( (m_dataMatrix[anIndex]).find(towerIndex) != (m_dataMatrix[anIndex]).end() ){
186  (m_dataMatrix[anIndex])[towerIndex] += theWeight;
187  }
188  else{
189  (m_dataMatrix[anIndex])[towerIndex] = theWeight;
190  }
191  */
192 
193  } // index retrieval check
194 
195  } // cell y loop
196  } // cell x loop
197 
198 /* // collect some stats
199  if ( (m_dataMatrix[anIndex]).size() < minTowers ) minTowers = (m_dataMatrix[anIndex]).size();
200  if ( (m_dataMatrix[anIndex]).size() > maxTowers )maxTowers = (m_dataMatrix[anIndex]).size();
201  aveTowers += (m_dataMatrix[anIndex]).size(); */
202 
203  } // cell index loop
204 
205 /* // report
206  double cellTowers = (double)aveTowers / (double)m_dataMatrix.size();
207  msg << MSG::INFO
208  << "FCal cell/tower lookup done - min/ave/max towers/cell: "
209  << minTowers << "/" << cellTowers << "/" << maxTowers
210  << ", total number of cell fragments "
211  << aveTowers
212  << endmsg; */
213 
214 
215 
216  return 1;
217 
218 }

◆ 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 223 of file LArFCalTowerStore.cxx.

224 {
225  return tower_subseg_iterator::make (towers(), subseg);
226 }

◆ 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
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:64
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:79
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
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
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:92
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
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
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
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
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
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
Definition: IdentifierHash.h:38
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.
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
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