|
ATLAS Offline Software
|
Go to the documentation of this file.
23 #include "CLHEP/Units/SystemOfUnits.h"
35 const std::string&
type,
36 const std::string&
name,
54 return StatusCode::SUCCESS;
60 const EventContext& ctx)
const
68 const EventContext& ctx)
const
76 const EventContext& ctx)
const
79 return StatusCode::SUCCESS;
85 unsigned int index = 0;
86 std::vector<double> eSumCalos;
87 std::vector<unsigned int> nCellCalos;
89 eSumCalos.push_back(0.);
90 nCellCalos.push_back(0);
94 for (
const CaloCell* aCell : *theCont) {
96 int iCalo =
static_cast<int>(theDDE->
getSubCalo());
98 eSumCalos[iCalo]+=aCell->e();
99 ++(nCellCalos[iCalo]);
102 const double aPeta=aP.
e() != 0 ? aP.
eta() : 0;
103 const double aPphi=aP.
phi() ;
111 if (aCell->e()!=0 && std::abs(aCell->eta()-aPeta)>0.0001) {
112 msg(MSG::WARNING) <<
"Cell " <<
index <<
" eta inconsistency : " << aCell->eta()
113 <<
" vs recalculated " << aPeta <<
endmsg ;
116 msg(MSG::WARNING) <<
"Cell " <<
index <<
" phi inconsistency : " << aCell->phi()
117 <<
" vs recalculated " << aPphi <<
endmsg ;
122 for (
const CaloCell* aCell : *theCont) {
126 <<
" eta " << theDDE->
eta()
127 <<
" phi " << theDDE->
phi()
128 <<
" e " << aCell->e() <<
endmsg ;
137 msg(MSG::WARNING) <<
" There are cells for calo "
138 << iCalo <<
" but hasCalo is not set. " <<
endmsg ;
147 double theESumCalo=0;
148 unsigned int theNCellCalo=0;
152 for (;itrCell!=endCell;++itrCell){
153 theESumCalo+=(*itrCell)->e();
159 <<
" nCellCalos[iCalo]=" <<nCellCalos[iCalo]
160 <<
" theCont->nCellsCalo(enumCalo)=" << theCont->nCellsCalo(enumCalo) );
162 if (theNCellCalo!=nCellCalos[iCalo] ||
163 static_cast<int>(theNCellCalo)!=theCont->nCellsCalo(enumCalo) ) {
164 msg(MSG::ERROR) <<
" Iterators: ncell do not match"
165 <<
" theNCellCalo="<<theNCellCalo
166 <<
" nCellCalos[iCalo]=" <<nCellCalos[iCalo]
167 <<
" theCont->nCellsCalo(enumCalo)=" << theCont->nCellsCalo(enumCalo)
169 returnSc = StatusCode::FAILURE;
174 ATH_MSG_DEBUG(
"theESumCalo eSumCalos[iCalo] "<< theESumCalo <<
" " << eSumCalos[iCalo]);
175 const double epsilon=1
e-5;
176 if (fabs(theESumCalo-eSumCalos[iCalo])>epsilon) {
177 msg(MSG::ERROR) <<
" Non const iterators: E sum do not match"
178 <<
" subcalo " << iCalo
179 <<
" should be " << eSumCalos[iCalo]
180 <<
" is " << theESumCalo <<
" (" << theESumCalo-eSumCalos[iCalo] <<
")" <<
endmsg ;
181 returnSc = StatusCode::FAILURE;
191 unsigned int nHoles =0;
193 ATH_MSG_DEBUG(
"Now check all hashes give meaningful answer");
194 for (
unsigned int theHash=0;theHash<hashMax;++theHash){
195 const CaloCell * theCell = theCont->findCell(theHash) ;
196 if (theCell==
nullptr) {
206 msg(
MSG::VERBOSE) <<
"Cell not found: id=0x" << std::hex <<
id << std::dec
207 <<
", SubCalo=" <<subcalo <<
", sampling="<< sampling <<
", pos_neg="
208 << pos_neg <<
", region=" << region <<
", sample=" <<
sample <<
endmsg;
212 ATH_MSG_DEBUG(
"Number of hash with no cells: " << nHoles <<
" out of " << hashMax);
214 std::vector<IdentifierHash>
hashes ;
222 if ((*itrCell)->et()>2000 *
MeV ) {
223 hashes.push_back(theHash);
224 eSumFound+=(*itrCell)->energy();
226 const CaloCell * reCell=theCont->findCell(theHash);
227 if (reCell!=*itrCell){
230 unsigned int reHash=0 ;
233 if (reCell!=
nullptr) reCaloDDE=reCell->
caloDDE();
234 if (reCaloDDE!=
nullptr) reHash = reCaloDDE->
calo_hash();
237 msg(MSG::ERROR) <<
index <<
"Cell " << theHash <<
" " << *itrCell
238 <<
" not found back " << reCell
239 <<
" reCaloDDE " << reCaloDDE
240 <<
" rehash " << reHash <<
endmsg ;
241 returnSc = StatusCode::FAILURE;
246 ATH_MSG_DEBUG(
"number of cells to be refound " <<
hashes.size() <<
" total energy " << eSumFound);
251 theCont->findCellVector(
hashes,foundCells);
253 if (
hashes.size()!=foundCells.size()){
254 msg(MSG::ERROR) <<
"number of cells to be found " <<
hashes.size() <<
"number found: " << foundCells.size() <<
endmsg ;
255 returnSc = StatusCode::FAILURE;
261 for (CaloCellContainer::CellVector::const_iterator itrCell=foundCells.begin();itrCell!=foundCells.end(); ++itrCell)
262 if (*itrCell!=0) reSumFound+=(*itrCell)->e();
265 if (std::abs(reSumFound-eSumFound)>10 *
MeV ){
266 msg(MSG::ERROR) <<
"Found cells wrong E sum " << reSumFound <<
" instead of " << eSumFound <<
endmsg ;
267 returnSc = StatusCode::FAILURE;
def retrieve(aClass, aKey=None)
Const iterator class for DataVector/DataList.
int region(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
virtual double e() const
get energy data member
virtual double eta() const
pseudo rapidity
int pos_neg(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
CaloCell_ID::SUBCALO getSubCalo() const
cell subcalo
IdentifierHash calo_hash() const
cell calo hash
int sample(const Identifier id) const
Tile field values (NOT_VALID == invalid request)
::StatusCode StatusCode
StatusCode definition for legacy code.
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
SUBCALO
enumeration of sub calorimeters
CaloPhiRange class declaration.
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
Container class for CaloCell.
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
Data object for each calorimeter readout cell.
CaloCellContainer that can accept const cell pointers.
float eta() const
cell eta
float phi() const
cell phi
CaloCellContainer that can accept const cell pointers.
virtual double phi() const
phi in [-pi,pi[
std::vector< const CaloCell * > CellVector
type to be used for the internal lookup table, and to return list of cells
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size