ATLAS Offline Software
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 
14 #include "xAODMuon/MuonContainer.h"
18 
19 using namespace xAODMaker;
20 
21 TrigMuonEFInfoToMuonCnvAlg::TrigMuonEFInfoToMuonCnvAlg(const std::string& name, ISvcLocator* svcLoc ) :
22  AthAlgorithm( name, svcLoc ),
23  m_converterTool("TrigMuonEFInfoMuonCnvTool/TrigMuonEFInfoMuonCnvTool"),
24  m_nMuonsCreated(0),
25  m_nCombTrksCreated(0),
26  m_nExtrapTrksCreated(0),
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:
73  xAOD::MuonContainer* xaodMuon = new xAOD::MuonContainer();
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
xAOD::TrackParticleAuxContainer_v5
Temporary container used until we have I/O for AuxStoreInternal.
Definition: TrackParticleAuxContainer_v5.h:35
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::finalize
virtual StatusCode finalize()
Function initialising the algorithm.
Definition: TrigMuonEFInfoToMuonCnvAlg.cxx:50
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::m_xaodCombTrkPartContainerName
std::string m_xaodCombTrkPartContainerName
The key for the output xAOD::TrackParticleContainer for combined tracks.
Definition: TrigMuonEFInfoToMuonCnvAlg.h:55
xAOD::MuonContainer
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Definition: Event/xAOD/xAODMuon/xAODMuon/MuonContainer.h:14
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::execute
virtual StatusCode execute()
Function executing the algorithm.
Definition: TrigMuonEFInfoToMuonCnvAlg.cxx:61
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TrigMuonEFInfoContainer.h
xAOD::TrackParticleAuxContainer
TrackParticleAuxContainer_v5 TrackParticleAuxContainer
Definition of the current TrackParticle auxiliary container.
Definition: TrackParticleAuxContainer.h:19
TrigMuonEFInfoToMuonCnvAlg.h
xAOD::TrackParticleContainer
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticleContainer.h:14
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::m_xaodExtrapTrkPartContainerName
std::string m_xaodExtrapTrkPartContainerName
The key for the output xAOD::TrackParticleContainer for extrapolated tracks.
Definition: TrigMuonEFInfoToMuonCnvAlg.h:57
TrigMuonEFInfoContainer
Definition: TrigMuonEFInfoContainer.h:27
xAODMaker
Definition: StoreGateSvc.h:72
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::recordxAODContainers
StatusCode recordxAODContainers(const std::string &containerName, const std::string &auxContainerName, CONT &xaod, AUXCONT &aux)
Utility function to record xAOD containers.
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::m_converterTool
ToolHandle< ITrigMuonEFInfoToMuonCnvTool > m_converterTool
Tool that actually does the conversion.
Definition: TrigMuonEFInfoToMuonCnvAlg.h:60
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MuonAuxContainer.h
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::m_xaodMuonContainerName
std::string m_xaodMuonContainerName
The key for the output xAOD::MuonContainer.
Definition: TrigMuonEFInfoToMuonCnvAlg.h:53
xAOD::MuonAuxContainer_v5
Temporary container used until we have I/O for AuxStoreInternal.
Definition: MuonAuxContainer_v5.h:31
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::m_aodContainerName
std::string m_aodContainerName
The key of the input TrigMuonEFInfoContainer.
Definition: TrigMuonEFInfoToMuonCnvAlg.h:51
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::m_nCombTrksCreated
unsigned int m_nCombTrksCreated
Definition: TrigMuonEFInfoToMuonCnvAlg.h:64
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrackParticleAuxContainer.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
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: TrigMuonEFInfoToMuonCnvAlg.cxx:36
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgorithm
Definition: AthAlgorithm.h:47
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::m_nproc
unsigned int m_nproc
Definition: TrigMuonEFInfoToMuonCnvAlg.h:66
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::m_nMuonsCreated
unsigned int m_nMuonsCreated
counters
Definition: TrigMuonEFInfoToMuonCnvAlg.h:63
MuonContainer.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::m_nExtrapTrksCreated
unsigned int m_nExtrapTrksCreated
Definition: TrigMuonEFInfoToMuonCnvAlg.h:65
xAOD::MuonAuxContainer
MuonAuxContainer_v5 MuonAuxContainer
Definition of the current Muon auxiliary container.
Definition: MuonAuxContainer.h:19
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAODMaker::TrigMuonEFInfoToMuonCnvAlg::TrigMuonEFInfoToMuonCnvAlg
TrigMuonEFInfoToMuonCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
Definition: TrigMuonEFInfoToMuonCnvAlg.cxx:21
TrackParticleContainer.h