ATLAS Offline Software
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 
16 namespace {
18  constexpr int adc_lower_threshold = 70;
19 
20 } // namespace
21 namespace 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 
29  MuonFixedIdManipulator idManip;
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;
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)
74  } else {
75  m_summary.hasBarrel = true;
76  if (stationIndex == MuonFixedIdManipulator::BM || stationIndex == MuonFixedIdManipulator::BO)
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)
115  else
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 
126  m_summary.hasBarrel = 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) {
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)
160  else
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)
205  else
207 
209  if (measuresPhi) { m_summary.phiStationLayers.insert(phiStationIndex); }
210  MuonFixedIdManipulator::StationIndex stationIndex = idManip.stationLayerIndex(id);
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
MuonCalib::MuonFixedIdManipulator::EMA
@ EMA
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonCalibTrackSummary::ChamberHitSummary::nhits
int nhits() const
Definition: MuonCalibTrackSummary.h:32
MuonCalib::MuonCalibTrackSummary::phiStationLayers
std::set< MuonFixedIdManipulator::PhiStationIndex > phiStationLayers
set of phi layers on the track
Definition: MuonCalibTrackSummary.h:110
MuonCalib::MuonCalibTrackSummary::ChamberHitSummary::nMdtHitsMl1
int nMdtHitsMl1() const
Definition: MuonCalibTrackSummary.h:40
MuonCalib::MuonFixedIdManipulator::StationIndex
StationIndex
enum defining station layers
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonCalibTrackSummary::ntgcPhiHits
unsigned int ntgcPhiHits
Definition: MuonCalibTrackSummary.h:70
MuonCalib::MuonFixedIdManipulator::chamberIdentifier
MuonFixedId chamberIdentifier(const MuonFixedId &id) const
returns chamber Identifier for the give id, same as stationIdentifier RPC: includes doubletR
Definition: MuonFixedIdManipulator.cxx:154
MuonCalib::MuonCalibSegment::cscHOT
const CscHitVec & cscHOT() const
retrieve the full set of CscCalibHitBase s assigned to this segment
Definition: MuonCalibSegment.cxx:156
MuonCalib::MuonCalibExtendedSegment::dump
std::string dump() const
dump all information to string
Definition: MuonCalibExtendedSegment.cxx:219
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
MuonCalib::MuonCalibTrackSummary::hasEndcapC
bool hasEndcapC
Definition: MuonCalibTrackSummary.h:76
MuonCalib::MuonFixedIdManipulator::PhiStationIndex
PhiStationIndex
enum defining trigger phi layers
Definition: MuonFixedIdManipulator.h:19
MuonCalib::MuonFixedIdManipulator::BM
@ BM
Definition: MuonFixedIdManipulator.h:17
MuonFixedIdPrinter.h
MuonCalib::MuonCalibTrackSummary::nmdtHits
unsigned int nmdtHits
Definition: MuonCalibTrackSummary.h:66
MuonCalib::MuonCalibSegment
Definition: MuonCalibSegment.h:39
MuonCalib::MuonFixedIdManipulator::phiStationLayerIndex
PhiStationIndex phiStationLayerIndex(const MuonFixedId &id) const
return phi station layer index for a give identifier
Definition: MuonFixedIdManipulator.cxx:9
MuonCalib::MuonCalibTrackSummary::ChamberHitSummary::Projection
Definition: MuonCalibTrackSummary.h:20
MuonCalib::MuonCalibTrackSummary::ChamberHitSummary::netaHits
int netaHits() const
Definition: MuonCalibTrackSummary.h:37
MuonCalib::MuonCalibExtendedSegment::m_summary
MuonCalibTrackSummary m_summary
track summary
Definition: MuonCalibExtendedSegment.h:59
MuonCalib::MuonCalibSegment::RpcHitPtr
std::shared_ptr< const RpcCalibHitBase > RpcHitPtr
typedef for a collection of RpcCalibHitBase s
Definition: MuonCalibSegment.h:52
MuonCalib::MuonFixedIdManipulator::BO
@ BO
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonCalibSegment::globalPosition
Amg::Vector3D globalPosition() const
retrieve global position
Definition: MuonCalibSegment.cxx:189
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:225
MuonCalib::MuonCalibTrackSummary::nrpcEtaHits
unsigned int nrpcEtaHits
Definition: MuonCalibTrackSummary.h:69
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonCalib::MuonCalibSegment::rpcHOT
const RpcHitVec & rpcHOT() const
retrieve the full set of RpcCalibHitBase s assigned to this segment
Definition: MuonCalibSegment.cxx:165
MuonCalib::MuonFixedIdManipulator::EMC
@ EMC
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonFixedIdManipulator
Definition: MuonFixedIdManipulator.h:14
MuonCalib::MuonCalibTrackSummary::dump
std::string dump() const
dump counts to string
Definition: MuonCalibTrackSummary.cxx:14
MuonCalib::MuonCalibTrackSummary::phiEtaStationLayers
std::set< MuonFixedIdManipulator::PhiStationIndex > phiEtaStationLayers
set of phi layers which also have eta hits on the track
Definition: MuonCalibTrackSummary.h:116
MuonCalib::MuonCalibTrackSummary::ChamberHitSummary::nMdtHitsMl2
int nMdtHitsMl2() const
Definition: MuonCalibTrackSummary.h:41
MuonCalib::MuonCalibSegment::tgcHOT
const TgcHitVec & tgcHOT() const
retrieve the full set of TgcCalibHitBase s assigned to this segment
Definition: MuonCalibSegment.cxx:174
MuonCalib::MuonCalibExtendedSegment::dumpSummary
std::string dumpSummary() const
dump track summary to string
Definition: MuonCalibExtendedSegment.cxx:233
MuonCalib::MuonFixedIdManipulator::measuresPhi
bool measuresPhi(const MuonFixedId &id) const
returns whether this is a phi measurement
Definition: MuonFixedIdManipulator.h:67
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonCalib::MuonCalibTrackSummary::ncscEtaHits
unsigned int ncscEtaHits
Definition: MuonCalibTrackSummary.h:73
MuonCalib::MuonFixedIdManipulator::EIA
@ EIA
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonCalibExtendedSegment::MuonCalibExtendedSegment
MuonCalibExtendedSegment(const MuonCalibSegment &segment)
Constructor taking input track.
Definition: MuonCalibExtendedSegment.cxx:28
MuonCalibExtendedSegment.h
MuonCalib::MuonCalibTrackSummary::ntgcEtaHits
unsigned int ntgcEtaHits
Definition: MuonCalibTrackSummary.h:71
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::MuonCalibTrackSummary::ChamberHitSummary
Definition: MuonCalibTrackSummary.h:19
MuonCalib::MuonCalibTrackSummary::chamberHitSummary
std::vector< ChamberHitSummary > chamberHitSummary
Definition: MuonCalibTrackSummary.h:107
MuonCalib::MuonCalibTrackSummary::ChamberHitSummary::chId
MuonFixedId chId
Definition: MuonCalibTrackSummary.h:29
MuonCalib::MuonCalibTrackSummary::ncscPhiHits
unsigned int ncscPhiHits
Definition: MuonCalibTrackSummary.h:72
MuonCalib::MuonCalibTrackSummary::hasBarrel
bool hasBarrel
Definition: MuonCalibTrackSummary.h:77
make_coralServer_rep.proj
proj
Definition: make_coralServer_rep.py:48
MuonCalib::MuonCalibSegment::CscHitPtr
std::shared_ptr< const CscCalibHitBase > CscHitPtr
typedef for a collection of CscCalibHitBase s
Definition: MuonCalibSegment.h:48
MuonCalibHit_E.h
MuonCalib::MuonCalibTrackSummary::ChamberHitSummary::nphiHits
int nphiHits() const
Definition: MuonCalibTrackSummary.h:38
MuonCalib::MuonCalibTrackSummary::nrpcPhiHits
unsigned int nrpcPhiHits
Definition: MuonCalibTrackSummary.h:68
MuonCalib::MuonCalibTrackSummary::precisionStationLayers
std::set< MuonFixedIdManipulator::StationIndex > precisionStationLayers
set of precision layers on the track
Definition: MuonCalibTrackSummary.h:113
MuonCalib::MuonFixedId
Definition: MuonFixedId.h:50
MuonCalib::MuonCalibExtendedSegment::dumpPars
std::string dumpPars() const
dump track parameters to string
Definition: MuonCalibExtendedSegment.cxx:225
MuonCalib::MuonCalibSegment::globalDirection
Amg::Vector3D globalDirection() const
retrieve global direction
Definition: MuonCalibSegment.cxx:190
MuonCalib::MuonCalibTrackSummary::goodPrecisionStationLayers
std::set< MuonFixedIdManipulator::StationIndex > goodPrecisionStationLayers
set of precision layers with (MDT: two multi layers, CSC: at least 2 eta and phi hits) on the track
Definition: MuonCalibTrackSummary.h:119
MuonCalib::MuonFixedIdManipulator::isEndcap
bool isEndcap(const MuonFixedId &id) const
returns whether this is a phi measurement
Definition: MuonFixedIdManipulator.h:77
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonCalib::MuonFixedIdManipulator::stationLayerIndex
StationIndex stationLayerIndex(const MuonFixedId &id) const
returns station layer index for a give identifier
Definition: MuonFixedIdManipulator.cxx:87
MuonCalib::MuonCalibTrackSummary::nmdtHitsBelowADCCut
unsigned int nmdtHitsBelowADCCut
Definition: MuonCalibTrackSummary.h:67
MuonCalib::MuonFixedIdManipulator::EIC
@ EIC
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonCalibSegment::chi2
double chi2() const
retrieve chi2
Definition: MuonCalibSegment.cxx:182
MuonCalib::MuonCalibTrackSummary::ChamberHitSummary::etaProjection
Projection & etaProjection()
Definition: MuonCalibTrackSummary.h:44
MuonCalib::MuonCalibSegment::TgcHitPtr
std::shared_ptr< const TgcCalibHitBase > TgcHitPtr
typedef for a collection of TgcCalibHitBase s
Definition: MuonCalibSegment.h:56
MuonCalib::MuonCalibSegment::mdtHOT
const MdtHitVec & mdtHOT() const
retrieve the full set of MdtCalibHitBase s assigned to this segment
Definition: MuonCalibSegment.cxx:147
MuonCalib::MuonCalibExtendedSegment::m_idSet
IdSet m_idSet
set with Identifiers on segment
Definition: MuonCalibExtendedSegment.h:62
MuonCalib::MuonCalibTrackSummary::nhits
unsigned int nhits
Definition: MuonCalibTrackSummary.h:54
MuonFixedIdManipulator.h
MuonCalib::MuonCalibTrackSummary::hasBarrelLayersWithRPC
bool hasBarrelLayersWithRPC
Definition: MuonCalibTrackSummary.h:80
MuonCalib::MuonCalibTrackSummary::hasEndcapA
bool hasEndcapA
Definition: MuonCalibTrackSummary.h:75
MuonCalib::MuonCalibTrackSummary::hasEndcapLayersWithTGC
bool hasEndcapLayersWithTGC
Definition: MuonCalibTrackSummary.h:79
MuonFixedId.h
MuonCalib::MuonCalibSegment::MdtHitPtr
std::shared_ptr< MdtCalibHitBase > MdtHitPtr
typedef for a collection of MdtCalibHitBase s
Definition: MuonCalibSegment.h:44
MuonCalib::MuonCalibTrackSummary::ChamberHitSummary::phiProjection
Projection & phiProjection()
Definition: MuonCalibTrackSummary.h:45
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5