64 return StatusCode::SUCCESS;
70 unsigned int index = 0;
71 std::vector<double> eSumCalos;
72 std::vector<unsigned int> nCellCalos;
74 eSumCalos.push_back(0.);
75 nCellCalos.push_back(0);
79 for (
const CaloCell* aCell : *theCont) {
81 int iCalo =
static_cast<int>(theDDE->
getSubCalo());
83 eSumCalos[iCalo]+=aCell->e();
84 ++(nCellCalos[iCalo]);
87 const double aPeta=aP.e() != 0 ? aP.eta() : 0;
88 const double aPphi=aP.phi() ;
96 if (aCell->e()!=0 && std::abs(aCell->eta()-aPeta)>0.0001) {
97 msg(MSG::WARNING) <<
"Cell " <<
index <<
" eta inconsistency : " << aCell->eta()
98 <<
" vs recalculated " << aPeta <<
endmsg ;
101 msg(MSG::WARNING) <<
"Cell " <<
index <<
" phi inconsistency : " << aCell->phi()
102 <<
" vs recalculated " << aPphi <<
endmsg ;
107 for (
const CaloCell* aCell : *theCont) {
111 <<
" eta " << theDDE->
eta()
112 <<
" phi " << theDDE->
phi()
113 <<
" e " << aCell->e() <<
endmsg ;
122 msg(MSG::WARNING) <<
" There are cells for calo "
123 << iCalo <<
" but hasCalo is not set. " <<
endmsg ;
132 double theESumCalo=0;
133 unsigned int theNCellCalo=0;
137 for (;itrCell!=endCell;++itrCell){
138 theESumCalo+=(*itrCell)->e();
144 <<
" nCellCalos[iCalo]=" <<nCellCalos[iCalo]
145 <<
" theCont->nCellsCalo(enumCalo)=" << theCont->nCellsCalo(enumCalo) );
147 if (theNCellCalo!=nCellCalos[iCalo] ||
148 static_cast<int>(theNCellCalo)!=theCont->nCellsCalo(enumCalo) ) {
149 msg(MSG::ERROR) <<
" Iterators: ncell do not match"
150 <<
" theNCellCalo="<<theNCellCalo
151 <<
" nCellCalos[iCalo]=" <<nCellCalos[iCalo]
152 <<
" theCont->nCellsCalo(enumCalo)=" << theCont->nCellsCalo(enumCalo)
154 returnSc = StatusCode::FAILURE;
159 ATH_MSG_DEBUG(
"theESumCalo eSumCalos[iCalo] "<< theESumCalo <<
" " << eSumCalos[iCalo]);
160 const double epsilon=1
e-5;
161 if (fabs(theESumCalo-eSumCalos[iCalo])>epsilon) {
162 msg(MSG::ERROR) <<
" Non const iterators: E sum do not match"
163 <<
" subcalo " << iCalo
164 <<
" should be " << eSumCalos[iCalo]
165 <<
" is " << theESumCalo <<
" (" << theESumCalo-eSumCalos[iCalo] <<
")" <<
endmsg ;
166 returnSc = StatusCode::FAILURE;
176 unsigned int nHoles =0;
178 ATH_MSG_DEBUG(
"Now check all hashes give meaningful answer");
179 for (
unsigned int theHash=0;theHash<hashMax;++theHash){
180 const CaloCell * theCell = theCont->findCell(theHash) ;
181 if (theCell==
nullptr) {
191 msg(
MSG::VERBOSE) <<
"Cell not found: id=0x" << std::hex <<
id << std::dec
192 <<
", SubCalo=" <<subcalo <<
", sampling="<< sampling <<
", pos_neg="
193 << pos_neg <<
", region=" << region <<
", sample=" <<
sample <<
endmsg;
197 ATH_MSG_DEBUG(
"Number of hash with no cells: " << nHoles <<
" out of " << hashMax);
199 std::vector<IdentifierHash>
hashes ;
207 if ((*itrCell)->et()>2000 *
MeV ) {
208 hashes.push_back(theHash);
209 eSumFound+=(*itrCell)->energy();
211 const CaloCell * reCell=theCont->findCell(theHash);
212 if (reCell!=*itrCell){
215 unsigned int reHash=0 ;
218 if (reCell!=
nullptr) reCaloDDE=reCell->
caloDDE();
219 if (reCaloDDE!=
nullptr) reHash = reCaloDDE->
calo_hash();
222 msg(MSG::ERROR) <<
index <<
"Cell " << theHash <<
" " << *itrCell
223 <<
" not found back " << reCell
224 <<
" reCaloDDE " << reCaloDDE
225 <<
" rehash " << reHash <<
endmsg ;
226 returnSc = StatusCode::FAILURE;
231 ATH_MSG_DEBUG(
"number of cells to be refound " <<
hashes.size() <<
" total energy " << eSumFound);
236 theCont->findCellVector(
hashes,foundCells);
238 if (
hashes.size()!=foundCells.size()){
239 msg(MSG::ERROR) <<
"number of cells to be found " <<
hashes.size() <<
"number found: " << foundCells.size() <<
endmsg ;
240 returnSc = StatusCode::FAILURE;
246 for (CaloCellContainer::CellVector::const_iterator itrCell=foundCells.begin();itrCell!=foundCells.end(); ++itrCell)
247 if (*itrCell!=0) reSumFound+=(*itrCell)->e();
250 if (std::abs(reSumFound-eSumFound)>10 *
MeV ){
251 msg(MSG::ERROR) <<
"Found cells wrong E sum " << reSumFound <<
" instead of " << eSumFound <<
endmsg ;
252 returnSc = StatusCode::FAILURE;