ATLAS Offline Software
MuonHitTimingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonHitTimingTool.h"
8 
9 
10 namespace Muon {
11 
12  MuonHitTimingTool::MuonHitTimingTool(const std::string& t, const std::string& n, const IInterface* p):
13  base_class(t,n,p),
14  m_hitTimingTools(this) {
15 
16  for( unsigned int tech = 0;tech<MuonStationIndex::TechnologyIndexMax;++tech ){
17  if( tech == static_cast<unsigned int>(MuonStationIndex::RPC) ) m_hitTimingTools.push_back(ToolHandle<IMuonHitTimingTool>("Muon::RPC_TimingTool/RPC_TimingTool"));
18  else m_hitTimingTools.push_back(ToolHandle<IMuonHitTimingTool>(""));
19  }
20 
21  }
22 
24 
25  ATH_CHECK(m_idHelperSvc.retrieve());
26 
27  // ensure that the number of tool handles corresponds to the number of technologies
28  if( m_hitTimingTools.size() != MuonStationIndex::TechnologyIndex::TechnologyIndexMax ){
29  ATH_MSG_ERROR(" The MuonHitTimingTool ToolHandleArray SHOULD contain exactly " << MuonStationIndex::TechnologyIndex::TechnologyIndexMax
30  << " ToolHandles (they can be empty). ");
31  return StatusCode::FAILURE;
32  }
33 
34  // loop over timing tool handles and check that they handle the technology they are supposed to, if not return a FAILURE
35  for( unsigned int tech = 0;tech<MuonStationIndex::TechnologyIndexMax;++tech ){
36  // get handle, accept empty handles
37  auto& toolHandle = m_hitTimingTools[tech];
39  if( toolHandle.empty() ) continue;
40  ATH_CHECK(toolHandle.retrieve());
41  }
42  return StatusCode::SUCCESS;
43  }
44 
45  IMuonHitTimingTool::TimingResult MuonHitTimingTool::calculateTimingResult( const std::vector<const MuonClusterOnTrack*>& hits ) const {
46 
47  // treat case of no hits and the case the first pointer is zero (should not happen)
48  if( hits.empty() || !hits.front()) return {};
49 
50  // for now assume that all hits are of the same technolgy
51  Identifier id = hits.front()->identify();
52  MuonStationIndex::TechnologyIndex tech = m_idHelperSvc->technologyIndex(id);
53 
54  // get handle and use it if it is not empty
55  const ToolHandle<IMuonHitTimingTool>& toolHandle = m_hitTimingTools[tech];
56  if( toolHandle.empty() ) {
57  ATH_MSG_VERBOSE("Unable to fill timing, timing tool missing. Tech = " << MuonStationIndex::technologyName(tech) );
58  return {};
59  }
60  return toolHandle->calculateTimingResult(hits);
61  }
62 
63 
64 }
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
CompetingMuonClustersOnTrack.h
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::MuonHitTimingTool::calculateTimingResult
virtual TimingResult calculateTimingResult(const std::vector< const MuonClusterOnTrack * > &hits) const override final
Calculate the time offset of a given set of hits wrt to the current bunch.
Definition: MuonHitTimingTool.cxx:45
RpcClusterOnTrack.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
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
Muon::MuonHitTimingTool::m_hitTimingTools
ToolHandleArray< IMuonHitTimingTool > m_hitTimingTools
Definition: MuonHitTimingTool.h:42
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonHitTimingTool.h
Muon::IMuonHitTimingTool::TimingResult
simple struct holding the result of the tool
Definition: IMuonHitTimingTool.h:38
Muon::MuonHitTimingTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonHitTimingTool.h:41
Muon::MuonStationIndex::TechnologyIndexMax
@ TechnologyIndexMax
Definition: MuonStationIndex.h:57
Muon::MuonStationIndex::RPC
@ RPC
Definition: MuonStationIndex.h:56
Muon::MuonStationIndex::TechnologyIndex
TechnologyIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:54
Muon::MuonHitTimingTool::initialize
virtual StatusCode initialize() override final
standard initialization method
Definition: MuonHitTimingTool.cxx:23
Muon::MuonHitTimingTool::MuonHitTimingTool
MuonHitTimingTool(const std::string &, const std::string &, const IInterface *)
Definition: MuonHitTimingTool.cxx:12
Identifier
Definition: IdentifierFieldParser.cxx:14
Muon::MuonStationIndex::technologyName
static const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
Definition: MuonStationIndex.cxx:209