ATLAS Offline Software
MbtsToVectorsTool.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // MbtsToVectorsTool.cxx
8 // Implementation file for class MbtsToVectorsTool
10 
11 // Tile includes
12 #include "MbtsToVectorsTool.h"
13 
14 #include "TileEvent/TileCell.h"
18 #include "StoreGate/ReadHandle.h"
19 #include "StoreGate/WriteHandle.h"
20 
21 #include <vector>
22 
23 namespace DerivationFramework {
24 
25  MbtsToVectorsTool::MbtsToVectorsTool( const std::string& type, const std::string& name, const IInterface* parent )
26  : base_class ( type, name, parent )
27  {
28  }
29 
31 
32  ATH_CHECK( m_cellContainerKey.initialize() );
33 
36 
39 
42 
45 
48 
51 
54 
57 
59 
60  return StatusCode::SUCCESS;
61  }
62 
64 
65  const EventContext& ctx = Gaudi::Hive::currentContext();
66 
68  ATH_CHECK( energy.record(std::make_unique<std::vector<float> >()) );
69  energy->reserve(MAX_MBTS_COUNTER);
70 
72  ATH_CHECK( time.record(std::make_unique<std::vector<float> >()) );
73  time->reserve(MAX_MBTS_COUNTER);
74 
76  ATH_CHECK( quality.record(std::make_unique<std::vector<int> >()) );
77  quality->reserve(MAX_MBTS_COUNTER);
78 
80  ATH_CHECK( module.record(std::make_unique<std::vector<int> >()) );
81  module->reserve(MAX_MBTS_COUNTER);
82 
84  ATH_CHECK( type.record(std::make_unique<std::vector<int> >()) );
85  type->reserve(MAX_MBTS_COUNTER);
86 
88  ATH_CHECK( channel.record(std::make_unique<std::vector<int> >()) );
89  channel->reserve(MAX_MBTS_COUNTER);
90 
92  ATH_CHECK( tileCells.isValid() );
93 
94  if (m_saveEtaPhi) {
96  ATH_CHECK( eta.record(std::make_unique<std::vector<float> >()) );
97  eta->reserve(MAX_MBTS_COUNTER);
98 
100  ATH_CHECK( phi.record(std::make_unique<std::vector<float> >()) );
101  phi->reserve(MAX_MBTS_COUNTER);
102 
103  for ( const TileCell* cell : *tileCells ){
104  energy->push_back( cell->energy() );
105  eta->push_back( cell->eta() );
106  phi->push_back( cell->phi() );
107  time->push_back( cell->time() );
108  quality->push_back(cell->quality() );
109  module->push_back(m_tileTBID->module( cell->ID() ) );
110  type->push_back(m_tileTBID->type( cell->ID() ) );
111  channel->push_back(m_tileTBID->channel( cell->ID() ) );
112  }
113 
114  } else {
115 
116  for ( const TileCell* cell : *tileCells ){
117  energy->push_back( cell->energy() );
118  time->push_back( cell->time() );
119  quality->push_back(cell->quality() );
120  module->push_back(m_tileTBID->module( cell->ID() ) );
121  type->push_back(m_tileTBID->type( cell->ID() ) );
122  channel->push_back(m_tileTBID->channel( cell->ID() ) );
123  }
124 
125  }
126 
127  return StatusCode::SUCCESS;
128  }
129 
130 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileCell
Definition: TileCell.h:57
DerivationFramework::MbtsToVectorsTool::m_timeKey
SG::WriteHandleKey< std::vector< float > > m_timeKey
Definition: MbtsToVectorsTool.h:50
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
DerivationFramework::MbtsToVectorsTool::m_typeKey
SG::WriteHandleKey< std::vector< int > > m_typeKey
Definition: MbtsToVectorsTool.h:54
DerivationFramework::MbtsToVectorsTool::addBranches
virtual StatusCode addBranches() const override final
Definition: MbtsToVectorsTool.cxx:63
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
MbtsToVectorsTool.h
DerivationFramework::MbtsToVectorsTool::m_qualityKey
SG::WriteHandleKey< std::vector< int > > m_qualityKey
Definition: MbtsToVectorsTool.h:53
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
TileTBID::type
int type(const Identifier &id) const
extract type field from TileTB identifier
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:146
DerivationFramework::MbtsToVectorsTool::m_prefix
Gaudi::Property< std::string > m_prefix
Definition: MbtsToVectorsTool.h:44
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
TileTBID::module
int module(const Identifier &id) const
extract module field from TileTB identifier
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:150
DerivationFramework::MbtsToVectorsTool::m_etaKey
SG::WriteHandleKey< std::vector< float > > m_etaKey
Definition: MbtsToVectorsTool.h:51
python.PyAthena.module
module
Definition: PyAthena.py:131
WriteHandle.h
Handle class for recording to StoreGate.
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
DerivationFramework::MbtsToVectorsTool::MAX_MBTS_COUNTER
static const unsigned int MAX_MBTS_COUNTER
Definition: MbtsToVectorsTool.h:60
DerivationFramework::MbtsToVectorsTool::m_saveEtaPhi
Gaudi::Property< bool > m_saveEtaPhi
Definition: MbtsToVectorsTool.h:45
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileCell.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
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
DerivationFramework::MbtsToVectorsTool::m_tileTBID
const TileTBID * m_tileTBID
Definition: MbtsToVectorsTool.h:58
TileTBID::channel
int channel(const Identifier &id) const
extract channel field from TileTB identifier
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:154
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
DerivationFramework::MbtsToVectorsTool::m_energyKey
SG::WriteHandleKey< std::vector< float > > m_energyKey
Definition: MbtsToVectorsTool.h:49
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
DerivationFramework::MbtsToVectorsTool::m_channelKey
SG::WriteHandleKey< std::vector< int > > m_channelKey
Definition: MbtsToVectorsTool.h:56
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
errorcheck.h
Helpers for checking error return status codes and reporting errors.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
DerivationFramework::MbtsToVectorsTool::m_cellContainerKey
SG::ReadHandleKey< TileCellContainer > m_cellContainerKey
Definition: MbtsToVectorsTool.h:47
DerivationFramework::MbtsToVectorsTool::m_moduleKey
SG::WriteHandleKey< std::vector< int > > m_moduleKey
Definition: MbtsToVectorsTool.h:55
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
python.TrackLeptonConfig.quality
quality
Definition: TrackLeptonConfig.py:16
TileTBID.h
DerivationFramework::MbtsToVectorsTool::m_phiKey
SG::WriteHandleKey< std::vector< float > > m_phiKey
Definition: MbtsToVectorsTool.h:52
ReadHandle.h
Handle class for reading from StoreGate.
TileContainer.h
DerivationFramework::MbtsToVectorsTool::MbtsToVectorsTool
MbtsToVectorsTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition: MbtsToVectorsTool.cxx:25
DerivationFramework::MbtsToVectorsTool::initialize
virtual StatusCode initialize() override final
Definition: MbtsToVectorsTool.cxx:30