ATLAS Offline Software
Loading...
Searching...
No Matches
BadLArRetriever.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 "BadLArRetriever.h"
6
8
11
12#include "CaloDetDescr/CaloDetDescrElement.h"
19
20using Athena::Units::GeV;
21
22namespace JiveXML {
23
27
29
30 ATH_MSG_DEBUG( "Initialising Tool" );
31 ATH_CHECK( detStore()->retrieve (m_calocell_id, "CaloCell_ID") );
32
33 ATH_CHECK(m_sgKey.initialize());
34 ATH_CHECK( m_cablingKey.initialize() );
35
36 return StatusCode::SUCCESS;
37 }
38
42 StatusCode BadLArRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
43
44 ATH_MSG_DEBUG( "in retrieve()" );
45
47 if (!cellContainer.isValid()){
48 ATH_MSG_WARNING( "Could not retrieve Calorimeter Cells " );
49 }
50 else{
51 if(m_lar){
52 DataMap data = getBadLArData(&(*cellContainer));
53 ATH_CHECK( FormatTool->AddToEvent(dataTypeName(), m_sgKey.key(), &data) );
54 ATH_MSG_DEBUG( "Bad LAr retrieved" );
55 }
56 }
57
58 //LAr cells retrieved okay
59 return StatusCode::SUCCESS;
60 }
61
62
68
69 ATH_MSG_DEBUG( "getBadLArData()" );
70
72 const auto nCells = cellContainer->size();
73 DataVect phi; phi.reserve(nCells);
74 DataVect eta; eta.reserve(nCells);
75 DataVect energy; energy.reserve(nCells);
76 DataVect idVec; idVec.reserve(nCells);
77 DataVect channel; channel.reserve(nCells);
78 DataVect feedThrough; feedThrough.reserve(nCells);
79 DataVect slot; slot.reserve(nCells);
80
81
82 char rndStr[30]; // for rounding (3 digit precision)
86 const LArOnOffIdMapping* cabling{*cablingHdl};
87 const LArOnlineID* onlineId = nullptr;
88 if ( detStore()->retrieve(onlineId, "LArOnlineID").isFailure()) {
89 ATH_MSG_ERROR( "in getBadLArData(),Could not get LArOnlineID!" );
90 }
91
92 if (m_doBadLAr && cabling) {
93 double energyGeV;
94 ATH_MSG_DEBUG( "Start iterator loop over cells" );
95 for(;it1!=it2;++it1){
96 if( !(*it1)->badcell() ) continue;
97 if ((((*it1)->provenance()&0xFF)!=0xA5)&&m_cellConditionCut) continue; // check full conditions for LAr
98 HWIdentifier LArhwid = cabling->createSignalChannelIDFromHash((*it1)->caloDDE()->calo_hash());
99 energyGeV = (*it1)->energy()*(1./GeV);
100 if (energyGeV == 0) energyGeV = 0.001; // 1 MeV due to LegoCut > 0.0 (couldn't be >= 0.0)
101
102 energy.emplace_back( gcvt( energyGeV, m_cellEnergyPrec, rndStr) );
103 idVec.emplace_back((Identifier::value_type)(*it1)->ID().get_compact() );
104 phi.emplace_back((*it1)->phi());
105 eta.emplace_back((*it1)->eta());
106 channel.emplace_back(onlineId->channel(LArhwid));
107 feedThrough.emplace_back(onlineId->feedthrough(LArhwid));
108 slot.emplace_back(onlineId->slot(LArhwid));
109 } // end cell iterator
110 } // doBadLAr
111 // write values into DataMap
112 const auto nEntries = phi.size();
113 DataMap["phi"] = std::move(phi);
114 DataMap["eta"] = std::move(eta);
115 DataMap["energy"] = std::move(energy);
116 DataMap["id"] = std::move(idVec);
117 DataMap["channel"] = std::move(channel);
118 DataMap["feedThrough"] = std::move(feedThrough);
119 DataMap["slot"] = std::move(slot);
120 //Be verbose
121 ATH_MSG_DEBUG( dataTypeName() << " , collection: " << dataTypeName()
122 << " retrieved with " << nEntries << " entries" );
123
124 //All collections retrieved okay
125 return DataMap;
126
127 } // getBadLArData
128
129 //--------------------------------------------------------------------------
130
131} // 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_ERROR(x)
#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.
virtual std::string dataTypeName() const override
Return the name of the data type.
virtual StatusCode initialize() override
Default AthAlgTool methods.
SG::ReadHandleKey< CaloCellContainer > m_sgKey
for properties
const CaloCell_ID * m_calocell_id
Gaudi::Property< bool > m_cellConditionCut
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool) override
Retrieve all the data.
Gaudi::Property< bool > m_doBadLAr
Gaudi::Property< bool > m_lar
const DataMap getBadLArData(const CaloCellContainer *cellContainer)
Retrieve LAr bad cell location and details.
Gaudi::Property< int > m_cellEnergyPrec
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
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