15#include "CaloEvent/CaloTowerContainer.h"
19#include "CLHEP/Units/SystemOfUnits.h"
20#include "GaudiKernel/ThreadLocalContext.h"
32bool comp (
double x1,
double x2,
double thresh = 1e-6)
34 double den = std::abs(x1) + std::abs(x2);
35 if (den == 0)
return true;
36 double num = std::abs (x1 - x2);
48 (
const std::string& name,
49 ISvcLocator* pSvcLocator)
69 return StatusCode::SUCCESS;
78 if(!caloMgrHandle.
isValid()) std::abort();
86 cells->push_back (
new CaloCell (dde, energy, 0, 0, 0,
90 cells->updateCaloIterators();
104 for (
size_t i = 0; i < tow->
size(); i++) {
108 index_t ieta0 = ieta1 + subseg.
etamin()-1;
109 index_t iphi0 = iphi1 + subseg.
phimin()-1;
110 if (iphi0 >
m_seg.nphi())
111 iphi0 -=
m_seg.nphi();
114 if (!comp (
t0->energy(), t1->energy()) ||
115 !comp (
t0->eta(), t1->eta()) ||
116 !comp (
t0->phi(), t1->phi()))
118 std::cout <<
"Energy mismatch " << i <<
" "
119 << ieta1 <<
" " << iphi1 <<
" "
120 <<
t0->eta() <<
" " <<
t0->phi() <<
" "
121 << t1->eta() <<
" " << t1->phi() <<
" "
122 <<
t0->energy() <<
" " << t1->energy() <<
"\n";
125 std::vector<unsigned int> h0;
127 cit !=
t0->cell_end();
130 h0.push_back ((*cit)->caloDDE()->calo_hash());
133 std::vector<unsigned int> h1;
135 cit != t1->cell_end();
138 h1.push_back ((*cit)->caloDDE()->calo_hash());
142 std::cout <<
"Cell list mismatch.\n";
143 for (
size_t i = 0; i < h0.size(); i++)
144 std::cout <<
" " << h0[i];
146 for (
size_t i = 0; i < h1.size(); i++)
147 std::cout <<
" " << h1[i];
154 return StatusCode::SUCCESS;
160 std::cout <<
"test1\n";
161 const EventContext& ctx = Gaudi::Hive::currentContext();
168 std::cout <<
"cells\n";
169 for (
size_t i = 0; i < cells->size(); i++) {
171 std::cout << i <<
" "
172 << (int)(c->caloDDE()->calo_hash()) <<
" "
173 << c->eta() <<
" " << c->phi() <<
" " << c->energy() <<
"\n";
177 std::cout <<
"towers\n";
178 for (
size_t i = 0; i < tow1->
size(); i++) {
180 std::cout << i <<
" "
183 << t->energy() <<
" ";
185 cit != t->cell_end();
188 std::cout << (*cit)->caloDDE()->calo_hash() <<
" ";
198 return StatusCode::SUCCESS;
208 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current CaloTowerContainer
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Container class for CaloCell.
CaloCell_Base_ID::SUBCALO SUBCALO
Data object for each calorimeter readout cell.
This class groups all DetDescr information related to a CaloCell.
calo_element_range element_range() const
Range over element vector.
This class provides the client interface for accessing the detector description information common to...
Storable container class for CaloTower.
CaloTower * getTower(index_t eta, index_t phi)
Returns a pointer to a tower with given indices.
index_t getTowerEtaIndex(const CaloTower *aTower) const
Returns the index for a given tower.
size_t index_t
Tower map index type.
index_t getTowerPhiIndex(const CaloTower *aTower) const
Returns the index for a given tower.
A rectangular window within the segmentation.
index_t etamin() const
Lower eta index.
index_t phimin() const
Lower phi index.
CaloTowerSeg segmentation() const
Return a new segmentation object corresponding to this window.
Data object stores CaloTower segmentation.
Data class for calorimeter cell towers.
CaloEnergyCluster::cell_iterator cell_iterator
Iterator on CaloCell s.
size_type size() const noexcept
Returns the number of elements in the collection.
float randf_seed(uint32_t &seed, float rmax, float rmin=0)
Generate a floating-point random number between rmin and rmax.
Very simple random numbers for regression testing.