ATLAS Offline Software
Loading...
Searching...
No Matches
BadTileRetriever.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "BadTileRetriever.h"
6
8
10
12#include "CaloDetDescr/CaloDetDescrElement.h"
13#include "TileEvent/TileCell.h"
26
27using Athena::Units::GeV;
28
29namespace JiveXML {
30
34
36 ATH_MSG_DEBUG( "Initialising Tool" );
37 ATH_CHECK( detStore()->retrieve (m_calocell_id, "CaloCell_ID") );
38 ATH_CHECK(m_sgKey.initialize());
39 return StatusCode::SUCCESS;
40 }
41
45 StatusCode BadTileRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
46 ATH_MSG_DEBUG( "in retrieve()" );
48 if (!cellContainer.isValid()){
49 ATH_MSG_WARNING( "Could not retrieve Calorimeter Cells " );
50 } else {
51 if(m_tile){
52 DataMap data = getBadTileData(&(*cellContainer));
53 ATH_CHECK( FormatTool->AddToEvent(dataTypeName(), m_sgKey.key(), &data) );
54 ATH_MSG_DEBUG( "Bad Tile retrieved" );
55 }
56 }
57 //Tile cells retrieved okay
58 return StatusCode::SUCCESS;
59 }
60
61
67 ATH_MSG_DEBUG( "getBadTileData()" );
68 char rndStr[30];
70 DataVect phi; phi.reserve(cellContainer->size());
71 DataVect eta; eta.reserve(cellContainer->size());
72 DataVect idVec; idVec.reserve(cellContainer->size());
73 DataVect energyVec; energyVec.reserve(cellContainer->size());
74 m_sub.clear();
75 //Loop Over CaloCellContainer to retrieve TileCell information
78 if (m_doBadTile==true) {
79 double energyGeV;
80 //int cellInd;
81 ATH_MSG_DEBUG( "Start iterator loop over cells" );
82 for(;it1!=it2;++it1){
83 if( !(*it1)->badcell() ) continue;
84 Identifier cellid = (*it1)->ID();
85 calcTILELayerSub(cellid);
86 energyGeV = (*it1)->energy()*(1./GeV);
87 energyVec.emplace_back( gcvt( energyGeV, m_cellEnergyPrec, rndStr) );
88 idVec.emplace_back( (Identifier::value_type)(*it1)->ID().get_compact() );
89 phi.emplace_back((*it1)->phi());
90 eta.emplace_back((*it1)->eta());
91 } // end cell iterator
92 } // doBadTile
93
94 // write values into DataMap
95 const auto nEntries = phi.size();
96 DataMap["phi"] = std::move(phi);
97 DataMap["eta"] = std::move(eta);
98 DataMap["sub"] = std::move(m_sub);
99 DataMap["id"] = std::move(idVec);
100 DataMap["energy"] = std::move(energyVec);
101 //Be verbose
102 ATH_MSG_DEBUG( dataTypeName() << " retrieved with " << nEntries << " entries" );
103 //All collections retrieved okay
104 return DataMap;
105 } // getTileData
106
107 //-----------------------------------------------------------------------------------------------------
108
110 {
111 if(m_calocell_id->is_tile_barrel(cellid))
112 {
113 if(m_calocell_id->is_tile_negative(cellid))
114 m_sub.emplace_back(2);
115 else
116 m_sub.emplace_back(3);
117 }
118 else if(m_calocell_id->is_tile_extbarrel(cellid))
119 {
120 if(m_calocell_id->is_tile_negative(cellid))
121 m_sub.emplace_back(0);
122 else
123 m_sub.emplace_back(5);
124 }
125 //else in ITC or scint
126 else
127 {
128 if(m_calocell_id->is_tile_negative(cellid))
129 m_sub.emplace_back(1);
130 else
131 m_sub.emplace_back(4);
132 }
133 }
134
135 //--------------------------------------------------------------------------
136
137} // JiveXML namespace
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Wrapper to avoid constant divisions when using units.
Container class for CaloCell.
CaloCellContainer::const_iterator beginConstCalo(CaloCell_ID::SUBCALO caloNum) const
get const iterators on cell of just one calo
CaloCellContainer::const_iterator endConstCalo(CaloCell_ID::SUBCALO caloNum) const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
size_type size() const noexcept
Returns the number of elements in the collection.
SG::ReadHandleKey< CaloCellContainer > m_sgKey
Gaudi::Property< bool > m_doBadTile
const CaloCell_ID * m_calocell_id
void calcTILELayerSub(Identifier &)
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool) override
Retrieve all the data.
virtual std::string dataTypeName() const override
Return the name of the data type.
virtual StatusCode initialize() override
Default AthAlgTool methods.
Gaudi::Property< bool > m_tile
const DataMap getBadTileData(const CaloCellContainer *cellContainer)
Retrieve Tile bad cell location and details.
Gaudi::Property< int > m_cellEnergyPrec
virtual bool isValid() override final
Can the handle be successfully dereferenced?
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
std::map< std::string, DataVect > DataMap
Definition DataType.h:59
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition DataType.h:58