ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalibExtendedSegment.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <sstream>
8
10#include "GaudiKernel/MsgStream.h"
15
16namespace {
18 constexpr int adc_lower_threshold = 70;
19
20} // namespace
21namespace MuonCalib {
22
23 // const std::vector<const MuonCalibExtendedTrack*>& MuonCalibExtendedSegment::associatedTracks() const { return m_associatedTracks; }
24
26 // void MuonCalibExtendedSegment::addTrack(const MuonCalibExtendedTrack* track) { m_associatedTracks.emplace_back(track); }
27
30
31 MuonCalibTrackSummary::ChamberHitSummary* currentChamberSummary = nullptr;
32
33 for (const MdtHitPtr& mdt_hit : mdtHOT()) {
34 const MuonFixedId& id = mdt_hit->identify();
35 if (!id.isValid()) {
36 MsgStream log(Athena::getMessageSvc(), "MuonCalibExtendedSegment");
37 log << MSG::WARNING << "invalid MDT id!" << endmsg;
38 continue;
39 }
40
41 m_idSet.insert(id);
42
43 MuonFixedId chId = idManip.chamberIdentifier(id);
44
45 bool measuresPhi = idManip.measuresPhi(id);
46 bool isMdt = id.is_mdt();
47 bool isFirst = isMdt ? id.mdtMultilayer() == 1 : !measuresPhi;
48
49 // check whether first chamber or new chamber
50 if (!currentChamberSummary || currentChamberSummary->chId != chId) {
51 m_summary.chamberHitSummary.emplace_back(chId);
52 currentChamberSummary = &m_summary.chamberHitSummary.back();
53 }
54
56 isFirst ? currentChamberSummary->etaProjection() : currentChamberSummary->phiProjection();
57
58 ++proj.nhits;
59
60 ++m_summary.nhits;
61 ++m_summary.nmdtHits;
62
63 if (mdt_hit->adcCount() < adc_lower_threshold) ++m_summary.nmdtHitsBelowADCCut;
64
66 if (idManip.isEndcap(id)) {
67 if (id.eta() < 0.)
68 m_summary.hasEndcapA = true;
69 else
70 m_summary.hasEndcapC = true;
71 if (stationIndex == MuonFixedIdManipulator::EIA || stationIndex == MuonFixedIdManipulator::EIC ||
72 stationIndex == MuonFixedIdManipulator::EMA || stationIndex == MuonFixedIdManipulator::EMC)
73 m_summary.hasEndcapLayersWithTGC = true;
74 } else {
75 m_summary.hasBarrel = true;
76 if (stationIndex == MuonFixedIdManipulator::BM || stationIndex == MuonFixedIdManipulator::BO)
77 m_summary.hasBarrelLayersWithRPC = true;
78 }
79
80 m_summary.precisionStationLayers.insert(stationIndex);
81 if (currentChamberSummary->nMdtHitsMl1() > 0 && currentChamberSummary->nMdtHitsMl2() && currentChamberSummary->nhits() > 3) {
82 m_summary.goodPrecisionStationLayers.insert(stationIndex);
83 }
84 }
85 for (const RpcHitPtr& rpc_hit : rpcHOT()) {
86 MuonFixedId id = rpc_hit->identify();
87 if (!id.isValid()) {
88 MsgStream log(Athena::getMessageSvc(), "MuonCalibExtendedSegment");
89 log << MSG::WARNING << "invalid RPC id!" << endmsg;
90 continue;
91 }
92
93 m_idSet.insert(id);
94
95 MuonFixedId chId = idManip.chamberIdentifier(id);
96
97 bool measuresPhi = idManip.measuresPhi(id);
98 bool isMdt = id.is_mdt();
99 bool isFirst = isMdt ? id.mdtMultilayer() == 1 : measuresPhi;
100
101 // check whether first chamber or new chamber
102 if (!currentChamberSummary || currentChamberSummary->chId != chId) {
103 m_summary.chamberHitSummary.emplace_back(chId);
104 currentChamberSummary = &m_summary.chamberHitSummary.back();
105 }
106
108 isFirst ? currentChamberSummary->etaProjection() : currentChamberSummary->phiProjection();
109
110 ++proj.nhits;
111
112 ++m_summary.nhits;
113 if (measuresPhi)
114 ++m_summary.nrpcPhiHits;
115 else
116 ++m_summary.nrpcEtaHits;
117
119 if (measuresPhi) m_summary.phiStationLayers.insert(phiStationIndex);
120 if (currentChamberSummary->netaHits() > 0 && currentChamberSummary->nphiHits() > 0) {
121 m_summary.phiEtaStationLayers.insert(phiStationIndex);
122 }
123 }
124
125 if (m_summary.nrpcEtaHits + m_summary.nrpcPhiHits > 0) {
126 m_summary.hasBarrel = true;
127 m_summary.hasBarrelLayersWithRPC = true;
128 }
129
130 for (const TgcHitPtr& tgc_hit : tgcHOT()) {
131 const MuonFixedId& id = tgc_hit->identify();
132 if (!id.isValid()) {
133 MsgStream log(Athena::getMessageSvc(), "MuonCalibExtendedSegment");
134 log << MSG::WARNING << "invalid TGC id!" << endmsg;
135 continue;
136 }
137
138 m_idSet.insert(id);
139
140 MuonFixedId chId = idManip.chamberIdentifier(id);
141
142 bool measuresPhi = idManip.measuresPhi(id);
143 bool isMdt = id.is_mdt();
144 bool isFirst = isMdt ? id.mdtMultilayer() == 1 : measuresPhi;
145
146 // check whether first chamber or new chamber
147 if (!currentChamberSummary || currentChamberSummary->chId != chId) {
148 m_summary.chamberHitSummary.push_back(MuonCalibTrackSummary::ChamberHitSummary(chId));
149 currentChamberSummary = &m_summary.chamberHitSummary.back();
150 }
151
153 isFirst ? currentChamberSummary->etaProjection() : currentChamberSummary->phiProjection();
154
155 ++proj.nhits;
156
157 ++m_summary.nhits;
158 if (measuresPhi)
159 ++m_summary.ntgcPhiHits;
160 else
161 ++m_summary.ntgcEtaHits;
162
163 if (id.eta() < 0)
164 m_summary.hasEndcapA = true;
165 else
166 m_summary.hasEndcapC = true;
167
169 if (measuresPhi) m_summary.phiStationLayers.insert(phiStationIndex);
170 if (currentChamberSummary->netaHits() > 0 && currentChamberSummary->nphiHits() > 0) {
171 m_summary.phiEtaStationLayers.insert(phiStationIndex);
172 }
173 }
174
175 for (const CscHitPtr& csc_hit : cscHOT()) {
176 const MuonFixedId& id = csc_hit->identify();
177 if (!id.isValid()) {
178 MsgStream log(Athena::getMessageSvc(), "MuonCalibExtendedSegment");
179 log << MSG::WARNING << "invalid CSC id!" << endmsg;
180 continue;
181 }
182
183 m_idSet.insert(id);
184
185 MuonFixedId chId = idManip.chamberIdentifier(id);
186
187 bool measuresPhi = idManip.measuresPhi(id);
188 bool isMdt = id.is_mdt();
189 bool isFirst = isMdt ? id.mdtMultilayer() == 1 : measuresPhi;
190
191 // check whether first chamber or new chamber
192 if (!currentChamberSummary || currentChamberSummary->chId != chId) {
193 m_summary.chamberHitSummary.emplace_back(chId);
194 currentChamberSummary = &m_summary.chamberHitSummary.back();
195 }
196
198 isFirst ? currentChamberSummary->etaProjection() : currentChamberSummary->phiProjection();
199
200 ++proj.nhits;
201
202 ++m_summary.nhits;
203 if (measuresPhi)
204 ++m_summary.ncscPhiHits;
205 else
206 ++m_summary.ncscEtaHits;
207
209 if (measuresPhi) { m_summary.phiStationLayers.insert(phiStationIndex); }
211 m_summary.precisionStationLayers.insert(stationIndex);
212 if (currentChamberSummary->netaHits() > 2 && currentChamberSummary->nphiHits() > 2) {
213 m_summary.goodPrecisionStationLayers.insert(stationIndex);
214 m_summary.phiEtaStationLayers.insert(phiStationIndex);
215 }
216 }
217 }
218
219 std::string MuonCalibExtendedSegment::dump() const {
220 std::ostringstream sout;
221 sout << dumpPars() << std::endl << dumpSummary();
222 return sout.str();
223 }
224
226 std::ostringstream sout;
227 sout << "Extended Segment: " << std::setprecision(4) << "chi2 " << chi2() << " r " << (int)globalPosition().perp() << " z "
228 << (int)globalPosition().z() << std::setprecision(5) << " phi " << globalDirection().phi() << " theta "
229 << globalDirection().theta(); // << " nassociatedTracks " << m_associatedTracks.size();
230 return sout.str();
231 }
232
234 std::ostringstream sout;
235 sout << m_summary.dump();
236 return sout.str();
237 }
238
239} // namespace MuonCalib
Scalar eta() const
pseudorapidity method
#define endmsg
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
IdSet m_idSet
set with Identifiers on segment
std::string dumpSummary() const
dump track summary to string
MuonCalibTrackSummary m_summary
track summary
MuonCalibExtendedSegment(const MuonCalibSegment &segment)
Constructor taking input track.
std::string dump() const
dump all information to string
std::string dumpPars() const
dump track parameters to string
std::shared_ptr< MdtCalibHitBase > MdtHitPtr
typedef for a collection of MdtCalibHitBase s
std::shared_ptr< const RpcCalibHitBase > RpcHitPtr
typedef for a collection of RpcCalibHitBase s
const CscHitVec & cscHOT() const
retrieve the full set of CscCalibHitBase s assigned to this segment
std::shared_ptr< const TgcCalibHitBase > TgcHitPtr
typedef for a collection of TgcCalibHitBase s
std::shared_ptr< const CscCalibHitBase > CscHitPtr
typedef for a collection of CscCalibHitBase s
double chi2() const
retrieve chi2
const MdtHitVec & mdtHOT() const
retrieve the full set of MdtCalibHitBase s assigned to this segment
Amg::Vector3D globalPosition() const
retrieve global position
MuonCalibSegment(double chi2, const Amg::Vector3D &pos, const Amg::Vector3D &dir, const Amg::Transform3D &locToGlo, unsigned int qualityFlag=0)
constructor fully initializing the segment-parameters, do we need default constructor?
const TgcHitVec & tgcHOT() const
retrieve the full set of TgcCalibHitBase s assigned to this segment
Amg::Vector3D globalDirection() const
retrieve global direction
const RpcHitVec & rpcHOT() const
retrieve the full set of RpcCalibHitBase s assigned to this segment
StationIndex
enum defining station layers
PhiStationIndex phiStationLayerIndex(const MuonFixedId &id) const
return phi station layer index for a give identifier
MuonFixedId chamberIdentifier(const MuonFixedId &id) const
returns chamber Identifier for the give id, same as stationIdentifier RPC: includes doubletR
StationIndex stationLayerIndex(const MuonFixedId &id) const
returns station layer index for a give identifier
PhiStationIndex
enum defining trigger phi layers
bool isEndcap(const MuonFixedId &id) const
returns whether this is a phi measurement
bool measuresPhi(const MuonFixedId &id) const
returns whether this is a phi measurement
Implements fixed identifiers not dependent upon Athena Identifier for internal use in the calibration...
Definition MuonFixedId.h:50
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.