ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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. More...
 

Private Member Functions

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

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  }

◆ 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::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  }

◆ 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  }

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.


The documentation for this class was generated from the following files:
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
Muon::RPC_TimingTool::getError
double getError(const Muon::MuonClusterOnTrack &) const
calculate error on the RPC time
Definition: RPC_TimingTool.cxx:71
binwidth
bool binwidth
Definition: listroot.cxx:58
bin
Definition: BinsDiffFromStripMedian.h:43
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
Muon::RPC_TimingTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: RPC_TimingTool.h:40
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
Muon::MuonStationIndex::BO
@ BO
Definition: MuonStationIndex.h:25
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
error
Definition: IImpactPoint3dEstimator.h:70
histogram
std::string histogram
Definition: chains.cxx:52
Identifier
Definition: IdentifierFieldParser.cxx:14