ATLAS Offline Software
MuonSegmentKey.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
15 
17 
19  // to ensure consistent usage of MDT signs flip
20  int signCor = segment.localDirection().angleYZ() < 0 ? -1 : 1;
21  calculateKeys(segment.containedMeasurements(), signCor);
22 }
23 
24 Muon::MuonSegmentKey::MuonSegmentKey(const std::vector<const Trk::MeasurementBase*>& measurements) { calculateKeys(measurements, 1); }
25 
26 void Muon::MuonSegmentKey::calculateKeys(const std::vector<const Trk::MeasurementBase*>& measurements, int signCor) {
27  // clear internal lists
28  m_measKeys.clear();
29  m_measKeysTrigger.clear();
30 
31  // loop over measurements
32  std::vector<const Trk::MeasurementBase*>::const_iterator it = measurements.begin(), itEnd = measurements.end();
33  for (; it != itEnd; ++it) {
34  const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(*it);
35  const Muon::CompetingMuonClustersOnTrack* crot = nullptr;
36  if (!rot) {
37  crot = dynamic_cast<const Muon::CompetingMuonClustersOnTrack*>(*it);
38 
39  if (crot && !crot->containedROTs().empty()) rot = crot->containedROTs().front();
40  }
41  if (!rot) continue;
42 
43  // cast Identifier to an int
44  unsigned int id = rot->identify().get_identifier32().get_compact();
45  int sign = 1;
46  // only consider MDT's and CSCs for now
47  const Muon::MdtDriftCircleOnTrack* mdt = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(*it);
48  if (mdt) {
49  // get drift radius for MDTs
50  const Trk::LocalParameters& locParams = (*it)->localParameters();
51 
52  // only take into account sign if more than 1 mm from wire
53  if (signCor * locParams.get(Trk::loc1) < -1.) sign = -1;
54 
55  // if signCor == 2 ignore sign
56  if (signCor == 2) sign = 1;
57 
58  m_measKeys.insert(std::make_pair(id, sign));
59  } else if (dynamic_cast<const Muon::CscClusterOnTrack*>(*it)) {
60  m_measKeys.insert(std::make_pair(id, sign));
61  } else if (dynamic_cast<const Muon::MMClusterOnTrack*>(*it)) {
62  m_measKeys.insert(std::make_pair(id, sign));
63  } else if (dynamic_cast<const Muon::sTgcClusterOnTrack*>(*it)) {
64  m_measKeys.insert(std::make_pair(id, sign));
65  } else {
66  m_measKeysTrigger.insert(std::make_pair(id, sign));
67  }
68  }
69 }
70 
Trk::LocalParameters
Definition: LocalParameters.h:98
sTgcClusterOnTrack.h
Muon::MuonSegmentKey::~MuonSegmentKey
virtual ~MuonSegmentKey()
skel.it
it
Definition: skel.GENtoEVGEN.py:396
CompetingMuonClustersOnTrack.h
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
Muon::CompetingMuonClustersOnTrack
Definition: CompetingMuonClustersOnTrack.h:54
MdtDriftCircleOnTrack.h
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
MMClusterOnTrack.h
Trk::LocalParameters::get
double get(ParamDefs par) const
Retrieve specified parameter (const version).
CscClusterOnTrack.h
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
Muon::sTgcClusterOnTrack
Class to represent calibrated clusters formed from TGC strips.
Definition: sTgcClusterOnTrack.h:30
Muon::MMClusterOnTrack
Class to represent calibrated clusters formed from TGC strips.
Definition: MMClusterOnTrack.h:26
Muon::MuonSegmentKey::calculateKeys
void calculateKeys(const std::vector< const Trk::MeasurementBase * > &measurements, int signCor=1)
function to calculate keys from a vector of measurements, the signCor is can be use to flip the signs...
Definition: MuonSegmentKey.cxx:26
RIO_OnTrack.h
Muon::MdtDriftCircleOnTrack
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
Definition: MdtDriftCircleOnTrack.h:37
Muon::CompetingMuonClustersOnTrack::containedROTs
const std::vector< const MuonClusterOnTrack * > & containedROTs() const
returns the vector of SCT_ClusterOnTrack objects .
Definition: CompetingMuonClustersOnTrack.h:184
Muon::CscClusterOnTrack
Class to represent the calibrated clusters created from CSC strips.
Definition: CscClusterOnTrack.h:47
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
Muon::MuonSegmentKey::MuonSegmentKey
MuonSegmentKey()
default constructor
MuonSegment.h
LocalDirection.h
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
Trk::loc1
@ loc1
Definition: ParamDefs.h:34
MuonSegmentKey.h
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5