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  : AthAlgTool ( type, name, parent )
27  {
28  declareInterface<DerivationFramework::IAugmentationTool>(this);
29  }
30 
32 
33  ATH_CHECK( m_cellContainerKey.initialize() );
34 
37 
40 
43 
46 
49 
52 
55 
58 
60 
61  return StatusCode::SUCCESS;
62  }
63 
65 
66  const EventContext& ctx = Gaudi::Hive::currentContext();
67 
69  ATH_CHECK( energy.record(std::make_unique<std::vector<float> >()) );
70  energy->reserve(MAX_MBTS_COUNTER);
71 
73  ATH_CHECK( time.record(std::make_unique<std::vector<float> >()) );
74  time->reserve(MAX_MBTS_COUNTER);
75 
77  ATH_CHECK( quality.record(std::make_unique<std::vector<int> >()) );
78  quality->reserve(MAX_MBTS_COUNTER);
79 
81  ATH_CHECK( module.record(std::make_unique<std::vector<int> >()) );
82  module->reserve(MAX_MBTS_COUNTER);
83 
85  ATH_CHECK( type.record(std::make_unique<std::vector<int> >()) );
86  type->reserve(MAX_MBTS_COUNTER);
87 
89  ATH_CHECK( channel.record(std::make_unique<std::vector<int> >()) );
90  channel->reserve(MAX_MBTS_COUNTER);
91 
93  ATH_CHECK( tileCells.isValid() );
94 
95  if (m_saveEtaPhi) {
97  ATH_CHECK( eta.record(std::make_unique<std::vector<float> >()) );
98  eta->reserve(MAX_MBTS_COUNTER);
99 
101  ATH_CHECK( phi.record(std::make_unique<std::vector<float> >()) );
102  phi->reserve(MAX_MBTS_COUNTER);
103 
104  for ( const TileCell* cell : *tileCells ){
105  energy->push_back( cell->energy() );
106  eta->push_back( cell->eta() );
107  phi->push_back( cell->phi() );
108  time->push_back( cell->time() );
109  quality->push_back(cell->quality() );
110  module->push_back(m_tileTBID->module( cell->ID() ) );
111  type->push_back(m_tileTBID->type( cell->ID() ) );
112  channel->push_back(m_tileTBID->channel( cell->ID() ) );
113  }
114 
115  } else {
116 
117  for ( const TileCell* cell : *tileCells ){
118  energy->push_back( cell->energy() );
119  time->push_back( cell->time() );
120  quality->push_back(cell->quality() );
121  module->push_back(m_tileTBID->module( cell->ID() ) );
122  type->push_back(m_tileTBID->type( cell->ID() ) );
123  channel->push_back(m_tileTBID->channel( cell->ID() ) );
124  }
125 
126  }
127 
128  return StatusCode::SUCCESS;
129  }
130 
131 }
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:51
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
DerivationFramework::MbtsToVectorsTool::m_typeKey
SG::WriteHandleKey< std::vector< int > > m_typeKey
Definition: MbtsToVectorsTool.h:55
DerivationFramework::MbtsToVectorsTool::addBranches
virtual StatusCode addBranches() const override final
Pass the thinning service
Definition: MbtsToVectorsTool.cxx:64
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MbtsToVectorsTool.h
DerivationFramework::MbtsToVectorsTool::m_qualityKey
SG::WriteHandleKey< std::vector< int > > m_qualityKey
Definition: MbtsToVectorsTool.h:54
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:45
TileTBID::module
int module(const Identifier &id) const
extract module field from TileTB identifier
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:150
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
DerivationFramework::MbtsToVectorsTool::m_etaKey
SG::WriteHandleKey< std::vector< float > > m_etaKey
Definition: MbtsToVectorsTool.h:52
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:61
DerivationFramework::MbtsToVectorsTool::m_saveEtaPhi
Gaudi::Property< bool > m_saveEtaPhi
Definition: MbtsToVectorsTool.h:46
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:59
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:50
DerivationFramework::MbtsToVectorsTool::m_channelKey
SG::WriteHandleKey< std::vector< int > > m_channelKey
Definition: MbtsToVectorsTool.h:57
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
errorcheck.h
Helpers for checking error return status codes and reporting errors.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
DerivationFramework::MbtsToVectorsTool::m_cellContainerKey
SG::ReadHandleKey< TileCellContainer > m_cellContainerKey
Definition: MbtsToVectorsTool.h:48
DerivationFramework::MbtsToVectorsTool::m_moduleKey
SG::WriteHandleKey< std::vector< int > > m_moduleKey
Definition: MbtsToVectorsTool.h:56
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TileTBID.h
DerivationFramework::MbtsToVectorsTool::m_phiKey
SG::WriteHandleKey< std::vector< float > > m_phiKey
Definition: MbtsToVectorsTool.h:53
ReadHandle.h
Handle class for reading from StoreGate.
AthAlgTool
Definition: AthAlgTool.h:26
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:31