24 #include "CaloDetDescr/CaloDetDescrElement.h"
32 const std::string&
type,
33 const std::string&
name,
36 m_caloSelection(false),
63 ATH_MSG_WARNING (
" no calo specified for correction. Will do nothing. ");
64 return StatusCode::SUCCESS;
67 << nSubCalo <<
" calo specified. Must be wrong. Stop.");
68 return StatusCode::FAILURE;
71 ATH_MSG_INFO (
" Correction will be applied on all calo.");
77 return StatusCode::FAILURE;
92 return StatusCode::SUCCESS;
97 const EventContext& )
const
112 for (std::vector<int>::const_iterator itrCalo=
m_caloNums.begin();itrCalo!=
m_caloNums.end();++itrCalo){
120 if (!theCont->
hasCalo(caloNum))
122 ATH_MSG_WARNING (
" Attempt to apply correction but CaloCellContainer has not been filled for this calo : "
129 <<
static_cast<int> (caloNum));
134 return StatusCode::SUCCESS ;
142 unsigned int myCellHashOffset = myHashMin;
145 std::map<Identifier,CaloCell*> cellMap;
146 std::map<Identifier,float> energyMap;
147 for (itrCell=itrCellBeg;itrCell!=itrCellEnd;++itrCell) {
149 cellMap.insert(std::pair<Identifier,CaloCell*>(theCell->
ID(),theCell));
150 energyMap.insert(std::pair<Identifier,float>(theCell->
ID(),theCell->
energy()));
153 for (itrCell=itrCellBeg;itrCell!=itrCellEnd;++itrCell) {
162 if (cellItEng==energyMap.end()) {
164 return StatusCode::FAILURE;
166 double e = (*cellItEng).second;
169 std::vector<IdentifierHash> theNeighbors;
177 ATH_MSG_DEBUG (
"N1 theNeighbors.size() = " << theNeighbors.size());
181 if (cellIt==cellMap.end()) {
182 ATH_MSG_ERROR (
"neighbor CaloCell object not found in cellMap");
183 return StatusCode::FAILURE;
185 CaloCell * theCellN1 = (*cellIt).second;
187 ATH_MSG_ERROR (
"neighbor CaloCell object not found in cellMap");
188 return StatusCode::FAILURE;
190 cellItEng = energyMap.find(theCellN1->
ID());
191 if (cellItEng==energyMap.end()) {
193 return StatusCode::FAILURE;
195 double eN1 = (*cellItEng).second;
198 int EMEC3neighbors = 0;
202 ATH_MSG_DEBUG (
"N2 theNeighbors.size() = " << theNeighbors.size() );
205 if (theNeighbors.size()>0) {
206 nId = theNeighbors.at(0)-myCellHashOffset;
208 cellIt = cellMap.find(myId);
209 if (cellIt!=cellMap.end()) {
210 theCellN2 = (*cellIt).second;
211 cellItEng = energyMap.find(theCellN2->
ID());
212 if (cellItEng==energyMap.end()) {
214 return StatusCode::FAILURE;
216 eN2 = (*cellItEng).second;
222 ATH_MSG_DEBUG (
"N3 theNeighbors.size() = " << theNeighbors.size() );
225 if (theNeighbors.size()>0) {
226 nId = theNeighbors.at(0)-myCellHashOffset;
228 cellIt = cellMap.find(myId);
229 if (cellIt!=cellMap.end()) {
230 theCellN3 = (*cellIt).second;
231 cellItEng = energyMap.find(theCellN3->
ID());
232 if (cellItEng==energyMap.end()) {
234 return StatusCode::FAILURE;
236 eN3 = (*cellItEng).second;
242 int EMEC2neighbors = 0;
246 ATH_MSG_DEBUG (
"N4 theNeighbors.size() = " << theNeighbors.size() );
249 if (theNeighbors.size()>0) {
250 nId = theNeighbors.at(0)-myCellHashOffset;
252 cellIt = cellMap.find(myId);
253 if (cellIt!=cellMap.end()) {
254 theCellN4 = (*cellIt).second;
255 cellItEng = energyMap.find(theCellN4->
ID());
256 if (cellItEng==energyMap.end()) {
258 return StatusCode::FAILURE;
260 eN4 = (*cellItEng).second;
266 ATH_MSG_DEBUG (
"N5 theNeighbors.size() = " << theNeighbors.size() );
269 if (theNeighbors.size()>0) {
270 nId = theNeighbors.at(0)-myCellHashOffset;
272 cellIt = cellMap.find(myId);
273 if (cellIt!=cellMap.end()) {
274 theCellN5 = (*cellIt).second;
275 cellItEng = energyMap.find(theCellN5->
ID());
276 if (cellItEng==energyMap.end()) {
278 return StatusCode::FAILURE;
280 eN5 = (*cellItEng).second;
288 double rescaled_eN1 = 0;
290 double rescaled_eN2 = 0.;
292 double rescaled_eN3 = 0.;
314 ATH_MSG_DEBUG (
"EMEC2 cell : energy before = " <<
e <<
" | energy after rescaling = " << rescaled_e );
320 <<
" | " << (theCell->
energy()-
e) );
321 ATH_MSG_DEBUG (
"EMEC3 cell (N1): energy before = " << eN1 <<
" | energy after rescaling = " << rescaled_eN1 );
323 <<
" | " << (theCellN1->
energy()-eN1) );
325 ATH_MSG_DEBUG (
"EMEC3 cell (N2): energy before = " << eN2 <<
" | energy after rescaling = " << rescaled_eN2 );
327 <<
" | " << (theCellN2->
energy()-eN2) );
330 ATH_MSG_DEBUG (
"EMEC3 cell (N3): energy before = " << eN3 <<
" | energy after rescaling = " << rescaled_eN3 );
332 <<
" | " << (theCellN3->
energy()-eN3) );
347 if (theCellN1) theCellN1->
setEnergy(rescaled_eN1);
348 if (theCellN2) theCellN2->
setEnergy(rescaled_eN2);
349 if (theCellN3) theCellN3->
setEnergy(rescaled_eN3);
355 return StatusCode::SUCCESS;