ATLAS Offline Software
MBTSInfoCopier.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
8 
9 #include "MBTSInfoCopier.h"
10 
11 MBTSInfoCopier::MBTSInfoCopier(const std::string& name, ISvcLocator* pSvcLocator) :
12  AthReentrantAlgorithm(name, pSvcLocator)
13 {
14 }
15 
17 {
18 }
19 
21 {
22  ATH_CHECK(m_mbtsCellContainerKey.initialize());
23  ATH_CHECK(m_MbtsBitsKey.initialize());
25  return StatusCode::SUCCESS;
26 }
27 
29 {
30  return StatusCode::SUCCESS;
31 }
32 
33 StatusCode MBTSInfoCopier::execute(const EventContext& context) const
34 {
36  static const unsigned int MAX_MBTS_COUNTER{32};
37  std::vector<float> energies(MAX_MBTS_COUNTER);
38  std::vector<float> times(MAX_MBTS_COUNTER);
39 
40  for (const TileCell* cell : *tileCellsHandle) {
41  // code from: TileCalorimeter/TileMonitoring/src/TileMBTSMonitorAlgorithm.cxx
42  Identifier id = cell->ID();
43  int counter = m_tileTBID->phi(id) + 8 * m_tileTBID->eta(id);
44  if (m_tileTBID->side(id) < 0) counter += 16;// EBC side
45  ATH_CHECK(counter<static_cast<int>(MAX_MBTS_COUNTER));
46  energies[counter] = cell->energy();
47  times[counter] = cell->time();
48  }
49  ATH_MSG_DEBUG("energies " << energies);
50  ATH_MSG_DEBUG("times " << times);
51 
52 
54  auto mbtsBitsContainer = std::make_unique< xAOD::TrigT2MbtsBitsContainer>();
55  auto mbtsBitsAuxContainer = std::make_unique< xAOD::TrigT2MbtsBitsAuxContainer>();
56  mbtsBitsContainer->setStore(mbtsBitsAuxContainer.get());
57 
59  mbtsBitsContainer->push_back(mbtsObj);
60 
61  mbtsObj->setTriggerEnergies(energies);
62  mbtsObj->setTriggerTimes(times);
63 
64  ATH_CHECK(mbtsBitsHandle.record( std::move(mbtsBitsContainer), std::move( mbtsBitsAuxContainer ) ) );
65 
66 
67 
68  return StatusCode::SUCCESS;
69 }
70 
xAOD::TrigT2MbtsBits_v1::setTriggerTimes
void setTriggerTimes(const std::vector< float > &trigTm)
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileCell
Definition: TileCell.h:57
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAOD::TrigT2MbtsBits_v1::setTriggerEnergies
void setTriggerEnergies(const std::vector< float > &trigEg)
MBTSInfoCopier::m_MbtsBitsKey
SG::WriteHandleKey< xAOD::TrigT2MbtsBitsContainer > m_MbtsBitsKey
Definition: MBTSInfoCopier.h:32
MBTSInfoCopier::finalize
virtual StatusCode finalize() override
Definition: MBTSInfoCopier.cxx:28
TrigT2MbtsBits.h
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
xAOD::TrigT2MbtsBits
TrigT2MbtsBits_v1 TrigT2MbtsBits
Definition: Event/xAOD/xAODTrigMinBias/xAODTrigMinBias/TrigT2MbtsBits.h:11
MBTSInfoCopier::MBTSInfoCopier
MBTSInfoCopier(const std::string &name, ISvcLocator *pSvcLocator)
Definition: MBTSInfoCopier.cxx:11
TrigT2MbtsBitsAuxContainer.h
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
xAOD::TrigT2MbtsBits_v1
Definition: TrigT2MbtsBits_v1.h:14
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MBTSInfoCopier::~MBTSInfoCopier
virtual ~MBTSInfoCopier() override
Definition: MBTSInfoCopier.cxx:16
MBTSInfoCopier::execute
virtual StatusCode execute(const EventContext &context) const override
Definition: MBTSInfoCopier.cxx:33
MBTSInfoCopier::m_mbtsCellContainerKey
SG::ReadHandleKey< TileCellContainer > m_mbtsCellContainerKey
Definition: MBTSInfoCopier.h:31
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
MBTSInfoCopier::initialize
virtual StatusCode initialize() override
Definition: MBTSInfoCopier.cxx:20
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
TileTBID::phi
int phi(const Identifier &id) const
extract phi field from MBTS identifier
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:165
MBTSInfoCopier.h
TileTBID::eta
int eta(const Identifier &id) const
extract eta field from MBTS identifier
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:169
test_pyathena.counter
counter
Definition: test_pyathena.py:15
MBTSInfoCopier::m_tileTBID
const TileTBID * m_tileTBID
Definition: MBTSInfoCopier.h:33
plot_times.times
def times(fn)
Definition: plot_times.py:11
TileTBID::side
int side(const Identifier &id) const
define synonyms for minimum bias scintillators
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:161
Identifier
Definition: IdentifierFieldParser.cxx:14