ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MuonPatternCalibration Class Reference

#include <MuonPatternCalibration.h>

Inheritance diagram for Muon::MuonPatternCalibration:
Collaboration diagram for Muon::MuonPatternCalibration:

Classes

struct  EtaPhiHits
struct  Region

Public Types

using ISPrd = std::pair<Amg::Vector3D, const MuonCluster*>
using ISPrdVec = std::vector<ISPrd>
using ISPrdMdt = std::pair<Amg::Vector3D, const MdtPrepData*>
using ISPrdMdtVec = std::vector<ISPrdMdt>
using RegionIdMap = std::map<int, ISPrdMdtVec>
using RegionMap = std::map<int, Region>

Public Member Functions

 MuonPatternCalibration (const std::string &, const std::string &, const IInterface *)
virtual ~MuonPatternCalibration ()=default
virtual StatusCode initialize () override
StatusCode calibrate (const EventContext &ctx, const MuonPatternCombination &pat, ROTsPerRegion &hitsPerRegion) const override
int getRegionId (const Identifier &id) const override
bool checkForPhiMeasurements (const MuonPatternCombination &pat) const override

Private Member Functions

StatusCode createRegionMap (const EventContext &ctx, const MuonPatternCombination &pat, RegionMap &regionMap, bool hasPhiMeasurements) const
void printRegionMap (const RegionMap &regionMap) const
void calibrateRegionMap (const RegionMap &regionMap, IMuonPatternCalibration::ROTsPerRegion &hitsPerRegion) const
void insertCluster (const MuonCluster &mdt, RegionMap &regionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
void insertMdt (const MdtPrepData &clus, RegionMap &regionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
template<class ContType>
StatusCode loadFromStoreGate (const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, const ContType *&cont_ptr) const
 load the container from storegate given a ReadHandleKey.

Private Attributes

ToolHandle< IMdtDriftCircleOnTrackCreatorm_mdtCreator
ToolHandle< IMuonClusterOnTrackCreatorm_clusterCreator
PublicToolHandle< MuonEDMPrinterToolm_printer
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
Gaudi::Property< bool > m_doMultiAnalysis {this, "DoMultiChamberAnalysis", true}
Gaudi::Property< double > m_dropDistance {this, "DropDistance", 1500.}
Gaudi::Property< double > m_phiAngleCut {this, "AngleCutPhi", 1.e9}
Gaudi::Property< bool > m_doSummary {this, "DoSummary", false}
Gaudi::Property< bool > m_recoverTriggerHits {this, "RecoverTriggerHits", true}
Gaudi::Property< bool > m_removeDoubleMdtHits {this, "RemoveDoubleMdtHits", true}
SG::ReadHandleKey< Muon::RpcPrepDataContainerm_keyRpc {this, "RpcPrepDataContainer","RPC_Measurements"}
SG::ReadHandleKey< Muon::TgcPrepDataContainerm_keyTgc {this, "TgcPrepDataContainer","TGC_Measurements"}

Detailed Description

Definition at line 30 of file MuonPatternCalibration.h.

Member Typedef Documentation

◆ ISPrd

Definition at line 32 of file MuonPatternCalibration.h.

◆ ISPrdMdt

Definition at line 35 of file MuonPatternCalibration.h.

◆ ISPrdMdtVec

Definition at line 36 of file MuonPatternCalibration.h.

◆ ISPrdVec

Definition at line 33 of file MuonPatternCalibration.h.

◆ RegionIdMap

Definition at line 37 of file MuonPatternCalibration.h.

◆ RegionMap

Definition at line 49 of file MuonPatternCalibration.h.

Constructor & Destructor Documentation

◆ MuonPatternCalibration()

Muon::MuonPatternCalibration::MuonPatternCalibration ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 22 of file MuonPatternCalibration.cxx.

23 : base_class(t, n, p) {}

◆ ~MuonPatternCalibration()

virtual Muon::MuonPatternCalibration::~MuonPatternCalibration ( )
virtualdefault

Member Function Documentation

◆ calibrate()

StatusCode Muon::MuonPatternCalibration::calibrate ( const EventContext & ctx,
const MuonPatternCombination & pat,
ROTsPerRegion & hitsPerRegion ) const
override

Definition at line 40 of file MuonPatternCalibration.cxx.

40 {
42 bool hasPhiMeasurements = checkForPhiMeasurements(pattern);
43 ATH_CHECK(createRegionMap(ctx, pattern, regionMap, hasPhiMeasurements));
44 // calibrate hits
45 calibrateRegionMap(regionMap, hitsPerRegion);
46 return StatusCode::SUCCESS;
47}
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode createRegionMap(const EventContext &ctx, const MuonPatternCombination &pat, RegionMap &regionMap, bool hasPhiMeasurements) const
bool checkForPhiMeasurements(const MuonPatternCombination &pat) const override
std::map< int, Region > RegionMap
void calibrateRegionMap(const RegionMap &regionMap, IMuonPatternCalibration::ROTsPerRegion &hitsPerRegion) const

◆ calibrateRegionMap()

void Muon::MuonPatternCalibration::calibrateRegionMap ( const RegionMap & regionMap,
IMuonPatternCalibration::ROTsPerRegion & hitsPerRegion ) const
private

Definition at line 423 of file MuonPatternCalibration.cxx.

424 {
425
426
427 for (const auto& [regionId, regMeasColl] : regionMap) {
428
429 ROTRegion rotRegion{};
430 rotRegion.regionId = regionId;
431 rotRegion.regionPos = regMeasColl.regionPos;
432 rotRegion.regionDir = regMeasColl.regionDir;
433 for (const auto& [globalPos, prd] : regMeasColl.triggerPrds) {
434 std::unique_ptr<const MuonClusterOnTrack> cluster{m_clusterCreator->createRIO_OnTrack(*prd, globalPos)};
435 if (!cluster) continue;
436 rotRegion.push_back(std::move(cluster));
437 }
438 for (const auto& [regionId, MdtsWithIsect] :regMeasColl.mdtPrdsPerChamber) {
439 ATH_MSG_VERBOSE("Run over region id "<<regionId);
440 MdtVec mdtROTs{};
441 for (const auto& [globalPos, prd] : MdtsWithIsect) {
442 ATH_MSG_VERBOSE("Calibrate prd"<<m_idHelperSvc->toString(prd->identify())
443 <<",tdc: "<<prd->tdc()<<",adc: "<<prd->adc()<<" at "<<Amg::toString(globalPos));
444 const MdtDriftCircleOnTrack* mdt = m_mdtCreator->createRIO_OnTrack(*prd, globalPos, &globalPos);
445 if (!mdt) {
446 ATH_MSG_VERBOSE("Failed to calibrate " << m_idHelperSvc->toString(prd->identify()));
447 continue;
448 }
449 mdtROTs.push_back(mdt);
450 }
451 if (!mdtROTs.empty()) rotRegion.push_back(std::move(mdtROTs));
452 }
453 hitsPerRegion.push_back(std::move(rotRegion));
454 }
455}
#define ATH_MSG_VERBOSE(x)
ToolHandle< IMdtDriftCircleOnTrackCreator > m_mdtCreator
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ToolHandle< IMuonClusterOnTrackCreator > m_clusterCreator
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.

◆ checkForPhiMeasurements()

bool Muon::MuonPatternCalibration::checkForPhiMeasurements ( const MuonPatternCombination & pat) const
override

Exclude the sTGC hits. MM hits do not have phi measurements

Definition at line 60 of file MuonPatternCalibration.cxx.

60 {
61
62 for (const MuonPatternChamberIntersect& intersect : pat.chamberData()) {
63 for (const Trk::PrepRawData* prd : intersect.prepRawDataVec()){
64 const Identifier id = prd->identify();
66 if (!m_idHelperSvc->issTgc(id) &&
67 m_idHelperSvc->measuresPhi(id)) return true;
68 }
69 }
70 return false;
71}
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.

◆ createRegionMap()

StatusCode Muon::MuonPatternCalibration::createRegionMap ( const EventContext & ctx,
const MuonPatternCombination & pat,
RegionMap & regionMap,
bool hasPhiMeasurements ) const
private

Try to recover missing phi clusters:

  • loop over the clusters in the region and sort them by collection
  • count the number of eta and phi clusters per collection

Remove the NSW hits from the segment building

Definition at line 74 of file MuonPatternCalibration.cxx.

76{
77 if (hasPhiMeasurements)
78 ATH_MSG_DEBUG("pattern has phi measurements using extrapolation to determine second coordinate");
79 else
80 ATH_MSG_DEBUG("No phi measurements using center tubes");
81
82
83 const TgcPrepDataContainer* tgcPrdCont{nullptr};
84 const RpcPrepDataContainer* rpcPrdCont{nullptr};
85 ATH_CHECK(loadFromStoreGate(ctx, m_keyRpc, rpcPrdCont));
86 ATH_CHECK(loadFromStoreGate(ctx, m_keyTgc, tgcPrdCont));
87
88 for (const MuonPatternChamberIntersect& isect : pat.chamberData()) {
89
90 if (isect.prepRawDataVec().empty()) continue;
91
92 const Amg::Vector3D& patpose = isect.intersectPosition();
93 const Amg::Vector3D patdire = isect.intersectDirection().unit();
94
100 std::map<int, EtaPhiHits> etaPhiHitsPerChamber;
101 std::set<Identifier> clusterIds;
102
103
104 const Trk::PrepRawData* prd = isect.prepRawDataVec().front();
105 const Identifier id = prd->identify();
106
107 // apply cut on the opening angle between pattern and chamber phi
108 // do some magic to avoid problems at phi = 0 and 2*pi
109 double phiStart = patdire.phi();
110 double chPhi = prd->detectorElement()->center().phi();
111 constexpr double phiRange = 0.75 * M_PI;
112 constexpr double phiRange2 = 0.25 * M_PI;
113 double phiOffset = 0.;
114 if (phiStart > phiRange || phiStart < -phiRange)
115 phiOffset = 2 * M_PI;
116 else if (phiStart > -phiRange2 && phiStart < phiRange2)
117 phiOffset = M_PI;
118
119 if (phiOffset > 1.5 * M_PI) {
120 if (phiStart < 0) phiStart += phiOffset;
121 if (chPhi < 0) chPhi += phiOffset;
122 } else if (phiOffset > 0.) {
123 phiStart += phiOffset;
124 chPhi += phiOffset;
125 }
126 double dphi = std::abs(phiStart - chPhi);
127
128 if (dphi > m_phiAngleCut) {
129 ATH_MSG_DEBUG("Large angular phi difference between pattern and chamber, phi pattern "
130 << patdire.phi() << " phi chamber " << prd->detectorElement()->center().phi());
131 continue;
132 }
133
134 // map to find duplicate hits in the chamber
135 std::map<Identifier, const MdtPrepData*> idMdtMap{};
136
137 for (const Trk::PrepRawData* isect_prd : isect.prepRawDataVec()) {
138
139 if (isect_prd->type(Trk::PrepRawDataType::MdtPrepData)) {
140 const MdtPrepData* mdt = dynamic_cast<const MdtPrepData*>(isect_prd);
142 const MdtPrepData*& previousMdt = idMdtMap[mdt->identify()];
143 if (!previousMdt || previousMdt->tdc() > mdt->tdc())
144 previousMdt = mdt;
145 else
146 continue;
147 }
148 insertMdt(*mdt, regionMap, patpose, patdire, hasPhiMeasurements);
149 continue;
150 }
151 else if (isect_prd->type(Trk::PrepRawDataType::MMPrepData) || isect_prd->type(Trk::PrepRawDataType::sTgcPrepData)){
152 continue;
153 }
154 const MuonCluster* clus = dynamic_cast<const MuonCluster*>(isect_prd);
155 if (!clus) continue;
156 const Identifier id = clus->identify();
157 if (!clusterIds.insert(id).second) continue;
158
160 bool measuresPhi = m_idHelperSvc->measuresPhi(id);
161 int colHash = clus->collectionHash();
162 EtaPhiHits& hitsPerChamber = etaPhiHitsPerChamber[colHash];
163 if (measuresPhi)
164 ++hitsPerChamber.nphi;
165 else
166 ++hitsPerChamber.neta;
167 }
168 insertCluster(*clus, regionMap, patpose, patdire, hasPhiMeasurements);
169 }
170 for (const auto& [coll_hash, hits] : etaPhiHitsPerChamber) {
171 if ((hits.neta > 0 && hits.nphi == 0) || (hits.nphi > 0 && hits.neta == 0)) {
172 if (m_idHelperSvc->isRpc(id) && rpcPrdCont) {
173
174 const RpcPrepDataCollection* prd_coll = rpcPrdCont->indexFindPtr(coll_hash);
175 if (!prd_coll) {
176 ATH_MSG_VERBOSE("RpcPrepDataCollection not found in container!!"<< m_keyRpc);
177 continue;
178 }
179 for (const RpcPrepData* rpc_prd : *prd_coll) {
180 if (!clusterIds.insert(rpc_prd->identify()).second) continue;
181 insertCluster(*rpc_prd, regionMap, patpose, patdire, hasPhiMeasurements);
182 }
183 } else if (m_idHelperSvc->isTgc(id) && tgcPrdCont) {
184 const TgcPrepDataCollection* prd_coll = tgcPrdCont->indexFindPtr(coll_hash);
185 if (!prd_coll) {
186 ATH_MSG_DEBUG("TgcPrepDataCollection not found in container!! "<< m_keyTgc);
187 continue;
188 }
189
190 for (const TgcPrepData* tgc_prd : *prd_coll) {
191 if (!clusterIds.insert(tgc_prd->identify()).second) continue;
192 insertCluster(*tgc_prd, regionMap, patpose, patdire, hasPhiMeasurements);
193 }
194 }
195 }
196 }
197 }
198 return StatusCode::SUCCESS;
199}
#define M_PI
#define ATH_MSG_DEBUG(x)
StatusCode loadFromStoreGate(const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, const ContType *&cont_ptr) const
load the container from storegate given a ReadHandleKey.
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_keyTgc
void insertCluster(const MuonCluster &mdt, RegionMap &regionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_keyRpc
Gaudi::Property< double > m_phiAngleCut
Gaudi::Property< bool > m_removeDoubleMdtHits
Gaudi::Property< bool > m_recoverTriggerHits
void insertMdt(const MdtPrepData &clus, RegionMap &regionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
Identifier identify() const
return the identifier
virtual const Amg::Vector3D & center() const =0
Return the center of the element.
Eigen::Matrix< double, 3, 1 > Vector3D
phiRange
Filling Phi ranges.
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
MuonPrepDataContainerT< RpcPrepData > RpcPrepDataContainer
MuonPrepDataContainerT< TgcPrepData > TgcPrepDataContainer
MuonPrepDataCollection< RpcPrepData > RpcPrepDataCollection

◆ getRegionId()

int Muon::MuonPatternCalibration::getRegionId ( const Identifier & id) const
override

Definition at line 50 of file MuonPatternCalibration.cxx.

50 {
51
52 // simple division of MuonSpectrometer in regions using barrel/endcap seperation plus
53 // inner/middle/outer seperation
54 using namespace MuonStationIndex;
55 return toInt(m_idHelperSvc->stationIndex(id)) * (m_idHelperSvc->stationEta(id) > 0 ? 1 : -1);
56}
constexpr int toInt(const EnumType enumVal)

◆ initialize()

StatusCode Muon::MuonPatternCalibration::initialize ( )
overridevirtual

Definition at line 26 of file MuonPatternCalibration.cxx.

27{
28 ATH_MSG_VERBOSE("MuonPatternCalibration::Initializing");
29 ATH_CHECK(m_mdtCreator.retrieve());
30 ATH_CHECK(m_printer.retrieve());
31 ATH_CHECK(m_idHelperSvc.retrieve());
32 ATH_CHECK(m_keyRpc.initialize(!m_keyRpc.empty()));
33 ATH_CHECK(m_keyTgc.initialize(!m_keyTgc.empty()));
34 ATH_CHECK(m_clusterCreator.retrieve(EnableTool{!m_keyRpc.empty() || !m_keyTgc.empty()}));
35 return StatusCode::SUCCESS;
36}
PublicToolHandle< MuonEDMPrinterTool > m_printer

◆ insertCluster()

void Muon::MuonPatternCalibration::insertCluster ( const MuonCluster & mdt,
RegionMap & regionMap,
const Amg::Vector3D & patpose,
const Amg::Vector3D & patdire,
bool hasPhiMeasurements ) const
private

Definition at line 202 of file MuonPatternCalibration.cxx.

204{
205
206 const Identifier id = clus.identify();
207 // check whether we are measuring phi or eta
208 const bool measuresPhi = m_idHelperSvc->measuresPhi(id);
209
210 Amg::Vector3D globalpos = clus.globalPosition();
211 Amg::Vector3D intersect{Amg::Vector3D::Zero()};
212
213 if (hasPhiMeasurements) {
214 // if there is a phi measurement in the pattern use the global direction to calculate the intersect with
215 // measurement plane and use the intersect to calculate the position along the strip
216
217 // calculate intersect pattern measurement plane
218 const Trk::Surface& surf = clus.detectorElement()->surface(id);
219 Amg::Vector3D planepostion = surf.center();
220 Amg::Vector3D planenormal = surf.normal();
221 double denom = patdire.dot(planenormal);
222 double u = (planenormal.dot(planepostion - patpose)) / (denom);
223 Amg::Vector3D piOnPlane = (patpose + u * patdire);
224
225 // transform to local plane coordiantes
226 const Amg::Transform3D gToLocal = clus.detectorElement()->surface().transform().inverse();
227 Amg::Vector3D ilpos = gToLocal * piOnPlane;
228 Amg::Vector3D glpos = gToLocal * globalpos;
229
230 // strip length
231 double striplen(0.);
232
233 // projective strips
234 bool hasPointingPhiStrips = false;
235
236 // detector specific stuff
237 const RpcPrepData* rpc = dynamic_cast<const RpcPrepData*>(&clus);
238 if (rpc) {
239 striplen = rpc->detectorElement()->StripLength(measuresPhi);
240 } else {
241 const TgcPrepData* tgc = dynamic_cast<const TgcPrepData*>(&clus);
242 if (!tgc) return;
243
244 int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(id);
245 if (measuresPhi) {
246 hasPointingPhiStrips = true;
247 striplen = tgc->detectorElement()->stripLength();
248 } else {
249 int wire = m_idHelperSvc->tgcIdHelper().channel(id);
250 striplen = tgc->detectorElement()->gangCentralWidth(gasGap, wire);
251 }
252 }
253
254 // set the position along the strip
255 if (!measuresPhi) {
256 glpos[0] = ilpos.x();
257 } else {
258 if (hasPointingPhiStrips) {
259 // do some special for tgcs
260 glpos[1] = ilpos.y();
261 } else {
262 glpos[1] = ilpos.y();
263 }
264 }
265
266 // transform back to global coordinates
267 intersect = gToLocal.inverse() * glpos;
268 Amg::Vector3D dif = globalpos - intersect;
269 if ((intersect - piOnPlane).mag() > m_dropDistance || dif.mag() > 0.5 * striplen + m_dropDistance) {
270
271 ATH_MSG_VERBOSE(">>>> extrapolated position far outside volume, dropping hit "
272 << m_idHelperSvc->toString(id) << ". dist along strip " << dif.mag() << " 1/2 strip len "
273 << 0.5 * striplen << " dist measurement plane " << (intersect - piOnPlane).mag());
274 return;
275 }
276 if (dif.mag() > 0.5 * striplen) {
277 Amg::Vector3D newpos = globalpos - dif * (0.5 * striplen / dif.mag());
278
279 ATH_MSG_VERBOSE(">>>> extrapolated position outside volume, shifting position "
280 << m_idHelperSvc->toString(id) << ". position along strip " << dif.mag() << " 1/2 tube len "
281 << 0.5 * striplen << " dist To strip " << (intersect - piOnPlane).mag()
282 << ". dist to newpos " << (newpos - globalpos).mag() << " pos " << newpos);
283
284 intersect = newpos;
285 }
286 } else {
287 // no phi measurements, use strip center
288 intersect = globalpos;
289 }
290
291 // enter hit in map
292 int regionId = getRegionId(id);
293
294 Region& region = regionMap[regionId];
295 if (!region.init) {
296 region.regionDir = patdire;
297 region.regionPos = patpose;
298 region.init = true;
299 }
300 region.triggerPrds.emplace_back(intersect, &clus);
301}
Scalar mag() const
mag method
Gaudi::Property< double > m_dropDistance
int getRegionId(const Identifier &id) const override
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Eigen::Affine3d Transform3D
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77

◆ insertMdt()

void Muon::MuonPatternCalibration::insertMdt ( const MdtPrepData & clus,
RegionMap & regionMap,
const Amg::Vector3D & patpose,
const Amg::Vector3D & patdire,
bool hasPhiMeasurements ) const
private

Definition at line 305 of file MuonPatternCalibration.cxx.

307{
308
309 Amg::Vector3D intersect{Amg::Vector3D::Zero()};
310 const Identifier& id = mdt.identify();
311
312 const MuonGM::MdtReadoutElement* detEl = mdt.detectorElement();
313 const Amg::Vector3D& tubePos = mdt.globalPosition();
314
315 if (hasPhiMeasurements) {
316 // if there is a phi measurement in the pattern use the global direction to calculate the intersect with the
317 // tube use the intersect to calculate the second coordinate
318
319 const Amg::Transform3D amdbToGlobal = detEl->AmdbLRSToGlobalTransform();
320
321
322 // calculate intersect pattern measurement plane
323 const Amg::Vector3D& planepostion = tubePos;
324
325 // always project on plane with normal in radial direction
326 Amg::Vector3D planenormal = m_idHelperSvc->mdtIdHelper().isBarrel(id)
327 ? amdbToGlobal.linear() * Amg::Vector3D(0., 0., 1.)
328 : amdbToGlobal.linear() * Amg::Vector3D(0., 1., 0.);
329
330 double denom = patdire.dot(planenormal);
331 double u = (planenormal.dot(planepostion - patpose)) / (denom);
332 Amg::Vector3D piOnPlane = (patpose + u * patdire);
333
334 Amg::Vector3D lpiOnPlane = amdbToGlobal.inverse() * piOnPlane;
335 Amg::Vector3D ltubePos = amdbToGlobal.inverse() * tubePos;
336
337 intersect = amdbToGlobal * Amg::Vector3D(lpiOnPlane.x(), ltubePos.y(), ltubePos.z());
338
339 Amg::Vector3D dif = tubePos - intersect;
340 double tubelen = detEl->getActiveTubeLength(m_idHelperSvc->mdtIdHelper().tubeLayer(id),
341 m_idHelperSvc->mdtIdHelper().tube(id));
342
343 if (dif.mag() > 0.5 * tubelen) {
344 Amg::Vector3D newpos = tubePos - dif * (0.5 * tubelen / dif.mag());
345
346 ATH_MSG_VERBOSE(">>>> extrapolated position outside volume, shifting position "
347 << m_idHelperSvc->toString(id) << ". position along strip " << dif.mag() << " 1/2 tube len "
348 << 0.5 * tubelen << " dist To Wire " << (piOnPlane - intersect).mag() << ". dist to newpos "
349 << (newpos - tubePos).mag() << " pos " << newpos);
350
351 intersect = newpos;
352 }
353 } else {
354 // not phi measurement, use tube center
355 intersect = tubePos;
356 }
357
358 // enter hit in map
359 Identifier elId = m_idHelperSvc->mdtIdHelper().elementID(id);
360
362 ChIndex chIndex = m_idHelperSvc->chamberIndex(elId);
363 int chFlag = elId.get_identifier32().get_compact();
364 if (m_doMultiAnalysis) {
365 if (isSmall(chIndex)) {
366 ATH_MSG_VERBOSE(" Small chamber " << m_idHelperSvc->toString(elId));
367 chFlag = 0;
368 if (chIndex == ChIndex::BIS && std::abs(m_idHelperSvc->stationEta(elId)) == 8) {
369 ATH_MSG_VERBOSE(" BIS8 chamber " << m_idHelperSvc->toString(elId));
370 chFlag = 3;
371 }
372 } else {
373 ATH_MSG_VERBOSE(" Large chamber " << m_idHelperSvc->toString(elId));
374 chFlag = 1;
375 if (chIndex == ChIndex::BIL && m_idHelperSvc->stationNameString(id)[2] == 'R') {
376 ATH_MSG_VERBOSE(" BIR chamber " << m_idHelperSvc->toString(elId));
377 chFlag = 2;
378 } else if (chIndex == ChIndex::BOL && std::abs(m_idHelperSvc->stationEta(id)) == 7) {
379 ATH_MSG_VERBOSE(" BOE chamber " << m_idHelperSvc->toString(elId));
380 chFlag = 4;
381 }
382 }
383 int phi = m_idHelperSvc->stationPhi(id);
384
385 chFlag += 10 * phi;
386 }
387 // use center tube for region assignment
388 int regionId = getRegionId(id);
389
390 Region& region = regionMap[regionId];
391 if (!region.init) {
392 region.regionPos = patpose;
393 region.regionDir = patdire;
394 region.init = true;
395 }
396 region.mdtPrdsPerChamber[chFlag].emplace_back(intersect, &mdt);
397}
Scalar phi() const
phi method
Eigen::Matrix< double, 3, 1 > Vector3D
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
double getActiveTubeLength(const int tubeLayer, const int tube) const
Gaudi::Property< bool > m_doMultiAnalysis
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
ChIndex
enum to classify the different chamber layers in the muon spectrometer

◆ loadFromStoreGate()

template<class ContType>
StatusCode Muon::MuonPatternCalibration::loadFromStoreGate ( const EventContext & ctx,
const SG::ReadHandleKey< ContType > & key,
const ContType *& cont_ptr ) const
private

load the container from storegate given a ReadHandleKey.

If the key is empty a nullptr will be returned

Definition at line 457 of file MuonPatternCalibration.cxx.

459 {
460 if (key.empty()){
461 ATH_MSG_VERBOSE("Empty key given for "<<typeid(ContType).name()<<".");
462 cont_ptr = nullptr;
463 return StatusCode::SUCCESS;
464 }
465 SG::ReadHandle<ContType> readHandle{key, ctx};
466 if (!readHandle.isValid()) {
467 ATH_MSG_FATAL("Failed to retrieve "<<key.fullKey()<<" from store gate");
468 return StatusCode::FAILURE;
469 }
470 cont_ptr = readHandle.cptr();
471 return StatusCode::SUCCESS;
472}
#define ATH_MSG_FATAL(x)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.

◆ printRegionMap()

void Muon::MuonPatternCalibration::printRegionMap ( const RegionMap & regionMap) const
private

Definition at line 400 of file MuonPatternCalibration.cxx.

401{
402
403 ATH_MSG_INFO("Summarizing input");
404
405 for (const auto& [detRegionId, chamberData] : regionMap) {
406 ATH_MSG_INFO("new region " << detRegionId << " trigger " << chamberData.triggerPrds.size() << " mdt ch "
407 << chamberData.mdtPrdsPerChamber.size());
408 if (!chamberData.triggerPrds.empty()) ATH_MSG_INFO("trigger hits " << chamberData.triggerPrds.size());
409
410 for (const auto& [globalPos, prd] : chamberData.triggerPrds) {
411 ATH_MSG_INFO(" " << m_printer->print(*prd)<<" "<<globalPos);
412 }
413 for (const auto& [statId, MdtChamHits]: chamberData.mdtPrdsPerChamber) {
414 ATH_MSG_INFO("new MDT chamber with " << MdtChamHits.size() << " hits");
415 for (const auto& [globalPos, prd] : MdtChamHits) {
416 ATH_MSG_INFO(" " << m_printer->print(*prd)<<" "<<globalPos);
417 }
418 }
419 }
420}
#define ATH_MSG_INFO(x)

Member Data Documentation

◆ m_clusterCreator

ToolHandle<IMuonClusterOnTrackCreator> Muon::MuonPatternCalibration::m_clusterCreator
private
Initial value:
{
this,
"ClusterCreator",
"Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator",
}

Definition at line 88 of file MuonPatternCalibration.h.

88 {
89 this,
90 "ClusterCreator",
91 "Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator",
92 }; //<! pointer to muon cluster rio ontrack creator

◆ m_doMultiAnalysis

Gaudi::Property<bool> Muon::MuonPatternCalibration::m_doMultiAnalysis {this, "DoMultiChamberAnalysis", true}
private

Definition at line 105 of file MuonPatternCalibration.h.

105{this, "DoMultiChamberAnalysis", true}; //<! use neighbouring chambers during segment finding

◆ m_doSummary

Gaudi::Property<bool> Muon::MuonPatternCalibration::m_doSummary {this, "DoSummary", false}
private

Definition at line 108 of file MuonPatternCalibration.h.

108{this, "DoSummary", false};

◆ m_dropDistance

Gaudi::Property<double> Muon::MuonPatternCalibration::m_dropDistance {this, "DropDistance", 1500.}
private

Definition at line 106 of file MuonPatternCalibration.h.

106{this, "DropDistance", 1500.}; //<! hits that are further away than the distance are not added to segmentmaker input

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::MuonPatternCalibration::m_idHelperSvc
private
Initial value:
{
this,
"MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc",
}

Definition at line 99 of file MuonPatternCalibration.h.

99 {
100 this,
101 "MuonIdHelperSvc",
102 "Muon::MuonIdHelperSvc/MuonIdHelperSvc",
103 };

◆ m_keyRpc

SG::ReadHandleKey<Muon::RpcPrepDataContainer> Muon::MuonPatternCalibration::m_keyRpc {this, "RpcPrepDataContainer","RPC_Measurements"}
private

Definition at line 112 of file MuonPatternCalibration.h.

112{this, "RpcPrepDataContainer","RPC_Measurements"};

◆ m_keyTgc

SG::ReadHandleKey<Muon::TgcPrepDataContainer> Muon::MuonPatternCalibration::m_keyTgc {this, "TgcPrepDataContainer","TGC_Measurements"}
private

Definition at line 113 of file MuonPatternCalibration.h.

113{this, "TgcPrepDataContainer","TGC_Measurements"};

◆ m_mdtCreator

ToolHandle<IMdtDriftCircleOnTrackCreator> Muon::MuonPatternCalibration::m_mdtCreator
private
Initial value:
{
this,
"MdtCreator",
"",
}

Definition at line 83 of file MuonPatternCalibration.h.

83 {
84 this,
85 "MdtCreator",
86 "",
87 }; //<! pointer to mdt rio ontrack creator

◆ m_phiAngleCut

Gaudi::Property<double> Muon::MuonPatternCalibration::m_phiAngleCut {this, "AngleCutPhi", 1.e9}
private

Definition at line 107 of file MuonPatternCalibration.h.

107{this, "AngleCutPhi", 1.e9}; //<! cut on the phi opening angle between chamber and pattern

◆ m_printer

PublicToolHandle<MuonEDMPrinterTool> Muon::MuonPatternCalibration::m_printer
private
Initial value:
{
this,
"Printer",
"Muon::MuonEDMPrinterTool",
}

Definition at line 93 of file MuonPatternCalibration.h.

93 {
94 this,
95 "Printer",
96 "Muon::MuonEDMPrinterTool",
97 }; //<! tool to print EDM objects

◆ m_recoverTriggerHits

Gaudi::Property<bool> Muon::MuonPatternCalibration::m_recoverTriggerHits {this, "RecoverTriggerHits", true}
private

Definition at line 109 of file MuonPatternCalibration.h.

109{this, "RecoverTriggerHits", true};

◆ m_removeDoubleMdtHits

Gaudi::Property<bool> Muon::MuonPatternCalibration::m_removeDoubleMdtHits {this, "RemoveDoubleMdtHits", true}
private

Definition at line 110 of file MuonPatternCalibration.h.

110{this, "RemoveDoubleMdtHits", true};

The documentation for this class was generated from the following files: