|
ATLAS Offline Software
|
#include <MuonPatternCalibration.h>
|
StatusCode | createRegionMap (const EventContext &ctx, const MuonPatternCombination &pat, RegionMap ®ionMap, bool hasPhiMeasurements) const |
|
void | printRegionMap (const RegionMap ®ionMap) const |
|
void | calibrateRegionMap (const RegionMap ®ionMap, IMuonPatternCalibration::ROTsPerRegion &hitsPerRegion) const |
|
void | insertCluster (const MuonCluster &mdt, RegionMap ®ionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const |
|
void | insertMdt (const MdtPrepData &clus, RegionMap ®ionMap, 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. More...
|
|
|
ToolHandle< IMdtDriftCircleOnTrackCreator > | m_mdtCreator |
|
ToolHandle< IMuonClusterOnTrackCreator > | m_clusterCreator |
|
PublicToolHandle< MuonEDMPrinterTool > | m_printer |
|
ServiceHandle< Muon::IMuonIdHelperSvc > | m_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::RpcPrepDataContainer > | m_keyRpc {this, "RpcPrepDataContainer","RPC_Measurements"} |
|
SG::ReadHandleKey< Muon::TgcPrepDataContainer > | m_keyTgc {this, "TgcPrepDataContainer","TGC_Measurements"} |
|
Definition at line 30 of file MuonPatternCalibration.h.
◆ ISPrd
◆ ISPrdMdt
◆ ISPrdMdtVec
◆ ISPrdVec
◆ RegionIdMap
◆ RegionMap
◆ MuonPatternCalibration()
Muon::MuonPatternCalibration::MuonPatternCalibration |
( |
const std::string & |
t, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
◆ ~MuonPatternCalibration()
virtual Muon::MuonPatternCalibration::~MuonPatternCalibration |
( |
| ) |
|
|
virtualdefault |
◆ calibrate()
◆ calibrateRegionMap()
Definition at line 429 of file MuonPatternCalibration.cxx.
433 for (
const auto& [regionId, regMeasColl] : regionMap) {
435 ROTRegion rotRegion{};
436 rotRegion.regionId = regionId;
437 rotRegion.regionPos = regMeasColl.regionPos;
438 rotRegion.regionDir = regMeasColl.regionDir;
439 for (
const auto& [globalPos, prd] : regMeasColl.triggerPrds) {
440 std::unique_ptr<const MuonClusterOnTrack> cluster{
m_clusterCreator->createRIO_OnTrack(*prd, globalPos)};
441 if (!cluster)
continue;
442 rotRegion.push_back(std::move(cluster));
444 for (
const auto& [regionId, MdtsWithIsect] :regMeasColl.mdtPrdsPerChamber) {
447 for (
const auto& [globalPos, prd] : MdtsWithIsect) {
449 <<
",tdc: "<<prd->tdc()<<
",adc: "<<prd->adc()<<
" at "<<
Amg::toString(globalPos));
450 const MdtDriftCircleOnTrack* mdt =
m_mdtCreator->createRIO_OnTrack(*prd, globalPos, &globalPos);
455 mdtROTs.push_back(mdt);
457 if (!mdtROTs.empty()) rotRegion.push_back(std::move(mdtROTs));
459 hitsPerRegion.push_back(std::move(rotRegion));
◆ checkForPhiMeasurements()
◆ createRegionMap()
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 73 of file MuonPatternCalibration.cxx.
76 if (hasPhiMeasurements)
77 ATH_MSG_DEBUG(
"pattern has phi measurements using extrapolation to determine second coordinate");
87 for (
const MuonPatternChamberIntersect& isect :
pat.chamberData()) {
89 if (isect.prepRawDataVec().empty())
continue;
92 const Amg::Vector3D patdire = isect.intersectDirection().unit();
99 std::map<int, EtaPhiHits> etaPhiHitsPerChamber;
100 std::set<Identifier> clusterIds;
108 double phiStart = patdire.phi();
111 constexpr
double phiRange2 = 0.25 *
M_PI;
112 double phiOffset = 0.;
114 phiOffset = 2 *
M_PI;
115 else if (phiStart > -phiRange2 && phiStart < phiRange2)
118 if (phiOffset > 1.5 *
M_PI) {
119 if (phiStart < 0) phiStart += phiOffset;
120 if (chPhi < 0) chPhi += phiOffset;
121 }
else if (phiOffset > 0.) {
122 phiStart += phiOffset;
125 double dphi = std::abs(phiStart - chPhi);
128 ATH_MSG_DEBUG(
"Large angular phi difference between pattern and chamber, phi pattern "
134 std::map<Identifier, const MdtPrepData*> idMdtMap{};
141 const MdtPrepData*& previousMdt = idMdtMap[mdt->identify()];
142 if (!previousMdt || previousMdt->tdc() > mdt->tdc())
147 insertMdt(*mdt, regionMap, patpose, patdire, hasPhiMeasurements);
156 if (!clusterIds.insert(
id).second)
continue;
160 int colHash = clus->collectionHash();
161 EtaPhiHits& hitsPerChamber = etaPhiHitsPerChamber[colHash];
163 ++hitsPerChamber.nphi;
165 ++hitsPerChamber.neta;
167 insertCluster(*clus, regionMap, patpose, patdire, hasPhiMeasurements);
169 for (
const auto& [coll_hash,
hits] : etaPhiHitsPerChamber) {
170 if ((
hits.neta > 0 &&
hits.nphi == 0) || (
hits.nphi > 0 &&
hits.neta == 0)) {
179 if (!clusterIds.insert(rpc_prd->identify()).second)
continue;
180 insertCluster(*rpc_prd, regionMap, patpose, patdire, hasPhiMeasurements);
190 if (!clusterIds.insert(tgc_prd->identify()).second)
continue;
191 insertCluster(*tgc_prd, regionMap, patpose, patdire, hasPhiMeasurements);
197 return StatusCode::SUCCESS;
◆ getRegionId()
int Muon::MuonPatternCalibration::getRegionId |
( |
const Identifier & |
id | ) |
const |
|
override |
◆ initialize()
StatusCode Muon::MuonPatternCalibration::initialize |
( |
| ) |
|
|
overridevirtual |
◆ insertCluster()
Definition at line 201 of file MuonPatternCalibration.cxx.
212 if (hasPhiMeasurements) {
217 const Trk::Surface& surf = clus.detectorElement()->surface(
id);
220 double denom = patdire.dot(planenormal);
221 double u = (planenormal.dot(planepostion - patpose)) / (
denom);
225 const Amg::Transform3D gToLocal = clus.detectorElement()->surface().transform().inverse();
233 bool hasPointingPhiStrips =
false;
238 striplen = rpc->detectorElement()->StripLength(measuresPhi);
245 hasPointingPhiStrips =
true;
246 striplen = tgc->detectorElement()->stripLength();
249 striplen = tgc->detectorElement()->gangCentralWidth(
gasGap, wire);
255 glpos[0] = ilpos.x();
257 if (hasPointingPhiStrips) {
259 glpos[1] = ilpos.y();
261 glpos[1] = ilpos.y();
270 ATH_MSG_VERBOSE(
">>>> extrapolated position far outside volume, dropping hit "
271 <<
m_idHelperSvc->toString(
id) <<
". dist along strip " << dif.mag() <<
" 1/2 strip len "
272 << 0.5 * striplen <<
" dist measurement plane " << (
intersect - piOnPlane).mag());
275 if (dif.mag() > 0.5 * striplen) {
276 Amg::Vector3D newpos = globalpos - dif * (0.5 * striplen / dif.mag());
278 ATH_MSG_VERBOSE(
">>>> extrapolated position outside volume, shifting position "
279 <<
m_idHelperSvc->toString(
id) <<
". position along strip " << dif.mag() <<
" 1/2 tube len "
280 << 0.5 * striplen <<
" dist To strip " << (
intersect - piOnPlane).mag()
281 <<
". dist to newpos " << (newpos - globalpos).mag() <<
" pos " << newpos);
293 Region& region = regionMap[regionId];
295 region.regionDir = patdire;
296 region.regionPos = patpose;
299 region.triggerPrds.emplace_back(
intersect, &clus);
◆ insertMdt()
Definition at line 304 of file MuonPatternCalibration.cxx.
314 if (hasPhiMeasurements) {
329 double denom = patdire.dot(planenormal);
330 double u = (planenormal.dot(planepostion - patpose)) / (
denom);
333 Amg::Vector3D lpiOnPlane = amdbToGlobal.inverse() * piOnPlane;
342 if (dif.mag() > 0.5 * tubelen) {
343 Amg::Vector3D newpos = tubePos - dif * (0.5 * tubelen / dif.mag());
345 ATH_MSG_VERBOSE(
">>>> extrapolated position outside volume, shifting position "
346 <<
m_idHelperSvc->toString(
id) <<
". position along strip " << dif.mag() <<
" 1/2 tube len "
347 << 0.5 * tubelen <<
" dist To Wire " << (piOnPlane -
intersect).mag() <<
". dist to newpos "
348 << (newpos - tubePos).mag() <<
" pos " << newpos);
368 if (std::abs(eta) == 8) {
378 if (stName[2] ==
'R') {
396 Region& region = regionMap[regionId];
398 region.regionPos = patpose;
399 region.regionDir = patdire;
402 region.mdtPrdsPerChamber[chFlag].emplace_back(
intersect, &mdt);
◆ 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 463 of file MuonPatternCalibration.cxx.
469 return StatusCode::SUCCESS;
472 if (!readHandle.isValid()) {
474 return StatusCode::FAILURE;
476 cont_ptr = readHandle.cptr();
477 return StatusCode::SUCCESS;
◆ printRegionMap()
void Muon::MuonPatternCalibration::printRegionMap |
( |
const RegionMap & |
regionMap | ) |
const |
|
private |
Definition at line 406 of file MuonPatternCalibration.cxx.
411 for (
const auto& [detRegionId, chamberData] : regionMap) {
412 ATH_MSG_INFO(
"new region " << detRegionId <<
" trigger " << chamberData.triggerPrds.size() <<
" mdt ch "
413 << chamberData.mdtPrdsPerChamber.size());
414 if (!chamberData.triggerPrds.empty())
ATH_MSG_INFO(
"trigger hits " << chamberData.triggerPrds.size());
416 for (
const auto& [globalPos, prd] : chamberData.triggerPrds) {
419 for (
const auto& [statId, MdtChamHits]: chamberData.mdtPrdsPerChamber) {
420 ATH_MSG_INFO(
"new MDT chamber with " << MdtChamHits.size() <<
" hits");
421 for (
const auto& [globalPos, prd] : MdtChamHits) {
◆ m_clusterCreator
Initial value:{
this,
"ClusterCreator",
"Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator",
}
Definition at line 88 of file MuonPatternCalibration.h.
◆ m_doMultiAnalysis
Gaudi::Property<bool> Muon::MuonPatternCalibration::m_doMultiAnalysis {this, "DoMultiChamberAnalysis", true} |
|
private |
◆ m_doSummary
Gaudi::Property<bool> Muon::MuonPatternCalibration::m_doSummary {this, "DoSummary", false} |
|
private |
◆ m_dropDistance
Gaudi::Property<double> Muon::MuonPatternCalibration::m_dropDistance {this, "DropDistance", 1500.} |
|
private |
◆ m_idHelperSvc
Initial value:{
this,
"MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc",
}
Definition at line 99 of file MuonPatternCalibration.h.
◆ m_keyRpc
◆ m_keyTgc
◆ m_mdtCreator
◆ m_phiAngleCut
Gaudi::Property<double> Muon::MuonPatternCalibration::m_phiAngleCut {this, "AngleCutPhi", 1.e9} |
|
private |
◆ m_printer
◆ m_recoverTriggerHits
Gaudi::Property<bool> Muon::MuonPatternCalibration::m_recoverTriggerHits {this, "RecoverTriggerHits", true} |
|
private |
◆ m_removeDoubleMdtHits
Gaudi::Property<bool> Muon::MuonPatternCalibration::m_removeDoubleMdtHits {this, "RemoveDoubleMdtHits", true} |
|
private |
The documentation for this class was generated from the following files:
Gaudi::Property< bool > m_removeDoubleMdtHits
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
virtual Amg::Transform3D AmdbLRSToGlobalTransform() const
PublicToolHandle< MuonEDMPrinterTool > m_printer
int getRegionId(const Identifier &id) const override
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
#define ATH_MSG_VERBOSE(x)
const Amg::Vector3D & center() const
Returns the center position of the Surface.
void calibrateRegionMap(const RegionMap ®ionMap, IMuonPatternCalibration::ROTsPerRegion &hitsPerRegion) const
Gaudi::Property< bool > m_recoverTriggerHits
value_type get_compact() const
Get the compact id.
@ u
Enums for curvilinear frames.
ToolHandle< IMuonClusterOnTrackCreator > m_clusterCreator
std::map< int, Region > RegionMap
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Class to represent RPC measurements.
double getActiveTubeLength(const int tubeLayer, const int tube) const
Eigen::Affine3d Transform3D
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
void insertCluster(const MuonCluster &mdt, RegionMap ®ionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
const Amg::Vector3D globalPosition() const
Template to hold collections of MuonPrepRawData objects.
Gaudi::Property< double > m_dropDistance
bool checkForPhiMeasurements(const MuonPatternCombination &pat) const override
Identifier identify() const
return the identifier
StatusCode loadFromStoreGate(const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, const ContType *&cont_ptr) const
load the container from storegate given a ReadHandleKey.
void insertMdt(const MdtPrepData &clus, RegionMap ®ionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
Definition of ATLAS Math & Geometry primitives (Amg)
Eigen::Matrix< double, 3, 1 > Vector3D
Gaudi::Property< double > m_phiAngleCut
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_keyTgc
ToolHandle< IMdtDriftCircleOnTrackCreator > m_mdtCreator
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point of closest approach of two lines.
Class to represent TGC measurements.
ChIndex
enum to classify the different chamber layers in the muon spectrometer
StatusCode createRegionMap(const EventContext &ctx, const MuonPatternCombination &pat, RegionMap ®ionMap, bool hasPhiMeasurements) const
phiRange
Filling Phi ranges.
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_keyRpc
Gaudi::Property< bool > m_doMultiAnalysis
virtual const Amg::Vector3D & center() const =0
Return the center of the element.
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...