|
ATLAS Offline Software
|
Go to the documentation of this file.
27 #include "GaudiKernel/Bootstrap.h"
28 #include "GaudiKernel/Service.h"
29 #include "GaudiKernel/MsgStream.h"
30 #include "GaudiKernel/IMessageSvc.h"
34 #include "CaloDetDescr/CaloDetDescrElement.h"
77 const std::vector<CaloCell_ID::SUBCALO>& theCalos)
95 msg << MSG::ERROR<<
"CaloDetDescrManager is not initialized, module unusable!"<<
endmsg;
101 size_t sizeCalos = theCalos.size();
103 unsigned int ntowers = theTowerSeg.
neta() * theTowerSeg.
nphi();
105 std::vector< std::vector<Entry> > ttcmatrix;
106 ttcmatrix.resize (ntowers);
110 for (
unsigned int iCalo=0; iCalo<sizeCalos; iCalo++ ){
118 for(
size_t cellIndex = firstIndex; cellIndex < lastIndex; cellIndex++){
123 if(theDDE==
nullptr) {
124 msg << MSG::ERROR<<
" CellIndex = "<< cellIndex<<
" has a DDE pointer NULL " <<
endmsg;
129 double cellDeta = theDDE->
deta();
130 double cellDphi = theDDE->
dphi();
131 double etaRaw = theDDE->
eta_raw();
140 size_t ke = (size_t) (cellDeta/theTowerSeg.
deta()+0.5);
141 ke = (ke==0) ? 1 : ke;
142 size_t kp = (size_t) (cellDphi/theTowerSeg.
dphi()+0.5);
143 kp = (kp==0) ? 1 : kp;
145 double theWeight = 1. / ( (
double) ke * kp );
147 double cellDdeta = cellDeta / (
double) ke;
148 double cellDdphi = cellDphi / (
double) kp;
149 double etaMin = etaRaw - cellDeta / 2.;
150 double phiMin = phiRaw - cellDphi / 2.;
157 for (
size_t ie=1;
ie<=ke;
ie++ ){
159 for (
size_t ip=1;
ip<=kp;
ip++ ){
160 double cellPhi = phiMin + ((
double)
ip - 0.5) * cellDdphi;
176 if (towerIndex < ntowers) {
177 ttcmatrix[towerIndex].emplace_back(cellIndex,iw);
190 m_towers.reserve (ttcmatrix.size()+1);
192 for (
size_t i = 0;
i < ttcmatrix.size();
i++) {
194 const std::vector<Entry>&
v = ttcmatrix[
i];
199 unsigned int stride = 0;
200 for (
size_t j = 1; j <
v.size(); j++) {
211 if ((
int)(
v[j].
hash -
v[j-1].
hash) == (
int)stride &&
230 printf (
"zzztowers calos: ");
231 for (
size_t z = 0;
z < theCalos.size();
z++) printf (
"%d ", theCalos[
z]);
232 printf (
"ntower: %d nent: %d nentraw: %d weights: ",
237 static FILE* flog = 0;
238 if (!flog) flog = fopen (
"towstore.dump",
"w");
239 fprintf (flog,
"========================================\n");
241 bool backref =
false;
243 fprintf (flog,
"tow %d %d %d %d %d %d\n",
it,
m_towers[
it].ncells,
270 std::vector<unsigned short>
entries;
274 for (
size_t i = 0;
i <
sz;
i++) {
291 unsigned int phase = 0;
293 unsigned int offs1 = 0;
294 unsigned int offs2 = 0;
305 unsigned int offs = ent2.
hash - ent1.
hash;
311 else if (
phase == 1) {
319 else if (
phase == 2) {
337 m_towers.back().backref_next =
true;
348 unsigned int the_windex,
349 unsigned int the_ncells ,
350 unsigned int the_stride )
364 unsigned int the_ncells)
366 backref_next (false),
378 unsigned int the_ncells,
380 unsigned int the_offs1,
381 unsigned int the_offs2)
383 backref_next (false),
391 assert (the_n1 <=
n1_max);
float deta() const
cell deta
Iterator over a rectangular window of towers.
void reset()
Reset the value to invalid.
static const unsigned int ncells_max
singleton-like access to IMessageSvc via open function and helper
static SubSegIterator make(TOWER_ITERATOR beg, const SubSeg &subseg)
Construct a new iterator for iterating over a window.
static const unsigned int offs1_max
bool isValid() const
Test to see if the value is valid.
static const unsigned int offs2_max
CxxUtils::CachedValue< std::vector< unsigned short > > m_entry_index
One of these for each entry in m_towers, giving the index of the corresponding entry in m_entries.
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
static const unsigned int nentries_max
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
~CaloTowerStore()
destructor
index_t neta() const
Retrieve number of bins.
static const unsigned int ncells_max
std::vector< Tower > m_towers
double deta() const
Retrieve bin size .
static const unsigned int hash_max
void store(const T &val)
Store a new value.
void pushTower(unsigned int nentries, unsigned int ncells)
IMessageSvc * getMessageSvc(bool quiet=false)
Definition of CaloDetDescrManager.
index_t nphi() const
Retrieve number of bins.
float eta_raw() const
cell eta_raw
bool isInitialized() const
for backwards compatibility only
A rectangular window within the segmentation.
std::vector< Entry > m_entries
Tower(unsigned int the_nentries, unsigned int the_ncells)
void checkEntryIndex() const
Check m_entry_index and fill it in if we haven't done so yet.
double dphi() const
Retrieve bin size .
static const unsigned int windex_max
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
CaloTowerStore()
constructor
std::vector< double > m_weights
size_t index_t
Type for eta, phi indices.
CaloPhiRange class declaration.
Helper class for offline cell identifiers.
static double fix(double phi)
index_t phiIndex(double phiVal) const
Returns index for a given value.
index_t etaphi(index_t etaInd, index_t phiInd) const
Returns combined continous index from , indices.
void set(const T &val) const
Set the value, assuming it is currently invalid.
static const unsigned int stride_max
static const unsigned int n1_max
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
float dphi() const
cell dphi
Entry(unsigned int the_hash=0, unsigned int the_windex=0, unsigned int the_ncells=1, unsigned int the_stride=0)
This class provides the client interface for accessing the detector description information common to...
static const index_t outOfRange
Used to flag out-of-range indices.
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
tower_iterator towers() const
Data object stores CaloTower segmentation.
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
index_t etaIndex(double etaVal) const
Returns index for a given value.
bool buildLookUp(const CaloDetDescrManager &theManager, const CaloTowerSeg &theTowerSeg, const std::vector< CaloCell_ID::SUBCALO > &theCalos)
setup trigger
float phi_raw() const
cell phi_raw