ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonReconstruction
MuonRecTools
MuonTimingTools
src
RPC_TimingTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
RPC_TimingTool.h
"
6
#include "
MuonRIO_OnTrack/RpcClusterOnTrack.h
"
7
#include "
MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h
"
8
9
namespace
Muon
{
10
11
RPC_TimingTool::RPC_TimingTool
(
const
std::string& t,
const
std::string& n,
const
IInterface* p) :
12
base_class(t,n,p) {}
13
14
StatusCode
RPC_TimingTool::initialize
() {
15
ATH_CHECK
(
m_idHelperSvc
.retrieve());
16
return
StatusCode::SUCCESS;
17
}
18
19
IMuonHitTimingTool::TimingResult
RPC_TimingTool::calculateTimingResult
(
const
std::vector<const MuonClusterOnTrack*>& hits )
const
{
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
}
70
71
double
RPC_TimingTool::getError
(
const
MuonClusterOnTrack
& rpcRIO)
const
{
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
}
89
90
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CompetingMuonClustersOnTrack.h
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
RPC_TimingTool.h
RpcClusterOnTrack.h
histogram
std::string histogram
Definition
chains.cxx:52
Muon::MuonClusterOnTrack
Base class for Muon cluster RIO_OnTracks.
Definition
MuonClusterOnTrack.h:34
Muon::RPC_TimingTool::getError
double getError(const Muon::MuonClusterOnTrack &) const
calculate error on the RPC time
Definition
RPC_TimingTool.cxx:71
Muon::RPC_TimingTool::initialize
virtual StatusCode initialize() override final
Definition
RPC_TimingTool.cxx:14
Muon::RPC_TimingTool::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
RPC_TimingTool.cxx:19
Muon::RPC_TimingTool::RPC_TimingTool
RPC_TimingTool(const std::string &, const std::string &, const IInterface *)
Definition
RPC_TimingTool.cxx:11
Muon::RPC_TimingTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition
RPC_TimingTool.h:40
Muon::RpcClusterOnTrack
Class to represent calibrated clusters formed from RPC strips.
Definition
RpcClusterOnTrack.h:35
Muon::RpcClusterOnTrack::time
float time() const
Return the time (ns).
Definition
RpcClusterOnTrack.h:159
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition
RIO_OnTrack.h:152
bin
Definition
BinsDiffFromStripMedian.h:43
binwidth
bool binwidth
Definition
listroot.cxx:58
Identifier
Definition
IdentifierFieldParser.cxx:14
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition
MuonStationIndex.h:24
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition
TrackSystemController.h:46
error
Definition
IImpactPoint3dEstimator.h:72
Muon::IMuonHitTimingTool::TimingResult
simple struct holding the result of the tool
Definition
IMuonHitTimingTool.h:38
Generated on
for ATLAS Offline Software by
1.17.0