ATLAS Offline Software
GetL2CBmuonInDetTracksAlg.cxx
Go to the documentation of this file.
1 /*
2  Get muon ID tracks from L2CB muons
3 
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
9 
10 GetL2CBmuonInDetTracksAlg::GetL2CBmuonInDetTracksAlg(const std::string& name, ISvcLocator* pSvcLocator )
11 :AthReentrantAlgorithm(name, pSvcLocator)
12 {
13 }
14 
16 
19  return StatusCode::SUCCESS;
20 }
21 
22 StatusCode GetL2CBmuonInDetTracksAlg::execute(const EventContext& ctx) const
23 {
24 
26  ATH_CHECK(wh_outidtracks.record(std::make_unique<xAOD::TrackParticleContainer>(), std::make_unique<xAOD::TrackParticleAuxContainer>()));
27  xAOD::TrackParticleContainer *idtracksout = wh_outidtracks.ptr();
28 
30  ATH_CHECK(cbMuons.isPresent());
31  ATH_MSG_DEBUG("adding combined muon container with size: "<<cbMuons->size());
32 
33  for(auto cbmuon : *cbMuons) {
34  if(cbmuon->idTrack()) idtracksout->push_back(new xAOD::TrackParticle(*cbmuon->idTrack()));
35  }
36  ATH_MSG_DEBUG("output ID muon tracks with size: " << idtracksout->size());
37  return StatusCode::SUCCESS;
38 
39 }
GetL2CBmuonInDetTracksAlg.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
GetL2CBmuonInDetTracksAlg::initialize
virtual StatusCode initialize() override
initialize
Definition: GetL2CBmuonInDetTracksAlg.cxx:15
TrackParticleAuxContainer.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
GetL2CBmuonInDetTracksAlg::m_muonL2CBContainerKey
SG::ReadHandleKey< xAOD::L2CombinedMuonContainer > m_muonL2CBContainerKey
Definition: GetL2CBmuonInDetTracksAlg.h:32
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
GetL2CBmuonInDetTracksAlg::GetL2CBmuonInDetTracksAlg
GetL2CBmuonInDetTracksAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: GetL2CBmuonInDetTracksAlg.cxx:10
GetL2CBmuonInDetTracksAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
execute the filter alg
Definition: GetL2CBmuonInDetTracksAlg.cxx:22
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition: StoreGate/src/VarHandleBase.cxx:400
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
GetL2CBmuonInDetTracksAlg::m_idTrackOutputKey
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_idTrackOutputKey
Definition: GetL2CBmuonInDetTracksAlg.h:33