ATLAS Offline Software
BadTileRetriever.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "BadTileRetriever.h"
6 
7 #include "AthenaKernel/Units.h"
8 
10 
12 #include "CaloDetDescr/CaloDetDescrElement.h"
13 #include "TileEvent/TileCell.h"
18 #include "CaloIdentifier/TileID.h"
26 
27 using Athena::Units::GeV;
28 
29 namespace JiveXML {
30 
37  BadTileRetriever::BadTileRetriever(const std::string& type,const std::string& name,const IInterface* parent):
39  m_calocell_id(nullptr)
40  {
41  //Only declare the interface
42  declareInterface<IDataRetriever>(this);
43 
44  declareProperty("CellThreshold", m_cellThreshold = 50.);
45  declareProperty("RetrieveTILE" , m_tile = true);
46  declareProperty("DoBadTile", m_doBadTile = false);
47 
48  declareProperty("CellEnergyPrec", m_cellEnergyPrec = 3);
49  }
50 
56  ATH_MSG_DEBUG( "Initialising Tool" );
57  ATH_CHECK( detStore()->retrieve (m_calocell_id, "CaloCell_ID") );
59  return StatusCode::SUCCESS;
60  }
61 
65  StatusCode BadTileRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
66  ATH_MSG_DEBUG( "in retrieve()" );
68  if (!cellContainer.isValid()){
69  ATH_MSG_WARNING( "Could not retrieve Calorimeter Cells " );
70  } else {
71  if(m_tile){
72  DataMap data = getBadTileData(&(*cellContainer));
73  ATH_CHECK( FormatTool->AddToEvent(dataTypeName(), m_sgKey.key(), &data) );
74  ATH_MSG_DEBUG( "Bad Tile retrieved" );
75  }
76  }
77  //Tile cells retrieved okay
78  return StatusCode::SUCCESS;
79  }
80 
81 
87  ATH_MSG_DEBUG( "getBadTileData()" );
88  char rndStr[30];
90  DataVect phi; phi.reserve(cellContainer->size());
91  DataVect eta; eta.reserve(cellContainer->size());
92  DataVect idVec; idVec.reserve(cellContainer->size());
93  DataVect energyVec; energyVec.reserve(cellContainer->size());
94  m_sub.clear();
95  //Loop Over CaloCellContainer to retrieve TileCell information
98  if (m_doBadTile==true) {
99  double energyGeV;
100  //int cellInd;
101  ATH_MSG_DEBUG( "Start iterator loop over cells" );
102  for(;it1!=it2;++it1){
103  if( !(*it1)->badcell() ) continue;
104  Identifier cellid = (*it1)->ID();
105  calcTILELayerSub(cellid);
106  energyGeV = (*it1)->energy()*(1./GeV);
107  energyVec.emplace_back( gcvt( energyGeV, m_cellEnergyPrec, rndStr) );
108  idVec.emplace_back( (Identifier::value_type)(*it1)->ID().get_compact() );
109  phi.emplace_back((*it1)->phi());
110  eta.emplace_back((*it1)->eta());
111  } // end cell iterator
112  } // doBadTile
113 
114  // write values into DataMap
115  const auto nEntries = phi.size();
116  DataMap["phi"] = std::move(phi);
117  DataMap["eta"] = std::move(eta);
118  DataMap["sub"] = std::move(m_sub);
119  DataMap["id"] = std::move(idVec);
120  DataMap["energy"] = std::move(energyVec);
121  //Be verbose
122  ATH_MSG_DEBUG( dataTypeName() << " retrieved with " << nEntries << " entries" );
123  //All collections retrieved okay
124  return DataMap;
125  } // getTileData
126 
127  //-----------------------------------------------------------------------------------------------------
128 
130  {
131  if(m_calocell_id->is_tile_barrel(cellid))
132  {
133  if(m_calocell_id->is_tile_negative(cellid))
134  m_sub.emplace_back(2);
135  else
136  m_sub.emplace_back(3);
137  }
138  else if(m_calocell_id->is_tile_extbarrel(cellid))
139  {
140  if(m_calocell_id->is_tile_negative(cellid))
141  m_sub.emplace_back(0);
142  else
143  m_sub.emplace_back(5);
144  }
145  //else in ITC or scint
146  else
147  {
148  if(m_calocell_id->is_tile_negative(cellid))
149  m_sub.emplace_back(1);
150  else
151  m_sub.emplace_back(4);
152  }
153  }
154 
155  //--------------------------------------------------------------------------
156 
157 } // JiveXML namespace
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
JiveXML::DataVect
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition: DataType.h:58
CaloCellContainer::beginConstCalo
CaloCellContainer::const_iterator beginConstCalo(CaloCell_ID::SUBCALO caloNum) const
get const iterators on cell of just one calo
Definition: CaloCellContainer.cxx:119
TileInfo.h
JiveXML::BadTileRetriever::initialize
StatusCode initialize()
Default AthAlgTool methods.
Definition: BadTileRetriever.cxx:55
TileCalibUtils.h
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
JiveXML::DataMap
std::map< std::string, DataVect > DataMap
Definition: DataType.h:59
CaloCell_Base_ID::is_tile_barrel
bool is_tile_barrel(const Identifier id) const
test if the id belongs to the Tiles barrel
TileID.h
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
JiveXML::BadTileRetriever::m_calocell_id
const CaloCell_ID * m_calocell_id
Definition: BadTileRetriever.h:59
JiveXML::BadTileRetriever::m_cellThreshold
double m_cellThreshold
Definition: BadTileRetriever.h:62
TileRawChannelContainer.h
TileHWID.h
TileCablingService.h
TileCondToolEmscale.h
JiveXML::BadTileRetriever::calcTILELayerSub
void calcTILELayerSub(Identifier &)
Definition: BadTileRetriever.cxx:129
TileDigitsContainer.h
DetDescrDictionaryDict::it1
std::vector< HWIdentifier >::iterator it1
Definition: DetDescrDictionaryDict.h:17
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloCell_Base_ID::is_tile_extbarrel
bool is_tile_extbarrel(const Identifier id) const
test if the id belongs to the Tiles extended barrel
TileCell.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
JiveXML::BadTileRetriever::getBadTileData
const DataMap getBadTileData(const CaloCellContainer *cellContainer)
Retrieve Tile bad cell location and details.
Definition: BadTileRetriever.cxx:86
BadTileRetriever.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
JiveXML::BadTileRetriever::m_tile
bool m_tile
Definition: BadTileRetriever.h:64
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
JiveXML::BadTileRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: BadTileRetriever.cxx:65
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
JiveXML::BadTileRetriever::m_sgKey
SG::ReadHandleKey< CaloCellContainer > m_sgKey
Definition: BadTileRetriever.h:61
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:22
HWIdentifier.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
JiveXML::BadTileRetriever::m_cellEnergyPrec
int m_cellEnergyPrec
Definition: BadTileRetriever.h:63
Units.h
Wrapper to avoid constant divisions when using units.
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
JiveXML::BadTileRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: BadTileRetriever.h:52
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CaloCell_Base_ID::is_tile_negative
bool is_tile_negative(const Identifier id) const
test if the id belongs to the Tiles negative side
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloCellContainer::endConstCalo
CaloCellContainer::const_iterator endConstCalo(CaloCell_ID::SUBCALO caloNum) const
Definition: CaloCellContainer.cxx:133
Identifier::value_type
unsigned long long value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:27
TileTBID.h
SelectAllObject.h
JiveXML::BadTileRetriever::m_sub
DataVect m_sub
Definition: BadTileRetriever.h:67
AthAlgTool
Definition: AthAlgTool.h:26
ITileBadChanTool.h
dqBeamSpot.nEntries
int nEntries
Definition: dqBeamSpot.py:73
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
JiveXML::BadTileRetriever::m_doBadTile
bool m_doBadTile
Definition: BadTileRetriever.h:65
TileCellContainer.h
JiveXML::BadTileRetriever::BadTileRetriever
BadTileRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: BadTileRetriever.cxx:37
Identifier
Definition: IdentifierFieldParser.cxx:14