ATLAS Offline Software
Loading...
Searching...
No Matches
MissingCellListTool.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2026 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 const EventContext& ctx = Gaudi::Hive::currentContext();
86
87 //cellset_t missingCells;
88 auto badandmissingCellsGeomMap = std::make_unique<jet::CaloCellFastMap>();
89 jet::cellset_t & badandmissingCells = badandmissingCellsGeomMap->cells();
90 badandmissingCellsGeomMap->init(m_rmax);
91
92 // get permanently missing cells.
93 const std::vector<Identifier> & tiledisconnected = m_tileCabling->disconnectedCells();
94 badandmissingCells.insert(tiledisconnected.begin(), tiledisconnected.end());
95
96 // from user given cells
97 for(cellidvec_t::const_iterator it=m_userAddedCells.begin(); it != m_userAddedCells.end(); ++it){
98 badandmissingCells.insert( Identifier(*it) ) ;
99 }
100 // remove user give cells.
101 for(cellidvec_t::const_iterator it=m_userRemovedCells.begin(); it != m_userRemovedCells.end(); ++it){
102 badandmissingCells.erase( Identifier(*it) );
103 }
104 // ---------------------------
105
107 const CaloDetDescrManager* caloDDM = *caloDetDescrMgrHandle;
108
109 if(m_addBadCells) {
110 // (In run1 this part possibly added several times the same cell in the geometric map)
112 if ( !cc.isValid() ) {
113 ATH_MSG_ERROR("Unable to retrieve CaloCellContainer AllCalo from event store.");
114 return 1;
115 }
116 const CaloCellContainer * cells = cc.ptr();
117 CaloCellContainer::const_iterator it= cells->begin();
118 CaloCellContainer::const_iterator itE= cells->end();
119 for(; it!=itE; ++it){
120 if( (*it)->badcell() ) {
121 const CaloCell * c= *it;
122 badandmissingCells.insert( c->ID() );
123 }
124 }
125 }
126
127
129 const CaloCell_ID* calo_id = caloDDM->getCaloCell_ID();
130 const TileBadChanTool* tileTool = dynamic_cast<const TileBadChanTool*>(m_tileTool.get());
131 if (!tileTool) {
132 ATH_MSG_ERROR( "Bad TileBadChanTool !!!" );
133 return 1;
134 }
136 const LArBadChannelCont *bcCont {*readHandle};
137 if(!bcCont) {
138 ATH_MSG_ERROR( "Do not have Bad chan container !!!" );
139 return 1;
140 }
141 std::vector<Identifier>::const_iterator idItr = calo_id->cell_begin();
142 std::vector<Identifier>::const_iterator idItrE = calo_id->cell_end();
143 for(; idItr!=idItrE; ++idItr){
144
145 // check if needs insertion.
146 bool insert = false;
147 if(calo_id->is_tile(*idItr)){
148 CaloBadChannel bc = tileTool->caloStatus(ctx, *idItr);
149 insert = (bc.packedData() & m_tileMaskBit) != 0 ;
150 } else {
151 LArBadChannel bc = bcCont->offlineStatus(*idItr);
152 insert = (bc.packedData() & m_larMaskBit) != 0 ;
153 }
154
155 if(insert) {
156 badandmissingCells.insert( *idItr );
157 }
158 }
159 }
160
161 // fill the geometric map : ------------------
162 jet::cellset_t::iterator lit = badandmissingCells.begin();
163 jet::cellset_t::iterator litE = badandmissingCells.end();
164 for( ; lit != litE; ++lit){
165 const CaloDetDescrElement * dde = caloDDM->get_element(*lit);
166 jet::CellPosition p(dde->eta(), dde->phi(), *lit, dde->getSampling());
167 badandmissingCellsGeomMap->insert( p );
168 }
169 // ---------------------------
170
171
172 ATH_MSG( DEBUG ) << " total bad and missing "<< badandmissingCells.size() << " "<< badandmissingCellsGeomMap->size() << endmsg;
173
175 StatusCode sc = badCellMap.record(std::move(badandmissingCellsGeomMap));
176 if (sc.isFailure()) {
177 ATH_MSG_ERROR("Unable to record badandmissingCellsGeomMap in event store: "
179 return 1;
180 }
181
182 return 0;
183}
184
#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