ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::RPC_TimingTool Class Reference

#include <RPC_TimingTool.h>

Inheritance diagram for Muon::RPC_TimingTool:
Collaboration diagram for Muon::RPC_TimingTool:

Public Member Functions

 RPC_TimingTool (const std::string &, const std::string &, const IInterface *)
virtual ~RPC_TimingTool ()=default
virtual StatusCode initialize () override final
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.

Private Member Functions

double getError (const Muon::MuonClusterOnTrack &) const
 calculate error on the RPC time

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}

Detailed Description

Definition at line 24 of file RPC_TimingTool.h.

Constructor & Destructor Documentation

◆ RPC_TimingTool()

RPC_TimingTool::RPC_TimingTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 11 of file RPC_TimingTool.cxx.

11 :
12 base_class(t,n,p) {}

◆ ~RPC_TimingTool()

virtual Muon::RPC_TimingTool::~RPC_TimingTool ( )
virtualdefault

Member Function Documentation

◆ calculateTimingResult()

IMuonHitTimingTool::TimingResult RPC_TimingTool::calculateTimingResult ( const std::vector< const MuonClusterOnTrack * > & hits) const
finaloverridevirtual

Calculate the time offset of a given set of hits wrt to the current bunch.

Definition at line 19 of file RPC_TimingTool.cxx.

19 {
20
21 // sanity check
22 if( hits.empty() ) return {};
23
24 ATH_MSG_DEBUG(" calculating timing for hits " << hits.size() );
25
26 std::vector<int> histogram(100,0);
27 float minTime = -100.;
28 float binwidth = 2*std::abs(minTime)/histogram.size();
29 float invbinwidth = 1./binwidth;
30
31
32 for( const auto *hit : hits ){
33 const RpcClusterOnTrack* rpc = dynamic_cast<const RpcClusterOnTrack*>(hit);
34 if( !rpc ) continue;
35 int bin = invbinwidth*(rpc->time()-minTime);
36 ATH_MSG_DEBUG(m_idHelperSvc->toString(hit->identify()) << " time " << rpc->time() << " bin " << bin );
37 if( bin < 0 || bin >= (int)histogram.size() ) continue;
38 ++histogram[bin];
39 }
40 int maxbin = -1;
41 int maxval = 0;
42 for( unsigned int i=0; i<histogram.size();++i ){
43 int val = histogram[i];
44 if( val > maxval ){
45 maxbin = i;
46 maxval = val;
47 }
48 }
49 if( maxbin != -1 ){
50 double time = 0.;
51 unsigned int nhits = 0;
52 double error = getError(*hits.front());
53 for( const auto *hit : hits ){
54 const RpcClusterOnTrack* rpc = dynamic_cast<const RpcClusterOnTrack*>(hit);
55 if( !rpc ) continue;
56 int bin = invbinwidth*(rpc->time()-minTime);
57 ATH_MSG_DEBUG(m_idHelperSvc->toString(hit->identify()) << " time " << rpc->time() << " bin " << bin );
58 // select hits in the max bin or the two neighbouring ones
59 if( bin > maxbin+1 || bin < maxbin-1 ) continue;
60 time += rpc->time();
61 ++nhits;
62 }
63 if( nhits == 0 ) return {};
64 time /= nhits;
65 ATH_MSG_DEBUG( " final time " << time << " error " << error );
66 return {true,time,error};
67 }
68 return {};
69 }
#define ATH_MSG_DEBUG(x)
std::string histogram
Definition chains.cxx:52
double getError(const Muon::MuonClusterOnTrack &) const
calculate error on the RPC time
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
bool binwidth
Definition listroot.cxx:58
time(flags, cells_name, *args, **kw)

◆ getError()

double RPC_TimingTool::getError ( const Muon::MuonClusterOnTrack & rpcRIO) const
private

calculate error on the RPC time

Definition at line 71 of file RPC_TimingTool.cxx.

71 {
72
73 // S. Spagnolo: Aug. 5th 2011 - implementation for rel 17 reprocessing (based on slide 8 and 9 of
74 // https://indico.cern.ch/getFile.py/access?contribId=6&resId=0&materialId=slides&confId=147791
75 // ... no calibration offline yet, no correction for signal propagation time)
76 Identifier id = rpcRIO.identify();
77 int measPhi = m_idHelperSvc->measuresPhi(id);
78 MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id);
79 if( stIndex == MuonStationIndex::StIndex::BO) {
80 // outer layer station => high pt
81 if (measPhi==1) return 5.10;
82 return 4.84;
83 }else{
84 // pivot plane of Middle station dbR=2 or low pT confirm dbR=1 but names like "BMS", "BML", etc
85 if (measPhi==1) return 5.04;
86 else return 4.18;
87 }
88 }
Identifier identify() const
return the identifier -extends MeasurementBase
StIndex
enum to classify the different station layers in the muon spectrometer

◆ initialize()

StatusCode RPC_TimingTool::initialize ( )
finaloverridevirtual

Definition at line 14 of file RPC_TimingTool.cxx.

14 {
15 ATH_CHECK(m_idHelperSvc.retrieve());
16 return StatusCode::SUCCESS;
17 }
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::RPC_TimingTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 40 of file RPC_TimingTool.h.

40{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

The documentation for this class was generated from the following files: