ATLAS Offline Software
Loading...
Searching...
No Matches
TrigMuonEFInfoToMuonCnvAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5//
6// TrigMuonEFInfoToMuonCnvAlg.cxx
7//
8// Created by Mark Owen on 13/03/2014.
9//
10
12
18
19using namespace xAODMaker;
20
21TrigMuonEFInfoToMuonCnvAlg::TrigMuonEFInfoToMuonCnvAlg(const std::string& name, ISvcLocator* svcLoc ) :
22 AthAlgorithm( name, svcLoc ),
23 m_converterTool("TrigMuonEFInfoMuonCnvTool/TrigMuonEFInfoMuonCnvTool"),
27 m_nproc(0)
28{
29 declareProperty( "AODContainerName", m_aodContainerName = "HLT_MuonEFInfo" ); // need to fix the name
30 declareProperty( "xAODMuonContainerName", m_xaodMuonContainerName = "HLT_Muons" );
31 declareProperty( "xAODCombinedTrackParticleContainerName", m_xaodCombTrkPartContainerName = "HLT_MuonCombinedTrackParticles" );
32 declareProperty( "xAODExtrapolatedTrackParticleContainerName", m_xaodExtrapTrkPartContainerName = "HLT_MuonExtrapolatedTrackParticles" );
33 declareProperty( "ConverterTool", m_converterTool );
34}
35
37
38 // print some settings
39 ATH_MSG_INFO( "AODContainerName = " << m_aodContainerName << ", xAODMuonContainerName = " << m_xaodMuonContainerName );
40 ATH_MSG_INFO( "xAODCombinedTrackParticleContainerName = " << m_xaodCombTrkPartContainerName << ", xAODExtrapolatedTrackParticleContainerName = " << m_xaodExtrapTrkPartContainerName);
41 ATH_MSG_INFO( "ConverterTool = " << m_converterTool.typeAndName());
42
43 // retrieve converter tool
44 ATH_CHECK(m_converterTool.retrieve());
45
46 // Return gracefully
47 return StatusCode::SUCCESS;
48}
49
51 ATH_MSG_INFO("Statistics for conversion:");
52 ATH_MSG_INFO("Successfully processed " << m_nproc << " events");
53 if(m_nproc>0) {
54 ATH_MSG_INFO("Created " << m_nMuonsCreated << " xAOD::Muons, average per event = " << ((double)m_nMuonsCreated)/((double)m_nproc));
55 ATH_MSG_INFO("Created " << m_nCombTrksCreated << " combined xAOD::TrackParticles, average per event = " << ((double)m_nCombTrksCreated)/((double)m_nproc));
56 ATH_MSG_INFO("Created " << m_nExtrapTrksCreated << " extrapolated xAOD::TrackParticles, average per event = " << ((double)m_nExtrapTrksCreated)/((double)m_nproc));
57 }
58 return StatusCode::SUCCESS;
59}
60
62
63 // Retrieve the AOD particles:
65 if (!aod) {
66 ATH_MSG_WARNING("No TrigMuonEFInfoContainer with key " << m_aodContainerName << " found. Do nothing.");
67 return StatusCode::SUCCESS;
68 }
69
70 ATH_MSG_DEBUG( "Retrieved particles with key: " << m_aodContainerName );
71
72 // Create the xAOD muon container and its auxiliary store:
76
77 // Create the xAOD track particle containers and auxiliary stores:
78 xAOD::TrackParticleContainer* xaodCombTrackParticles = new xAOD::TrackParticleContainer();
80 ATH_CHECK(recordxAODContainers( m_xaodCombTrkPartContainerName, m_xaodCombTrkPartContainerName + "Aux.", *xaodCombTrackParticles, *auxCombTrack));
81 xAOD::TrackParticleContainer* xaodExtrapTrackParticles = new xAOD::TrackParticleContainer();
83 ATH_CHECK(recordxAODContainers( m_xaodExtrapTrkPartContainerName, m_xaodExtrapTrkPartContainerName + "Aux.", *xaodExtrapTrackParticles, *auxExtrapTrack));
84
85 // call the converter tool which does the work
86 StatusCode sc = m_converterTool->convertTrigMuonEFInfoContainer( *aod, *xaodMuon, xaodCombTrackParticles, xaodExtrapTrackParticles);
87 if(sc.isFailure()) {
88 ATH_MSG_ERROR("Converter tool failed");
89 return sc;
90 }
91 // update our counters
92 ++m_nproc;
93 m_nMuonsCreated += xaodMuon->size();
94 m_nCombTrksCreated += xaodCombTrackParticles->size();
95 m_nExtrapTrksCreated += xaodExtrapTrackParticles->size();
96
97 return StatusCode::SUCCESS;
98
99}//execute
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
size_type size() const noexcept
Returns the number of elements in the collection.
ToolHandle< ITrigMuonEFInfoToMuonCnvTool > m_converterTool
Tool that actually does the conversion.
std::string m_xaodExtrapTrkPartContainerName
The key for the output xAOD::TrackParticleContainer for extrapolated tracks.
virtual StatusCode execute()
Function executing the algorithm.
StatusCode recordxAODContainers(const std::string &containerName, const std::string &auxContainerName, CONT &xaod, AUXCONT &aux)
Utility function to record xAOD containers.
std::string m_aodContainerName
The key of the input TrigMuonEFInfoContainer.
virtual StatusCode initialize()
Function initialising the algorithm.
std::string m_xaodCombTrkPartContainerName
The key for the output xAOD::TrackParticleContainer for combined tracks.
virtual StatusCode finalize()
Function initialising the algorithm.
std::string m_xaodMuonContainerName
The key for the output xAOD::MuonContainer.
TrigMuonEFInfoToMuonCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
MuonAuxContainer_v5 MuonAuxContainer
Definition of the current Muon auxiliary container.
TrackParticleAuxContainer_v5 TrackParticleAuxContainer
Definition of the current TrackParticle auxiliary container.
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".