ATLAS Offline Software
Loading...
Searching...
No Matches
MissingCellListTool.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7// MissingCellListTool.cxx
8// Implementation file for class MissingCellListTool
9// Author: S.Binet<binet@cern.ch>
11
12// JetMomentTools includes
14// FrameWork includes
16// StoreGate
19
20//
23
24
25
26// ///////////////////////////////////////////////////////////////////
27// // Public methods:
28// ///////////////////////////////////////////////////////////////////
29
30// Constructors
33 asg::AsgTool ( name ),
34 m_tileCabling("TileCablingSvc",name),
35 m_tileTool("TileBadChanTool",this)
36{
37
38 //declareInterface<IMissingCellListTool>( this );
39
40 declareProperty("AddCellList", m_userAddedCells);
41 declareProperty("RemoveCellList", m_userRemovedCells );
42 declareProperty("AddBadCells", m_addBadCells=true );
43 declareProperty("DeltaRmax", m_rmax=1.0);
44 // ported from JetBadChanCorrTool
45 declareProperty("AddCellFromTool", m_addCellFromTool = false);
46 //608517, deadReadout | deadPhys | missingFEB | highNoiseHG | highNoiseMG | highNoiseLG | spor adicBurstNoise
47 declareProperty("LArMaskBit", m_larMaskBit = ( 1<< 0 | 1<< 2 | 1<<16 | 1<<8 | 1<<11 | 1<<14 | 1<<19 ));
48 declareProperty("TileMaskBit", m_tileMaskBit = ( 1<< 0 )); //1, dead
49}
50
51// Destructor
54= default;
55
56// Athena algtool's Hooks
59{
60 ATH_MSG_INFO ("Initializing " << name() << "...");
61 CHECK( m_tileCabling.retrieve() );
62 //
63 ATH_CHECK(m_badCellMap_key.initialize());
64 ATH_CHECK(m_caloDetDescrMgrKey.initialize());
68 ATH_CHECK( m_tileTool.retrieve() );
69 } else {
70 m_tileTool.disable();
71 }
72 return StatusCode::SUCCESS;
73}
74
76{
77 ATH_MSG_INFO ("Finalizing " << name() << "...");
78
79 return StatusCode::SUCCESS;
80}
81
82
84
85 //cellset_t missingCells;
86 auto badandmissingCellsGeomMap = std::make_unique<jet::CaloCellFastMap>();
87 jet::cellset_t & badandmissingCells = badandmissingCellsGeomMap->cells();
88 badandmissingCellsGeomMap->init(m_rmax);
89
90 // get permanently missing cells.
91 const std::vector<Identifier> & tiledisconnected = m_tileCabling->disconnectedCells();
92 badandmissingCells.insert(tiledisconnected.begin(), tiledisconnected.end());
93
94 // from user given cells
95 for(cellidvec_t::const_iterator it=m_userAddedCells.begin(); it != m_userAddedCells.end(); ++it){
96 badandmissingCells.insert( Identifier(*it) ) ;
97 }
98 // remove user give cells.
99 for(cellidvec_t::const_iterator it=m_userRemovedCells.begin(); it != m_userRemovedCells.end(); ++it){
100 badandmissingCells.erase( Identifier(*it) );
101 }
102 // ---------------------------
103
105 const CaloDetDescrManager* caloDDM = *caloDetDescrMgrHandle;
106
107 if(m_addBadCells) {
108 // (In run1 this part possibly added several times the same cell in the geometric map)
110 if ( !cc.isValid() ) {
111 ATH_MSG_ERROR("Unable to retrieve CaloCellContainer AllCalo from event store.");
112 return 1;
113 }
114 const CaloCellContainer * cells = cc.ptr();
115 CaloCellContainer::const_iterator it= cells->begin();
116 CaloCellContainer::const_iterator itE= cells->end();
117 for(; it!=itE; ++it){
118 if( (*it)->badcell() ) {
119 const CaloCell * c= *it;
120 badandmissingCells.insert( c->ID() );
121 }
122 }
123 }
124
125
127 const CaloCell_ID* calo_id = caloDDM->getCaloCell_ID();
128 const TileBadChanTool* tileTool = dynamic_cast<const TileBadChanTool*>(m_tileTool.get());
129 if (!tileTool) {
130 ATH_MSG_ERROR( "Bad TileBadChanTool !!!" );
131 return 1;
132 }
134 const LArBadChannelCont *bcCont {*readHandle};
135 if(!bcCont) {
136 ATH_MSG_ERROR( "Do not have Bad chan container !!!" );
137 return 1;
138 }
139 std::vector<Identifier>::const_iterator idItr = calo_id->cell_begin();
140 std::vector<Identifier>::const_iterator idItrE = calo_id->cell_end();
141 for(; idItr!=idItrE; ++idItr){
142
143 // check if needs insertion.
144 bool insert = false;
145 if(calo_id->is_tile(*idItr)){
146 CaloBadChannel bc = tileTool->caloStatus(*idItr);
147 insert = (bc.packedData() & m_tileMaskBit) != 0 ;
148 } else {
149 LArBadChannel bc = bcCont->offlineStatus(*idItr);
150 insert = (bc.packedData() & m_larMaskBit) != 0 ;
151 }
152
153 if(insert) {
154 badandmissingCells.insert( *idItr );
155 }
156 }
157 }
158
159 // fill the geometric map : ------------------
160 jet::cellset_t::iterator lit = badandmissingCells.begin();
161 jet::cellset_t::iterator litE = badandmissingCells.end();
162 for( ; lit != litE; ++lit){
163 const CaloDetDescrElement * dde = caloDDM->get_element(*lit);
164 jet::CellPosition p(dde->eta(), dde->phi(), *lit, dde->getSampling());
165 badandmissingCellsGeomMap->insert( p );
166 }
167 // ---------------------------
168
169
170 ATH_MSG( DEBUG ) << " total bad and missing "<< badandmissingCells.size() << " "<< badandmissingCellsGeomMap->size() << endmsg;
171
173 StatusCode sc = badCellMap.record(std::move(badandmissingCellsGeomMap));
174 if (sc.isFailure()) {
175 ATH_MSG_ERROR("Unable to record badandmissingCellsGeomMap in event store: "
177 return 1;
178 }
179
180 return 0;
181}
182
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG(lvl)
#define ATH_MSG_INFO(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
LArBadXCont< LArBadChannel > LArBadChannelCont
static Double_t sc
Handle class for recording to StoreGate.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
BitWord packedData() const
Container class for CaloCell.
id_iterator cell_begin() const
begin iterator over full set of Identifiers (LAr + Tiles)
id_iterator cell_end() const
end iterator over full set of Identifiers (LAr + Tiles)
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
BitWord packedData() const
LArBC_t offlineStatus(const Identifier id) const
Query the status of a particular channel by offline ID This is the main client access method.
MissingCellListTool(const std::string &name)
Default constructor:
SG::ReadHandleKey< CaloCellContainer > m_cells_name
SG::WriteHandleKey< jet::CaloCellFastMap > m_badCellMap_key
SG::ReadCondHandleKey< LArBadChannelCont > m_BCKey
virtual ~MissingCellListTool()
Destructor:
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloDetDescrMgrKey
ServiceHandle< TileCablingSvc > m_tileCabling
ToolHandle< ITileBadChanTool > m_tileTool
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
virtual int execute() const
Method to be called for each event.
virtual StatusCode finalize()
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
The tool to get Tile channel and ADC status.
virtual CaloBadChannel caloStatus(const EventContext &ctx, Identifier cell_id) const override
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
std::unordered_set< Identifier > cellset_t
#define DEBUG
Definition page_access.h:11
a cell position for the geometric map of missing/bad cells