ATLAS Offline Software
BadTileRetriever.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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 
57  ATH_MSG_DEBUG( "Initialising Tool" );
58  ATH_CHECK( detStore()->retrieve (m_calocell_id, "CaloCell_ID") );
60 
61  return StatusCode::SUCCESS;
62  }
63 
67  StatusCode BadTileRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
68 
69  ATH_MSG_DEBUG( "in retrieve()" );
70 
72  if (!cellContainer.isValid()){
73  ATH_MSG_WARNING( "Could not retrieve Calorimeter Cells " );
74  }
75  else{
76  if(m_tile){
77  DataMap data = getBadTileData(&(*cellContainer));
78  ATH_CHECK( FormatTool->AddToEvent(dataTypeName(), m_sgKey.key(), &data) );
79  ATH_MSG_DEBUG( "Bad Tile retrieved" );
80  }
81  }
82 
83  //Tile cells retrieved okay
84  return StatusCode::SUCCESS;
85  }
86 
87 
93 
94  ATH_MSG_DEBUG( "getBadTileData()" );
95  char rndStr[30];
97 
98  DataVect phi; phi.reserve(cellContainer->size());
99  DataVect eta; eta.reserve(cellContainer->size());
100  DataVect idVec; idVec.reserve(cellContainer->size());
101  DataVect energyVec; energyVec.reserve(cellContainer->size());
102 
103 // m_sub; m_sub.reserve(cellContainer->size());
104  m_sub.clear();
105 
106 //Loop Over CaloCellContainer to retrieve TileCell information
107 
110 
111  if (m_doBadTile==true) {
112 
113  double energyGeV;
114  //int cellInd;
115 
116  ATH_MSG_DEBUG( "Start iterator loop over cells" );
117 
118  for(;it1!=it2;++it1){
119 
120  if( !(*it1)->badcell() ) continue;
121  //if( (*it1)->energy() < m_cellThreshold ) continue;
122  Identifier cellid = (*it1)->ID();
123  //IdentifierHash cell_hash = m_calocell_id->calo_cell_hash( cellid );
124  //cellInd = cellContainer->findIndex(cell_hash);
125  calcTILELayerSub(cellid);
126 
127  energyGeV = (*it1)->energy()*(1./GeV);
128  energyVec.push_back(DataType( gcvt( energyGeV, m_cellEnergyPrec, rndStr) ));
129 
130  idVec.push_back(DataType( (Identifier::value_type)(*it1)->ID().get_compact() ));
131  phi.push_back(DataType((*it1)->phi()));
132  eta.push_back(DataType((*it1)->eta()));
133 
134  } // end cell iterator
135 
136  } // doBadTile
137 
138  // write values into DataMap
139  DataMap["phi"] = phi;
140  DataMap["eta"] = eta;
141  DataMap["sub"] = m_sub;
142  DataMap["id"] = idVec;
143  DataMap["energy"] = energyVec;
144 
145  //Be verbose
146  ATH_MSG_DEBUG( dataTypeName() << " retrieved with " << phi.size() << " entries" );
147 
148  //All collections retrieved okay
149  return DataMap;
150 
151  } // getTileData
152 
153  //-----------------------------------------------------------------------------------------------------
154 
156  {
157  if(m_calocell_id->is_tile_barrel(cellid))
158  {
159  if(m_calocell_id->is_tile_negative(cellid))
160  m_sub.push_back(DataType(2));
161  else
162  m_sub.push_back(DataType(3));
163  }
164  else if(m_calocell_id->is_tile_extbarrel(cellid))
165  {
166  if(m_calocell_id->is_tile_negative(cellid))
167  m_sub.push_back(DataType(0));
168  else
169  m_sub.push_back(DataType(5));
170  }
171  //else in ITC or scint
172  else
173  {
174  if(m_calocell_id->is_tile_negative(cellid))
175  m_sub.push_back(DataType(1));
176  else
177  m_sub.push_back(DataType(4));
178  }
179  }
180 
181  //--------------------------------------------------------------------------
182 
183 } // JiveXML namespace
Identifier::value_type
IDENTIFIER_TYPE value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:39
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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
DataType
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
Definition: RoIBResultByteStreamTool.cxx:25
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:63
JiveXML::BadTileRetriever::m_cellThreshold
double m_cellThreshold
Definition: BadTileRetriever.h:66
TileRawChannelContainer.h
TileHWID.h
TileCablingService.h
TileCondToolEmscale.h
JiveXML::BadTileRetriever::calcTILELayerSub
void calcTILELayerSub(Identifier &)
Definition: BadTileRetriever.cxx:155
TileDigitsContainer.h
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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:92
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:68
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:67
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:65
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:21
HWIdentifier.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
JiveXML::BadTileRetriever::m_cellEnergyPrec
int m_cellEnergyPrec
Definition: BadTileRetriever.h:67
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:56
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
TileTBID.h
SelectAllObject.h
JiveXML::BadTileRetriever::m_sub
DataVect m_sub
Definition: BadTileRetriever.h:71
AthAlgTool
Definition: AthAlgTool.h:26
ITileBadChanTool.h
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
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:69
TileCellContainer.h
JiveXML::BadTileRetriever::BadTileRetriever
BadTileRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: BadTileRetriever.cxx:37