37{
38
40
42 const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle};
43 if (!MuonDetMgr) {
44 ATH_MSG_ERROR(
"Null pointer to the read MuonDetectorManager conditions object");
45 return hitCounts;
46 }
47
48
49 double shortestTube {FLT_MAX};
50 const MdtDriftCircleOnTrack* mdtShortest = nullptr;
51 bool transformIsSet = false;
55 double dxdy = 1.;
56
57 using namespace MuonStationIndex;
60
62 if ((!
m_idHelperSvc->isCsc(chid) && stIdx == StIndex::EI) || stIdx == StIndex::BO)
63 hitCounts.nexpectedTrigHitLayers = 1;
64 else if (stIdx == StIndex::BM)
65 hitCounts.nexpectedTrigHitLayers = 2;
66 else if (stIdx == StIndex::EM)
67 hitCounts.nexpectedTrigHitLayers = 3;
68
69
71
72
75
76
78
82 int layIndex = 4 * (ml - 1) + (lay - 1);
85
86 const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(meas);
87 if (mdt) {
88 const MuonGM::MdtReadoutElement* detEl =
90 if (!detEl) {
92 continue;
93 }
94
96 layIntersect.tubeLength = tubeLen;
97 if (!transformIsSet) {
101 dxdy = std::abs(ldir.y()) > 0.001 ? ldir.x() / ldir.y() : 1000.;
102 transformIsSet = true;
103 }
104 if (!mdtShortest || tubeLen < shortestTube) {
105 mdtShortest = mdt;
106 shortestTube = tubeLen;
107 }
108 }
109 const bool first_layer = (
m_idHelperSvc->mdtIdHelper().multilayer(
id) == 1);
110 hitCounts.nmdtHitsMl1 += first_layer;
111 hitCounts.nmdtHitsMl2 += !first_layer;
115 hitCounts.adcMax = std::max(adc, hitCounts.adcMax);
116 }
117
118 }
121
124 hitCounts.hitCountsPerLayer[gasGapId].nphiHits+= measuresPhi;
125 hitCounts.hitCountsPerLayer[gasGapId].netaHits+= !measuresPhi;
128 hitCounts.ncscHits.nphiHits+= measuresPhi;
129 hitCounts.ncscHits.netaHits+= !measuresPhi;
132 hitCounts.nstgcHits.nphiHits+= measuresPhi;
133 hitCounts.nstgcHits.netaHits+= !measuresPhi;
135 const bool isStereo =
m_idHelperSvc->mmIdHelper().isStereo(
id);
136 hitCounts.nmmEtaHits += !isStereo;
137 hitCounts.nmmStereoHits+= isStereo;
138 }
139 }
140
141 const MuonSegmentQuality* quality =
dynamic_cast<const MuonSegmentQuality*
>(seg.
fitQuality());
142 if (quality) {
143 for (const Identifier& id : quality->channelsWithoutHit()) {
148 int layIndex = 4 * (ml - 1) + (lay - 1);
151
152 if (transformIsSet) {
154 if (!detEl) {
156 continue;
157 }
159 double ytube = (gToAMDB * detEl->
center(
id)).y();
160 double xint = dxdy * (ytube - lpos.y()) + lpos.x();
161 layIntersect.distFromTubeEnd = xint;
162 layIntersect.tubeLength = tubeLen;
163 }
164 }
165 }
166
167
168
169 for (std::pair<const Identifier, EtaPhiHitCount>& it : hitCounts.hitCountsPerLayer) {
171
172
173 if (
counts.nphiHits != 0) ++hitCounts.nphiTrigHitLayers;
174 if (
counts.netaHits != 0) {
175 ++hitCounts.netaTrigHitLayers;
176
177
178 if (
counts.nphiHits != 0) ++hitCounts.npairedTrigHitLayers;
179 }
180 }
181
182 int currentEnclosedHoles = 0;
183 bool firstLayerWithHits = false;
184
185 for ( auto& lit : hitCounts.mdtHitHolePerLayerCounts) {
186 hitCounts.nmdtHoles += lit.second.nholes;
187 if (lit.second.nhits == 0) {
188 ++currentEnclosedHoles;
189
191 ++hitCounts.nmdtHolesInChamber;
192 } else {
193 if (firstLayerWithHits) hitCounts.nmdtEnclosedHoles += currentEnclosedHoles;
194 currentEnclosedHoles = 0;
195 firstLayerWithHits = true;
196 }
197 }
198
199 if (mdtShortest) {
201 if (0.5 * shortestTube - std::abs(posAlongTube) < 100.) hitCounts.closeToChamberEdge = true;
202 }
203
205
208 }
209
210
211 return hitCounts;
212}
#define ATH_MSG_WARNING(x)
virtual const Trk::StraightLineSurface & associatedSurface() const override final
Returns the surface on which this measurement was taken.
virtual const MdtPrepData * prepRawData() const override final
Returns the PrepRawData used to create this corrected measurement.
double getActiveTubeLength(const int tubeLayer, const int tube) const
virtual const Amg::Vector3D & center(const Identifier &) const override final
Return the center of the surface associated with this identifier In the case of silicon it returns th...
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
virtual Amg::Transform3D GlobalToAmdbLRSTransform() const
const Amg::Vector3D & globalDirection() const
global direction
virtual const Amg::Vector3D & globalPosition() const override final
global position
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
double chiSquared() const
returns the of the overall track fit
const FitQuality * fitQuality() const
return the FitQuality object, returns NULL if no FitQuality is defined
const std::vector< const Trk::MeasurementBase * > & containedMeasurements() const
returns the vector of Trk::MeasurementBase objects
Eigen::Affine3d Transform3D
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Eigen::Matrix< double, 3, 1 > Vector3D
StIndex
enum to classify the different station layers in the muon spectrometer